vendor: 5,174 bytes, lines 1-141
1/** 2* vue v3.5.26 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: 6,715 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: 84,917 bytes, lines 282-2959
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 = /* @__PURE__ */ Symbol( 1009 "Object iterate" 1010 ); 1011 const MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol( 1012 "Map keys iterate" 1013 ); 1014 const ARRAY_ITERATE_KEY = /* @__PURE__ */ 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
vendor: 8,810 bytes, lines 2960-3215
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(); 3052 callWithAsyncErrorHandling(hook, instance, 8, [ 3053 vnode.el, 3054 binding, 3055 vnode, 3056 prevVNode 3057 ]); 3058 resetTracking(); 3059 } 3060 } 3061 } 3062 3063 function provide(key, value) { 3064 { 3065 if (!currentInstance || currentInstance.isMounted) { 3066 warn$1(`provide() can only be used inside setup().`); 3067 } 3068 } 3069 if (currentInstance) { 3070 let provides = currentInstance.provides; 3071 const parentProvides = currentInstance.parent && currentInstance.parent.provides; 3072 if (parentProvides === provides) { 3073 provides = currentInstance.provides = Object.create(parentProvides); 3074 } 3075 provides[key] = value; 3076 } 3077 } 3078 function inject(key, defaultValue, treatDefaultAsFactory = false) { 3079 const instance = getCurrentInstance(); 3080 if (instance || currentApp) { 3081 let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; 3082 if (provides && key in provides) { 3083 return provides[key]; 3084 } else if (arguments.length > 1) { 3085 return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; 3086 } else { 3087 warn$1(`injection "${String(key)}" not found.`); 3088 } 3089 } else { 3090 warn$1(`inject() can only be used inside setup() or functional components.`); 3091 } 3092 } 3093 function hasInjectionContext() { 3094 return !!(getCurrentInstance() || currentApp); 3095 } 3096 3097 const ssrContextKey = /* @__PURE__ */ Symbol.for("v-scx"); 3098 const useSSRContext = () => { 3099 { 3100 warn$1(`useSSRContext() is not supported in the global build.`); 3101 } 3102 }; 3103 3104 function watchEffect(effect, options) { 3105 return doWatch(effect, null, options); 3106 } 3107 function watchPostEffect(effect, options) { 3108 return doWatch( 3109 effect, 3110 null, 3111 extend({}, options, { flush: "post" }) 3112 ); 3113 } 3114 function watchSyncEffect(effect, options) { 3115 return doWatch( 3116 effect, 3117 null, 3118 extend({}, options, { flush: "sync" }) 3119 ); 3120 } 3121 function watch(source, cb, options) { 3122 if (!isFunction(cb)) { 3123 warn$1( 3124 `\`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.` 3125 ); 3126 } 3127 return doWatch(source, cb, options); 3128 } 3129 function doWatch(source, cb, options = EMPTY_OBJ) { 3130 const { immediate, deep, flush, once } = options; 3131 if (!cb) { 3132 if (immediate !== void 0) { 3133 warn$1( 3134 `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.` 3135 ); 3136 } 3137 if (deep !== void 0) { 3138 warn$1( 3139 `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.` 3140 ); 3141 } 3142 if (once !== void 0) { 3143 warn$1( 3144 `watch() "once" option is only respected when using the watch(source, callback, options?) signature.` 3145 ); 3146 } 3147 } 3148 const baseWatchOptions = extend({}, options); 3149 baseWatchOptions.onWarn = warn$1; 3150 const instance = currentInstance; 3151 baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args); 3152 let isPre = false; 3153 if (flush === "post") { 3154 baseWatchOptions.scheduler = (job) => { 3155 queuePostRenderEffect(job, instance && instance.suspense); 3156 }; 3157 } else if (flush !== "sync") { 3158 isPre = true; 3159 baseWatchOptions.scheduler = (job, isFirstRun) => { 3160 if (isFirstRun) { 3161 job(); 3162 } else { 3163 queueJob(job); 3164 } 3165 }; 3166 } 3167 baseWatchOptions.augmentJob = (job) => { 3168 if (cb) { 3169 job.flags |= 4; 3170 } 3171 if (isPre) { 3172 job.flags |= 2; 3173 if (instance) { 3174 job.id = instance.uid; 3175 job.i = instance; 3176 } 3177 } 3178 }; 3179 const watchHandle = watch$1(source, cb, baseWatchOptions); 3180 return watchHandle; 3181 } 3182 function instanceWatch(source, value, options) { 3183 const publicThis = this.proxy; 3184 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); 3185 let cb; 3186 if (isFunction(value)) { 3187 cb = value; 3188 } else { 3189 cb = value.handler; 3190 options = value; 3191 } 3192 const reset = setCurrentInstance(this); 3193 const res = doWatch(getter, cb.bind(publicThis), options); 3194 reset(); 3195 return res; 3196 } 3197 function createPathGetter(ctx, path) { 3198 const segments = path.split("."); 3199 return () => { 3200 let cur = ctx; 3201 for (let i = 0; i < segments.length && cur; i++) { 3202 cur = cur[segments[i]]; 3203 } 3204 return cur; 3205 }; 3206 } 3207 3208 const TeleportEndKey = /* @__PURE__ */ Symbol("_vte"); 3209 const isTeleport = (type) => type.__isTeleport; 3210 const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === ""); 3211 const isTeleportDeferred = (props) => props && (props.defer || props.defer === ""); 3212 const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement; 3213 const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement; 3214 const resolveTarget = (props, select) => { 3215 const targetSelector = props && props.to;
vendor: 14,204 bytes, lines 3216-3624
3216 if (isString(targetSelector)) { 3217 if (!select) { 3218 warn$1( 3219 `Current renderer does not support string target for Teleports. (missing querySelector renderer option)` 3220 ); 3221 return null; 3222 } else { 3223 const target = select(targetSelector); 3224 if (!target && !isTeleportDisabled(props)) { 3225 warn$1( 3226 `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.` 3227 ); 3228 } 3229 return target; 3230 } 3231 } else { 3232 if (!targetSelector && !isTeleportDisabled(props)) { 3233 warn$1(`Invalid Teleport target: ${targetSelector}`); 3234 } 3235 return targetSelector; 3236 } 3237 }; 3238 const TeleportImpl = { 3239 name: "Teleport", 3240 __isTeleport: true, 3241 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) { 3242 const { 3243 mc: mountChildren, 3244 pc: patchChildren, 3245 pbc: patchBlockChildren, 3246 o: { insert, querySelector, createText, createComment } 3247 } = internals; 3248 const disabled = isTeleportDisabled(n2.props); 3249 let { shapeFlag, children, dynamicChildren } = n2; 3250 if (isHmrUpdating) { 3251 optimized = false; 3252 dynamicChildren = null; 3253 } 3254 if (n1 == null) { 3255 const placeholder = n2.el = createComment("teleport start") ; 3256 const mainAnchor = n2.anchor = createComment("teleport end") ; 3257 insert(placeholder, container, anchor); 3258 insert(mainAnchor, container, anchor); 3259 const mount = (container2, anchor2) => { 3260 if (shapeFlag & 16) { 3261 mountChildren( 3262 children, 3263 container2, 3264 anchor2, 3265 parentComponent, 3266 parentSuspense, 3267 namespace, 3268 slotScopeIds, 3269 optimized 3270 ); 3271 } 3272 }; 3273 const mountToTarget = () => { 3274 const target = n2.target = resolveTarget(n2.props, querySelector); 3275 const targetAnchor = prepareAnchor(target, n2, createText, insert); 3276 if (target) { 3277 if (namespace !== "svg" && isTargetSVG(target)) { 3278 namespace = "svg"; 3279 } else if (namespace !== "mathml" && isTargetMathML(target)) { 3280 namespace = "mathml"; 3281 } 3282 if (parentComponent && parentComponent.isCE) { 3283 (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target); 3284 } 3285 if (!disabled) { 3286 mount(target, targetAnchor); 3287 updateCssVars(n2, false); 3288 } 3289 } else if (!disabled) { 3290 warn$1( 3291 "Invalid Teleport target on mount:", 3292 target, 3293 `(${typeof target})` 3294 ); 3295 } 3296 }; 3297 if (disabled) { 3298 mount(container, mainAnchor); 3299 updateCssVars(n2, true); 3300 } 3301 if (isTeleportDeferred(n2.props)) { 3302 n2.el.__isMounted = false; 3303 queuePostRenderEffect(() => { 3304 mountToTarget(); 3305 delete n2.el.__isMounted; 3306 }, parentSuspense); 3307 } else { 3308 mountToTarget(); 3309 } 3310 } else { 3311 if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) { 3312 queuePostRenderEffect(() => { 3313 TeleportImpl.process( 3314 n1, 3315 n2, 3316 container, 3317 anchor, 3318 parentComponent, 3319 parentSuspense, 3320 namespace, 3321 slotScopeIds, 3322 optimized, 3323 internals 3324 ); 3325 }, parentSuspense); 3326 return; 3327 } 3328 n2.el = n1.el; 3329 n2.targetStart = n1.targetStart; 3330 const mainAnchor = n2.anchor = n1.anchor; 3331 const target = n2.target = n1.target; 3332 const targetAnchor = n2.targetAnchor = n1.targetAnchor; 3333 const wasDisabled = isTeleportDisabled(n1.props); 3334 const currentContainer = wasDisabled ? container : target; 3335 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor; 3336 if (namespace === "svg" || isTargetSVG(target)) { 3337 namespace = "svg"; 3338 } else if (namespace === "mathml" || isTargetMathML(target)) { 3339 namespace = "mathml"; 3340 } 3341 if (dynamicChildren) { 3342 patchBlockChildren( 3343 n1.dynamicChildren, 3344 dynamicChildren, 3345 currentContainer, 3346 parentComponent, 3347 parentSuspense, 3348 namespace, 3349 slotScopeIds 3350 ); 3351 traverseStaticChildren(n1, n2, false); 3352 } else if (!optimized) { 3353 patchChildren( 3354 n1, 3355 n2, 3356 currentContainer, 3357 currentAnchor, 3358 parentComponent, 3359 parentSuspense, 3360 namespace, 3361 slotScopeIds, 3362 false 3363 ); 3364 } 3365 if (disabled) { 3366 if (!wasDisabled) { 3367 moveTeleport( 3368 n2, 3369 container, 3370 mainAnchor, 3371 internals, 3372 1 3373 ); 3374 } else { 3375 if (n2.props && n1.props && n2.props.to !== n1.props.to) { 3376 n2.props.to = n1.props.to; 3377 } 3378 } 3379 } else { 3380 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) { 3381 const nextTarget = n2.target = resolveTarget( 3382 n2.props, 3383 querySelector 3384 ); 3385 if (nextTarget) { 3386 moveTeleport( 3387 n2, 3388 nextTarget, 3389 null, 3390 internals, 3391 0 3392 ); 3393 } else { 3394 warn$1( 3395 "Invalid Teleport target on update:", 3396 target, 3397 `(${typeof target})` 3398 ); 3399 } 3400 } else if (wasDisabled) { 3401 moveTeleport( 3402 n2, 3403 target, 3404 targetAnchor, 3405 internals, 3406 1 3407 ); 3408 } 3409 } 3410 updateCssVars(n2, disabled); 3411 } 3412 }, 3413 remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) { 3414 const { 3415 shapeFlag, 3416 children, 3417 anchor, 3418 targetStart, 3419 targetAnchor, 3420 target, 3421 props 3422 } = vnode; 3423 if (target) { 3424 hostRemove(targetStart); 3425 hostRemove(targetAnchor); 3426 } 3427 doRemove && hostRemove(anchor); 3428 if (shapeFlag & 16) { 3429 const shouldRemove = doRemove || !isTeleportDisabled(props); 3430 for (let i = 0; i < children.length; i++) { 3431 const child = children[i]; 3432 unmount( 3433 child, 3434 parentComponent, 3435 parentSuspense, 3436 shouldRemove, 3437 !!child.dynamicChildren 3438 ); 3439 } 3440 } 3441 }, 3442 move: moveTeleport, 3443 hydrate: hydrateTeleport 3444 }; 3445 function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) { 3446 if (moveType === 0) { 3447 insert(vnode.targetAnchor, container, parentAnchor); 3448 } 3449 const { el, anchor, shapeFlag, children, props } = vnode; 3450 const isReorder = moveType === 2; 3451 if (isReorder) { 3452 insert(el, container, parentAnchor); 3453 } 3454 if (!isReorder || isTeleportDisabled(props)) { 3455 if (shapeFlag & 16) { 3456 for (let i = 0; i < children.length; i++) { 3457 move( 3458 children[i], 3459 container, 3460 parentAnchor, 3461 2 3462 ); 3463 } 3464 } 3465 } 3466 if (isReorder) { 3467 insert(anchor, container, parentAnchor); 3468 } 3469 } 3470 function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { 3471 o: { nextSibling, parentNode, querySelector, insert, createText } 3472 }, hydrateChildren) { 3473 function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) { 3474 vnode2.anchor = hydrateChildren( 3475 nextSibling(node2), 3476 vnode2, 3477 parentNode(node2), 3478 parentComponent, 3479 parentSuspense, 3480 slotScopeIds, 3481 optimized 3482 ); 3483 vnode2.targetStart = targetStart; 3484 vnode2.targetAnchor = targetAnchor; 3485 } 3486 const target = vnode.target = resolveTarget( 3487 vnode.props, 3488 querySelector 3489 ); 3490 const disabled = isTeleportDisabled(vnode.props); 3491 if (target) { 3492 const targetNode = target._lpa || target.firstChild; 3493 if (vnode.shapeFlag & 16) { 3494 if (disabled) { 3495 hydrateDisabledTeleport( 3496 node, 3497 vnode, 3498 targetNode, 3499 targetNode && nextSibling(targetNode) 3500 ); 3501 } else { 3502 vnode.anchor = nextSibling(node); 3503 let targetAnchor = targetNode; 3504 while (targetAnchor) { 3505 if (targetAnchor && targetAnchor.nodeType === 8) { 3506 if (targetAnchor.data === "teleport start anchor") { 3507 vnode.targetStart = targetAnchor; 3508 } else if (targetAnchor.data === "teleport anchor") { 3509 vnode.targetAnchor = targetAnchor; 3510 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor); 3511 break; 3512 } 3513 } 3514 targetAnchor = nextSibling(targetAnchor); 3515 } 3516 if (!vnode.targetAnchor) { 3517 prepareAnchor(target, vnode, createText, insert); 3518 } 3519 hydrateChildren( 3520 targetNode && nextSibling(targetNode), 3521 vnode, 3522 target, 3523 parentComponent, 3524 parentSuspense, 3525 slotScopeIds, 3526 optimized 3527 ); 3528 } 3529 } 3530 updateCssVars(vnode, disabled); 3531 } else if (disabled) { 3532 if (vnode.shapeFlag & 16) { 3533 hydrateDisabledTeleport(node, vnode, node, nextSibling(node)); 3534 } 3535 } 3536 return vnode.anchor && nextSibling(vnode.anchor); 3537 } 3538 const Teleport = TeleportImpl; 3539 function updateCssVars(vnode, isDisabled) { 3540 const ctx = vnode.ctx; 3541 if (ctx && ctx.ut) { 3542 let node, anchor; 3543 if (isDisabled) { 3544 node = vnode.el; 3545 anchor = vnode.anchor; 3546 } else { 3547 node = vnode.targetStart; 3548 anchor = vnode.targetAnchor; 3549 } 3550 while (node && node !== anchor) { 3551 if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid); 3552 node = node.nextSibling; 3553 } 3554 ctx.ut(); 3555 } 3556 } 3557 function prepareAnchor(target, vnode, createText, insert) { 3558 const targetStart = vnode.targetStart = createText(""); 3559 const targetAnchor = vnode.targetAnchor = createText(""); 3560 targetStart[TeleportEndKey] = targetAnchor; 3561 if (target) { 3562 insert(targetStart, target); 3563 insert(targetAnchor, target); 3564 } 3565 return targetAnchor; 3566 } 3567 3568 const leaveCbKey = /* @__PURE__ */ Symbol("_leaveCb"); 3569 const enterCbKey$1 = /* @__PURE__ */ Symbol("_enterCb"); 3570 function useTransitionState() { 3571 const state = { 3572 isMounted: false, 3573 isLeaving: false, 3574 isUnmounting: false, 3575 leavingVNodes: /* @__PURE__ */ new Map() 3576 }; 3577 onMounted(() => { 3578 state.isMounted = true; 3579 }); 3580 onBeforeUnmount(() => { 3581 state.isUnmounting = true; 3582 }); 3583 return state; 3584 } 3585 const TransitionHookValidator = [Function, Array]; 3586 const BaseTransitionPropsValidators = { 3587 mode: String, 3588 appear: Boolean, 3589 persisted: Boolean, 3590 // enter 3591 onBeforeEnter: TransitionHookValidator, 3592 onEnter: TransitionHookValidator, 3593 onAfterEnter: TransitionHookValidator, 3594 onEnterCancelled: TransitionHookValidator, 3595 // leave 3596 onBeforeLeave: TransitionHookValidator, 3597 onLeave: TransitionHookValidator, 3598 onAfterLeave: TransitionHookValidator, 3599 onLeaveCancelled: TransitionHookValidator, 3600 // appear 3601 onBeforeAppear: TransitionHookValidator, 3602 onAppear: TransitionHookValidator, 3603 onAfterAppear: TransitionHookValidator, 3604 onAppearCancelled: TransitionHookValidator 3605 }; 3606 const recursiveGetSubtree = (instance) => { 3607 const subTree = instance.subTree; 3608 return subTree.component ? recursiveGetSubtree(subTree.component) : subTree; 3609 }; 3610 const BaseTransitionImpl = { 3611 name: `BaseTransition`, 3612 props: BaseTransitionPropsValidators, 3613 setup(props, { slots }) { 3614 const instance = getCurrentInstance(); 3615 const state = useTransitionState(); 3616 return () => { 3617 const children = slots.default && getTransitionRawChildren(slots.default(), true); 3618 if (!children || !children.length) { 3619 return; 3620 } 3621 const child = findNonCommentChild(children); 3622 const rawProps = toRaw(props); 3623 const { mode } = rawProps; 3624 if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
vendor: 43,120 bytes, lines 3625-4851
3625 warn$1(`invalid <transition> mode: ${mode}`); 3626 } 3627 if (state.isLeaving) { 3628 return emptyPlaceholder(child); 3629 } 3630 const innerChild = getInnerChild$1(child); 3631 if (!innerChild) { 3632 return emptyPlaceholder(child); 3633 } 3634 let enterHooks = resolveTransitionHooks( 3635 innerChild, 3636 rawProps, 3637 state, 3638 instance, 3639 // #11061, ensure enterHooks is fresh after clone 3640 (hooks) => enterHooks = hooks 3641 ); 3642 if (innerChild.type !== Comment) { 3643 setTransitionHooks(innerChild, enterHooks); 3644 } 3645 let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree); 3646 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) { 3647 let leavingHooks = resolveTransitionHooks( 3648 oldInnerChild, 3649 rawProps, 3650 state, 3651 instance 3652 ); 3653 setTransitionHooks(oldInnerChild, leavingHooks); 3654 if (mode === "out-in" && innerChild.type !== Comment) { 3655 state.isLeaving = true; 3656 leavingHooks.afterLeave = () => { 3657 state.isLeaving = false; 3658 if (!(instance.job.flags & 8)) { 3659 instance.update(); 3660 } 3661 delete leavingHooks.afterLeave; 3662 oldInnerChild = void 0; 3663 }; 3664 return emptyPlaceholder(child); 3665 } else if (mode === "in-out" && innerChild.type !== Comment) { 3666 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { 3667 const leavingVNodesCache = getLeavingNodesForType( 3668 state, 3669 oldInnerChild 3670 ); 3671 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; 3672 el[leaveCbKey] = () => { 3673 earlyRemove(); 3674 el[leaveCbKey] = void 0; 3675 delete enterHooks.delayedLeave; 3676 oldInnerChild = void 0; 3677 }; 3678 enterHooks.delayedLeave = () => { 3679 delayedLeave(); 3680 delete enterHooks.delayedLeave; 3681 oldInnerChild = void 0; 3682 }; 3683 }; 3684 } else { 3685 oldInnerChild = void 0; 3686 } 3687 } else if (oldInnerChild) { 3688 oldInnerChild = void 0; 3689 } 3690 return child; 3691 }; 3692 } 3693 }; 3694 function findNonCommentChild(children) { 3695 let child = children[0]; 3696 if (children.length > 1) { 3697 let hasFound = false; 3698 for (const c of children) { 3699 if (c.type !== Comment) { 3700 if (hasFound) { 3701 warn$1( 3702 "<transition> can only be used on a single element or component. Use <transition-group> for lists." 3703 ); 3704 break; 3705 } 3706 child = c; 3707 hasFound = true; 3708 } 3709 } 3710 } 3711 return child; 3712 } 3713 const BaseTransition = BaseTransitionImpl; 3714 function getLeavingNodesForType(state, vnode) { 3715 const { leavingVNodes } = state; 3716 let leavingVNodesCache = leavingVNodes.get(vnode.type); 3717 if (!leavingVNodesCache) { 3718 leavingVNodesCache = /* @__PURE__ */ Object.create(null); 3719 leavingVNodes.set(vnode.type, leavingVNodesCache); 3720 } 3721 return leavingVNodesCache; 3722 } 3723 function resolveTransitionHooks(vnode, props, state, instance, postClone) { 3724 const { 3725 appear, 3726 mode, 3727 persisted = false, 3728 onBeforeEnter, 3729 onEnter, 3730 onAfterEnter, 3731 onEnterCancelled, 3732 onBeforeLeave, 3733 onLeave, 3734 onAfterLeave, 3735 onLeaveCancelled, 3736 onBeforeAppear, 3737 onAppear, 3738 onAfterAppear, 3739 onAppearCancelled 3740 } = props; 3741 const key = String(vnode.key); 3742 const leavingVNodesCache = getLeavingNodesForType(state, vnode); 3743 const callHook = (hook, args) => { 3744 hook && callWithAsyncErrorHandling( 3745 hook, 3746 instance, 3747 9, 3748 args 3749 ); 3750 }; 3751 const callAsyncHook = (hook, args) => { 3752 const done = args[1]; 3753 callHook(hook, args); 3754 if (isArray(hook)) { 3755 if (hook.every((hook2) => hook2.length <= 1)) done(); 3756 } else if (hook.length <= 1) { 3757 done(); 3758 } 3759 }; 3760 const hooks = { 3761 mode, 3762 persisted, 3763 beforeEnter(el) { 3764 let hook = onBeforeEnter; 3765 if (!state.isMounted) { 3766 if (appear) { 3767 hook = onBeforeAppear || onBeforeEnter; 3768 } else { 3769 return; 3770 } 3771 } 3772 if (el[leaveCbKey]) { 3773 el[leaveCbKey]( 3774 true 3775 /* cancelled */ 3776 ); 3777 } 3778 const leavingVNode = leavingVNodesCache[key]; 3779 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) { 3780 leavingVNode.el[leaveCbKey](); 3781 } 3782 callHook(hook, [el]); 3783 }, 3784 enter(el) { 3785 let hook = onEnter; 3786 let afterHook = onAfterEnter; 3787 let cancelHook = onEnterCancelled; 3788 if (!state.isMounted) { 3789 if (appear) { 3790 hook = onAppear || onEnter; 3791 afterHook = onAfterAppear || onAfterEnter; 3792 cancelHook = onAppearCancelled || onEnterCancelled; 3793 } else { 3794 return; 3795 } 3796 } 3797 let called = false; 3798 const done = el[enterCbKey$1] = (cancelled) => { 3799 if (called) return; 3800 called = true; 3801 if (cancelled) { 3802 callHook(cancelHook, [el]); 3803 } else { 3804 callHook(afterHook, [el]); 3805 } 3806 if (hooks.delayedLeave) { 3807 hooks.delayedLeave(); 3808 } 3809 el[enterCbKey$1] = void 0; 3810 }; 3811 if (hook) { 3812 callAsyncHook(hook, [el, done]); 3813 } else { 3814 done(); 3815 } 3816 }, 3817 leave(el, remove) { 3818 const key2 = String(vnode.key); 3819 if (el[enterCbKey$1]) { 3820 el[enterCbKey$1]( 3821 true 3822 /* cancelled */ 3823 ); 3824 } 3825 if (state.isUnmounting) { 3826 return remove(); 3827 } 3828 callHook(onBeforeLeave, [el]); 3829 let called = false; 3830 const done = el[leaveCbKey] = (cancelled) => { 3831 if (called) return; 3832 called = true; 3833 remove(); 3834 if (cancelled) { 3835 callHook(onLeaveCancelled, [el]); 3836 } else { 3837 callHook(onAfterLeave, [el]); 3838 } 3839 el[leaveCbKey] = void 0; 3840 if (leavingVNodesCache[key2] === vnode) { 3841 delete leavingVNodesCache[key2]; 3842 } 3843 }; 3844 leavingVNodesCache[key2] = vnode; 3845 if (onLeave) { 3846 callAsyncHook(onLeave, [el, done]); 3847 } else { 3848 done(); 3849 } 3850 }, 3851 clone(vnode2) { 3852 const hooks2 = resolveTransitionHooks( 3853 vnode2, 3854 props, 3855 state, 3856 instance, 3857 postClone 3858 ); 3859 if (postClone) postClone(hooks2); 3860 return hooks2; 3861 } 3862 }; 3863 return hooks; 3864 } 3865 function emptyPlaceholder(vnode) { 3866 if (isKeepAlive(vnode)) { 3867 vnode = cloneVNode(vnode); 3868 vnode.children = null; 3869 return vnode; 3870 } 3871 } 3872 function getInnerChild$1(vnode) { 3873 if (!isKeepAlive(vnode)) { 3874 if (isTeleport(vnode.type) && vnode.children) { 3875 return findNonCommentChild(vnode.children); 3876 } 3877 return vnode; 3878 } 3879 if (vnode.component) { 3880 return vnode.component.subTree; 3881 } 3882 const { shapeFlag, children } = vnode; 3883 if (children) { 3884 if (shapeFlag & 16) { 3885 return children[0]; 3886 } 3887 if (shapeFlag & 32 && isFunction(children.default)) { 3888 return children.default(); 3889 } 3890 } 3891 } 3892 function setTransitionHooks(vnode, hooks) { 3893 if (vnode.shapeFlag & 6 && vnode.component) { 3894 vnode.transition = hooks; 3895 setTransitionHooks(vnode.component.subTree, hooks); 3896 } else if (vnode.shapeFlag & 128) { 3897 vnode.ssContent.transition = hooks.clone(vnode.ssContent); 3898 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback); 3899 } else { 3900 vnode.transition = hooks; 3901 } 3902 } 3903 function getTransitionRawChildren(children, keepComment = false, parentKey) { 3904 let ret = []; 3905 let keyedFragmentCount = 0; 3906 for (let i = 0; i < children.length; i++) { 3907 let child = children[i]; 3908 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i); 3909 if (child.type === Fragment) { 3910 if (child.patchFlag & 128) keyedFragmentCount++; 3911 ret = ret.concat( 3912 getTransitionRawChildren(child.children, keepComment, key) 3913 ); 3914 } else if (keepComment || child.type !== Comment) { 3915 ret.push(key != null ? cloneVNode(child, { key }) : child); 3916 } 3917 } 3918 if (keyedFragmentCount > 1) { 3919 for (let i = 0; i < ret.length; i++) { 3920 ret[i].patchFlag = -2; 3921 } 3922 } 3923 return ret; 3924 } 3925 3926 // @__NO_SIDE_EFFECTS__ 3927 function defineComponent(options, extraOptions) { 3928 return isFunction(options) ? ( 3929 // #8236: extend call and options.name access are considered side-effects 3930 // by Rollup, so we have to wrap it in a pure-annotated IIFE. 3931 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))() 3932 ) : options; 3933 } 3934 3935 function useId() { 3936 const i = getCurrentInstance(); 3937 if (i) { 3938 return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++; 3939 } else { 3940 warn$1( 3941 `useId() is called when there is no active component instance to be associated with.` 3942 ); 3943 } 3944 return ""; 3945 } 3946 function markAsyncBoundary(instance) { 3947 instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0]; 3948 } 3949 3950 const knownTemplateRefs = /* @__PURE__ */ new WeakSet(); 3951 function useTemplateRef(key) { 3952 const i = getCurrentInstance(); 3953 const r = shallowRef(null); 3954 if (i) { 3955 const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs; 3956 let desc; 3957 if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) { 3958 warn$1(`useTemplateRef('${key}') already exists.`); 3959 } else { 3960 Object.defineProperty(refs, key, { 3961 enumerable: true, 3962 get: () => r.value, 3963 set: (val) => r.value = val 3964 }); 3965 } 3966 } else { 3967 warn$1( 3968 `useTemplateRef() is called when there is no active component instance to be associated with.` 3969 ); 3970 } 3971 const ret = readonly(r) ; 3972 { 3973 knownTemplateRefs.add(ret); 3974 } 3975 return ret; 3976 } 3977 3978 const pendingSetRefMap = /* @__PURE__ */ new WeakMap(); 3979 function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { 3980 if (isArray(rawRef)) { 3981 rawRef.forEach( 3982 (r, i) => setRef( 3983 r, 3984 oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), 3985 parentSuspense, 3986 vnode, 3987 isUnmount 3988 ) 3989 ); 3990 return; 3991 } 3992 if (isAsyncWrapper(vnode) && !isUnmount) { 3993 if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) { 3994 setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree); 3995 } 3996 return; 3997 } 3998 const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el; 3999 const value = isUnmount ? null : refValue; 4000 const { i: owner, r: ref } = rawRef; 4001 if (!owner) { 4002 warn$1( 4003 `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.` 4004 ); 4005 return; 4006 } 4007 const oldRef = oldRawRef && oldRawRef.r; 4008 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs; 4009 const setupState = owner.setupState; 4010 const rawSetupState = toRaw(setupState); 4011 const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => { 4012 { 4013 if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) { 4014 warn$1( 4015 `Template ref "${key}" used on a non-ref value. It will not work in the production build.` 4016 ); 4017 } 4018 if (knownTemplateRefs.has(rawSetupState[key])) { 4019 return false; 4020 } 4021 } 4022 return hasOwn(rawSetupState, key); 4023 }; 4024 const canSetRef = (ref2) => { 4025 return !knownTemplateRefs.has(ref2); 4026 }; 4027 if (oldRef != null && oldRef !== ref) { 4028 invalidatePendingSetRef(oldRawRef); 4029 if (isString(oldRef)) { 4030 refs[oldRef] = null; 4031 if (canSetSetupRef(oldRef)) { 4032 setupState[oldRef] = null; 4033 } 4034 } else if (isRef(oldRef)) { 4035 if (canSetRef(oldRef)) { 4036 oldRef.value = null; 4037 } 4038 const oldRawRefAtom = oldRawRef; 4039 if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null; 4040 } 4041 } 4042 if (isFunction(ref)) { 4043 callWithErrorHandling(ref, owner, 12, [value, refs]); 4044 } else { 4045 const _isString = isString(ref); 4046 const _isRef = isRef(ref); 4047 if (_isString || _isRef) { 4048 const doSet = () => { 4049 if (rawRef.f) { 4050 const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k]; 4051 if (isUnmount) { 4052 isArray(existing) && remove(existing, refValue); 4053 } else { 4054 if (!isArray(existing)) { 4055 if (_isString) { 4056 refs[ref] = [refValue]; 4057 if (canSetSetupRef(ref)) { 4058 setupState[ref] = refs[ref]; 4059 } 4060 } else { 4061 const newVal = [refValue]; 4062 if (canSetRef(ref)) { 4063 ref.value = newVal; 4064 } 4065 if (rawRef.k) refs[rawRef.k] = newVal; 4066 } 4067 } else if (!existing.includes(refValue)) { 4068 existing.push(refValue); 4069 } 4070 } 4071 } else if (_isString) { 4072 refs[ref] = value; 4073 if (canSetSetupRef(ref)) { 4074 setupState[ref] = value; 4075 } 4076 } else if (_isRef) { 4077 if (canSetRef(ref)) { 4078 ref.value = value; 4079 } 4080 if (rawRef.k) refs[rawRef.k] = value; 4081 } else { 4082 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 4083 } 4084 }; 4085 if (value) { 4086 const job = () => { 4087 doSet(); 4088 pendingSetRefMap.delete(rawRef); 4089 }; 4090 job.id = -1; 4091 pendingSetRefMap.set(rawRef, job); 4092 queuePostRenderEffect(job, parentSuspense); 4093 } else { 4094 invalidatePendingSetRef(rawRef); 4095 doSet(); 4096 } 4097 } else { 4098 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 4099 } 4100 } 4101 } 4102 function invalidatePendingSetRef(rawRef) { 4103 const pendingSetRef = pendingSetRefMap.get(rawRef); 4104 if (pendingSetRef) { 4105 pendingSetRef.flags |= 8; 4106 pendingSetRefMap.delete(rawRef); 4107 } 4108 } 4109 4110 let hasLoggedMismatchError = false; 4111 const logMismatchError = () => { 4112 if (hasLoggedMismatchError) { 4113 return; 4114 } 4115 console.error("Hydration completed but contains mismatches."); 4116 hasLoggedMismatchError = true; 4117 }; 4118 const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject"; 4119 const isMathMLContainer = (container) => container.namespaceURI.includes("MathML"); 4120 const getContainerType = (container) => { 4121 if (container.nodeType !== 1) return void 0; 4122 if (isSVGContainer(container)) return "svg"; 4123 if (isMathMLContainer(container)) return "mathml"; 4124 return void 0; 4125 }; 4126 const isComment = (node) => node.nodeType === 8; 4127 function createHydrationFunctions(rendererInternals) { 4128 const { 4129 mt: mountComponent, 4130 p: patch, 4131 o: { 4132 patchProp, 4133 createText, 4134 nextSibling, 4135 parentNode, 4136 remove, 4137 insert, 4138 createComment 4139 } 4140 } = rendererInternals; 4141 const hydrate = (vnode, container) => { 4142 if (!container.hasChildNodes()) { 4143 warn$1( 4144 `Attempting to hydrate existing markup but container is empty. Performing full mount instead.` 4145 ); 4146 patch(null, vnode, container); 4147 flushPostFlushCbs(); 4148 container._vnode = vnode; 4149 return; 4150 } 4151 hydrateNode(container.firstChild, vnode, null, null, null); 4152 flushPostFlushCbs(); 4153 container._vnode = vnode; 4154 }; 4155 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => { 4156 optimized = optimized || !!vnode.dynamicChildren; 4157 const isFragmentStart = isComment(node) && node.data === "["; 4158 const onMismatch = () => handleMismatch( 4159 node, 4160 vnode, 4161 parentComponent, 4162 parentSuspense, 4163 slotScopeIds, 4164 isFragmentStart 4165 ); 4166 const { type, ref, shapeFlag, patchFlag } = vnode; 4167 let domType = node.nodeType; 4168 vnode.el = node; 4169 { 4170 def(node, "__vnode", vnode, true); 4171 def(node, "__vueParentComponent", parentComponent, true); 4172 } 4173 if (patchFlag === -2) { 4174 optimized = false; 4175 vnode.dynamicChildren = null; 4176 } 4177 let nextNode = null; 4178 switch (type) { 4179 case Text: 4180 if (domType !== 3) { 4181 if (vnode.children === "") { 4182 insert(vnode.el = createText(""), parentNode(node), node); 4183 nextNode = node; 4184 } else { 4185 nextNode = onMismatch(); 4186 } 4187 } else { 4188 if (node.data !== vnode.children) { 4189 warn$1( 4190 `Hydration text mismatch in`, 4191 node.parentNode, 4192 ` 4193 - rendered on server: ${JSON.stringify( 4194 node.data 4195 )} 4196 - expected on client: ${JSON.stringify(vnode.children)}` 4197 ); 4198 logMismatchError(); 4199 node.data = vnode.children; 4200 } 4201 nextNode = nextSibling(node); 4202 } 4203 break; 4204 case Comment: 4205 if (isTemplateNode(node)) { 4206 nextNode = nextSibling(node); 4207 replaceNode( 4208 vnode.el = node.content.firstChild, 4209 node, 4210 parentComponent 4211 ); 4212 } else if (domType !== 8 || isFragmentStart) { 4213 nextNode = onMismatch(); 4214 } else { 4215 nextNode = nextSibling(node); 4216 } 4217 break; 4218 case Static: 4219 if (isFragmentStart) { 4220 node = nextSibling(node); 4221 domType = node.nodeType; 4222 } 4223 if (domType === 1 || domType === 3) { 4224 nextNode = node; 4225 const needToAdoptContent = !vnode.children.length; 4226 for (let i = 0; i < vnode.staticCount; i++) { 4227 if (needToAdoptContent) 4228 vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data; 4229 if (i === vnode.staticCount - 1) { 4230 vnode.anchor = nextNode; 4231 } 4232 nextNode = nextSibling(nextNode); 4233 } 4234 return isFragmentStart ? nextSibling(nextNode) : nextNode; 4235 } else { 4236 onMismatch(); 4237 } 4238 break; 4239 case Fragment: 4240 if (!isFragmentStart) { 4241 nextNode = onMismatch(); 4242 } else { 4243 nextNode = hydrateFragment( 4244 node, 4245 vnode, 4246 parentComponent, 4247 parentSuspense, 4248 slotScopeIds, 4249 optimized 4250 ); 4251 } 4252 break; 4253 default: 4254 if (shapeFlag & 1) { 4255 if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) { 4256 nextNode = onMismatch(); 4257 } else { 4258 nextNode = hydrateElement( 4259 node, 4260 vnode, 4261 parentComponent, 4262 parentSuspense, 4263 slotScopeIds, 4264 optimized 4265 ); 4266 } 4267 } else if (shapeFlag & 6) { 4268 vnode.slotScopeIds = slotScopeIds; 4269 const container = parentNode(node); 4270 if (isFragmentStart) { 4271 nextNode = locateClosingAnchor(node); 4272 } else if (isComment(node) && node.data === "teleport start") { 4273 nextNode = locateClosingAnchor(node, node.data, "teleport end"); 4274 } else { 4275 nextNode = nextSibling(node); 4276 } 4277 mountComponent( 4278 vnode, 4279 container, 4280 null, 4281 parentComponent, 4282 parentSuspense, 4283 getContainerType(container), 4284 optimized 4285 ); 4286 if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) { 4287 let subTree; 4288 if (isFragmentStart) { 4289 subTree = createVNode(Fragment); 4290 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild; 4291 } else { 4292 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div"); 4293 } 4294 subTree.el = node; 4295 vnode.component.subTree = subTree; 4296 } 4297 } else if (shapeFlag & 64) { 4298 if (domType !== 8) { 4299 nextNode = onMismatch(); 4300 } else { 4301 nextNode = vnode.type.hydrate( 4302 node, 4303 vnode, 4304 parentComponent, 4305 parentSuspense, 4306 slotScopeIds, 4307 optimized, 4308 rendererInternals, 4309 hydrateChildren 4310 ); 4311 } 4312 } else if (shapeFlag & 128) { 4313 nextNode = vnode.type.hydrate( 4314 node, 4315 vnode, 4316 parentComponent, 4317 parentSuspense, 4318 getContainerType(parentNode(node)), 4319 slotScopeIds, 4320 optimized, 4321 rendererInternals, 4322 hydrateNode 4323 ); 4324 } else { 4325 warn$1("Invalid HostVNode type:", type, `(${typeof type})`); 4326 } 4327 } 4328 if (ref != null) { 4329 setRef(ref, null, parentSuspense, vnode); 4330 } 4331 return nextNode; 4332 }; 4333 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4334 optimized = optimized || !!vnode.dynamicChildren; 4335 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode; 4336 const forcePatch = type === "input" || type === "option"; 4337 { 4338 if (dirs) { 4339 invokeDirectiveHook(vnode, null, parentComponent, "created"); 4340 } 4341 let needCallTransitionHooks = false; 4342 if (isTemplateNode(el)) { 4343 needCallTransitionHooks = needTransition( 4344 null, 4345 // no need check parentSuspense in hydration 4346 transition 4347 ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; 4348 const content = el.content.firstChild; 4349 if (needCallTransitionHooks) { 4350 const cls = content.getAttribute("class"); 4351 if (cls) content.$cls = cls; 4352 transition.beforeEnter(content); 4353 } 4354 replaceNode(content, el, parentComponent); 4355 vnode.el = el = content; 4356 } 4357 if (shapeFlag & 16 && // skip if element has innerHTML / textContent 4358 !(props && (props.innerHTML || props.textContent))) { 4359 let next = hydrateChildren( 4360 el.firstChild, 4361 vnode, 4362 el, 4363 parentComponent, 4364 parentSuspense, 4365 slotScopeIds, 4366 optimized 4367 ); 4368 let hasWarned = false; 4369 while (next) { 4370 if (!isMismatchAllowed(el, 1 /* CHILDREN */)) { 4371 if (!hasWarned) { 4372 warn$1( 4373 `Hydration children mismatch on`, 4374 el, 4375 ` 4376 Server rendered element contains more child nodes than client vdom.` 4377 ); 4378 hasWarned = true; 4379 } 4380 logMismatchError(); 4381 } 4382 const cur = next; 4383 next = next.nextSibling; 4384 remove(cur); 4385 } 4386 } else if (shapeFlag & 8) { 4387 let clientText = vnode.children; 4388 if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) { 4389 clientText = clientText.slice(1); 4390 } 4391 const { textContent } = el; 4392 if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM 4393 textContent !== clientText.replace(/\r\n|\r/g, "\n")) { 4394 if (!isMismatchAllowed(el, 0 /* TEXT */)) { 4395 warn$1( 4396 `Hydration text content mismatch on`, 4397 el, 4398 ` 4399 - rendered on server: ${textContent} 4400 - expected on client: ${clientText}` 4401 ); 4402 logMismatchError(); 4403 } 4404 el.textContent = vnode.children; 4405 } 4406 } 4407 if (props) { 4408 { 4409 const isCustomElement = el.tagName.includes("-"); 4410 for (const key in props) { 4411 if (// #11189 skip if this node has directives that have created hooks 4412 // as it could have mutated the DOM in any possible way 4413 !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) { 4414 logMismatchError(); 4415 } 4416 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers 4417 key[0] === "." || isCustomElement) { 4418 patchProp(el, key, null, props[key], void 0, parentComponent); 4419 } 4420 } 4421 } 4422 } 4423 let vnodeHooks; 4424 if (vnodeHooks = props && props.onVnodeBeforeMount) { 4425 invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4426 } 4427 if (dirs) { 4428 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 4429 } 4430 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) { 4431 queueEffectWithSuspense(() => { 4432 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4433 needCallTransitionHooks && transition.enter(el); 4434 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 4435 }, parentSuspense); 4436 } 4437 } 4438 return el.nextSibling; 4439 }; 4440 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4441 optimized = optimized || !!parentVNode.dynamicChildren; 4442 const children = parentVNode.children; 4443 const l = children.length; 4444 let hasWarned = false; 4445 for (let i = 0; i < l; i++) { 4446 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]); 4447 const isText = vnode.type === Text; 4448 if (node) { 4449 if (isText && !optimized) { 4450 if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) { 4451 insert( 4452 createText( 4453 node.data.slice(vnode.children.length) 4454 ), 4455 container, 4456 nextSibling(node) 4457 ); 4458 node.data = vnode.children; 4459 } 4460 } 4461 node = hydrateNode( 4462 node, 4463 vnode, 4464 parentComponent, 4465 parentSuspense, 4466 slotScopeIds, 4467 optimized 4468 ); 4469 } else if (isText && !vnode.children) { 4470 insert(vnode.el = createText(""), container); 4471 } else { 4472 if (!isMismatchAllowed(container, 1 /* CHILDREN */)) { 4473 if (!hasWarned) { 4474 warn$1( 4475 `Hydration children mismatch on`, 4476 container, 4477 ` 4478 Server rendered element contains fewer child nodes than client vdom.` 4479 ); 4480 hasWarned = true; 4481 } 4482 logMismatchError(); 4483 } 4484 patch( 4485 null, 4486 vnode, 4487 container, 4488 null, 4489 parentComponent, 4490 parentSuspense, 4491 getContainerType(container), 4492 slotScopeIds 4493 ); 4494 } 4495 } 4496 return node; 4497 }; 4498 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4499 const { slotScopeIds: fragmentSlotScopeIds } = vnode; 4500 if (fragmentSlotScopeIds) { 4501 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 4502 } 4503 const container = parentNode(node); 4504 const next = hydrateChildren( 4505 nextSibling(node), 4506 vnode, 4507 container, 4508 parentComponent, 4509 parentSuspense, 4510 slotScopeIds, 4511 optimized 4512 ); 4513 if (next && isComment(next) && next.data === "]") { 4514 return nextSibling(vnode.anchor = next); 4515 } else { 4516 logMismatchError(); 4517 insert(vnode.anchor = createComment(`]`), container, next); 4518 return next; 4519 } 4520 }; 4521 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => { 4522 if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) { 4523 warn$1( 4524 `Hydration node mismatch: 4525 - rendered on server:`, 4526 node, 4527 node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``, 4528 ` 4529 - expected on client:`, 4530 vnode.type 4531 ); 4532 logMismatchError(); 4533 } 4534 vnode.el = null; 4535 if (isFragment) { 4536 const end = locateClosingAnchor(node); 4537 while (true) { 4538 const next2 = nextSibling(node); 4539 if (next2 && next2 !== end) { 4540 remove(next2); 4541 } else { 4542 break; 4543 } 4544 } 4545 } 4546 const next = nextSibling(node); 4547 const container = parentNode(node); 4548 remove(node); 4549 patch( 4550 null, 4551 vnode, 4552 container, 4553 next, 4554 parentComponent, 4555 parentSuspense, 4556 getContainerType(container), 4557 slotScopeIds 4558 ); 4559 if (parentComponent) { 4560 parentComponent.vnode.el = vnode.el; 4561 updateHOCHostEl(parentComponent, vnode.el); 4562 } 4563 return next; 4564 }; 4565 const locateClosingAnchor = (node, open = "[", close = "]") => { 4566 let match = 0; 4567 while (node) { 4568 node = nextSibling(node); 4569 if (node && isComment(node)) { 4570 if (node.data === open) match++; 4571 if (node.data === close) { 4572 if (match === 0) { 4573 return nextSibling(node); 4574 } else { 4575 match--; 4576 } 4577 } 4578 } 4579 } 4580 return node; 4581 }; 4582 const replaceNode = (newNode, oldNode, parentComponent) => { 4583 const parentNode2 = oldNode.parentNode; 4584 if (parentNode2) { 4585 parentNode2.replaceChild(newNode, oldNode); 4586 } 4587 let parent = parentComponent; 4588 while (parent) { 4589 if (parent.vnode.el === oldNode) { 4590 parent.vnode.el = parent.subTree.el = newNode; 4591 } 4592 parent = parent.parent; 4593 } 4594 }; 4595 const isTemplateNode = (node) => { 4596 return node.nodeType === 1 && node.tagName === "TEMPLATE"; 4597 }; 4598 return [hydrate, hydrateNode]; 4599 } 4600 function propHasMismatch(el, key, clientValue, vnode, instance) { 4601 let mismatchType; 4602 let mismatchKey; 4603 let actual; 4604 let expected; 4605 if (key === "class") { 4606 if (el.$cls) { 4607 actual = el.$cls; 4608 delete el.$cls; 4609 } else { 4610 actual = el.getAttribute("class"); 4611 } 4612 expected = normalizeClass(clientValue); 4613 if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { 4614 mismatchType = 2 /* CLASS */; 4615 mismatchKey = `class`; 4616 } 4617 } else if (key === "style") { 4618 actual = el.getAttribute("style") || ""; 4619 expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue)); 4620 const actualMap = toStyleMap(actual); 4621 const expectedMap = toStyleMap(expected); 4622 if (vnode.dirs) { 4623 for (const { dir, value } of vnode.dirs) { 4624 if (dir.name === "show" && !value) { 4625 expectedMap.set("display", "none"); 4626 } 4627 } 4628 } 4629 if (instance) { 4630 resolveCssVars(instance, vnode, expectedMap); 4631 } 4632 if (!isMapEqual(actualMap, expectedMap)) { 4633 mismatchType = 3 /* STYLE */; 4634 mismatchKey = "style"; 4635 } 4636 } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) { 4637 if (isBooleanAttr(key)) { 4638 actual = el.hasAttribute(key); 4639 expected = includeBooleanAttr(clientValue); 4640 } else if (clientValue == null) { 4641 actual = el.hasAttribute(key); 4642 expected = false; 4643 } else { 4644 if (el.hasAttribute(key)) { 4645 actual = el.getAttribute(key); 4646 } else if (key === "value" && el.tagName === "TEXTAREA") { 4647 actual = el.value; 4648 } else { 4649 actual = false; 4650 } 4651 expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false; 4652 } 4653 if (actual !== expected) { 4654 mismatchType = 4 /* ATTRIBUTE */; 4655 mismatchKey = key; 4656 } 4657 } 4658 if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) { 4659 const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`; 4660 const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`; 4661 const postSegment = ` 4662 - rendered on server: ${format(actual)} 4663 - expected on client: ${format(expected)} 4664 Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead. 4665 You should fix the source of the mismatch.`; 4666 { 4667 warn$1(preSegment, el, postSegment); 4668 } 4669 return true; 4670 } 4671 return false; 4672 } 4673 function toClassSet(str) { 4674 return new Set(str.trim().split(/\s+/)); 4675 } 4676 function isSetEqual(a, b) { 4677 if (a.size !== b.size) { 4678 return false; 4679 } 4680 for (const s of a) { 4681 if (!b.has(s)) { 4682 return false; 4683 } 4684 } 4685 return true; 4686 } 4687 function toStyleMap(str) { 4688 const styleMap = /* @__PURE__ */ new Map(); 4689 for (const item of str.split(";")) { 4690 let [key, value] = item.split(":"); 4691 key = key.trim(); 4692 value = value && value.trim(); 4693 if (key && value) { 4694 styleMap.set(key, value); 4695 } 4696 } 4697 return styleMap; 4698 } 4699 function isMapEqual(a, b) { 4700 if (a.size !== b.size) { 4701 return false; 4702 } 4703 for (const [key, value] of a) { 4704 if (value !== b.get(key)) { 4705 return false; 4706 } 4707 } 4708 return true; 4709 } 4710 function resolveCssVars(instance, vnode, expectedMap) { 4711 const root = instance.subTree; 4712 if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) { 4713 const cssVars = instance.getCssVars(); 4714 for (const key in cssVars) { 4715 const value = normalizeCssVarValue(cssVars[key]); 4716 expectedMap.set(`--${getEscapedCssVarName(key)}`, value); 4717 } 4718 } 4719 if (vnode === root && instance.parent) { 4720 resolveCssVars(instance.parent, instance.vnode, expectedMap); 4721 } 4722 } 4723 const allowMismatchAttr = "data-allow-mismatch"; 4724 const MismatchTypeString = { 4725 [0 /* TEXT */]: "text", 4726 [1 /* CHILDREN */]: "children", 4727 [2 /* CLASS */]: "class", 4728 [3 /* STYLE */]: "style", 4729 [4 /* ATTRIBUTE */]: "attribute" 4730 }; 4731 function isMismatchAllowed(el, allowedType) { 4732 if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) { 4733 while (el && !el.hasAttribute(allowMismatchAttr)) { 4734 el = el.parentElement; 4735 } 4736 } 4737 const allowedAttr = el && el.getAttribute(allowMismatchAttr); 4738 if (allowedAttr == null) { 4739 return false; 4740 } else if (allowedAttr === "") { 4741 return true; 4742 } else { 4743 const list = allowedAttr.split(","); 4744 if (allowedType === 0 /* TEXT */ && list.includes("children")) { 4745 return true; 4746 } 4747 return list.includes(MismatchTypeString[allowedType]); 4748 } 4749 } 4750 4751 const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1)); 4752 const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id)); 4753 const hydrateOnIdle = (timeout = 1e4) => (hydrate) => { 4754 const id = requestIdleCallback(hydrate, { timeout }); 4755 return () => cancelIdleCallback(id); 4756 }; 4757 function elementIsVisibleInViewport(el) { 4758 const { top, left, bottom, right } = el.getBoundingClientRect(); 4759 const { innerHeight, innerWidth } = window; 4760 return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth); 4761 } 4762 const hydrateOnVisible = (opts) => (hydrate, forEach) => { 4763 const ob = new IntersectionObserver((entries) => { 4764 for (const e of entries) { 4765 if (!e.isIntersecting) continue; 4766 ob.disconnect(); 4767 hydrate(); 4768 break; 4769 } 4770 }, opts); 4771 forEach((el) => { 4772 if (!(el instanceof Element)) return; 4773 if (elementIsVisibleInViewport(el)) { 4774 hydrate(); 4775 ob.disconnect(); 4776 return false; 4777 } 4778 ob.observe(el); 4779 }); 4780 return () => ob.disconnect(); 4781 }; 4782 const hydrateOnMediaQuery = (query) => (hydrate) => { 4783 if (query) { 4784 const mql = matchMedia(query); 4785 if (mql.matches) { 4786 hydrate(); 4787 } else { 4788 mql.addEventListener("change", hydrate, { once: true }); 4789 return () => mql.removeEventListener("change", hydrate); 4790 } 4791 } 4792 }; 4793 const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => { 4794 if (isString(interactions)) interactions = [interactions]; 4795 let hasHydrated = false; 4796 const doHydrate = (e) => { 4797 if (!hasHydrated) { 4798 hasHydrated = true; 4799 teardown(); 4800 hydrate(); 4801 e.target.dispatchEvent(new e.constructor(e.type, e)); 4802 } 4803 }; 4804 const teardown = () => { 4805 forEach((el) => { 4806 for (const i of interactions) { 4807 el.removeEventListener(i, doHydrate); 4808 } 4809 }); 4810 }; 4811 forEach((el) => { 4812 for (const i of interactions) { 4813 el.addEventListener(i, doHydrate, { once: true }); 4814 } 4815 }); 4816 return teardown; 4817 }; 4818 function forEachElement(node, cb) { 4819 if (isComment(node) && node.data === "[") { 4820 let depth = 1; 4821 let next = node.nextSibling; 4822 while (next) { 4823 if (next.nodeType === 1) { 4824 const result = cb(next); 4825 if (result === false) { 4826 break; 4827 } 4828 } else if (isComment(next)) { 4829 if (next.data === "]") { 4830 if (--depth === 0) break; 4831 } else if (next.data === "[") { 4832 depth++; 4833 } 4834 } 4835 next = next.nextSibling; 4836 } 4837 } else { 4838 cb(node); 4839 } 4840 } 4841 4842 const isAsyncWrapper = (i) => !!i.type.__asyncLoader; 4843 // @__NO_SIDE_EFFECTS__ 4844 function defineAsyncComponent(source) { 4845 if (isFunction(source)) { 4846 source = { loader: source }; 4847 } 4848 const { 4849 loader, 4850 loadingComponent, 4851 errorComponent,
vendor: 4,466 bytes, lines 4852-4980
4852 delay = 200, 4853 hydrate: hydrateStrategy, 4854 timeout, 4855 // undefined = never times out 4856 suspensible = true, 4857 onError: userOnError 4858 } = source; 4859 let pendingRequest = null; 4860 let resolvedComp; 4861 let retries = 0; 4862 const retry = () => { 4863 retries++; 4864 pendingRequest = null; 4865 return load(); 4866 }; 4867 const load = () => { 4868 let thisRequest; 4869 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => { 4870 err = err instanceof Error ? err : new Error(String(err)); 4871 if (userOnError) { 4872 return new Promise((resolve, reject) => { 4873 const userRetry = () => resolve(retry()); 4874 const userFail = () => reject(err); 4875 userOnError(err, userRetry, userFail, retries + 1); 4876 }); 4877 } else { 4878 throw err; 4879 } 4880 }).then((comp) => { 4881 if (thisRequest !== pendingRequest && pendingRequest) { 4882 return pendingRequest; 4883 } 4884 if (!comp) { 4885 warn$1( 4886 `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.` 4887 ); 4888 } 4889 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) { 4890 comp = comp.default; 4891 } 4892 if (comp && !isObject(comp) && !isFunction(comp)) { 4893 throw new Error(`Invalid async component load result: ${comp}`); 4894 } 4895 resolvedComp = comp; 4896 return comp; 4897 })); 4898 }; 4899 return defineComponent({ 4900 name: "AsyncComponentWrapper", 4901 __asyncLoader: load, 4902 __asyncHydrate(el, instance, hydrate) { 4903 let patched = false; 4904 (instance.bu || (instance.bu = [])).push(() => patched = true); 4905 const performHydrate = () => { 4906 if (patched) { 4907 { 4908 warn$1( 4909 `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.` 4910 ); 4911 } 4912 return; 4913 } 4914 hydrate(); 4915 }; 4916 const doHydrate = hydrateStrategy ? () => { 4917 const teardown = hydrateStrategy( 4918 performHydrate, 4919 (cb) => forEachElement(el, cb) 4920 ); 4921 if (teardown) { 4922 (instance.bum || (instance.bum = [])).push(teardown); 4923 } 4924 } : performHydrate; 4925 if (resolvedComp) { 4926 doHydrate(); 4927 } else { 4928 load().then(() => !instance.isUnmounted && doHydrate()); 4929 } 4930 }, 4931 get __asyncResolved() { 4932 return resolvedComp; 4933 }, 4934 setup() { 4935 const instance = currentInstance; 4936 markAsyncBoundary(instance); 4937 if (resolvedComp) { 4938 return () => createInnerComp(resolvedComp, instance); 4939 } 4940 const onError = (err) => { 4941 pendingRequest = null; 4942 handleError( 4943 err, 4944 instance, 4945 13, 4946 !errorComponent 4947 ); 4948 }; 4949 if (suspensible && instance.suspense || false) { 4950 return load().then((comp) => { 4951 return () => createInnerComp(comp, instance); 4952 }).catch((err) => { 4953 onError(err); 4954 return () => errorComponent ? createVNode(errorComponent, { 4955 error: err 4956 }) : null; 4957 }); 4958 } 4959 const loaded = ref(false); 4960 const error = ref(); 4961 const delayed = ref(!!delay); 4962 if (delay) { 4963 setTimeout(() => { 4964 delayed.value = false; 4965 }, delay); 4966 } 4967 if (timeout != null) { 4968 setTimeout(() => { 4969 if (!loaded.value && !error.value) { 4970 const err = new Error( 4971 `Async component timed out after ${timeout}ms.` 4972 ); 4973 onError(err); 4974 error.value = err; 4975 } 4976 }, timeout); 4977 } 4978 load().then(() => { 4979 loaded.value = true; 4980 if (instance.parent && isKeepAlive(instance.parent.vnode)) {
vendor: 36,895 bytes, lines 4981-6024
4981 instance.parent.update(); 4982 } 4983 }).catch((err) => { 4984 onError(err); 4985 error.value = err; 4986 }); 4987 return () => { 4988 if (loaded.value && resolvedComp) { 4989 return createInnerComp(resolvedComp, instance); 4990 } else if (error.value && errorComponent) { 4991 return createVNode(errorComponent, { 4992 error: error.value 4993 }); 4994 } else if (loadingComponent && !delayed.value) { 4995 return createInnerComp( 4996 loadingComponent, 4997 instance 4998 ); 4999 } 5000 }; 5001 } 5002 }); 5003 } 5004 function createInnerComp(comp, parent) { 5005 const { ref: ref2, props, children, ce } = parent.vnode; 5006 const vnode = createVNode(comp, props, children); 5007 vnode.ref = ref2; 5008 vnode.ce = ce; 5009 delete parent.vnode.ce; 5010 return vnode; 5011 } 5012 5013 const isKeepAlive = (vnode) => vnode.type.__isKeepAlive; 5014 const KeepAliveImpl = { 5015 name: `KeepAlive`, 5016 // Marker for special handling inside the renderer. We are not using a === 5017 // check directly on KeepAlive in the renderer, because importing it directly 5018 // would prevent it from being tree-shaken. 5019 __isKeepAlive: true, 5020 props: { 5021 include: [String, RegExp, Array], 5022 exclude: [String, RegExp, Array], 5023 max: [String, Number] 5024 }, 5025 setup(props, { slots }) { 5026 const instance = getCurrentInstance(); 5027 const sharedContext = instance.ctx; 5028 const cache = /* @__PURE__ */ new Map(); 5029 const keys = /* @__PURE__ */ new Set(); 5030 let current = null; 5031 { 5032 instance.__v_cache = cache; 5033 } 5034 const parentSuspense = instance.suspense; 5035 const { 5036 renderer: { 5037 p: patch, 5038 m: move, 5039 um: _unmount, 5040 o: { createElement } 5041 } 5042 } = sharedContext; 5043 const storageContainer = createElement("div"); 5044 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => { 5045 const instance2 = vnode.component; 5046 move(vnode, container, anchor, 0, parentSuspense); 5047 patch( 5048 instance2.vnode, 5049 vnode, 5050 container, 5051 anchor, 5052 instance2, 5053 parentSuspense, 5054 namespace, 5055 vnode.slotScopeIds, 5056 optimized 5057 ); 5058 queuePostRenderEffect(() => { 5059 instance2.isDeactivated = false; 5060 if (instance2.a) { 5061 invokeArrayFns(instance2.a); 5062 } 5063 const vnodeHook = vnode.props && vnode.props.onVnodeMounted; 5064 if (vnodeHook) { 5065 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 5066 } 5067 }, parentSuspense); 5068 { 5069 devtoolsComponentAdded(instance2); 5070 } 5071 }; 5072 sharedContext.deactivate = (vnode) => { 5073 const instance2 = vnode.component; 5074 invalidateMount(instance2.m); 5075 invalidateMount(instance2.a); 5076 move(vnode, storageContainer, null, 1, parentSuspense); 5077 queuePostRenderEffect(() => { 5078 if (instance2.da) { 5079 invokeArrayFns(instance2.da); 5080 } 5081 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted; 5082 if (vnodeHook) { 5083 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 5084 } 5085 instance2.isDeactivated = true; 5086 }, parentSuspense); 5087 { 5088 devtoolsComponentAdded(instance2); 5089 } 5090 { 5091 instance2.__keepAliveStorageContainer = storageContainer; 5092 } 5093 }; 5094 function unmount(vnode) { 5095 resetShapeFlag(vnode); 5096 _unmount(vnode, instance, parentSuspense, true); 5097 } 5098 function pruneCache(filter) { 5099 cache.forEach((vnode, key) => { 5100 const name = getComponentName( 5101 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : vnode.type 5102 ); 5103 if (name && !filter(name)) { 5104 pruneCacheEntry(key); 5105 } 5106 }); 5107 } 5108 function pruneCacheEntry(key) { 5109 const cached = cache.get(key); 5110 if (cached && (!current || !isSameVNodeType(cached, current))) { 5111 unmount(cached); 5112 } else if (current) { 5113 resetShapeFlag(current); 5114 } 5115 cache.delete(key); 5116 keys.delete(key); 5117 } 5118 watch( 5119 () => [props.include, props.exclude], 5120 ([include, exclude]) => { 5121 include && pruneCache((name) => matches(include, name)); 5122 exclude && pruneCache((name) => !matches(exclude, name)); 5123 }, 5124 // prune post-render after `current` has been updated 5125 { flush: "post", deep: true } 5126 ); 5127 let pendingCacheKey = null; 5128 const cacheSubtree = () => { 5129 if (pendingCacheKey != null) { 5130 if (isSuspense(instance.subTree.type)) { 5131 queuePostRenderEffect(() => { 5132 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 5133 }, instance.subTree.suspense); 5134 } else { 5135 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 5136 } 5137 } 5138 }; 5139 onMounted(cacheSubtree); 5140 onUpdated(cacheSubtree); 5141 onBeforeUnmount(() => { 5142 cache.forEach((cached) => { 5143 const { subTree, suspense } = instance; 5144 const vnode = getInnerChild(subTree); 5145 if (cached.type === vnode.type && cached.key === vnode.key) { 5146 resetShapeFlag(vnode); 5147 const da = vnode.component.da; 5148 da && queuePostRenderEffect(da, suspense); 5149 return; 5150 } 5151 unmount(cached); 5152 }); 5153 }); 5154 return () => { 5155 pendingCacheKey = null; 5156 if (!slots.default) { 5157 return current = null; 5158 } 5159 const children = slots.default(); 5160 const rawVNode = children[0]; 5161 if (children.length > 1) { 5162 { 5163 warn$1(`KeepAlive should contain exactly one component child.`); 5164 } 5165 current = null; 5166 return children; 5167 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { 5168 current = null; 5169 return rawVNode; 5170 } 5171 let vnode = getInnerChild(rawVNode); 5172 if (vnode.type === Comment) { 5173 current = null; 5174 return vnode; 5175 } 5176 const comp = vnode.type; 5177 const name = getComponentName( 5178 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp 5179 ); 5180 const { include, exclude, max } = props; 5181 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { 5182 vnode.shapeFlag &= -257; 5183 current = vnode; 5184 return rawVNode; 5185 } 5186 const key = vnode.key == null ? comp : vnode.key; 5187 const cachedVNode = cache.get(key); 5188 if (vnode.el) { 5189 vnode = cloneVNode(vnode); 5190 if (rawVNode.shapeFlag & 128) { 5191 rawVNode.ssContent = vnode; 5192 } 5193 } 5194 pendingCacheKey = key; 5195 if (cachedVNode) { 5196 vnode.el = cachedVNode.el; 5197 vnode.component = cachedVNode.component; 5198 if (vnode.transition) { 5199 setTransitionHooks(vnode, vnode.transition); 5200 } 5201 vnode.shapeFlag |= 512; 5202 keys.delete(key); 5203 keys.add(key); 5204 } else { 5205 keys.add(key); 5206 if (max && keys.size > parseInt(max, 10)) { 5207 pruneCacheEntry(keys.values().next().value); 5208 } 5209 } 5210 vnode.shapeFlag |= 256; 5211 current = vnode; 5212 return isSuspense(rawVNode.type) ? rawVNode : vnode; 5213 }; 5214 } 5215 }; 5216 const KeepAlive = KeepAliveImpl; 5217 function matches(pattern, name) { 5218 if (isArray(pattern)) { 5219 return pattern.some((p) => matches(p, name)); 5220 } else if (isString(pattern)) { 5221 return pattern.split(",").includes(name); 5222 } else if (isRegExp(pattern)) { 5223 pattern.lastIndex = 0; 5224 return pattern.test(name); 5225 } 5226 return false; 5227 } 5228 function onActivated(hook, target) { 5229 registerKeepAliveHook(hook, "a", target); 5230 } 5231 function onDeactivated(hook, target) { 5232 registerKeepAliveHook(hook, "da", target); 5233 } 5234 function registerKeepAliveHook(hook, type, target = currentInstance) { 5235 const wrappedHook = hook.__wdc || (hook.__wdc = () => { 5236 let current = target; 5237 while (current) { 5238 if (current.isDeactivated) { 5239 return; 5240 } 5241 current = current.parent; 5242 } 5243 return hook(); 5244 }); 5245 injectHook(type, wrappedHook, target); 5246 if (target) { 5247 let current = target.parent; 5248 while (current && current.parent) { 5249 if (isKeepAlive(current.parent.vnode)) { 5250 injectToKeepAliveRoot(wrappedHook, type, target, current); 5251 } 5252 current = current.parent; 5253 } 5254 } 5255 } 5256 function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) { 5257 const injected = injectHook( 5258 type, 5259 hook, 5260 keepAliveRoot, 5261 true 5262 /* prepend */ 5263 ); 5264 onUnmounted(() => { 5265 remove(keepAliveRoot[type], injected); 5266 }, target); 5267 } 5268 function resetShapeFlag(vnode) { 5269 vnode.shapeFlag &= -257; 5270 vnode.shapeFlag &= -513; 5271 } 5272 function getInnerChild(vnode) { 5273 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; 5274 } 5275 5276 function injectHook(type, hook, target = currentInstance, prepend = false) { 5277 if (target) { 5278 const hooks = target[type] || (target[type] = []); 5279 const wrappedHook = hook.__weh || (hook.__weh = (...args) => { 5280 pauseTracking(); 5281 const reset = setCurrentInstance(target); 5282 const res = callWithAsyncErrorHandling(hook, target, type, args); 5283 reset(); 5284 resetTracking(); 5285 return res; 5286 }); 5287 if (prepend) { 5288 hooks.unshift(wrappedHook); 5289 } else { 5290 hooks.push(wrappedHook); 5291 } 5292 return wrappedHook; 5293 } else { 5294 const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, "")); 5295 warn$1( 5296 `${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.` ) 5297 ); 5298 } 5299 } 5300 const createHook = (lifecycle) => (hook, target = currentInstance) => { 5301 if (!isInSSRComponentSetup || lifecycle === "sp") { 5302 injectHook(lifecycle, (...args) => hook(...args), target); 5303 } 5304 }; 5305 const onBeforeMount = createHook("bm"); 5306 const onMounted = createHook("m"); 5307 const onBeforeUpdate = createHook( 5308 "bu" 5309 ); 5310 const onUpdated = createHook("u"); 5311 const onBeforeUnmount = createHook( 5312 "bum" 5313 ); 5314 const onUnmounted = createHook("um"); 5315 const onServerPrefetch = createHook( 5316 "sp" 5317 ); 5318 const onRenderTriggered = createHook("rtg"); 5319 const onRenderTracked = createHook("rtc"); 5320 function onErrorCaptured(hook, target = currentInstance) { 5321 injectHook("ec", hook, target); 5322 } 5323 5324 const COMPONENTS = "components"; 5325 const DIRECTIVES = "directives"; 5326 function resolveComponent(name, maybeSelfReference) { 5327 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; 5328 } 5329 const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for("v-ndc"); 5330 function resolveDynamicComponent(component) { 5331 if (isString(component)) { 5332 return resolveAsset(COMPONENTS, component, false) || component; 5333 } else { 5334 return component || NULL_DYNAMIC_COMPONENT; 5335 } 5336 } 5337 function resolveDirective(name) { 5338 return resolveAsset(DIRECTIVES, name); 5339 } 5340 function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) { 5341 const instance = currentRenderingInstance || currentInstance; 5342 if (instance) { 5343 const Component = instance.type; 5344 if (type === COMPONENTS) { 5345 const selfName = getComponentName( 5346 Component, 5347 false 5348 ); 5349 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) { 5350 return Component; 5351 } 5352 } 5353 const res = ( 5354 // local registration 5355 // check instance[type] first which is resolved for options API 5356 resolve(instance[type] || Component[type], name) || // global registration 5357 resolve(instance.appContext[type], name) 5358 ); 5359 if (!res && maybeSelfReference) { 5360 return Component; 5361 } 5362 if (warnMissing && !res) { 5363 const extra = type === COMPONENTS ? ` 5364 If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``; 5365 warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`); 5366 } 5367 return res; 5368 } else { 5369 warn$1( 5370 `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().` 5371 ); 5372 } 5373 } 5374 function resolve(registry, name) { 5375 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]); 5376 } 5377 5378 function renderList(source, renderItem, cache, index) { 5379 let ret; 5380 const cached = cache && cache[index]; 5381 const sourceIsArray = isArray(source); 5382 if (sourceIsArray || isString(source)) { 5383 const sourceIsReactiveArray = sourceIsArray && isReactive(source); 5384 let needsWrap = false; 5385 let isReadonlySource = false; 5386 if (sourceIsReactiveArray) { 5387 needsWrap = !isShallow(source); 5388 isReadonlySource = isReadonly(source); 5389 source = shallowReadArray(source); 5390 } 5391 ret = new Array(source.length); 5392 for (let i = 0, l = source.length; i < l; i++) { 5393 ret[i] = renderItem( 5394 needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i], 5395 i, 5396 void 0, 5397 cached && cached[i] 5398 ); 5399 } 5400 } else if (typeof source === "number") { 5401 if (!Number.isInteger(source)) { 5402 warn$1(`The v-for range expect an integer value but got ${source}.`); 5403 } 5404 ret = new Array(source); 5405 for (let i = 0; i < source; i++) { 5406 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]); 5407 } 5408 } else if (isObject(source)) { 5409 if (source[Symbol.iterator]) { 5410 ret = Array.from( 5411 source, 5412 (item, i) => renderItem(item, i, void 0, cached && cached[i]) 5413 ); 5414 } else { 5415 const keys = Object.keys(source); 5416 ret = new Array(keys.length); 5417 for (let i = 0, l = keys.length; i < l; i++) { 5418 const key = keys[i]; 5419 ret[i] = renderItem(source[key], key, i, cached && cached[i]); 5420 } 5421 } 5422 } else { 5423 ret = []; 5424 } 5425 if (cache) { 5426 cache[index] = ret; 5427 } 5428 return ret; 5429 } 5430 5431 function createSlots(slots, dynamicSlots) { 5432 for (let i = 0; i < dynamicSlots.length; i++) { 5433 const slot = dynamicSlots[i]; 5434 if (isArray(slot)) { 5435 for (let j = 0; j < slot.length; j++) { 5436 slots[slot[j].name] = slot[j].fn; 5437 } 5438 } else if (slot) { 5439 slots[slot.name] = slot.key ? (...args) => { 5440 const res = slot.fn(...args); 5441 if (res) res.key = slot.key; 5442 return res; 5443 } : slot.fn; 5444 } 5445 } 5446 return slots; 5447 } 5448 5449 function renderSlot(slots, name, props = {}, fallback, noSlotted) { 5450 if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) { 5451 const hasProps = Object.keys(props).length > 0; 5452 if (name !== "default") props.name = name; 5453 return openBlock(), createBlock( 5454 Fragment, 5455 null, 5456 [createVNode("slot", props, fallback && fallback())], 5457 hasProps ? -2 : 64 5458 ); 5459 } 5460 let slot = slots[name]; 5461 if (slot && slot.length > 1) { 5462 warn$1( 5463 `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.` 5464 ); 5465 slot = () => []; 5466 } 5467 if (slot && slot._c) { 5468 slot._d = false; 5469 } 5470 openBlock(); 5471 const validSlotContent = slot && ensureValidVNode(slot(props)); 5472 const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch 5473 // key attached in the `createSlots` helper, respect that 5474 validSlotContent && validSlotContent.key; 5475 const rendered = createBlock( 5476 Fragment, 5477 { 5478 key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content 5479 (!validSlotContent && fallback ? "_fb" : "") 5480 }, 5481 validSlotContent || (fallback ? fallback() : []), 5482 validSlotContent && slots._ === 1 ? 64 : -2 5483 ); 5484 if (!noSlotted && rendered.scopeId) { 5485 rendered.slotScopeIds = [rendered.scopeId + "-s"]; 5486 } 5487 if (slot && slot._c) { 5488 slot._d = true; 5489 } 5490 return rendered; 5491 } 5492 function ensureValidVNode(vnodes) { 5493 return vnodes.some((child) => { 5494 if (!isVNode(child)) return true; 5495 if (child.type === Comment) return false; 5496 if (child.type === Fragment && !ensureValidVNode(child.children)) 5497 return false; 5498 return true; 5499 }) ? vnodes : null; 5500 } 5501 5502 function toHandlers(obj, preserveCaseIfNecessary) { 5503 const ret = {}; 5504 if (!isObject(obj)) { 5505 warn$1(`v-on with no argument expects an object value.`); 5506 return ret; 5507 } 5508 for (const key in obj) { 5509 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key]; 5510 } 5511 return ret; 5512 } 5513 5514 const getPublicInstance = (i) => { 5515 if (!i) return null; 5516 if (isStatefulComponent(i)) return getComponentPublicInstance(i); 5517 return getPublicInstance(i.parent); 5518 }; 5519 const publicPropertiesMap = ( 5520 // Move PURE marker to new line to workaround compiler discarding it 5521 // due to type annotation 5522 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), { 5523 $: (i) => i, 5524 $el: (i) => i.vnode.el, 5525 $data: (i) => i.data, 5526 $props: (i) => shallowReadonly(i.props) , 5527 $attrs: (i) => shallowReadonly(i.attrs) , 5528 $slots: (i) => shallowReadonly(i.slots) , 5529 $refs: (i) => shallowReadonly(i.refs) , 5530 $parent: (i) => getPublicInstance(i.parent), 5531 $root: (i) => getPublicInstance(i.root), 5532 $host: (i) => i.ce, 5533 $emit: (i) => i.emit, 5534 $options: (i) => resolveMergedOptions(i) , 5535 $forceUpdate: (i) => i.f || (i.f = () => { 5536 queueJob(i.update); 5537 }), 5538 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)), 5539 $watch: (i) => instanceWatch.bind(i) 5540 }) 5541 ); 5542 const isReservedPrefix = (key) => key === "_" || key === "$"; 5543 const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key); 5544 const PublicInstanceProxyHandlers = { 5545 get({ _: instance }, key) { 5546 if (key === "__v_skip") { 5547 return true; 5548 } 5549 const { ctx, setupState, data, props, accessCache, type, appContext } = instance; 5550 if (key === "__isVue") { 5551 return true; 5552 } 5553 if (key[0] !== "$") { 5554 const n = accessCache[key]; 5555 if (n !== void 0) { 5556 switch (n) { 5557 case 1 /* SETUP */: 5558 return setupState[key]; 5559 case 2 /* DATA */: 5560 return data[key]; 5561 case 4 /* CONTEXT */: 5562 return ctx[key]; 5563 case 3 /* PROPS */: 5564 return props[key]; 5565 } 5566 } else if (hasSetupBinding(setupState, key)) { 5567 accessCache[key] = 1 /* SETUP */; 5568 return setupState[key]; 5569 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 5570 accessCache[key] = 2 /* DATA */; 5571 return data[key]; 5572 } else if (hasOwn(props, key)) { 5573 accessCache[key] = 3 /* PROPS */; 5574 return props[key]; 5575 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 5576 accessCache[key] = 4 /* CONTEXT */; 5577 return ctx[key]; 5578 } else if (shouldCacheAccess) { 5579 accessCache[key] = 0 /* OTHER */; 5580 } 5581 } 5582 const publicGetter = publicPropertiesMap[key]; 5583 let cssModule, globalProperties; 5584 if (publicGetter) { 5585 if (key === "$attrs") { 5586 track(instance.attrs, "get", ""); 5587 markAttrsAccessed(); 5588 } else if (key === "$slots") { 5589 track(instance, "get", key); 5590 } 5591 return publicGetter(instance); 5592 } else if ( 5593 // css module (injected by vue-loader) 5594 (cssModule = type.__cssModules) && (cssModule = cssModule[key]) 5595 ) { 5596 return cssModule; 5597 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 5598 accessCache[key] = 4 /* CONTEXT */; 5599 return ctx[key]; 5600 } else if ( 5601 // global properties 5602 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key) 5603 ) { 5604 { 5605 return globalProperties[key]; 5606 } 5607 } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading 5608 // to infinite warning loop 5609 key.indexOf("__v") !== 0)) { 5610 if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) { 5611 warn$1( 5612 `Property ${JSON.stringify( 5613 key 5614 )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.` 5615 ); 5616 } else if (instance === currentRenderingInstance) { 5617 warn$1( 5618 `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.` 5619 ); 5620 } 5621 } 5622 }, 5623 set({ _: instance }, key, value) { 5624 const { data, setupState, ctx } = instance; 5625 if (hasSetupBinding(setupState, key)) { 5626 setupState[key] = value; 5627 return true; 5628 } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) { 5629 warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`); 5630 return false; 5631 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 5632 data[key] = value; 5633 return true; 5634 } else if (hasOwn(instance.props, key)) { 5635 warn$1(`Attempting to mutate prop "${key}". Props are readonly.`); 5636 return false; 5637 } 5638 if (key[0] === "$" && key.slice(1) in instance) { 5639 warn$1( 5640 `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.` 5641 ); 5642 return false; 5643 } else { 5644 if (key in instance.appContext.config.globalProperties) { 5645 Object.defineProperty(ctx, key, { 5646 enumerable: true, 5647 configurable: true, 5648 value 5649 }); 5650 } else { 5651 ctx[key] = value; 5652 } 5653 } 5654 return true; 5655 }, 5656 has({ 5657 _: { data, setupState, accessCache, ctx, appContext, props, type } 5658 }, key) { 5659 let cssModules; 5660 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]); 5661 }, 5662 defineProperty(target, key, descriptor) { 5663 if (descriptor.get != null) { 5664 target._.accessCache[key] = 0; 5665 } else if (hasOwn(descriptor, "value")) { 5666 this.set(target, key, descriptor.value, null); 5667 } 5668 return Reflect.defineProperty(target, key, descriptor); 5669 } 5670 }; 5671 { 5672 PublicInstanceProxyHandlers.ownKeys = (target) => { 5673 warn$1( 5674 `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.` 5675 ); 5676 return Reflect.ownKeys(target); 5677 }; 5678 } 5679 const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, { 5680 get(target, key) { 5681 if (key === Symbol.unscopables) { 5682 return; 5683 } 5684 return PublicInstanceProxyHandlers.get(target, key, target); 5685 }, 5686 has(_, key) { 5687 const has = key[0] !== "_" && !isGloballyAllowed(key); 5688 if (!has && PublicInstanceProxyHandlers.has(_, key)) { 5689 warn$1( 5690 `Property ${JSON.stringify( 5691 key 5692 )} should not start with _ which is a reserved prefix for Vue internals.` 5693 ); 5694 } 5695 return has; 5696 } 5697 }); 5698 function createDevRenderContext(instance) { 5699 const target = {}; 5700 Object.defineProperty(target, `_`, { 5701 configurable: true, 5702 enumerable: false, 5703 get: () => instance 5704 }); 5705 Object.keys(publicPropertiesMap).forEach((key) => { 5706 Object.defineProperty(target, key, { 5707 configurable: true, 5708 enumerable: false, 5709 get: () => publicPropertiesMap[key](instance), 5710 // intercepted by the proxy so no need for implementation, 5711 // but needed to prevent set errors 5712 set: NOOP 5713 }); 5714 }); 5715 return target; 5716 } 5717 function exposePropsOnRenderContext(instance) { 5718 const { 5719 ctx, 5720 propsOptions: [propsOptions] 5721 } = instance; 5722 if (propsOptions) { 5723 Object.keys(propsOptions).forEach((key) => { 5724 Object.defineProperty(ctx, key, { 5725 enumerable: true, 5726 configurable: true, 5727 get: () => instance.props[key], 5728 set: NOOP 5729 }); 5730 }); 5731 } 5732 } 5733 function exposeSetupStateOnRenderContext(instance) { 5734 const { ctx, setupState } = instance; 5735 Object.keys(toRaw(setupState)).forEach((key) => { 5736 if (!setupState.__isScriptSetup) { 5737 if (isReservedPrefix(key[0])) { 5738 warn$1( 5739 `setup() return property ${JSON.stringify( 5740 key 5741 )} should not start with "$" or "_" which are reserved prefixes for Vue internals.` 5742 ); 5743 return; 5744 } 5745 Object.defineProperty(ctx, key, { 5746 enumerable: true, 5747 configurable: true, 5748 get: () => setupState[key], 5749 set: NOOP 5750 }); 5751 } 5752 }); 5753 } 5754 5755 const warnRuntimeUsage = (method) => warn$1( 5756 `${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.` 5757 ); 5758 function defineProps() { 5759 { 5760 warnRuntimeUsage(`defineProps`); 5761 } 5762 return null; 5763 } 5764 function defineEmits() { 5765 { 5766 warnRuntimeUsage(`defineEmits`); 5767 } 5768 return null; 5769 } 5770 function defineExpose(exposed) { 5771 { 5772 warnRuntimeUsage(`defineExpose`); 5773 } 5774 } 5775 function defineOptions(options) { 5776 { 5777 warnRuntimeUsage(`defineOptions`); 5778 } 5779 } 5780 function defineSlots() { 5781 { 5782 warnRuntimeUsage(`defineSlots`); 5783 } 5784 return null; 5785 } 5786 function defineModel() { 5787 { 5788 warnRuntimeUsage("defineModel"); 5789 } 5790 } 5791 function withDefaults(props, defaults) { 5792 { 5793 warnRuntimeUsage(`withDefaults`); 5794 } 5795 return null; 5796 } 5797 function useSlots() { 5798 return getContext("useSlots").slots; 5799 } 5800 function useAttrs() { 5801 return getContext("useAttrs").attrs; 5802 } 5803 function getContext(calledFunctionName) { 5804 const i = getCurrentInstance(); 5805 if (!i) { 5806 warn$1(`${calledFunctionName}() called without active instance.`); 5807 } 5808 return i.setupContext || (i.setupContext = createSetupContext(i)); 5809 } 5810 function normalizePropsOrEmits(props) { 5811 return isArray(props) ? props.reduce( 5812 (normalized, p) => (normalized[p] = null, normalized), 5813 {} 5814 ) : props; 5815 } 5816 function mergeDefaults(raw, defaults) { 5817 const props = normalizePropsOrEmits(raw); 5818 for (const key in defaults) { 5819 if (key.startsWith("__skip")) continue; 5820 let opt = props[key]; 5821 if (opt) { 5822 if (isArray(opt) || isFunction(opt)) { 5823 opt = props[key] = { type: opt, default: defaults[key] }; 5824 } else { 5825 opt.default = defaults[key]; 5826 } 5827 } else if (opt === null) { 5828 opt = props[key] = { default: defaults[key] }; 5829 } else { 5830 warn$1(`props default key "${key}" has no corresponding declaration.`); 5831 } 5832 if (opt && defaults[`__skip_${key}`]) { 5833 opt.skipFactory = true; 5834 } 5835 } 5836 return props; 5837 } 5838 function mergeModels(a, b) { 5839 if (!a || !b) return a || b; 5840 if (isArray(a) && isArray(b)) return a.concat(b); 5841 return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b)); 5842 } 5843 function createPropsRestProxy(props, excludedKeys) { 5844 const ret = {}; 5845 for (const key in props) { 5846 if (!excludedKeys.includes(key)) { 5847 Object.defineProperty(ret, key, { 5848 enumerable: true, 5849 get: () => props[key] 5850 }); 5851 } 5852 } 5853 return ret; 5854 } 5855 function withAsyncContext(getAwaitable) { 5856 const ctx = getCurrentInstance(); 5857 if (!ctx) { 5858 warn$1( 5859 `withAsyncContext called without active current instance. This is likely a bug.` 5860 ); 5861 } 5862 let awaitable = getAwaitable(); 5863 unsetCurrentInstance(); 5864 if (isPromise(awaitable)) { 5865 awaitable = awaitable.catch((e) => { 5866 setCurrentInstance(ctx); 5867 throw e; 5868 }); 5869 } 5870 return [awaitable, () => setCurrentInstance(ctx)]; 5871 } 5872 5873 function createDuplicateChecker() { 5874 const cache = /* @__PURE__ */ Object.create(null); 5875 return (type, key) => { 5876 if (cache[key]) { 5877 warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`); 5878 } else { 5879 cache[key] = type; 5880 } 5881 }; 5882 } 5883 let shouldCacheAccess = true; 5884 function applyOptions(instance) { 5885 const options = resolveMergedOptions(instance); 5886 const publicThis = instance.proxy; 5887 const ctx = instance.ctx; 5888 shouldCacheAccess = false; 5889 if (options.beforeCreate) { 5890 callHook$1(options.beforeCreate, instance, "bc"); 5891 } 5892 const { 5893 // state 5894 data: dataOptions, 5895 computed: computedOptions, 5896 methods, 5897 watch: watchOptions, 5898 provide: provideOptions, 5899 inject: injectOptions, 5900 // lifecycle 5901 created, 5902 beforeMount, 5903 mounted, 5904 beforeUpdate, 5905 updated, 5906 activated, 5907 deactivated, 5908 beforeDestroy, 5909 beforeUnmount, 5910 destroyed, 5911 unmounted, 5912 render, 5913 renderTracked, 5914 renderTriggered, 5915 errorCaptured, 5916 serverPrefetch, 5917 // public API 5918 expose, 5919 inheritAttrs, 5920 // assets 5921 components, 5922 directives, 5923 filters 5924 } = options; 5925 const checkDuplicateProperties = createDuplicateChecker() ; 5926 { 5927 const [propsOptions] = instance.propsOptions; 5928 if (propsOptions) { 5929 for (const key in propsOptions) { 5930 checkDuplicateProperties("Props" /* PROPS */, key); 5931 } 5932 } 5933 } 5934 if (injectOptions) { 5935 resolveInjections(injectOptions, ctx, checkDuplicateProperties); 5936 } 5937 if (methods) { 5938 for (const key in methods) { 5939 const methodHandler = methods[key]; 5940 if (isFunction(methodHandler)) { 5941 { 5942 Object.defineProperty(ctx, key, { 5943 value: methodHandler.bind(publicThis), 5944 configurable: true, 5945 enumerable: true, 5946 writable: true 5947 }); 5948 } 5949 { 5950 checkDuplicateProperties("Methods" /* METHODS */, key); 5951 } 5952 } else { 5953 warn$1( 5954 `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?` 5955 ); 5956 } 5957 } 5958 } 5959 if (dataOptions) { 5960 if (!isFunction(dataOptions)) { 5961 warn$1( 5962 `The data option must be a function. Plain object usage is no longer supported.` 5963 ); 5964 } 5965 const data = dataOptions.call(publicThis, publicThis); 5966 if (isPromise(data)) { 5967 warn$1( 5968 `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.` 5969 ); 5970 } 5971 if (!isObject(data)) { 5972 warn$1(`data() should return an object.`); 5973 } else { 5974 instance.data = reactive(data); 5975 { 5976 for (const key in data) { 5977 checkDuplicateProperties("Data" /* DATA */, key); 5978 if (!isReservedPrefix(key[0])) { 5979 Object.defineProperty(ctx, key, { 5980 configurable: true, 5981 enumerable: true, 5982 get: () => data[key], 5983 set: NOOP 5984 }); 5985 } 5986 } 5987 } 5988 } 5989 } 5990 shouldCacheAccess = true; 5991 if (computedOptions) { 5992 for (const key in computedOptions) { 5993 const opt = computedOptions[key]; 5994 const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; 5995 if (get === NOOP) { 5996 warn$1(`Computed property "${key}" has no getter.`); 5997 } 5998 const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => { 5999 warn$1( 6000 `Write operation failed: computed property "${key}" is readonly.` 6001 ); 6002 } ; 6003 const c = computed({ 6004 get, 6005 set 6006 }); 6007 Object.defineProperty(ctx, key, { 6008 enumerable: true, 6009 configurable: true, 6010 get: () => c.value, 6011 set: (v) => c.value = v 6012 }); 6013 { 6014 checkDuplicateProperties("Computed" /* COMPUTED */, key); 6015 } 6016 } 6017 } 6018 if (watchOptions) { 6019 for (const key in watchOptions) { 6020 createWatcher(watchOptions[key], ctx, publicThis, key); 6021 } 6022 } 6023 if (provideOptions) { 6024 const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
vendor: 4,565 bytes, lines 6025-6153
6025 Reflect.ownKeys(provides).forEach((key) => { 6026 provide(key, provides[key]); 6027 }); 6028 } 6029 if (created) { 6030 callHook$1(created, instance, "c"); 6031 } 6032 function registerLifecycleHook(register, hook) { 6033 if (isArray(hook)) { 6034 hook.forEach((_hook) => register(_hook.bind(publicThis))); 6035 } else if (hook) { 6036 register(hook.bind(publicThis)); 6037 } 6038 } 6039 registerLifecycleHook(onBeforeMount, beforeMount); 6040 registerLifecycleHook(onMounted, mounted); 6041 registerLifecycleHook(onBeforeUpdate, beforeUpdate); 6042 registerLifecycleHook(onUpdated, updated); 6043 registerLifecycleHook(onActivated, activated); 6044 registerLifecycleHook(onDeactivated, deactivated); 6045 registerLifecycleHook(onErrorCaptured, errorCaptured); 6046 registerLifecycleHook(onRenderTracked, renderTracked); 6047 registerLifecycleHook(onRenderTriggered, renderTriggered); 6048 registerLifecycleHook(onBeforeUnmount, beforeUnmount); 6049 registerLifecycleHook(onUnmounted, unmounted); 6050 registerLifecycleHook(onServerPrefetch, serverPrefetch); 6051 if (isArray(expose)) { 6052 if (expose.length) { 6053 const exposed = instance.exposed || (instance.exposed = {}); 6054 expose.forEach((key) => { 6055 Object.defineProperty(exposed, key, { 6056 get: () => publicThis[key], 6057 set: (val) => publicThis[key] = val, 6058 enumerable: true 6059 }); 6060 }); 6061 } else if (!instance.exposed) { 6062 instance.exposed = {}; 6063 } 6064 } 6065 if (render && instance.render === NOOP) { 6066 instance.render = render; 6067 } 6068 if (inheritAttrs != null) { 6069 instance.inheritAttrs = inheritAttrs; 6070 } 6071 if (components) instance.components = components; 6072 if (directives) instance.directives = directives; 6073 } 6074 function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) { 6075 if (isArray(injectOptions)) { 6076 injectOptions = normalizeInject(injectOptions); 6077 } 6078 for (const key in injectOptions) { 6079 const opt = injectOptions[key]; 6080 let injected; 6081 if (isObject(opt)) { 6082 if ("default" in opt) { 6083 injected = inject( 6084 opt.from || key, 6085 opt.default, 6086 true 6087 ); 6088 } else { 6089 injected = inject(opt.from || key); 6090 } 6091 } else { 6092 injected = inject(opt); 6093 } 6094 if (isRef(injected)) { 6095 Object.defineProperty(ctx, key, { 6096 enumerable: true, 6097 configurable: true, 6098 get: () => injected.value, 6099 set: (v) => injected.value = v 6100 }); 6101 } else { 6102 ctx[key] = injected; 6103 } 6104 { 6105 checkDuplicateProperties("Inject" /* INJECT */, key); 6106 } 6107 } 6108 } 6109 function callHook$1(hook, instance, type) { 6110 callWithAsyncErrorHandling( 6111 isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy), 6112 instance, 6113 type 6114 ); 6115 } 6116 function createWatcher(raw, ctx, publicThis, key) { 6117 let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; 6118 if (isString(raw)) { 6119 const handler = ctx[raw]; 6120 if (isFunction(handler)) { 6121 { 6122 watch(getter, handler); 6123 } 6124 } else { 6125 warn$1(`Invalid watch handler specified by key "${raw}"`, handler); 6126 } 6127 } else if (isFunction(raw)) { 6128 { 6129 watch(getter, raw.bind(publicThis)); 6130 } 6131 } else if (isObject(raw)) { 6132 if (isArray(raw)) { 6133 raw.forEach((r) => createWatcher(r, ctx, publicThis, key)); 6134 } else { 6135 const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; 6136 if (isFunction(handler)) { 6137 watch(getter, handler, raw); 6138 } else { 6139 warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler); 6140 } 6141 } 6142 } else { 6143 warn$1(`Invalid watch option: "${key}"`, raw); 6144 } 6145 } 6146 function resolveMergedOptions(instance) { 6147 const base = instance.type; 6148 const { mixins, extends: extendsOptions } = base; 6149 const { 6150 mixins: globalMixins, 6151 optionsCache: cache, 6152 config: { optionMergeStrategies } 6153 } = instance.appContext;
vendor: 83,902 bytes, lines 6154-8586
6154 const cached = cache.get(base); 6155 let resolved; 6156 if (cached) { 6157 resolved = cached; 6158 } else if (!globalMixins.length && !mixins && !extendsOptions) { 6159 { 6160 resolved = base; 6161 } 6162 } else { 6163 resolved = {}; 6164 if (globalMixins.length) { 6165 globalMixins.forEach( 6166 (m) => mergeOptions(resolved, m, optionMergeStrategies, true) 6167 ); 6168 } 6169 mergeOptions(resolved, base, optionMergeStrategies); 6170 } 6171 if (isObject(base)) { 6172 cache.set(base, resolved); 6173 } 6174 return resolved; 6175 } 6176 function mergeOptions(to, from, strats, asMixin = false) { 6177 const { mixins, extends: extendsOptions } = from; 6178 if (extendsOptions) { 6179 mergeOptions(to, extendsOptions, strats, true); 6180 } 6181 if (mixins) { 6182 mixins.forEach( 6183 (m) => mergeOptions(to, m, strats, true) 6184 ); 6185 } 6186 for (const key in from) { 6187 if (asMixin && key === "expose") { 6188 warn$1( 6189 `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.` 6190 ); 6191 } else { 6192 const strat = internalOptionMergeStrats[key] || strats && strats[key]; 6193 to[key] = strat ? strat(to[key], from[key]) : from[key]; 6194 } 6195 } 6196 return to; 6197 } 6198 const internalOptionMergeStrats = { 6199 data: mergeDataFn, 6200 props: mergeEmitsOrPropsOptions, 6201 emits: mergeEmitsOrPropsOptions, 6202 // objects 6203 methods: mergeObjectOptions, 6204 computed: mergeObjectOptions, 6205 // lifecycle 6206 beforeCreate: mergeAsArray$1, 6207 created: mergeAsArray$1, 6208 beforeMount: mergeAsArray$1, 6209 mounted: mergeAsArray$1, 6210 beforeUpdate: mergeAsArray$1, 6211 updated: mergeAsArray$1, 6212 beforeDestroy: mergeAsArray$1, 6213 beforeUnmount: mergeAsArray$1, 6214 destroyed: mergeAsArray$1, 6215 unmounted: mergeAsArray$1, 6216 activated: mergeAsArray$1, 6217 deactivated: mergeAsArray$1, 6218 errorCaptured: mergeAsArray$1, 6219 serverPrefetch: mergeAsArray$1, 6220 // assets 6221 components: mergeObjectOptions, 6222 directives: mergeObjectOptions, 6223 // watch 6224 watch: mergeWatchOptions, 6225 // provide / inject 6226 provide: mergeDataFn, 6227 inject: mergeInject 6228 }; 6229 function mergeDataFn(to, from) { 6230 if (!from) { 6231 return to; 6232 } 6233 if (!to) { 6234 return from; 6235 } 6236 return function mergedDataFn() { 6237 return (extend)( 6238 isFunction(to) ? to.call(this, this) : to, 6239 isFunction(from) ? from.call(this, this) : from 6240 ); 6241 }; 6242 } 6243 function mergeInject(to, from) { 6244 return mergeObjectOptions(normalizeInject(to), normalizeInject(from)); 6245 } 6246 function normalizeInject(raw) { 6247 if (isArray(raw)) { 6248 const res = {}; 6249 for (let i = 0; i < raw.length; i++) { 6250 res[raw[i]] = raw[i]; 6251 } 6252 return res; 6253 } 6254 return raw; 6255 } 6256 function mergeAsArray$1(to, from) { 6257 return to ? [...new Set([].concat(to, from))] : from; 6258 } 6259 function mergeObjectOptions(to, from) { 6260 return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from; 6261 } 6262 function mergeEmitsOrPropsOptions(to, from) { 6263 if (to) { 6264 if (isArray(to) && isArray(from)) { 6265 return [.../* @__PURE__ */ new Set([...to, ...from])]; 6266 } 6267 return extend( 6268 /* @__PURE__ */ Object.create(null), 6269 normalizePropsOrEmits(to), 6270 normalizePropsOrEmits(from != null ? from : {}) 6271 ); 6272 } else { 6273 return from; 6274 } 6275 } 6276 function mergeWatchOptions(to, from) { 6277 if (!to) return from; 6278 if (!from) return to; 6279 const merged = extend(/* @__PURE__ */ Object.create(null), to); 6280 for (const key in from) { 6281 merged[key] = mergeAsArray$1(to[key], from[key]); 6282 } 6283 return merged; 6284 } 6285 6286 function createAppContext() { 6287 return { 6288 app: null, 6289 config: { 6290 isNativeTag: NO, 6291 performance: false, 6292 globalProperties: {}, 6293 optionMergeStrategies: {}, 6294 errorHandler: void 0, 6295 warnHandler: void 0, 6296 compilerOptions: {} 6297 }, 6298 mixins: [], 6299 components: {}, 6300 directives: {}, 6301 provides: /* @__PURE__ */ Object.create(null), 6302 optionsCache: /* @__PURE__ */ new WeakMap(), 6303 propsCache: /* @__PURE__ */ new WeakMap(), 6304 emitsCache: /* @__PURE__ */ new WeakMap() 6305 }; 6306 } 6307 let uid$1 = 0; 6308 function createAppAPI(render, hydrate) { 6309 return function createApp(rootComponent, rootProps = null) { 6310 if (!isFunction(rootComponent)) { 6311 rootComponent = extend({}, rootComponent); 6312 } 6313 if (rootProps != null && !isObject(rootProps)) { 6314 warn$1(`root props passed to app.mount() must be an object.`); 6315 rootProps = null; 6316 } 6317 const context = createAppContext(); 6318 const installedPlugins = /* @__PURE__ */ new WeakSet(); 6319 const pluginCleanupFns = []; 6320 let isMounted = false; 6321 const app = context.app = { 6322 _uid: uid$1++, 6323 _component: rootComponent, 6324 _props: rootProps, 6325 _container: null, 6326 _context: context, 6327 _instance: null, 6328 version, 6329 get config() { 6330 return context.config; 6331 }, 6332 set config(v) { 6333 { 6334 warn$1( 6335 `app.config cannot be replaced. Modify individual options instead.` 6336 ); 6337 } 6338 }, 6339 use(plugin, ...options) { 6340 if (installedPlugins.has(plugin)) { 6341 warn$1(`Plugin has already been applied to target app.`); 6342 } else if (plugin && isFunction(plugin.install)) { 6343 installedPlugins.add(plugin); 6344 plugin.install(app, ...options); 6345 } else if (isFunction(plugin)) { 6346 installedPlugins.add(plugin); 6347 plugin(app, ...options); 6348 } else { 6349 warn$1( 6350 `A plugin must either be a function or an object with an "install" function.` 6351 ); 6352 } 6353 return app; 6354 }, 6355 mixin(mixin) { 6356 { 6357 if (!context.mixins.includes(mixin)) { 6358 context.mixins.push(mixin); 6359 } else { 6360 warn$1( 6361 "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "") 6362 ); 6363 } 6364 } 6365 return app; 6366 }, 6367 component(name, component) { 6368 { 6369 validateComponentName(name, context.config); 6370 } 6371 if (!component) { 6372 return context.components[name]; 6373 } 6374 if (context.components[name]) { 6375 warn$1(`Component "${name}" has already been registered in target app.`); 6376 } 6377 context.components[name] = component; 6378 return app; 6379 }, 6380 directive(name, directive) { 6381 { 6382 validateDirectiveName(name); 6383 } 6384 if (!directive) { 6385 return context.directives[name]; 6386 } 6387 if (context.directives[name]) { 6388 warn$1(`Directive "${name}" has already been registered in target app.`); 6389 } 6390 context.directives[name] = directive; 6391 return app; 6392 }, 6393 mount(rootContainer, isHydrate, namespace) { 6394 if (!isMounted) { 6395 if (rootContainer.__vue_app__) { 6396 warn$1( 6397 `There is already an app instance mounted on the host container. 6398 If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.` 6399 ); 6400 } 6401 const vnode = app._ceVNode || createVNode(rootComponent, rootProps); 6402 vnode.appContext = context; 6403 if (namespace === true) { 6404 namespace = "svg"; 6405 } else if (namespace === false) { 6406 namespace = void 0; 6407 } 6408 { 6409 context.reload = () => { 6410 const cloned = cloneVNode(vnode); 6411 cloned.el = null; 6412 render(cloned, rootContainer, namespace); 6413 }; 6414 } 6415 if (isHydrate && hydrate) { 6416 hydrate(vnode, rootContainer); 6417 } else { 6418 render(vnode, rootContainer, namespace); 6419 } 6420 isMounted = true; 6421 app._container = rootContainer; 6422 rootContainer.__vue_app__ = app; 6423 { 6424 app._instance = vnode.component; 6425 devtoolsInitApp(app, version); 6426 } 6427 return getComponentPublicInstance(vnode.component); 6428 } else { 6429 warn$1( 6430 `App has already been mounted. 6431 If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\`` 6432 ); 6433 } 6434 }, 6435 onUnmount(cleanupFn) { 6436 if (typeof cleanupFn !== "function") { 6437 warn$1( 6438 `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}` 6439 ); 6440 } 6441 pluginCleanupFns.push(cleanupFn); 6442 }, 6443 unmount() { 6444 if (isMounted) { 6445 callWithAsyncErrorHandling( 6446 pluginCleanupFns, 6447 app._instance, 6448 16 6449 ); 6450 render(null, app._container); 6451 { 6452 app._instance = null; 6453 devtoolsUnmountApp(app); 6454 } 6455 delete app._container.__vue_app__; 6456 } else { 6457 warn$1(`Cannot unmount an app that is not mounted.`); 6458 } 6459 }, 6460 provide(key, value) { 6461 if (key in context.provides) { 6462 if (hasOwn(context.provides, key)) { 6463 warn$1( 6464 `App already provides property with key "${String(key)}". It will be overwritten with the new value.` 6465 ); 6466 } else { 6467 warn$1( 6468 `App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.` 6469 ); 6470 } 6471 } 6472 context.provides[key] = value; 6473 return app; 6474 }, 6475 runWithContext(fn) { 6476 const lastApp = currentApp; 6477 currentApp = app; 6478 try { 6479 return fn(); 6480 } finally { 6481 currentApp = lastApp; 6482 } 6483 } 6484 }; 6485 return app; 6486 }; 6487 } 6488 let currentApp = null; 6489 6490 function useModel(props, name, options = EMPTY_OBJ) { 6491 const i = getCurrentInstance(); 6492 if (!i) { 6493 warn$1(`useModel() called without active instance.`); 6494 return ref(); 6495 } 6496 const camelizedName = camelize(name); 6497 if (!i.propsOptions[0][camelizedName]) { 6498 warn$1(`useModel() called with prop "${name}" which is not declared.`); 6499 return ref(); 6500 } 6501 const hyphenatedName = hyphenate(name); 6502 const modifiers = getModelModifiers(props, camelizedName); 6503 const res = customRef((track, trigger) => { 6504 let localValue; 6505 let prevSetValue = EMPTY_OBJ; 6506 let prevEmittedValue; 6507 watchSyncEffect(() => { 6508 const propValue = props[camelizedName]; 6509 if (hasChanged(localValue, propValue)) { 6510 localValue = propValue; 6511 trigger(); 6512 } 6513 }); 6514 return { 6515 get() { 6516 track(); 6517 return options.get ? options.get(localValue) : localValue; 6518 }, 6519 set(value) { 6520 const emittedValue = options.set ? options.set(value) : value; 6521 if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) { 6522 return; 6523 } 6524 const rawProps = i.vnode.props; 6525 if (!(rawProps && // check if parent has passed v-model 6526 (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) { 6527 localValue = value; 6528 trigger(); 6529 } 6530 i.emit(`update:${name}`, emittedValue); 6531 if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) { 6532 trigger(); 6533 } 6534 prevSetValue = value; 6535 prevEmittedValue = emittedValue; 6536 } 6537 }; 6538 }); 6539 res[Symbol.iterator] = () => { 6540 let i2 = 0; 6541 return { 6542 next() { 6543 if (i2 < 2) { 6544 return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false }; 6545 } else { 6546 return { done: true }; 6547 } 6548 } 6549 }; 6550 }; 6551 return res; 6552 } 6553 const getModelModifiers = (props, modelName) => { 6554 return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`]; 6555 }; 6556 6557 function emit(instance, event, ...rawArgs) { 6558 if (instance.isUnmounted) return; 6559 const props = instance.vnode.props || EMPTY_OBJ; 6560 { 6561 const { 6562 emitsOptions, 6563 propsOptions: [propsOptions] 6564 } = instance; 6565 if (emitsOptions) { 6566 if (!(event in emitsOptions) && true) { 6567 if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) { 6568 warn$1( 6569 `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.` 6570 ); 6571 } 6572 } else { 6573 const validator = emitsOptions[event]; 6574 if (isFunction(validator)) { 6575 const isValid = validator(...rawArgs); 6576 if (!isValid) { 6577 warn$1( 6578 `Invalid event arguments: event validation failed for event "${event}".` 6579 ); 6580 } 6581 } 6582 } 6583 } 6584 } 6585 let args = rawArgs; 6586 const isModelListener = event.startsWith("update:"); 6587 const modifiers = isModelListener && getModelModifiers(props, event.slice(7)); 6588 if (modifiers) { 6589 if (modifiers.trim) { 6590 args = rawArgs.map((a) => isString(a) ? a.trim() : a); 6591 } 6592 if (modifiers.number) { 6593 args = rawArgs.map(looseToNumber); 6594 } 6595 } 6596 { 6597 devtoolsComponentEmit(instance, event, args); 6598 } 6599 { 6600 const lowerCaseEvent = event.toLowerCase(); 6601 if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) { 6602 warn$1( 6603 `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName( 6604 instance, 6605 instance.type 6606 )} 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( 6607 event 6608 )}" instead of "${event}".` 6609 ); 6610 } 6611 } 6612 let handlerName; 6613 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249) 6614 props[handlerName = toHandlerKey(camelize(event))]; 6615 if (!handler && isModelListener) { 6616 handler = props[handlerName = toHandlerKey(hyphenate(event))]; 6617 } 6618 if (handler) { 6619 callWithAsyncErrorHandling( 6620 handler, 6621 instance, 6622 6, 6623 args 6624 ); 6625 } 6626 const onceHandler = props[handlerName + `Once`]; 6627 if (onceHandler) { 6628 if (!instance.emitted) { 6629 instance.emitted = {}; 6630 } else if (instance.emitted[handlerName]) { 6631 return; 6632 } 6633 instance.emitted[handlerName] = true; 6634 callWithAsyncErrorHandling( 6635 onceHandler, 6636 instance, 6637 6, 6638 args 6639 ); 6640 } 6641 } 6642 const mixinEmitsCache = /* @__PURE__ */ new WeakMap(); 6643 function normalizeEmitsOptions(comp, appContext, asMixin = false) { 6644 const cache = asMixin ? mixinEmitsCache : appContext.emitsCache; 6645 const cached = cache.get(comp); 6646 if (cached !== void 0) { 6647 return cached; 6648 } 6649 const raw = comp.emits; 6650 let normalized = {}; 6651 let hasExtends = false; 6652 if (!isFunction(comp)) { 6653 const extendEmits = (raw2) => { 6654 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); 6655 if (normalizedFromExtend) { 6656 hasExtends = true; 6657 extend(normalized, normalizedFromExtend); 6658 } 6659 }; 6660 if (!asMixin && appContext.mixins.length) { 6661 appContext.mixins.forEach(extendEmits); 6662 } 6663 if (comp.extends) { 6664 extendEmits(comp.extends); 6665 } 6666 if (comp.mixins) { 6667 comp.mixins.forEach(extendEmits); 6668 } 6669 } 6670 if (!raw && !hasExtends) { 6671 if (isObject(comp)) { 6672 cache.set(comp, null); 6673 } 6674 return null; 6675 } 6676 if (isArray(raw)) { 6677 raw.forEach((key) => normalized[key] = null); 6678 } else { 6679 extend(normalized, raw); 6680 } 6681 if (isObject(comp)) { 6682 cache.set(comp, normalized); 6683 } 6684 return normalized; 6685 } 6686 function isEmitListener(options, key) { 6687 if (!options || !isOn(key)) { 6688 return false; 6689 } 6690 key = key.slice(2).replace(/Once$/, ""); 6691 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); 6692 } 6693 6694 let accessedAttrs = false; 6695 function markAttrsAccessed() { 6696 accessedAttrs = true; 6697 } 6698 function renderComponentRoot(instance) { 6699 const { 6700 type: Component, 6701 vnode, 6702 proxy, 6703 withProxy, 6704 propsOptions: [propsOptions], 6705 slots, 6706 attrs, 6707 emit, 6708 render, 6709 renderCache, 6710 props, 6711 data, 6712 setupState, 6713 ctx, 6714 inheritAttrs 6715 } = instance; 6716 const prev = setCurrentRenderingInstance(instance); 6717 let result; 6718 let fallthroughAttrs; 6719 { 6720 accessedAttrs = false; 6721 } 6722 try { 6723 if (vnode.shapeFlag & 4) { 6724 const proxyToUse = withProxy || proxy; 6725 const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, { 6726 get(target, key, receiver) { 6727 warn$1( 6728 `Property '${String( 6729 key 6730 )}' was accessed via 'this'. Avoid using 'this' in templates.` 6731 ); 6732 return Reflect.get(target, key, receiver); 6733 } 6734 }) : proxyToUse; 6735 result = normalizeVNode( 6736 render.call( 6737 thisProxy, 6738 proxyToUse, 6739 renderCache, 6740 true ? shallowReadonly(props) : props, 6741 setupState, 6742 data, 6743 ctx 6744 ) 6745 ); 6746 fallthroughAttrs = attrs; 6747 } else { 6748 const render2 = Component; 6749 if (attrs === props) { 6750 markAttrsAccessed(); 6751 } 6752 result = normalizeVNode( 6753 render2.length > 1 ? render2( 6754 true ? shallowReadonly(props) : props, 6755 true ? { 6756 get attrs() { 6757 markAttrsAccessed(); 6758 return shallowReadonly(attrs); 6759 }, 6760 slots, 6761 emit 6762 } : { attrs, slots, emit } 6763 ) : render2( 6764 true ? shallowReadonly(props) : props, 6765 null 6766 ) 6767 ); 6768 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs); 6769 } 6770 } catch (err) { 6771 blockStack.length = 0; 6772 handleError(err, instance, 1); 6773 result = createVNode(Comment); 6774 } 6775 let root = result; 6776 let setRoot = void 0; 6777 if (result.patchFlag > 0 && result.patchFlag & 2048) { 6778 [root, setRoot] = getChildRoot(result); 6779 } 6780 if (fallthroughAttrs && inheritAttrs !== false) { 6781 const keys = Object.keys(fallthroughAttrs); 6782 const { shapeFlag } = root; 6783 if (keys.length) { 6784 if (shapeFlag & (1 | 6)) { 6785 if (propsOptions && keys.some(isModelListener)) { 6786 fallthroughAttrs = filterModelListeners( 6787 fallthroughAttrs, 6788 propsOptions 6789 ); 6790 } 6791 root = cloneVNode(root, fallthroughAttrs, false, true); 6792 } else if (!accessedAttrs && root.type !== Comment) { 6793 const allAttrs = Object.keys(attrs); 6794 const eventAttrs = []; 6795 const extraAttrs = []; 6796 for (let i = 0, l = allAttrs.length; i < l; i++) { 6797 const key = allAttrs[i]; 6798 if (isOn(key)) { 6799 if (!isModelListener(key)) { 6800 eventAttrs.push(key[2].toLowerCase() + key.slice(3)); 6801 } 6802 } else { 6803 extraAttrs.push(key); 6804 } 6805 } 6806 if (extraAttrs.length) { 6807 warn$1( 6808 `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.` 6809 ); 6810 } 6811 if (eventAttrs.length) { 6812 warn$1( 6813 `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.` 6814 ); 6815 } 6816 } 6817 } 6818 } 6819 if (vnode.dirs) { 6820 if (!isElementRoot(root)) { 6821 warn$1( 6822 `Runtime directive used on component with non-element root node. The directives will not function as intended.` 6823 ); 6824 } 6825 root = cloneVNode(root, null, false, true); 6826 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs; 6827 } 6828 if (vnode.transition) { 6829 if (!isElementRoot(root)) { 6830 warn$1( 6831 `Component inside <Transition> renders non-element root node that cannot be animated.` 6832 ); 6833 } 6834 setTransitionHooks(root, vnode.transition); 6835 } 6836 if (setRoot) { 6837 setRoot(root); 6838 } else { 6839 result = root; 6840 } 6841 setCurrentRenderingInstance(prev); 6842 return result; 6843 } 6844 const getChildRoot = (vnode) => { 6845 const rawChildren = vnode.children; 6846 const dynamicChildren = vnode.dynamicChildren; 6847 const childRoot = filterSingleRoot(rawChildren, false); 6848 if (!childRoot) { 6849 return [vnode, void 0]; 6850 } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) { 6851 return getChildRoot(childRoot); 6852 } 6853 const index = rawChildren.indexOf(childRoot); 6854 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1; 6855 const setRoot = (updatedRoot) => { 6856 rawChildren[index] = updatedRoot; 6857 if (dynamicChildren) { 6858 if (dynamicIndex > -1) { 6859 dynamicChildren[dynamicIndex] = updatedRoot; 6860 } else if (updatedRoot.patchFlag > 0) { 6861 vnode.dynamicChildren = [...dynamicChildren, updatedRoot]; 6862 } 6863 } 6864 }; 6865 return [normalizeVNode(childRoot), setRoot]; 6866 }; 6867 function filterSingleRoot(children, recurse = true) { 6868 let singleRoot; 6869 for (let i = 0; i < children.length; i++) { 6870 const child = children[i]; 6871 if (isVNode(child)) { 6872 if (child.type !== Comment || child.children === "v-if") { 6873 if (singleRoot) { 6874 return; 6875 } else { 6876 singleRoot = child; 6877 if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) { 6878 return filterSingleRoot(singleRoot.children); 6879 } 6880 } 6881 } 6882 } else { 6883 return; 6884 } 6885 } 6886 return singleRoot; 6887 } 6888 const getFunctionalFallthrough = (attrs) => { 6889 let res; 6890 for (const key in attrs) { 6891 if (key === "class" || key === "style" || isOn(key)) { 6892 (res || (res = {}))[key] = attrs[key]; 6893 } 6894 } 6895 return res; 6896 }; 6897 const filterModelListeners = (attrs, props) => { 6898 const res = {}; 6899 for (const key in attrs) { 6900 if (!isModelListener(key) || !(key.slice(9) in props)) { 6901 res[key] = attrs[key]; 6902 } 6903 } 6904 return res; 6905 }; 6906 const isElementRoot = (vnode) => { 6907 return vnode.shapeFlag & (6 | 1) || vnode.type === Comment; 6908 }; 6909 function shouldUpdateComponent(prevVNode, nextVNode, optimized) { 6910 const { props: prevProps, children: prevChildren, component } = prevVNode; 6911 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; 6912 const emits = component.emitsOptions; 6913 if ((prevChildren || nextChildren) && isHmrUpdating) { 6914 return true; 6915 } 6916 if (nextVNode.dirs || nextVNode.transition) { 6917 return true; 6918 } 6919 if (optimized && patchFlag >= 0) { 6920 if (patchFlag & 1024) { 6921 return true; 6922 } 6923 if (patchFlag & 16) { 6924 if (!prevProps) { 6925 return !!nextProps; 6926 } 6927 return hasPropsChanged(prevProps, nextProps, emits); 6928 } else if (patchFlag & 8) { 6929 const dynamicProps = nextVNode.dynamicProps; 6930 for (let i = 0; i < dynamicProps.length; i++) { 6931 const key = dynamicProps[i]; 6932 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) { 6933 return true; 6934 } 6935 } 6936 } 6937 } else { 6938 if (prevChildren || nextChildren) { 6939 if (!nextChildren || !nextChildren.$stable) { 6940 return true; 6941 } 6942 } 6943 if (prevProps === nextProps) { 6944 return false; 6945 } 6946 if (!prevProps) { 6947 return !!nextProps; 6948 } 6949 if (!nextProps) { 6950 return true; 6951 } 6952 return hasPropsChanged(prevProps, nextProps, emits); 6953 } 6954 return false; 6955 } 6956 function hasPropsChanged(prevProps, nextProps, emitsOptions) { 6957 const nextKeys = Object.keys(nextProps); 6958 if (nextKeys.length !== Object.keys(prevProps).length) { 6959 return true; 6960 } 6961 for (let i = 0; i < nextKeys.length; i++) { 6962 const key = nextKeys[i]; 6963 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { 6964 return true; 6965 } 6966 } 6967 return false; 6968 } 6969 function updateHOCHostEl({ vnode, parent }, el) { 6970 while (parent) { 6971 const root = parent.subTree; 6972 if (root.suspense && root.suspense.activeBranch === vnode) { 6973 root.el = vnode.el; 6974 } 6975 if (root === vnode) { 6976 (vnode = parent.vnode).el = el; 6977 parent = parent.parent; 6978 } else { 6979 break; 6980 } 6981 } 6982 } 6983 6984 const internalObjectProto = {}; 6985 const createInternalObject = () => Object.create(internalObjectProto); 6986 const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto; 6987 6988 function initProps(instance, rawProps, isStateful, isSSR = false) { 6989 const props = {}; 6990 const attrs = createInternalObject(); 6991 instance.propsDefaults = /* @__PURE__ */ Object.create(null); 6992 setFullProps(instance, rawProps, props, attrs); 6993 for (const key in instance.propsOptions[0]) { 6994 if (!(key in props)) { 6995 props[key] = void 0; 6996 } 6997 } 6998 { 6999 validateProps(rawProps || {}, props, instance); 7000 } 7001 if (isStateful) { 7002 instance.props = isSSR ? props : shallowReactive(props); 7003 } else { 7004 if (!instance.type.props) { 7005 instance.props = attrs; 7006 } else { 7007 instance.props = props; 7008 } 7009 } 7010 instance.attrs = attrs; 7011 } 7012 function isInHmrContext(instance) { 7013 while (instance) { 7014 if (instance.type.__hmrId) return true; 7015 instance = instance.parent; 7016 } 7017 } 7018 function updateProps(instance, rawProps, rawPrevProps, optimized) { 7019 const { 7020 props, 7021 attrs, 7022 vnode: { patchFlag } 7023 } = instance; 7024 const rawCurrentProps = toRaw(props); 7025 const [options] = instance.propsOptions; 7026 let hasAttrsChanged = false; 7027 if ( 7028 // always force full diff in dev 7029 // - #1942 if hmr is enabled with sfc component 7030 // - vite#872 non-sfc component used by sfc component 7031 !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16) 7032 ) { 7033 if (patchFlag & 8) { 7034 const propsToUpdate = instance.vnode.dynamicProps; 7035 for (let i = 0; i < propsToUpdate.length; i++) { 7036 let key = propsToUpdate[i]; 7037 if (isEmitListener(instance.emitsOptions, key)) { 7038 continue; 7039 } 7040 const value = rawProps[key]; 7041 if (options) { 7042 if (hasOwn(attrs, key)) { 7043 if (value !== attrs[key]) { 7044 attrs[key] = value; 7045 hasAttrsChanged = true; 7046 } 7047 } else { 7048 const camelizedKey = camelize(key); 7049 props[camelizedKey] = resolvePropValue( 7050 options, 7051 rawCurrentProps, 7052 camelizedKey, 7053 value, 7054 instance, 7055 false 7056 ); 7057 } 7058 } else { 7059 if (value !== attrs[key]) { 7060 attrs[key] = value; 7061 hasAttrsChanged = true; 7062 } 7063 } 7064 } 7065 } 7066 } else { 7067 if (setFullProps(instance, rawProps, props, attrs)) { 7068 hasAttrsChanged = true; 7069 } 7070 let kebabKey; 7071 for (const key in rawCurrentProps) { 7072 if (!rawProps || // for camelCase 7073 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case 7074 // and converted to camelCase (#955) 7075 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) { 7076 if (options) { 7077 if (rawPrevProps && // for camelCase 7078 (rawPrevProps[key] !== void 0 || // for kebab-case 7079 rawPrevProps[kebabKey] !== void 0)) { 7080 props[key] = resolvePropValue( 7081 options, 7082 rawCurrentProps, 7083 key, 7084 void 0, 7085 instance, 7086 true 7087 ); 7088 } 7089 } else { 7090 delete props[key]; 7091 } 7092 } 7093 } 7094 if (attrs !== rawCurrentProps) { 7095 for (const key in attrs) { 7096 if (!rawProps || !hasOwn(rawProps, key) && true) { 7097 delete attrs[key]; 7098 hasAttrsChanged = true; 7099 } 7100 } 7101 } 7102 } 7103 if (hasAttrsChanged) { 7104 trigger(instance.attrs, "set", ""); 7105 } 7106 { 7107 validateProps(rawProps || {}, props, instance); 7108 } 7109 } 7110 function setFullProps(instance, rawProps, props, attrs) { 7111 const [options, needCastKeys] = instance.propsOptions; 7112 let hasAttrsChanged = false; 7113 let rawCastValues; 7114 if (rawProps) { 7115 for (let key in rawProps) { 7116 if (isReservedProp(key)) { 7117 continue; 7118 } 7119 const value = rawProps[key]; 7120 let camelKey; 7121 if (options && hasOwn(options, camelKey = camelize(key))) { 7122 if (!needCastKeys || !needCastKeys.includes(camelKey)) { 7123 props[camelKey] = value; 7124 } else { 7125 (rawCastValues || (rawCastValues = {}))[camelKey] = value; 7126 } 7127 } else if (!isEmitListener(instance.emitsOptions, key)) { 7128 if (!(key in attrs) || value !== attrs[key]) { 7129 attrs[key] = value; 7130 hasAttrsChanged = true; 7131 } 7132 } 7133 } 7134 } 7135 if (needCastKeys) { 7136 const rawCurrentProps = toRaw(props); 7137 const castValues = rawCastValues || EMPTY_OBJ; 7138 for (let i = 0; i < needCastKeys.length; i++) { 7139 const key = needCastKeys[i]; 7140 props[key] = resolvePropValue( 7141 options, 7142 rawCurrentProps, 7143 key, 7144 castValues[key], 7145 instance, 7146 !hasOwn(castValues, key) 7147 ); 7148 } 7149 } 7150 return hasAttrsChanged; 7151 } 7152 function resolvePropValue(options, props, key, value, instance, isAbsent) { 7153 const opt = options[key]; 7154 if (opt != null) { 7155 const hasDefault = hasOwn(opt, "default"); 7156 if (hasDefault && value === void 0) { 7157 const defaultValue = opt.default; 7158 if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) { 7159 const { propsDefaults } = instance; 7160 if (key in propsDefaults) { 7161 value = propsDefaults[key]; 7162 } else { 7163 const reset = setCurrentInstance(instance); 7164 value = propsDefaults[key] = defaultValue.call( 7165 null, 7166 props 7167 ); 7168 reset(); 7169 } 7170 } else { 7171 value = defaultValue; 7172 } 7173 if (instance.ce) { 7174 instance.ce._setProp(key, value); 7175 } 7176 } 7177 if (opt[0 /* shouldCast */]) { 7178 if (isAbsent && !hasDefault) { 7179 value = false; 7180 } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) { 7181 value = true; 7182 } 7183 } 7184 } 7185 return value; 7186 } 7187 const mixinPropsCache = /* @__PURE__ */ new WeakMap(); 7188 function normalizePropsOptions(comp, appContext, asMixin = false) { 7189 const cache = asMixin ? mixinPropsCache : appContext.propsCache; 7190 const cached = cache.get(comp); 7191 if (cached) { 7192 return cached; 7193 } 7194 const raw = comp.props; 7195 const normalized = {}; 7196 const needCastKeys = []; 7197 let hasExtends = false; 7198 if (!isFunction(comp)) { 7199 const extendProps = (raw2) => { 7200 hasExtends = true; 7201 const [props, keys] = normalizePropsOptions(raw2, appContext, true); 7202 extend(normalized, props); 7203 if (keys) needCastKeys.push(...keys); 7204 }; 7205 if (!asMixin && appContext.mixins.length) { 7206 appContext.mixins.forEach(extendProps); 7207 } 7208 if (comp.extends) { 7209 extendProps(comp.extends); 7210 } 7211 if (comp.mixins) { 7212 comp.mixins.forEach(extendProps); 7213 } 7214 } 7215 if (!raw && !hasExtends) { 7216 if (isObject(comp)) { 7217 cache.set(comp, EMPTY_ARR); 7218 } 7219 return EMPTY_ARR; 7220 } 7221 if (isArray(raw)) { 7222 for (let i = 0; i < raw.length; i++) { 7223 if (!isString(raw[i])) { 7224 warn$1(`props must be strings when using array syntax.`, raw[i]); 7225 } 7226 const normalizedKey = camelize(raw[i]); 7227 if (validatePropName(normalizedKey)) { 7228 normalized[normalizedKey] = EMPTY_OBJ; 7229 } 7230 } 7231 } else if (raw) { 7232 if (!isObject(raw)) { 7233 warn$1(`invalid props options`, raw); 7234 } 7235 for (const key in raw) { 7236 const normalizedKey = camelize(key); 7237 if (validatePropName(normalizedKey)) { 7238 const opt = raw[key]; 7239 const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt); 7240 const propType = prop.type; 7241 let shouldCast = false; 7242 let shouldCastTrue = true; 7243 if (isArray(propType)) { 7244 for (let index = 0; index < propType.length; ++index) { 7245 const type = propType[index]; 7246 const typeName = isFunction(type) && type.name; 7247 if (typeName === "Boolean") { 7248 shouldCast = true; 7249 break; 7250 } else if (typeName === "String") { 7251 shouldCastTrue = false; 7252 } 7253 } 7254 } else { 7255 shouldCast = isFunction(propType) && propType.name === "Boolean"; 7256 } 7257 prop[0 /* shouldCast */] = shouldCast; 7258 prop[1 /* shouldCastTrue */] = shouldCastTrue; 7259 if (shouldCast || hasOwn(prop, "default")) { 7260 needCastKeys.push(normalizedKey); 7261 } 7262 } 7263 } 7264 } 7265 const res = [normalized, needCastKeys]; 7266 if (isObject(comp)) { 7267 cache.set(comp, res); 7268 } 7269 return res; 7270 } 7271 function validatePropName(key) { 7272 if (key[0] !== "$" && !isReservedProp(key)) { 7273 return true; 7274 } else { 7275 warn$1(`Invalid prop name: "${key}" is a reserved property.`); 7276 } 7277 return false; 7278 } 7279 function getType(ctor) { 7280 if (ctor === null) { 7281 return "null"; 7282 } 7283 if (typeof ctor === "function") { 7284 return ctor.name || ""; 7285 } else if (typeof ctor === "object") { 7286 const name = ctor.constructor && ctor.constructor.name; 7287 return name || ""; 7288 } 7289 return ""; 7290 } 7291 function validateProps(rawProps, props, instance) { 7292 const resolvedValues = toRaw(props); 7293 const options = instance.propsOptions[0]; 7294 const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key)); 7295 for (const key in options) { 7296 let opt = options[key]; 7297 if (opt == null) continue; 7298 validateProp( 7299 key, 7300 resolvedValues[key], 7301 opt, 7302 shallowReadonly(resolvedValues) , 7303 !camelizePropsKey.includes(key) 7304 ); 7305 } 7306 } 7307 function validateProp(name, value, prop, props, isAbsent) { 7308 const { type, required, validator, skipCheck } = prop; 7309 if (required && isAbsent) { 7310 warn$1('Missing required prop: "' + name + '"'); 7311 return; 7312 } 7313 if (value == null && !required) { 7314 return; 7315 } 7316 if (type != null && type !== true && !skipCheck) { 7317 let isValid = false; 7318 const types = isArray(type) ? type : [type]; 7319 const expectedTypes = []; 7320 for (let i = 0; i < types.length && !isValid; i++) { 7321 const { valid, expectedType } = assertType(value, types[i]); 7322 expectedTypes.push(expectedType || ""); 7323 isValid = valid; 7324 } 7325 if (!isValid) { 7326 warn$1(getInvalidTypeMessage(name, value, expectedTypes)); 7327 return; 7328 } 7329 } 7330 if (validator && !validator(value, props)) { 7331 warn$1('Invalid prop: custom validator check failed for prop "' + name + '".'); 7332 } 7333 } 7334 const isSimpleType = /* @__PURE__ */ makeMap( 7335 "String,Number,Boolean,Function,Symbol,BigInt" 7336 ); 7337 function assertType(value, type) { 7338 let valid; 7339 const expectedType = getType(type); 7340 if (expectedType === "null") { 7341 valid = value === null; 7342 } else if (isSimpleType(expectedType)) { 7343 const t = typeof value; 7344 valid = t === expectedType.toLowerCase(); 7345 if (!valid && t === "object") { 7346 valid = value instanceof type; 7347 } 7348 } else if (expectedType === "Object") { 7349 valid = isObject(value); 7350 } else if (expectedType === "Array") { 7351 valid = isArray(value); 7352 } else { 7353 valid = value instanceof type; 7354 } 7355 return { 7356 valid, 7357 expectedType 7358 }; 7359 } 7360 function getInvalidTypeMessage(name, value, expectedTypes) { 7361 if (expectedTypes.length === 0) { 7362 return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`; 7363 } 7364 let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`; 7365 const expectedType = expectedTypes[0]; 7366 const receivedType = toRawType(value); 7367 const expectedValue = styleValue(value, expectedType); 7368 const receivedValue = styleValue(value, receivedType); 7369 if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) { 7370 message += ` with value ${expectedValue}`; 7371 } 7372 message += `, got ${receivedType} `; 7373 if (isExplicable(receivedType)) { 7374 message += `with value ${receivedValue}.`; 7375 } 7376 return message; 7377 } 7378 function styleValue(value, type) { 7379 if (type === "String") { 7380 return `"${value}"`; 7381 } else if (type === "Number") { 7382 return `${Number(value)}`; 7383 } else { 7384 return `${value}`; 7385 } 7386 } 7387 function isExplicable(type) { 7388 const explicitTypes = ["string", "number", "boolean"]; 7389 return explicitTypes.some((elem) => type.toLowerCase() === elem); 7390 } 7391 function isBoolean(...args) { 7392 return args.some((elem) => elem.toLowerCase() === "boolean"); 7393 } 7394 7395 const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable"; 7396 const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; 7397 const normalizeSlot = (key, rawSlot, ctx) => { 7398 if (rawSlot._n) { 7399 return rawSlot; 7400 } 7401 const normalized = withCtx((...args) => { 7402 if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) { 7403 warn$1( 7404 `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.` 7405 ); 7406 } 7407 return normalizeSlotValue(rawSlot(...args)); 7408 }, ctx); 7409 normalized._c = false; 7410 return normalized; 7411 }; 7412 const normalizeObjectSlots = (rawSlots, slots, instance) => { 7413 const ctx = rawSlots._ctx; 7414 for (const key in rawSlots) { 7415 if (isInternalKey(key)) continue; 7416 const value = rawSlots[key]; 7417 if (isFunction(value)) { 7418 slots[key] = normalizeSlot(key, value, ctx); 7419 } else if (value != null) { 7420 { 7421 warn$1( 7422 `Non-function value encountered for slot "${key}". Prefer function slots for better performance.` 7423 ); 7424 } 7425 const normalized = normalizeSlotValue(value); 7426 slots[key] = () => normalized; 7427 } 7428 } 7429 }; 7430 const normalizeVNodeSlots = (instance, children) => { 7431 if (!isKeepAlive(instance.vnode) && true) { 7432 warn$1( 7433 `Non-function value encountered for default slot. Prefer function slots for better performance.` 7434 ); 7435 } 7436 const normalized = normalizeSlotValue(children); 7437 instance.slots.default = () => normalized; 7438 }; 7439 const assignSlots = (slots, children, optimized) => { 7440 for (const key in children) { 7441 if (optimized || !isInternalKey(key)) { 7442 slots[key] = children[key]; 7443 } 7444 } 7445 }; 7446 const initSlots = (instance, children, optimized) => { 7447 const slots = instance.slots = createInternalObject(); 7448 if (instance.vnode.shapeFlag & 32) { 7449 const type = children._; 7450 if (type) { 7451 assignSlots(slots, children, optimized); 7452 if (optimized) { 7453 def(slots, "_", type, true); 7454 } 7455 } else { 7456 normalizeObjectSlots(children, slots); 7457 } 7458 } else if (children) { 7459 normalizeVNodeSlots(instance, children); 7460 } 7461 }; 7462 const updateSlots = (instance, children, optimized) => { 7463 const { vnode, slots } = instance; 7464 let needDeletionCheck = true; 7465 let deletionComparisonTarget = EMPTY_OBJ; 7466 if (vnode.shapeFlag & 32) { 7467 const type = children._; 7468 if (type) { 7469 if (isHmrUpdating) { 7470 assignSlots(slots, children, optimized); 7471 trigger(instance, "set", "$slots"); 7472 } else if (optimized && type === 1) { 7473 needDeletionCheck = false; 7474 } else { 7475 assignSlots(slots, children, optimized); 7476 } 7477 } else { 7478 needDeletionCheck = !children.$stable; 7479 normalizeObjectSlots(children, slots); 7480 } 7481 deletionComparisonTarget = children; 7482 } else if (children) { 7483 normalizeVNodeSlots(instance, children); 7484 deletionComparisonTarget = { default: 1 }; 7485 } 7486 if (needDeletionCheck) { 7487 for (const key in slots) { 7488 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) { 7489 delete slots[key]; 7490 } 7491 } 7492 } 7493 }; 7494 7495 let supported; 7496 let perf; 7497 function startMeasure(instance, type) { 7498 if (instance.appContext.config.performance && isSupported()) { 7499 perf.mark(`vue-${type}-${instance.uid}`); 7500 } 7501 { 7502 devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now()); 7503 } 7504 } 7505 function endMeasure(instance, type) { 7506 if (instance.appContext.config.performance && isSupported()) { 7507 const startTag = `vue-${type}-${instance.uid}`; 7508 const endTag = startTag + `:end`; 7509 const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`; 7510 perf.mark(endTag); 7511 perf.measure(measureName, startTag, endTag); 7512 perf.clearMeasures(measureName); 7513 perf.clearMarks(startTag); 7514 perf.clearMarks(endTag); 7515 } 7516 { 7517 devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now()); 7518 } 7519 } 7520 function isSupported() { 7521 if (supported !== void 0) { 7522 return supported; 7523 } 7524 if (typeof window !== "undefined" && window.performance) { 7525 supported = true; 7526 perf = window.performance; 7527 } else { 7528 supported = false; 7529 } 7530 return supported; 7531 } 7532 7533 const queuePostRenderEffect = queueEffectWithSuspense ; 7534 function createRenderer(options) { 7535 return baseCreateRenderer(options); 7536 } 7537 function createHydrationRenderer(options) { 7538 return baseCreateRenderer(options, createHydrationFunctions); 7539 } 7540 function baseCreateRenderer(options, createHydrationFns) { 7541 const target = getGlobalThis(); 7542 target.__VUE__ = true; 7543 { 7544 setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target); 7545 } 7546 const { 7547 insert: hostInsert, 7548 remove: hostRemove, 7549 patchProp: hostPatchProp, 7550 createElement: hostCreateElement, 7551 createText: hostCreateText, 7552 createComment: hostCreateComment, 7553 setText: hostSetText, 7554 setElementText: hostSetElementText, 7555 parentNode: hostParentNode, 7556 nextSibling: hostNextSibling, 7557 setScopeId: hostSetScopeId = NOOP, 7558 insertStaticContent: hostInsertStaticContent 7559 } = options; 7560 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => { 7561 if (n1 === n2) { 7562 return; 7563 } 7564 if (n1 && !isSameVNodeType(n1, n2)) { 7565 anchor = getNextHostNode(n1); 7566 unmount(n1, parentComponent, parentSuspense, true); 7567 n1 = null; 7568 } 7569 if (n2.patchFlag === -2) { 7570 optimized = false; 7571 n2.dynamicChildren = null; 7572 } 7573 const { type, ref, shapeFlag } = n2; 7574 switch (type) { 7575 case Text: 7576 processText(n1, n2, container, anchor); 7577 break; 7578 case Comment: 7579 processCommentNode(n1, n2, container, anchor); 7580 break; 7581 case Static: 7582 if (n1 == null) { 7583 mountStaticNode(n2, container, anchor, namespace); 7584 } else { 7585 patchStaticNode(n1, n2, container, namespace); 7586 } 7587 break; 7588 case Fragment: 7589 processFragment( 7590 n1, 7591 n2, 7592 container, 7593 anchor, 7594 parentComponent, 7595 parentSuspense, 7596 namespace, 7597 slotScopeIds, 7598 optimized 7599 ); 7600 break; 7601 default: 7602 if (shapeFlag & 1) { 7603 processElement( 7604 n1, 7605 n2, 7606 container, 7607 anchor, 7608 parentComponent, 7609 parentSuspense, 7610 namespace, 7611 slotScopeIds, 7612 optimized 7613 ); 7614 } else if (shapeFlag & 6) { 7615 processComponent( 7616 n1, 7617 n2, 7618 container, 7619 anchor, 7620 parentComponent, 7621 parentSuspense, 7622 namespace, 7623 slotScopeIds, 7624 optimized 7625 ); 7626 } else if (shapeFlag & 64) { 7627 type.process( 7628 n1, 7629 n2, 7630 container, 7631 anchor, 7632 parentComponent, 7633 parentSuspense, 7634 namespace, 7635 slotScopeIds, 7636 optimized, 7637 internals 7638 ); 7639 } else if (shapeFlag & 128) { 7640 type.process( 7641 n1, 7642 n2, 7643 container, 7644 anchor, 7645 parentComponent, 7646 parentSuspense, 7647 namespace, 7648 slotScopeIds, 7649 optimized, 7650 internals 7651 ); 7652 } else { 7653 warn$1("Invalid VNode type:", type, `(${typeof type})`); 7654 } 7655 } 7656 if (ref != null && parentComponent) { 7657 setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); 7658 } else if (ref == null && n1 && n1.ref != null) { 7659 setRef(n1.ref, null, parentSuspense, n1, true); 7660 } 7661 }; 7662 const processText = (n1, n2, container, anchor) => { 7663 if (n1 == null) { 7664 hostInsert( 7665 n2.el = hostCreateText(n2.children), 7666 container, 7667 anchor 7668 ); 7669 } else { 7670 const el = n2.el = n1.el; 7671 if (n2.children !== n1.children) { 7672 if (isHmrUpdating && n2.patchFlag === -1 && "__elIndex" in n1) { 7673 const childNodes = container.childNodes; 7674 const newChild = hostCreateText(n2.children); 7675 const oldChild = childNodes[n2.__elIndex = n1.__elIndex]; 7676 hostInsert(newChild, container, oldChild); 7677 hostRemove(oldChild); 7678 } else { 7679 hostSetText(el, n2.children); 7680 } 7681 } 7682 } 7683 }; 7684 const processCommentNode = (n1, n2, container, anchor) => { 7685 if (n1 == null) { 7686 hostInsert( 7687 n2.el = hostCreateComment(n2.children || ""), 7688 container, 7689 anchor 7690 ); 7691 } else { 7692 n2.el = n1.el; 7693 } 7694 }; 7695 const mountStaticNode = (n2, container, anchor, namespace) => { 7696 [n2.el, n2.anchor] = hostInsertStaticContent( 7697 n2.children, 7698 container, 7699 anchor, 7700 namespace, 7701 n2.el, 7702 n2.anchor 7703 ); 7704 }; 7705 const patchStaticNode = (n1, n2, container, namespace) => { 7706 if (n2.children !== n1.children) { 7707 const anchor = hostNextSibling(n1.anchor); 7708 removeStaticNode(n1); 7709 [n2.el, n2.anchor] = hostInsertStaticContent( 7710 n2.children, 7711 container, 7712 anchor, 7713 namespace 7714 ); 7715 } else { 7716 n2.el = n1.el; 7717 n2.anchor = n1.anchor; 7718 } 7719 }; 7720 const moveStaticNode = ({ el, anchor }, container, nextSibling) => { 7721 let next; 7722 while (el && el !== anchor) { 7723 next = hostNextSibling(el); 7724 hostInsert(el, container, nextSibling); 7725 el = next; 7726 } 7727 hostInsert(anchor, container, nextSibling); 7728 }; 7729 const removeStaticNode = ({ el, anchor }) => { 7730 let next; 7731 while (el && el !== anchor) { 7732 next = hostNextSibling(el); 7733 hostRemove(el); 7734 el = next; 7735 } 7736 hostRemove(anchor); 7737 }; 7738 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7739 if (n2.type === "svg") { 7740 namespace = "svg"; 7741 } else if (n2.type === "math") { 7742 namespace = "mathml"; 7743 } 7744 if (n1 == null) { 7745 mountElement( 7746 n2, 7747 container, 7748 anchor, 7749 parentComponent, 7750 parentSuspense, 7751 namespace, 7752 slotScopeIds, 7753 optimized 7754 ); 7755 } else { 7756 const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null; 7757 try { 7758 if (customElement) { 7759 customElement._beginPatch(); 7760 } 7761 patchElement( 7762 n1, 7763 n2, 7764 parentComponent, 7765 parentSuspense, 7766 namespace, 7767 slotScopeIds, 7768 optimized 7769 ); 7770 } finally { 7771 if (customElement) { 7772 customElement._endPatch(); 7773 } 7774 } 7775 } 7776 }; 7777 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7778 let el; 7779 let vnodeHook; 7780 const { props, shapeFlag, transition, dirs } = vnode; 7781 el = vnode.el = hostCreateElement( 7782 vnode.type, 7783 namespace, 7784 props && props.is, 7785 props 7786 ); 7787 if (shapeFlag & 8) { 7788 hostSetElementText(el, vnode.children); 7789 } else if (shapeFlag & 16) { 7790 mountChildren( 7791 vnode.children, 7792 el, 7793 null, 7794 parentComponent, 7795 parentSuspense, 7796 resolveChildrenNamespace(vnode, namespace), 7797 slotScopeIds, 7798 optimized 7799 ); 7800 } 7801 if (dirs) { 7802 invokeDirectiveHook(vnode, null, parentComponent, "created"); 7803 } 7804 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent); 7805 if (props) { 7806 for (const key in props) { 7807 if (key !== "value" && !isReservedProp(key)) { 7808 hostPatchProp(el, key, null, props[key], namespace, parentComponent); 7809 } 7810 } 7811 if ("value" in props) { 7812 hostPatchProp(el, "value", null, props.value, namespace); 7813 } 7814 if (vnodeHook = props.onVnodeBeforeMount) { 7815 invokeVNodeHook(vnodeHook, parentComponent, vnode); 7816 } 7817 } 7818 { 7819 def(el, "__vnode", vnode, true); 7820 def(el, "__vueParentComponent", parentComponent, true); 7821 } 7822 if (dirs) { 7823 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 7824 } 7825 const needCallTransitionHooks = needTransition(parentSuspense, transition); 7826 if (needCallTransitionHooks) { 7827 transition.beforeEnter(el); 7828 } 7829 hostInsert(el, container, anchor); 7830 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) { 7831 queuePostRenderEffect(() => { 7832 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 7833 needCallTransitionHooks && transition.enter(el); 7834 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 7835 }, parentSuspense); 7836 } 7837 }; 7838 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => { 7839 if (scopeId) { 7840 hostSetScopeId(el, scopeId); 7841 } 7842 if (slotScopeIds) { 7843 for (let i = 0; i < slotScopeIds.length; i++) { 7844 hostSetScopeId(el, slotScopeIds[i]); 7845 } 7846 } 7847 if (parentComponent) { 7848 let subTree = parentComponent.subTree; 7849 if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) { 7850 subTree = filterSingleRoot(subTree.children) || subTree; 7851 } 7852 if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) { 7853 const parentVNode = parentComponent.vnode; 7854 setScopeId( 7855 el, 7856 parentVNode, 7857 parentVNode.scopeId, 7858 parentVNode.slotScopeIds, 7859 parentComponent.parent 7860 ); 7861 } 7862 } 7863 }; 7864 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => { 7865 for (let i = start; i < children.length; i++) { 7866 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]); 7867 patch( 7868 null, 7869 child, 7870 container, 7871 anchor, 7872 parentComponent, 7873 parentSuspense, 7874 namespace, 7875 slotScopeIds, 7876 optimized 7877 ); 7878 } 7879 }; 7880 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7881 const el = n2.el = n1.el; 7882 { 7883 el.__vnode = n2; 7884 } 7885 let { patchFlag, dynamicChildren, dirs } = n2; 7886 patchFlag |= n1.patchFlag & 16; 7887 const oldProps = n1.props || EMPTY_OBJ; 7888 const newProps = n2.props || EMPTY_OBJ; 7889 let vnodeHook; 7890 parentComponent && toggleRecurse(parentComponent, false); 7891 if (vnodeHook = newProps.onVnodeBeforeUpdate) { 7892 invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7893 } 7894 if (dirs) { 7895 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate"); 7896 } 7897 parentComponent && toggleRecurse(parentComponent, true); 7898 if (isHmrUpdating) { 7899 patchFlag = 0; 7900 optimized = false; 7901 dynamicChildren = null; 7902 } 7903 if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) { 7904 hostSetElementText(el, ""); 7905 } 7906 if (dynamicChildren) { 7907 patchBlockChildren( 7908 n1.dynamicChildren, 7909 dynamicChildren, 7910 el, 7911 parentComponent, 7912 parentSuspense, 7913 resolveChildrenNamespace(n2, namespace), 7914 slotScopeIds 7915 ); 7916 { 7917 traverseStaticChildren(n1, n2); 7918 } 7919 } else if (!optimized) { 7920 patchChildren( 7921 n1, 7922 n2, 7923 el, 7924 null, 7925 parentComponent, 7926 parentSuspense, 7927 resolveChildrenNamespace(n2, namespace), 7928 slotScopeIds, 7929 false 7930 ); 7931 } 7932 if (patchFlag > 0) { 7933 if (patchFlag & 16) { 7934 patchProps(el, oldProps, newProps, parentComponent, namespace); 7935 } else { 7936 if (patchFlag & 2) { 7937 if (oldProps.class !== newProps.class) { 7938 hostPatchProp(el, "class", null, newProps.class, namespace); 7939 } 7940 } 7941 if (patchFlag & 4) { 7942 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace); 7943 } 7944 if (patchFlag & 8) { 7945 const propsToUpdate = n2.dynamicProps; 7946 for (let i = 0; i < propsToUpdate.length; i++) { 7947 const key = propsToUpdate[i]; 7948 const prev = oldProps[key]; 7949 const next = newProps[key]; 7950 if (next !== prev || key === "value") { 7951 hostPatchProp(el, key, prev, next, namespace, parentComponent); 7952 } 7953 } 7954 } 7955 } 7956 if (patchFlag & 1) { 7957 if (n1.children !== n2.children) { 7958 hostSetElementText(el, n2.children); 7959 } 7960 } 7961 } else if (!optimized && dynamicChildren == null) { 7962 patchProps(el, oldProps, newProps, parentComponent, namespace); 7963 } 7964 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) { 7965 queuePostRenderEffect(() => { 7966 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7967 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated"); 7968 }, parentSuspense); 7969 } 7970 }; 7971 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => { 7972 for (let i = 0; i < newChildren.length; i++) { 7973 const oldVNode = oldChildren[i]; 7974 const newVNode = newChildren[i]; 7975 const container = ( 7976 // oldVNode may be an errored async setup() component inside Suspense 7977 // which will not have a mounted element 7978 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent 7979 // of the Fragment itself so it can move its children. 7980 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement 7981 // which also requires the correct parent container 7982 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. 7983 oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : ( 7984 // In other cases, the parent container is not actually used so we 7985 // just pass the block element here to avoid a DOM parentNode call. 7986 fallbackContainer 7987 ) 7988 ); 7989 patch( 7990 oldVNode, 7991 newVNode, 7992 container, 7993 null, 7994 parentComponent, 7995 parentSuspense, 7996 namespace, 7997 slotScopeIds, 7998 true 7999 ); 8000 } 8001 }; 8002 const patchProps = (el, oldProps, newProps, parentComponent, namespace) => { 8003 if (oldProps !== newProps) { 8004 if (oldProps !== EMPTY_OBJ) { 8005 for (const key in oldProps) { 8006 if (!isReservedProp(key) && !(key in newProps)) { 8007 hostPatchProp( 8008 el, 8009 key, 8010 oldProps[key], 8011 null, 8012 namespace, 8013 parentComponent 8014 ); 8015 } 8016 } 8017 } 8018 for (const key in newProps) { 8019 if (isReservedProp(key)) continue; 8020 const next = newProps[key]; 8021 const prev = oldProps[key]; 8022 if (next !== prev && key !== "value") { 8023 hostPatchProp(el, key, prev, next, namespace, parentComponent); 8024 } 8025 } 8026 if ("value" in newProps) { 8027 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace); 8028 } 8029 } 8030 }; 8031 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 8032 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText(""); 8033 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText(""); 8034 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2; 8035 if ( 8036 // #5523 dev root fragment may inherit directives 8037 isHmrUpdating || patchFlag & 2048 8038 ) { 8039 patchFlag = 0; 8040 optimized = false; 8041 dynamicChildren = null; 8042 } 8043 if (fragmentSlotScopeIds) { 8044 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 8045 } 8046 if (n1 == null) { 8047 hostInsert(fragmentStartAnchor, container, anchor); 8048 hostInsert(fragmentEndAnchor, container, anchor); 8049 mountChildren( 8050 // #10007 8051 // such fragment like `<></>` will be compiled into 8052 // a fragment which doesn't have a children. 8053 // In this case fallback to an empty array 8054 n2.children || [], 8055 container, 8056 fragmentEndAnchor, 8057 parentComponent, 8058 parentSuspense, 8059 namespace, 8060 slotScopeIds, 8061 optimized 8062 ); 8063 } else { 8064 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result 8065 // of renderSlot() with no valid children 8066 n1.dynamicChildren && n1.dynamicChildren.length === dynamicChildren.length) { 8067 patchBlockChildren( 8068 n1.dynamicChildren, 8069 dynamicChildren, 8070 container, 8071 parentComponent, 8072 parentSuspense, 8073 namespace, 8074 slotScopeIds 8075 ); 8076 { 8077 traverseStaticChildren(n1, n2); 8078 } 8079 } else { 8080 patchChildren( 8081 n1, 8082 n2, 8083 container, 8084 fragmentEndAnchor, 8085 parentComponent, 8086 parentSuspense, 8087 namespace, 8088 slotScopeIds, 8089 optimized 8090 ); 8091 } 8092 } 8093 }; 8094 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 8095 n2.slotScopeIds = slotScopeIds; 8096 if (n1 == null) { 8097 if (n2.shapeFlag & 512) { 8098 parentComponent.ctx.activate( 8099 n2, 8100 container, 8101 anchor, 8102 namespace, 8103 optimized 8104 ); 8105 } else { 8106 mountComponent( 8107 n2, 8108 container, 8109 anchor, 8110 parentComponent, 8111 parentSuspense, 8112 namespace, 8113 optimized 8114 ); 8115 } 8116 } else { 8117 updateComponent(n1, n2, optimized); 8118 } 8119 }; 8120 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => { 8121 const instance = (initialVNode.component = createComponentInstance( 8122 initialVNode, 8123 parentComponent, 8124 parentSuspense 8125 )); 8126 if (instance.type.__hmrId) { 8127 registerHMR(instance); 8128 } 8129 { 8130 pushWarningContext(initialVNode); 8131 startMeasure(instance, `mount`); 8132 } 8133 if (isKeepAlive(initialVNode)) { 8134 instance.ctx.renderer = internals; 8135 } 8136 { 8137 { 8138 startMeasure(instance, `init`); 8139 } 8140 setupComponent(instance, false, optimized); 8141 { 8142 endMeasure(instance, `init`); 8143 } 8144 } 8145 if (isHmrUpdating) initialVNode.el = null; 8146 if (instance.asyncDep) { 8147 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); 8148 if (!initialVNode.el) { 8149 const placeholder = instance.subTree = createVNode(Comment); 8150 processCommentNode(null, placeholder, container, anchor); 8151 initialVNode.placeholder = placeholder.el; 8152 } 8153 } else { 8154 setupRenderEffect( 8155 instance, 8156 initialVNode, 8157 container, 8158 anchor, 8159 parentSuspense, 8160 namespace, 8161 optimized 8162 ); 8163 } 8164 { 8165 popWarningContext(); 8166 endMeasure(instance, `mount`); 8167 } 8168 }; 8169 const updateComponent = (n1, n2, optimized) => { 8170 const instance = n2.component = n1.component; 8171 if (shouldUpdateComponent(n1, n2, optimized)) { 8172 if (instance.asyncDep && !instance.asyncResolved) { 8173 { 8174 pushWarningContext(n2); 8175 } 8176 updateComponentPreRender(instance, n2, optimized); 8177 { 8178 popWarningContext(); 8179 } 8180 return; 8181 } else { 8182 instance.next = n2; 8183 instance.update(); 8184 } 8185 } else { 8186 n2.el = n1.el; 8187 instance.vnode = n2; 8188 } 8189 }; 8190 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => { 8191 const componentUpdateFn = () => { 8192 if (!instance.isMounted) { 8193 let vnodeHook; 8194 const { el, props } = initialVNode; 8195 const { bm, m, parent, root, type } = instance; 8196 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode); 8197 toggleRecurse(instance, false); 8198 if (bm) { 8199 invokeArrayFns(bm); 8200 } 8201 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) { 8202 invokeVNodeHook(vnodeHook, parent, initialVNode); 8203 } 8204 toggleRecurse(instance, true); 8205 if (el && hydrateNode) { 8206 const hydrateSubTree = () => { 8207 { 8208 startMeasure(instance, `render`); 8209 } 8210 instance.subTree = renderComponentRoot(instance); 8211 { 8212 endMeasure(instance, `render`); 8213 } 8214 { 8215 startMeasure(instance, `hydrate`); 8216 } 8217 hydrateNode( 8218 el, 8219 instance.subTree, 8220 instance, 8221 parentSuspense, 8222 null 8223 ); 8224 { 8225 endMeasure(instance, `hydrate`); 8226 } 8227 }; 8228 if (isAsyncWrapperVNode && type.__asyncHydrate) { 8229 type.__asyncHydrate( 8230 el, 8231 instance, 8232 hydrateSubTree 8233 ); 8234 } else { 8235 hydrateSubTree(); 8236 } 8237 } else { 8238 if (root.ce && // @ts-expect-error _def is private 8239 root.ce._def.shadowRoot !== false) { 8240 root.ce._injectChildStyle(type); 8241 } 8242 { 8243 startMeasure(instance, `render`); 8244 } 8245 const subTree = instance.subTree = renderComponentRoot(instance); 8246 { 8247 endMeasure(instance, `render`); 8248 } 8249 { 8250 startMeasure(instance, `patch`); 8251 } 8252 patch( 8253 null, 8254 subTree, 8255 container, 8256 anchor, 8257 instance, 8258 parentSuspense, 8259 namespace 8260 ); 8261 { 8262 endMeasure(instance, `patch`); 8263 } 8264 initialVNode.el = subTree.el; 8265 } 8266 if (m) { 8267 queuePostRenderEffect(m, parentSuspense); 8268 } 8269 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) { 8270 const scopedInitialVNode = initialVNode; 8271 queuePostRenderEffect( 8272 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), 8273 parentSuspense 8274 ); 8275 } 8276 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) { 8277 instance.a && queuePostRenderEffect(instance.a, parentSuspense); 8278 } 8279 instance.isMounted = true; 8280 { 8281 devtoolsComponentAdded(instance); 8282 } 8283 initialVNode = container = anchor = null; 8284 } else { 8285 let { next, bu, u, parent, vnode } = instance; 8286 { 8287 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance); 8288 if (nonHydratedAsyncRoot) { 8289 if (next) { 8290 next.el = vnode.el; 8291 updateComponentPreRender(instance, next, optimized); 8292 } 8293 nonHydratedAsyncRoot.asyncDep.then(() => { 8294 if (!instance.isUnmounted) { 8295 componentUpdateFn(); 8296 } 8297 }); 8298 return; 8299 } 8300 } 8301 let originNext = next; 8302 let vnodeHook; 8303 { 8304 pushWarningContext(next || instance.vnode); 8305 } 8306 toggleRecurse(instance, false); 8307 if (next) { 8308 next.el = vnode.el; 8309 updateComponentPreRender(instance, next, optimized); 8310 } else { 8311 next = vnode; 8312 } 8313 if (bu) { 8314 invokeArrayFns(bu); 8315 } 8316 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) { 8317 invokeVNodeHook(vnodeHook, parent, next, vnode); 8318 } 8319 toggleRecurse(instance, true); 8320 { 8321 startMeasure(instance, `render`); 8322 } 8323 const nextTree = renderComponentRoot(instance); 8324 { 8325 endMeasure(instance, `render`); 8326 } 8327 const prevTree = instance.subTree; 8328 instance.subTree = nextTree; 8329 { 8330 startMeasure(instance, `patch`); 8331 } 8332 patch( 8333 prevTree, 8334 nextTree, 8335 // parent may have changed if it's in a teleport 8336 hostParentNode(prevTree.el), 8337 // anchor may have changed if it's in a fragment 8338 getNextHostNode(prevTree), 8339 instance, 8340 parentSuspense, 8341 namespace 8342 ); 8343 { 8344 endMeasure(instance, `patch`); 8345 } 8346 next.el = nextTree.el; 8347 if (originNext === null) { 8348 updateHOCHostEl(instance, nextTree.el); 8349 } 8350 if (u) { 8351 queuePostRenderEffect(u, parentSuspense); 8352 } 8353 if (vnodeHook = next.props && next.props.onVnodeUpdated) { 8354 queuePostRenderEffect( 8355 () => invokeVNodeHook(vnodeHook, parent, next, vnode), 8356 parentSuspense 8357 ); 8358 } 8359 { 8360 devtoolsComponentUpdated(instance); 8361 } 8362 { 8363 popWarningContext(); 8364 } 8365 } 8366 }; 8367 instance.scope.on(); 8368 const effect = instance.effect = new ReactiveEffect(componentUpdateFn); 8369 instance.scope.off(); 8370 const update = instance.update = effect.run.bind(effect); 8371 const job = instance.job = effect.runIfDirty.bind(effect); 8372 job.i = instance; 8373 job.id = instance.uid; 8374 effect.scheduler = () => queueJob(job); 8375 toggleRecurse(instance, true); 8376 { 8377 effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0; 8378 effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0; 8379 } 8380 update(); 8381 }; 8382 const updateComponentPreRender = (instance, nextVNode, optimized) => { 8383 nextVNode.component = instance; 8384 const prevProps = instance.vnode.props; 8385 instance.vnode = nextVNode; 8386 instance.next = null; 8387 updateProps(instance, nextVNode.props, prevProps, optimized); 8388 updateSlots(instance, nextVNode.children, optimized); 8389 pauseTracking(); 8390 flushPreFlushCbs(instance); 8391 resetTracking(); 8392 }; 8393 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => { 8394 const c1 = n1 && n1.children; 8395 const prevShapeFlag = n1 ? n1.shapeFlag : 0; 8396 const c2 = n2.children; 8397 const { patchFlag, shapeFlag } = n2; 8398 if (patchFlag > 0) { 8399 if (patchFlag & 128) { 8400 patchKeyedChildren( 8401 c1, 8402 c2, 8403 container, 8404 anchor, 8405 parentComponent, 8406 parentSuspense, 8407 namespace, 8408 slotScopeIds, 8409 optimized 8410 ); 8411 return; 8412 } else if (patchFlag & 256) { 8413 patchUnkeyedChildren( 8414 c1, 8415 c2, 8416 container, 8417 anchor, 8418 parentComponent, 8419 parentSuspense, 8420 namespace, 8421 slotScopeIds, 8422 optimized 8423 ); 8424 return; 8425 } 8426 } 8427 if (shapeFlag & 8) { 8428 if (prevShapeFlag & 16) { 8429 unmountChildren(c1, parentComponent, parentSuspense); 8430 } 8431 if (c2 !== c1) { 8432 hostSetElementText(container, c2); 8433 } 8434 } else { 8435 if (prevShapeFlag & 16) { 8436 if (shapeFlag & 16) { 8437 patchKeyedChildren( 8438 c1, 8439 c2, 8440 container, 8441 anchor, 8442 parentComponent, 8443 parentSuspense, 8444 namespace, 8445 slotScopeIds, 8446 optimized 8447 ); 8448 } else { 8449 unmountChildren(c1, parentComponent, parentSuspense, true); 8450 } 8451 } else { 8452 if (prevShapeFlag & 8) { 8453 hostSetElementText(container, ""); 8454 } 8455 if (shapeFlag & 16) { 8456 mountChildren( 8457 c2, 8458 container, 8459 anchor, 8460 parentComponent, 8461 parentSuspense, 8462 namespace, 8463 slotScopeIds, 8464 optimized 8465 ); 8466 } 8467 } 8468 } 8469 }; 8470 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 8471 c1 = c1 || EMPTY_ARR; 8472 c2 = c2 || EMPTY_ARR; 8473 const oldLength = c1.length; 8474 const newLength = c2.length; 8475 const commonLength = Math.min(oldLength, newLength); 8476 let i; 8477 for (i = 0; i < commonLength; i++) { 8478 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 8479 patch( 8480 c1[i], 8481 nextChild, 8482 container, 8483 null, 8484 parentComponent, 8485 parentSuspense, 8486 namespace, 8487 slotScopeIds, 8488 optimized 8489 ); 8490 } 8491 if (oldLength > newLength) { 8492 unmountChildren( 8493 c1, 8494 parentComponent, 8495 parentSuspense, 8496 true, 8497 false, 8498 commonLength 8499 ); 8500 } else { 8501 mountChildren( 8502 c2, 8503 container, 8504 anchor, 8505 parentComponent, 8506 parentSuspense, 8507 namespace, 8508 slotScopeIds, 8509 optimized, 8510 commonLength 8511 ); 8512 } 8513 }; 8514 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 8515 let i = 0; 8516 const l2 = c2.length; 8517 let e1 = c1.length - 1; 8518 let e2 = l2 - 1; 8519 while (i <= e1 && i <= e2) { 8520 const n1 = c1[i]; 8521 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 8522 if (isSameVNodeType(n1, n2)) { 8523 patch( 8524 n1, 8525 n2, 8526 container, 8527 null, 8528 parentComponent, 8529 parentSuspense, 8530 namespace, 8531 slotScopeIds, 8532 optimized 8533 ); 8534 } else { 8535 break; 8536 } 8537 i++; 8538 } 8539 while (i <= e1 && i <= e2) { 8540 const n1 = c1[e1]; 8541 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]); 8542 if (isSameVNodeType(n1, n2)) { 8543 patch( 8544 n1, 8545 n2, 8546 container, 8547 null, 8548 parentComponent, 8549 parentSuspense, 8550 namespace, 8551 slotScopeIds, 8552 optimized 8553 ); 8554 } else { 8555 break; 8556 } 8557 e1--; 8558 e2--; 8559 } 8560 if (i > e1) { 8561 if (i <= e2) { 8562 const nextPos = e2 + 1; 8563 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor; 8564 while (i <= e2) { 8565 patch( 8566 null, 8567 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]), 8568 container, 8569 anchor, 8570 parentComponent, 8571 parentSuspense, 8572 namespace, 8573 slotScopeIds, 8574 optimized 8575 ); 8576 i++; 8577 } 8578 } 8579 } else if (i > e2) { 8580 while (i <= e1) { 8581 unmount(c1[i], parentComponent, parentSuspense, true); 8582 i++; 8583 } 8584 } else { 8585 const s1 = i; 8586 const s2 = i;
vendor: 8,869 bytes, lines 8587-8825
8587 const keyToNewIndexMap = /* @__PURE__ */ new Map(); 8588 for (i = s2; i <= e2; i++) { 8589 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 8590 if (nextChild.key != null) { 8591 if (keyToNewIndexMap.has(nextChild.key)) { 8592 warn$1( 8593 `Duplicate keys found during update:`, 8594 JSON.stringify(nextChild.key), 8595 `Make sure keys are unique.` 8596 ); 8597 } 8598 keyToNewIndexMap.set(nextChild.key, i); 8599 } 8600 } 8601 let j; 8602 let patched = 0; 8603 const toBePatched = e2 - s2 + 1; 8604 let moved = false; 8605 let maxNewIndexSoFar = 0; 8606 const newIndexToOldIndexMap = new Array(toBePatched); 8607 for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0; 8608 for (i = s1; i <= e1; i++) { 8609 const prevChild = c1[i]; 8610 if (patched >= toBePatched) { 8611 unmount(prevChild, parentComponent, parentSuspense, true); 8612 continue; 8613 } 8614 let newIndex; 8615 if (prevChild.key != null) { 8616 newIndex = keyToNewIndexMap.get(prevChild.key); 8617 } else { 8618 for (j = s2; j <= e2; j++) { 8619 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) { 8620 newIndex = j; 8621 break; 8622 } 8623 } 8624 } 8625 if (newIndex === void 0) { 8626 unmount(prevChild, parentComponent, parentSuspense, true); 8627 } else { 8628 newIndexToOldIndexMap[newIndex - s2] = i + 1; 8629 if (newIndex >= maxNewIndexSoFar) { 8630 maxNewIndexSoFar = newIndex; 8631 } else { 8632 moved = true; 8633 } 8634 patch( 8635 prevChild, 8636 c2[newIndex], 8637 container, 8638 null, 8639 parentComponent, 8640 parentSuspense, 8641 namespace, 8642 slotScopeIds, 8643 optimized 8644 ); 8645 patched++; 8646 } 8647 } 8648 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR; 8649 j = increasingNewIndexSequence.length - 1; 8650 for (i = toBePatched - 1; i >= 0; i--) { 8651 const nextIndex = s2 + i; 8652 const nextChild = c2[nextIndex]; 8653 const anchorVNode = c2[nextIndex + 1]; 8654 const anchor = nextIndex + 1 < l2 ? ( 8655 // #13559, #14173 fallback to el placeholder for unresolved async component 8656 anchorVNode.el || resolveAsyncComponentPlaceholder(anchorVNode) 8657 ) : parentAnchor; 8658 if (newIndexToOldIndexMap[i] === 0) { 8659 patch( 8660 null, 8661 nextChild, 8662 container, 8663 anchor, 8664 parentComponent, 8665 parentSuspense, 8666 namespace, 8667 slotScopeIds, 8668 optimized 8669 ); 8670 } else if (moved) { 8671 if (j < 0 || i !== increasingNewIndexSequence[j]) { 8672 move(nextChild, container, anchor, 2); 8673 } else { 8674 j--; 8675 } 8676 } 8677 } 8678 } 8679 }; 8680 const move = (vnode, container, anchor, moveType, parentSuspense = null) => { 8681 const { el, type, transition, children, shapeFlag } = vnode; 8682 if (shapeFlag & 6) { 8683 move(vnode.component.subTree, container, anchor, moveType); 8684 return; 8685 } 8686 if (shapeFlag & 128) { 8687 vnode.suspense.move(container, anchor, moveType); 8688 return; 8689 } 8690 if (shapeFlag & 64) { 8691 type.move(vnode, container, anchor, internals); 8692 return; 8693 } 8694 if (type === Fragment) { 8695 hostInsert(el, container, anchor); 8696 for (let i = 0; i < children.length; i++) { 8697 move(children[i], container, anchor, moveType); 8698 } 8699 hostInsert(vnode.anchor, container, anchor); 8700 return; 8701 } 8702 if (type === Static) { 8703 moveStaticNode(vnode, container, anchor); 8704 return; 8705 } 8706 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition; 8707 if (needTransition2) { 8708 if (moveType === 0) { 8709 transition.beforeEnter(el); 8710 hostInsert(el, container, anchor); 8711 queuePostRenderEffect(() => transition.enter(el), parentSuspense); 8712 } else { 8713 const { leave, delayLeave, afterLeave } = transition; 8714 const remove2 = () => { 8715 if (vnode.ctx.isUnmounted) { 8716 hostRemove(el); 8717 } else { 8718 hostInsert(el, container, anchor); 8719 } 8720 }; 8721 const performLeave = () => { 8722 if (el._isLeaving) { 8723 el[leaveCbKey]( 8724 true 8725 /* cancelled */ 8726 ); 8727 } 8728 leave(el, () => { 8729 remove2(); 8730 afterLeave && afterLeave(); 8731 }); 8732 }; 8733 if (delayLeave) { 8734 delayLeave(el, remove2, performLeave); 8735 } else { 8736 performLeave(); 8737 } 8738 } 8739 } else { 8740 hostInsert(el, container, anchor); 8741 } 8742 }; 8743 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => { 8744 const { 8745 type, 8746 props, 8747 ref, 8748 children, 8749 dynamicChildren, 8750 shapeFlag, 8751 patchFlag, 8752 dirs, 8753 cacheIndex 8754 } = vnode; 8755 if (patchFlag === -2) { 8756 optimized = false; 8757 } 8758 if (ref != null) { 8759 pauseTracking(); 8760 setRef(ref, null, parentSuspense, vnode, true); 8761 resetTracking(); 8762 } 8763 if (cacheIndex != null) { 8764 parentComponent.renderCache[cacheIndex] = void 0; 8765 } 8766 if (shapeFlag & 256) { 8767 parentComponent.ctx.deactivate(vnode); 8768 return; 8769 } 8770 const shouldInvokeDirs = shapeFlag & 1 && dirs; 8771 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode); 8772 let vnodeHook; 8773 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) { 8774 invokeVNodeHook(vnodeHook, parentComponent, vnode); 8775 } 8776 if (shapeFlag & 6) { 8777 unmountComponent(vnode.component, parentSuspense, doRemove); 8778 } else { 8779 if (shapeFlag & 128) { 8780 vnode.suspense.unmount(parentSuspense, doRemove); 8781 return; 8782 } 8783 if (shouldInvokeDirs) { 8784 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount"); 8785 } 8786 if (shapeFlag & 64) { 8787 vnode.type.remove( 8788 vnode, 8789 parentComponent, 8790 parentSuspense, 8791 internals, 8792 doRemove 8793 ); 8794 } else if (dynamicChildren && // #5154 8795 // when v-once is used inside a block, setBlockTracking(-1) marks the 8796 // parent block with hasOnce: true 8797 // so that it doesn't take the fast path during unmount - otherwise 8798 // components nested in v-once are never unmounted. 8799 !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments 8800 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) { 8801 unmountChildren( 8802 dynamicChildren, 8803 parentComponent, 8804 parentSuspense, 8805 false, 8806 true 8807 ); 8808 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) { 8809 unmountChildren(children, parentComponent, parentSuspense); 8810 } 8811 if (doRemove) { 8812 remove(vnode); 8813 } 8814 } 8815 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) { 8816 queuePostRenderEffect(() => { 8817 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 8818 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted"); 8819 }, parentSuspense); 8820 } 8821 }; 8822 const remove = (vnode) => { 8823 const { type, el, anchor, transition } = vnode; 8824 if (type === Fragment) { 8825 if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
vendor: 13,270 bytes, lines 8826-9252
8826 vnode.children.forEach((child) => { 8827 if (child.type === Comment) { 8828 hostRemove(child.el); 8829 } else { 8830 remove(child); 8831 } 8832 }); 8833 } else { 8834 removeFragment(el, anchor); 8835 } 8836 return; 8837 } 8838 if (type === Static) { 8839 removeStaticNode(vnode); 8840 return; 8841 } 8842 const performRemove = () => { 8843 hostRemove(el); 8844 if (transition && !transition.persisted && transition.afterLeave) { 8845 transition.afterLeave(); 8846 } 8847 }; 8848 if (vnode.shapeFlag & 1 && transition && !transition.persisted) { 8849 const { leave, delayLeave } = transition; 8850 const performLeave = () => leave(el, performRemove); 8851 if (delayLeave) { 8852 delayLeave(vnode.el, performRemove, performLeave); 8853 } else { 8854 performLeave(); 8855 } 8856 } else { 8857 performRemove(); 8858 } 8859 }; 8860 const removeFragment = (cur, end) => { 8861 let next; 8862 while (cur !== end) { 8863 next = hostNextSibling(cur); 8864 hostRemove(cur); 8865 cur = next; 8866 } 8867 hostRemove(end); 8868 }; 8869 const unmountComponent = (instance, parentSuspense, doRemove) => { 8870 if (instance.type.__hmrId) { 8871 unregisterHMR(instance); 8872 } 8873 const { bum, scope, job, subTree, um, m, a } = instance; 8874 invalidateMount(m); 8875 invalidateMount(a); 8876 if (bum) { 8877 invokeArrayFns(bum); 8878 } 8879 scope.stop(); 8880 if (job) { 8881 job.flags |= 8; 8882 unmount(subTree, instance, parentSuspense, doRemove); 8883 } 8884 if (um) { 8885 queuePostRenderEffect(um, parentSuspense); 8886 } 8887 queuePostRenderEffect(() => { 8888 instance.isUnmounted = true; 8889 }, parentSuspense); 8890 { 8891 devtoolsComponentRemoved(instance); 8892 } 8893 }; 8894 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => { 8895 for (let i = start; i < children.length; i++) { 8896 unmount(children[i], parentComponent, parentSuspense, doRemove, optimized); 8897 } 8898 }; 8899 const getNextHostNode = (vnode) => { 8900 if (vnode.shapeFlag & 6) { 8901 return getNextHostNode(vnode.component.subTree); 8902 } 8903 if (vnode.shapeFlag & 128) { 8904 return vnode.suspense.next(); 8905 } 8906 const el = hostNextSibling(vnode.anchor || vnode.el); 8907 const teleportEnd = el && el[TeleportEndKey]; 8908 return teleportEnd ? hostNextSibling(teleportEnd) : el; 8909 }; 8910 let isFlushing = false; 8911 const render = (vnode, container, namespace) => { 8912 let instance; 8913 if (vnode == null) { 8914 if (container._vnode) { 8915 unmount(container._vnode, null, null, true); 8916 instance = container._vnode.component; 8917 } 8918 } else { 8919 patch( 8920 container._vnode || null, 8921 vnode, 8922 container, 8923 null, 8924 null, 8925 null, 8926 namespace 8927 ); 8928 } 8929 container._vnode = vnode; 8930 if (!isFlushing) { 8931 isFlushing = true; 8932 flushPreFlushCbs(instance); 8933 flushPostFlushCbs(); 8934 isFlushing = false; 8935 } 8936 }; 8937 const internals = { 8938 p: patch, 8939 um: unmount, 8940 m: move, 8941 r: remove, 8942 mt: mountComponent, 8943 mc: mountChildren, 8944 pc: patchChildren, 8945 pbc: patchBlockChildren, 8946 n: getNextHostNode, 8947 o: options 8948 }; 8949 let hydrate; 8950 let hydrateNode; 8951 if (createHydrationFns) { 8952 [hydrate, hydrateNode] = createHydrationFns( 8953 internals 8954 ); 8955 } 8956 return { 8957 render, 8958 hydrate, 8959 createApp: createAppAPI(render, hydrate) 8960 }; 8961 } 8962 function resolveChildrenNamespace({ type, props }, currentNamespace) { 8963 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace; 8964 } 8965 function toggleRecurse({ effect, job }, allowed) { 8966 if (allowed) { 8967 effect.flags |= 32; 8968 job.flags |= 4; 8969 } else { 8970 effect.flags &= -33; 8971 job.flags &= -5; 8972 } 8973 } 8974 function needTransition(parentSuspense, transition) { 8975 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted; 8976 } 8977 function traverseStaticChildren(n1, n2, shallow = false) { 8978 const ch1 = n1.children; 8979 const ch2 = n2.children; 8980 if (isArray(ch1) && isArray(ch2)) { 8981 for (let i = 0; i < ch1.length; i++) { 8982 const c1 = ch1[i]; 8983 let c2 = ch2[i]; 8984 if (c2.shapeFlag & 1 && !c2.dynamicChildren) { 8985 if (c2.patchFlag <= 0 || c2.patchFlag === 32) { 8986 c2 = ch2[i] = cloneIfMounted(ch2[i]); 8987 c2.el = c1.el; 8988 } 8989 if (!shallow && c2.patchFlag !== -2) 8990 traverseStaticChildren(c1, c2); 8991 } 8992 if (c2.type === Text) { 8993 if (c2.patchFlag !== -1) { 8994 c2.el = c1.el; 8995 } else { 8996 c2.__elIndex = i + // take fragment start anchor into account 8997 (n1.type === Fragment ? 1 : 0); 8998 } 8999 } 9000 if (c2.type === Comment && !c2.el) { 9001 c2.el = c1.el; 9002 } 9003 { 9004 c2.el && (c2.el.__vnode = c2); 9005 } 9006 } 9007 } 9008 } 9009 function getSequence(arr) { 9010 const p = arr.slice(); 9011 const result = [0]; 9012 let i, j, u, v, c; 9013 const len = arr.length; 9014 for (i = 0; i < len; i++) { 9015 const arrI = arr[i]; 9016 if (arrI !== 0) { 9017 j = result[result.length - 1]; 9018 if (arr[j] < arrI) { 9019 p[i] = j; 9020 result.push(i); 9021 continue; 9022 } 9023 u = 0; 9024 v = result.length - 1; 9025 while (u < v) { 9026 c = u + v >> 1; 9027 if (arr[result[c]] < arrI) { 9028 u = c + 1; 9029 } else { 9030 v = c; 9031 } 9032 } 9033 if (arrI < arr[result[u]]) { 9034 if (u > 0) { 9035 p[i] = result[u - 1]; 9036 } 9037 result[u] = i; 9038 } 9039 } 9040 } 9041 u = result.length; 9042 v = result[u - 1]; 9043 while (u-- > 0) { 9044 result[u] = v; 9045 v = p[v]; 9046 } 9047 return result; 9048 } 9049 function locateNonHydratedAsyncRoot(instance) { 9050 const subComponent = instance.subTree.component; 9051 if (subComponent) { 9052 if (subComponent.asyncDep && !subComponent.asyncResolved) { 9053 return subComponent; 9054 } else { 9055 return locateNonHydratedAsyncRoot(subComponent); 9056 } 9057 } 9058 } 9059 function invalidateMount(hooks) { 9060 if (hooks) { 9061 for (let i = 0; i < hooks.length; i++) 9062 hooks[i].flags |= 8; 9063 } 9064 } 9065 function resolveAsyncComponentPlaceholder(anchorVnode) { 9066 if (anchorVnode.placeholder) { 9067 return anchorVnode.placeholder; 9068 } 9069 const instance = anchorVnode.component; 9070 if (instance) { 9071 return resolveAsyncComponentPlaceholder(instance.subTree); 9072 } 9073 return null; 9074 } 9075 9076 const isSuspense = (type) => type.__isSuspense; 9077 let suspenseId = 0; 9078 const SuspenseImpl = { 9079 name: "Suspense", 9080 // In order to make Suspense tree-shakable, we need to avoid importing it 9081 // directly in the renderer. The renderer checks for the __isSuspense flag 9082 // on a vnode's type and calls the `process` method, passing in renderer 9083 // internals. 9084 __isSuspense: true, 9085 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 9086 if (n1 == null) { 9087 mountSuspense( 9088 n2, 9089 container, 9090 anchor, 9091 parentComponent, 9092 parentSuspense, 9093 namespace, 9094 slotScopeIds, 9095 optimized, 9096 rendererInternals 9097 ); 9098 } else { 9099 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) { 9100 n2.suspense = n1.suspense; 9101 n2.suspense.vnode = n2; 9102 n2.el = n1.el; 9103 return; 9104 } 9105 patchSuspense( 9106 n1, 9107 n2, 9108 container, 9109 anchor, 9110 parentComponent, 9111 namespace, 9112 slotScopeIds, 9113 optimized, 9114 rendererInternals 9115 ); 9116 } 9117 }, 9118 hydrate: hydrateSuspense, 9119 normalize: normalizeSuspenseChildren 9120 }; 9121 const Suspense = SuspenseImpl ; 9122 function triggerEvent(vnode, name) { 9123 const eventListener = vnode.props && vnode.props[name]; 9124 if (isFunction(eventListener)) { 9125 eventListener(); 9126 } 9127 } 9128 function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 9129 const { 9130 p: patch, 9131 o: { createElement } 9132 } = rendererInternals; 9133 const hiddenContainer = createElement("div"); 9134 const suspense = vnode.suspense = createSuspenseBoundary( 9135 vnode, 9136 parentSuspense, 9137 parentComponent, 9138 container, 9139 hiddenContainer, 9140 anchor, 9141 namespace, 9142 slotScopeIds, 9143 optimized, 9144 rendererInternals 9145 ); 9146 patch( 9147 null, 9148 suspense.pendingBranch = vnode.ssContent, 9149 hiddenContainer, 9150 null, 9151 parentComponent, 9152 suspense, 9153 namespace, 9154 slotScopeIds 9155 ); 9156 if (suspense.deps > 0) { 9157 triggerEvent(vnode, "onPending"); 9158 triggerEvent(vnode, "onFallback"); 9159 patch( 9160 null, 9161 vnode.ssFallback, 9162 container, 9163 anchor, 9164 parentComponent, 9165 null, 9166 // fallback tree will not have suspense context 9167 namespace, 9168 slotScopeIds 9169 ); 9170 setActiveBranch(suspense, vnode.ssFallback); 9171 } else { 9172 suspense.resolve(false, true); 9173 } 9174 } 9175 function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) { 9176 const suspense = n2.suspense = n1.suspense; 9177 suspense.vnode = n2; 9178 n2.el = n1.el; 9179 const newBranch = n2.ssContent; 9180 const newFallback = n2.ssFallback; 9181 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense; 9182 if (pendingBranch) { 9183 suspense.pendingBranch = newBranch; 9184 if (isSameVNodeType(pendingBranch, newBranch)) { 9185 patch( 9186 pendingBranch, 9187 newBranch, 9188 suspense.hiddenContainer, 9189 null, 9190 parentComponent, 9191 suspense, 9192 namespace, 9193 slotScopeIds, 9194 optimized 9195 ); 9196 if (suspense.deps <= 0) { 9197 suspense.resolve(); 9198 } else if (isInFallback) { 9199 if (!isHydrating) { 9200 patch( 9201 activeBranch, 9202 newFallback, 9203 container, 9204 anchor, 9205 parentComponent, 9206 null, 9207 // fallback tree will not have suspense context 9208 namespace, 9209 slotScopeIds, 9210 optimized 9211 ); 9212 setActiveBranch(suspense, newFallback); 9213 } 9214 } 9215 } else { 9216 suspense.pendingId = suspenseId++; 9217 if (isHydrating) { 9218 suspense.isHydrating = false; 9219 suspense.activeBranch = pendingBranch; 9220 } else { 9221 unmount(pendingBranch, parentComponent, suspense); 9222 } 9223 suspense.deps = 0; 9224 suspense.effects.length = 0; 9225 suspense.hiddenContainer = createElement("div"); 9226 if (isInFallback) { 9227 patch( 9228 null, 9229 newBranch, 9230 suspense.hiddenContainer, 9231 null, 9232 parentComponent, 9233 suspense, 9234 namespace, 9235 slotScopeIds, 9236 optimized 9237 ); 9238 if (suspense.deps <= 0) { 9239 suspense.resolve(); 9240 } else { 9241 patch( 9242 activeBranch, 9243 newFallback, 9244 container, 9245 anchor, 9246 parentComponent, 9247 null, 9248 // fallback tree will not have suspense context 9249 namespace, 9250 slotScopeIds, 9251 optimized 9252 );
9253 setActiveBranch(suspense, newFallback); 9254 } 9255 } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) { 9256 patch( 9257 activeBranch, 9258 newBranch, 9259 container, 9260 anchor, 9261 parentComponent, 9262 suspense, 9263 namespace, 9264 slotScopeIds, 9265 optimized 9266 ); 9267 suspense.resolve(true); 9268 } else { 9269 patch( 9270 null, 9271 newBranch, 9272 suspense.hiddenContainer, 9273 null, 9274 parentComponent, 9275 suspense, 9276 namespace, 9277 slotScopeIds, 9278 optimized 9279 ); 9280 if (suspense.deps <= 0) { 9281 suspense.resolve(); 9282 } 9283 } 9284 } 9285 } else { 9286 if (activeBranch && isSameVNodeType(activeBranch, newBranch)) { 9287 patch( 9288 activeBranch, 9289 newBranch, 9290 container, 9291 anchor, 9292 parentComponent, 9293 suspense, 9294 namespace, 9295 slotScopeIds, 9296 optimized 9297 );
vendor: 26,496 bytes, lines 9298-10041
9298 setActiveBranch(suspense, newBranch); 9299 } else { 9300 triggerEvent(n2, "onPending"); 9301 suspense.pendingBranch = newBranch; 9302 if (newBranch.shapeFlag & 512) { 9303 suspense.pendingId = newBranch.component.suspenseId; 9304 } else { 9305 suspense.pendingId = suspenseId++; 9306 } 9307 patch( 9308 null, 9309 newBranch, 9310 suspense.hiddenContainer, 9311 null, 9312 parentComponent, 9313 suspense, 9314 namespace, 9315 slotScopeIds, 9316 optimized 9317 ); 9318 if (suspense.deps <= 0) { 9319 suspense.resolve(); 9320 } else { 9321 const { timeout, pendingId } = suspense; 9322 if (timeout > 0) { 9323 setTimeout(() => { 9324 if (suspense.pendingId === pendingId) { 9325 suspense.fallback(newFallback); 9326 } 9327 }, timeout); 9328 } else if (timeout === 0) { 9329 suspense.fallback(newFallback); 9330 } 9331 } 9332 } 9333 } 9334 } 9335 let hasWarned = false; 9336 function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) { 9337 if (!hasWarned) { 9338 hasWarned = true; 9339 console[console.info ? "info" : "log"]( 9340 `<Suspense> is an experimental feature and its API will likely change.` 9341 ); 9342 } 9343 const { 9344 p: patch, 9345 m: move, 9346 um: unmount, 9347 n: next, 9348 o: { parentNode, remove } 9349 } = rendererInternals; 9350 let parentSuspenseId; 9351 const isSuspensible = isVNodeSuspensible(vnode); 9352 if (isSuspensible) { 9353 if (parentSuspense && parentSuspense.pendingBranch) { 9354 parentSuspenseId = parentSuspense.pendingId; 9355 parentSuspense.deps++; 9356 } 9357 } 9358 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; 9359 { 9360 assertNumber(timeout, `Suspense timeout`); 9361 } 9362 const initialAnchor = anchor; 9363 const suspense = { 9364 vnode, 9365 parent: parentSuspense, 9366 parentComponent, 9367 namespace, 9368 container, 9369 hiddenContainer, 9370 deps: 0, 9371 pendingId: suspenseId++, 9372 timeout: typeof timeout === "number" ? timeout : -1, 9373 activeBranch: null, 9374 pendingBranch: null, 9375 isInFallback: !isHydrating, 9376 isHydrating, 9377 isUnmounted: false, 9378 effects: [], 9379 resolve(resume = false, sync = false) { 9380 { 9381 if (!resume && !suspense.pendingBranch) { 9382 throw new Error( 9383 `suspense.resolve() is called without a pending branch.` 9384 ); 9385 } 9386 if (suspense.isUnmounted) { 9387 throw new Error( 9388 `suspense.resolve() is called on an already unmounted suspense boundary.` 9389 ); 9390 } 9391 } 9392 const { 9393 vnode: vnode2, 9394 activeBranch, 9395 pendingBranch, 9396 pendingId, 9397 effects, 9398 parentComponent: parentComponent2, 9399 container: container2, 9400 isInFallback 9401 } = suspense; 9402 let delayEnter = false; 9403 if (suspense.isHydrating) { 9404 suspense.isHydrating = false; 9405 } else if (!resume) { 9406 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in"; 9407 if (delayEnter) { 9408 activeBranch.transition.afterLeave = () => { 9409 if (pendingId === suspense.pendingId) { 9410 move( 9411 pendingBranch, 9412 container2, 9413 anchor === initialAnchor ? next(activeBranch) : anchor, 9414 0 9415 ); 9416 queuePostFlushCb(effects); 9417 if (isInFallback && vnode2.ssFallback) { 9418 vnode2.ssFallback.el = null; 9419 } 9420 } 9421 }; 9422 } 9423 if (activeBranch) { 9424 if (parentNode(activeBranch.el) === container2) { 9425 anchor = next(activeBranch); 9426 } 9427 unmount(activeBranch, parentComponent2, suspense, true); 9428 if (!delayEnter && isInFallback && vnode2.ssFallback) { 9429 queuePostRenderEffect(() => vnode2.ssFallback.el = null, suspense); 9430 } 9431 } 9432 if (!delayEnter) { 9433 move(pendingBranch, container2, anchor, 0); 9434 } 9435 } 9436 setActiveBranch(suspense, pendingBranch); 9437 suspense.pendingBranch = null; 9438 suspense.isInFallback = false; 9439 let parent = suspense.parent; 9440 let hasUnresolvedAncestor = false; 9441 while (parent) { 9442 if (parent.pendingBranch) { 9443 parent.effects.push(...effects); 9444 hasUnresolvedAncestor = true; 9445 break; 9446 } 9447 parent = parent.parent; 9448 } 9449 if (!hasUnresolvedAncestor && !delayEnter) { 9450 queuePostFlushCb(effects); 9451 } 9452 suspense.effects = []; 9453 if (isSuspensible) { 9454 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { 9455 parentSuspense.deps--; 9456 if (parentSuspense.deps === 0 && !sync) { 9457 parentSuspense.resolve(); 9458 } 9459 } 9460 } 9461 triggerEvent(vnode2, "onResolve"); 9462 }, 9463 fallback(fallbackVNode) { 9464 if (!suspense.pendingBranch) { 9465 return; 9466 } 9467 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense; 9468 triggerEvent(vnode2, "onFallback"); 9469 const anchor2 = next(activeBranch); 9470 const mountFallback = () => { 9471 if (!suspense.isInFallback) { 9472 return; 9473 } 9474 patch( 9475 null, 9476 fallbackVNode, 9477 container2, 9478 anchor2, 9479 parentComponent2, 9480 null, 9481 // fallback tree will not have suspense context 9482 namespace2, 9483 slotScopeIds, 9484 optimized 9485 ); 9486 setActiveBranch(suspense, fallbackVNode); 9487 }; 9488 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in"; 9489 if (delayEnter) { 9490 activeBranch.transition.afterLeave = mountFallback; 9491 } 9492 suspense.isInFallback = true; 9493 unmount( 9494 activeBranch, 9495 parentComponent2, 9496 null, 9497 // no suspense so unmount hooks fire now 9498 true 9499 // shouldRemove 9500 ); 9501 if (!delayEnter) { 9502 mountFallback(); 9503 } 9504 }, 9505 move(container2, anchor2, type) { 9506 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type); 9507 suspense.container = container2; 9508 }, 9509 next() { 9510 return suspense.activeBranch && next(suspense.activeBranch); 9511 }, 9512 registerDep(instance, setupRenderEffect, optimized2) { 9513 const isInPendingSuspense = !!suspense.pendingBranch; 9514 if (isInPendingSuspense) { 9515 suspense.deps++; 9516 } 9517 const hydratedEl = instance.vnode.el; 9518 instance.asyncDep.catch((err) => { 9519 handleError(err, instance, 0); 9520 }).then((asyncSetupResult) => { 9521 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { 9522 return; 9523 } 9524 instance.asyncResolved = true; 9525 const { vnode: vnode2 } = instance; 9526 { 9527 pushWarningContext(vnode2); 9528 } 9529 handleSetupResult(instance, asyncSetupResult, false); 9530 if (hydratedEl) { 9531 vnode2.el = hydratedEl; 9532 } 9533 const placeholder = !hydratedEl && instance.subTree.el; 9534 setupRenderEffect( 9535 instance, 9536 vnode2, 9537 // component may have been moved before resolve. 9538 // if this is not a hydration, instance.subTree will be the comment 9539 // placeholder. 9540 parentNode(hydratedEl || instance.subTree.el), 9541 // anchor will not be used if this is hydration, so only need to 9542 // consider the comment placeholder case. 9543 hydratedEl ? null : next(instance.subTree), 9544 suspense, 9545 namespace, 9546 optimized2 9547 ); 9548 if (placeholder) { 9549 vnode2.placeholder = null; 9550 remove(placeholder); 9551 } 9552 updateHOCHostEl(instance, vnode2.el); 9553 { 9554 popWarningContext(); 9555 } 9556 if (isInPendingSuspense && --suspense.deps === 0) { 9557 suspense.resolve(); 9558 } 9559 }); 9560 }, 9561 unmount(parentSuspense2, doRemove) { 9562 suspense.isUnmounted = true; 9563 if (suspense.activeBranch) { 9564 unmount( 9565 suspense.activeBranch, 9566 parentComponent, 9567 parentSuspense2, 9568 doRemove 9569 ); 9570 } 9571 if (suspense.pendingBranch) { 9572 unmount( 9573 suspense.pendingBranch, 9574 parentComponent, 9575 parentSuspense2, 9576 doRemove 9577 ); 9578 } 9579 } 9580 }; 9581 return suspense; 9582 } 9583 function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) { 9584 const suspense = vnode.suspense = createSuspenseBoundary( 9585 vnode, 9586 parentSuspense, 9587 parentComponent, 9588 node.parentNode, 9589 // eslint-disable-next-line no-restricted-globals 9590 document.createElement("div"), 9591 null, 9592 namespace, 9593 slotScopeIds, 9594 optimized, 9595 rendererInternals, 9596 true 9597 ); 9598 const result = hydrateNode( 9599 node, 9600 suspense.pendingBranch = vnode.ssContent, 9601 parentComponent, 9602 suspense, 9603 slotScopeIds, 9604 optimized 9605 ); 9606 if (suspense.deps === 0) { 9607 suspense.resolve(false, true); 9608 } 9609 return result; 9610 } 9611 function normalizeSuspenseChildren(vnode) { 9612 const { shapeFlag, children } = vnode; 9613 const isSlotChildren = shapeFlag & 32; 9614 vnode.ssContent = normalizeSuspenseSlot( 9615 isSlotChildren ? children.default : children 9616 ); 9617 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); 9618 } 9619 function normalizeSuspenseSlot(s) { 9620 let block; 9621 if (isFunction(s)) { 9622 const trackBlock = isBlockTreeEnabled && s._c; 9623 if (trackBlock) { 9624 s._d = false; 9625 openBlock(); 9626 } 9627 s = s(); 9628 if (trackBlock) { 9629 s._d = true; 9630 block = currentBlock; 9631 closeBlock(); 9632 } 9633 } 9634 if (isArray(s)) { 9635 const singleChild = filterSingleRoot(s); 9636 if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) { 9637 warn$1(`<Suspense> slots expect a single root node.`); 9638 } 9639 s = singleChild; 9640 } 9641 s = normalizeVNode(s); 9642 if (block && !s.dynamicChildren) { 9643 s.dynamicChildren = block.filter((c) => c !== s); 9644 } 9645 return s; 9646 } 9647 function queueEffectWithSuspense(fn, suspense) { 9648 if (suspense && suspense.pendingBranch) { 9649 if (isArray(fn)) { 9650 suspense.effects.push(...fn); 9651 } else { 9652 suspense.effects.push(fn); 9653 } 9654 } else { 9655 queuePostFlushCb(fn); 9656 } 9657 } 9658 function setActiveBranch(suspense, branch) { 9659 suspense.activeBranch = branch; 9660 const { vnode, parentComponent } = suspense; 9661 let el = branch.el; 9662 while (!el && branch.component) { 9663 branch = branch.component.subTree; 9664 el = branch.el; 9665 } 9666 vnode.el = el; 9667 if (parentComponent && parentComponent.subTree === vnode) { 9668 parentComponent.vnode.el = el; 9669 updateHOCHostEl(parentComponent, el); 9670 } 9671 } 9672 function isVNodeSuspensible(vnode) { 9673 const suspensible = vnode.props && vnode.props.suspensible; 9674 return suspensible != null && suspensible !== false; 9675 } 9676 9677 const Fragment = /* @__PURE__ */ Symbol.for("v-fgt"); 9678 const Text = /* @__PURE__ */ Symbol.for("v-txt"); 9679 const Comment = /* @__PURE__ */ Symbol.for("v-cmt"); 9680 const Static = /* @__PURE__ */ Symbol.for("v-stc"); 9681 const blockStack = []; 9682 let currentBlock = null; 9683 function openBlock(disableTracking = false) { 9684 blockStack.push(currentBlock = disableTracking ? null : []); 9685 } 9686 function closeBlock() { 9687 blockStack.pop(); 9688 currentBlock = blockStack[blockStack.length - 1] || null; 9689 } 9690 let isBlockTreeEnabled = 1; 9691 function setBlockTracking(value, inVOnce = false) { 9692 isBlockTreeEnabled += value; 9693 if (value < 0 && currentBlock && inVOnce) { 9694 currentBlock.hasOnce = true; 9695 } 9696 } 9697 function setupBlock(vnode) { 9698 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null; 9699 closeBlock(); 9700 if (isBlockTreeEnabled > 0 && currentBlock) { 9701 currentBlock.push(vnode); 9702 } 9703 return vnode; 9704 } 9705 function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) { 9706 return setupBlock( 9707 createBaseVNode( 9708 type, 9709 props, 9710 children, 9711 patchFlag, 9712 dynamicProps, 9713 shapeFlag, 9714 true 9715 ) 9716 ); 9717 } 9718 function createBlock(type, props, children, patchFlag, dynamicProps) { 9719 return setupBlock( 9720 createVNode( 9721 type, 9722 props, 9723 children, 9724 patchFlag, 9725 dynamicProps, 9726 true 9727 ) 9728 ); 9729 } 9730 function isVNode(value) { 9731 return value ? value.__v_isVNode === true : false; 9732 } 9733 function isSameVNodeType(n1, n2) { 9734 if (n2.shapeFlag & 6 && n1.component) { 9735 const dirtyInstances = hmrDirtyComponents.get(n2.type); 9736 if (dirtyInstances && dirtyInstances.has(n1.component)) { 9737 n1.shapeFlag &= -257; 9738 n2.shapeFlag &= -513; 9739 return false; 9740 } 9741 } 9742 return n1.type === n2.type && n1.key === n2.key; 9743 } 9744 let vnodeArgsTransformer; 9745 function transformVNodeArgs(transformer) { 9746 vnodeArgsTransformer = transformer; 9747 } 9748 const createVNodeWithArgsTransform = (...args) => { 9749 return _createVNode( 9750 ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args 9751 ); 9752 }; 9753 const normalizeKey = ({ key }) => key != null ? key : null; 9754 const normalizeRef = ({ 9755 ref, 9756 ref_key, 9757 ref_for 9758 }) => { 9759 if (typeof ref === "number") { 9760 ref = "" + ref; 9761 } 9762 return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null; 9763 }; 9764 function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) { 9765 const vnode = { 9766 __v_isVNode: true, 9767 __v_skip: true, 9768 type, 9769 props, 9770 key: props && normalizeKey(props), 9771 ref: props && normalizeRef(props), 9772 scopeId: currentScopeId, 9773 slotScopeIds: null, 9774 children, 9775 component: null, 9776 suspense: null, 9777 ssContent: null, 9778 ssFallback: null, 9779 dirs: null, 9780 transition: null, 9781 el: null, 9782 anchor: null, 9783 target: null, 9784 targetStart: null, 9785 targetAnchor: null, 9786 staticCount: 0, 9787 shapeFlag, 9788 patchFlag, 9789 dynamicProps, 9790 dynamicChildren: null, 9791 appContext: null, 9792 ctx: currentRenderingInstance 9793 }; 9794 if (needFullChildrenNormalization) { 9795 normalizeChildren(vnode, children); 9796 if (shapeFlag & 128) { 9797 type.normalize(vnode); 9798 } 9799 } else if (children) { 9800 vnode.shapeFlag |= isString(children) ? 8 : 16; 9801 } 9802 if (vnode.key !== vnode.key) { 9803 warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type); 9804 } 9805 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself 9806 !isBlockNode && // has current parent block 9807 currentBlock && // presence of a patch flag indicates this node needs patching on updates. 9808 // component nodes also should always be patched, because even if the 9809 // component doesn't need to update, it needs to persist the instance on to 9810 // the next vnode so that it can be properly unmounted later. 9811 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the 9812 // vnode should not be considered dynamic due to handler caching. 9813 vnode.patchFlag !== 32) { 9814 currentBlock.push(vnode); 9815 } 9816 return vnode; 9817 } 9818 const createVNode = createVNodeWithArgsTransform ; 9819 function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) { 9820 if (!type || type === NULL_DYNAMIC_COMPONENT) { 9821 if (!type) { 9822 warn$1(`Invalid vnode type when creating vnode: ${type}.`); 9823 } 9824 type = Comment; 9825 } 9826 if (isVNode(type)) { 9827 const cloned = cloneVNode( 9828 type, 9829 props, 9830 true 9831 /* mergeRef: true */ 9832 ); 9833 if (children) { 9834 normalizeChildren(cloned, children); 9835 } 9836 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) { 9837 if (cloned.shapeFlag & 6) { 9838 currentBlock[currentBlock.indexOf(type)] = cloned; 9839 } else { 9840 currentBlock.push(cloned); 9841 } 9842 } 9843 cloned.patchFlag = -2; 9844 return cloned; 9845 } 9846 if (isClassComponent(type)) { 9847 type = type.__vccOpts; 9848 } 9849 if (props) { 9850 props = guardReactiveProps(props); 9851 let { class: klass, style } = props; 9852 if (klass && !isString(klass)) { 9853 props.class = normalizeClass(klass); 9854 } 9855 if (isObject(style)) { 9856 if (isProxy(style) && !isArray(style)) { 9857 style = extend({}, style); 9858 } 9859 props.style = normalizeStyle(style); 9860 } 9861 } 9862 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0; 9863 if (shapeFlag & 4 && isProxy(type)) { 9864 type = toRaw(type); 9865 warn$1( 9866 `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\`.`, 9867 ` 9868 Component that was made reactive: `, 9869 type 9870 ); 9871 } 9872 return createBaseVNode( 9873 type, 9874 props, 9875 children, 9876 patchFlag, 9877 dynamicProps, 9878 shapeFlag, 9879 isBlockNode, 9880 true 9881 ); 9882 } 9883 function guardReactiveProps(props) { 9884 if (!props) return null; 9885 return isProxy(props) || isInternalObject(props) ? extend({}, props) : props; 9886 } 9887 function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) { 9888 const { props, ref, patchFlag, children, transition } = vnode; 9889 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props; 9890 const cloned = { 9891 __v_isVNode: true, 9892 __v_skip: true, 9893 type: vnode.type, 9894 props: mergedProps, 9895 key: mergedProps && normalizeKey(mergedProps), 9896 ref: extraProps && extraProps.ref ? ( 9897 // #2078 in the case of <component :is="vnode" ref="extra"/> 9898 // if the vnode itself already has a ref, cloneVNode will need to merge 9899 // the refs so the single vnode can be set on multiple refs 9900 mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) 9901 ) : ref, 9902 scopeId: vnode.scopeId, 9903 slotScopeIds: vnode.slotScopeIds, 9904 children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children, 9905 target: vnode.target, 9906 targetStart: vnode.targetStart, 9907 targetAnchor: vnode.targetAnchor, 9908 staticCount: vnode.staticCount, 9909 shapeFlag: vnode.shapeFlag, 9910 // if the vnode is cloned with extra props, we can no longer assume its 9911 // existing patch flag to be reliable and need to add the FULL_PROPS flag. 9912 // note: preserve flag for fragments since they use the flag for children 9913 // fast paths only. 9914 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag, 9915 dynamicProps: vnode.dynamicProps, 9916 dynamicChildren: vnode.dynamicChildren, 9917 appContext: vnode.appContext, 9918 dirs: vnode.dirs, 9919 transition, 9920 // These should technically only be non-null on mounted VNodes. However, 9921 // they *should* be copied for kept-alive vnodes. So we just always copy 9922 // them since them being non-null during a mount doesn't affect the logic as 9923 // they will simply be overwritten. 9924 component: vnode.component, 9925 suspense: vnode.suspense, 9926 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent), 9927 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback), 9928 placeholder: vnode.placeholder, 9929 el: vnode.el, 9930 anchor: vnode.anchor, 9931 ctx: vnode.ctx, 9932 ce: vnode.ce 9933 }; 9934 if (transition && cloneTransition) { 9935 setTransitionHooks( 9936 cloned, 9937 transition.clone(cloned) 9938 ); 9939 } 9940 return cloned; 9941 } 9942 function deepCloneVNode(vnode) { 9943 const cloned = cloneVNode(vnode); 9944 if (isArray(vnode.children)) { 9945 cloned.children = vnode.children.map(deepCloneVNode); 9946 } 9947 return cloned; 9948 } 9949 function createTextVNode(text = " ", flag = 0) { 9950 return createVNode(Text, null, text, flag); 9951 } 9952 function createStaticVNode(content, numberOfNodes) { 9953 const vnode = createVNode(Static, null, content); 9954 vnode.staticCount = numberOfNodes; 9955 return vnode; 9956 } 9957 function createCommentVNode(text = "", asBlock = false) { 9958 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text); 9959 } 9960 function normalizeVNode(child) { 9961 if (child == null || typeof child === "boolean") { 9962 return createVNode(Comment); 9963 } else if (isArray(child)) { 9964 return createVNode( 9965 Fragment, 9966 null, 9967 // #3666, avoid reference pollution when reusing vnode 9968 child.slice() 9969 ); 9970 } else if (isVNode(child)) { 9971 return cloneIfMounted(child); 9972 } else { 9973 return createVNode(Text, null, String(child)); 9974 } 9975 } 9976 function cloneIfMounted(child) { 9977 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child); 9978 } 9979 function normalizeChildren(vnode, children) { 9980 let type = 0; 9981 const { shapeFlag } = vnode; 9982 if (children == null) { 9983 children = null; 9984 } else if (isArray(children)) { 9985 type = 16; 9986 } else if (typeof children === "object") { 9987 if (shapeFlag & (1 | 64)) { 9988 const slot = children.default; 9989 if (slot) { 9990 slot._c && (slot._d = false); 9991 normalizeChildren(vnode, slot()); 9992 slot._c && (slot._d = true); 9993 } 9994 return; 9995 } else { 9996 type = 32; 9997 const slotFlag = children._; 9998 if (!slotFlag && !isInternalObject(children)) { 9999 children._ctx = currentRenderingInstance; 10000 } else if (slotFlag === 3 && currentRenderingInstance) { 10001 if (currentRenderingInstance.slots._ === 1) { 10002 children._ = 1; 10003 } else { 10004 children._ = 2; 10005 vnode.patchFlag |= 1024; 10006 } 10007 } 10008 } 10009 } else if (isFunction(children)) { 10010 children = { default: children, _ctx: currentRenderingInstance }; 10011 type = 32; 10012 } else { 10013 children = String(children); 10014 if (shapeFlag & 64) { 10015 type = 16; 10016 children = [createTextVNode(children)]; 10017 } else { 10018 type = 8; 10019 } 10020 } 10021 vnode.children = children; 10022 vnode.shapeFlag |= type; 10023 } 10024 function mergeProps(...args) { 10025 const ret = {}; 10026 for (let i = 0; i < args.length; i++) { 10027 const toMerge = args[i]; 10028 for (const key in toMerge) { 10029 if (key === "class") { 10030 if (ret.class !== toMerge.class) { 10031 ret.class = normalizeClass([ret.class, toMerge.class]); 10032 } 10033 } else if (key === "style") { 10034 ret.style = normalizeStyle([ret.style, toMerge.style]); 10035 } else if (isOn(key)) { 10036 const existing = ret[key]; 10037 const incoming = toMerge[key]; 10038 if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) { 10039 ret[key] = existing ? [].concat(existing, incoming) : incoming; 10040 } 10041 } else if (key !== "") {
vendor: 8,441 bytes, lines 10042-10290
10042 ret[key] = toMerge[key]; 10043 } 10044 } 10045 } 10046 return ret; 10047 } 10048 function invokeVNodeHook(hook, instance, vnode, prevVNode = null) { 10049 callWithAsyncErrorHandling(hook, instance, 7, [ 10050 vnode, 10051 prevVNode 10052 ]); 10053 } 10054 10055 const emptyAppContext = createAppContext(); 10056 let uid = 0; 10057 function createComponentInstance(vnode, parent, suspense) { 10058 const type = vnode.type; 10059 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext; 10060 const instance = { 10061 uid: uid++, 10062 vnode, 10063 type, 10064 parent, 10065 appContext, 10066 root: null, 10067 // to be immediately set 10068 next: null, 10069 subTree: null, 10070 // will be set synchronously right after creation 10071 effect: null, 10072 update: null, 10073 // will be set synchronously right after creation 10074 job: null, 10075 scope: new EffectScope( 10076 true 10077 /* detached */ 10078 ), 10079 render: null, 10080 proxy: null, 10081 exposed: null, 10082 exposeProxy: null, 10083 withProxy: null, 10084 provides: parent ? parent.provides : Object.create(appContext.provides), 10085 ids: parent ? parent.ids : ["", 0, 0], 10086 accessCache: null, 10087 renderCache: [], 10088 // local resolved assets 10089 components: null, 10090 directives: null, 10091 // resolved props and emits options 10092 propsOptions: normalizePropsOptions(type, appContext), 10093 emitsOptions: normalizeEmitsOptions(type, appContext), 10094 // emit 10095 emit: null, 10096 // to be set immediately 10097 emitted: null, 10098 // props default value 10099 propsDefaults: EMPTY_OBJ, 10100 // inheritAttrs 10101 inheritAttrs: type.inheritAttrs, 10102 // state 10103 ctx: EMPTY_OBJ, 10104 data: EMPTY_OBJ, 10105 props: EMPTY_OBJ, 10106 attrs: EMPTY_OBJ, 10107 slots: EMPTY_OBJ, 10108 refs: EMPTY_OBJ, 10109 setupState: EMPTY_OBJ, 10110 setupContext: null, 10111 // suspense related 10112 suspense, 10113 suspenseId: suspense ? suspense.pendingId : 0, 10114 asyncDep: null, 10115 asyncResolved: false, 10116 // lifecycle hooks 10117 // not using enums here because it results in computed properties 10118 isMounted: false, 10119 isUnmounted: false, 10120 isDeactivated: false, 10121 bc: null, 10122 c: null, 10123 bm: null, 10124 m: null, 10125 bu: null, 10126 u: null, 10127 um: null, 10128 bum: null, 10129 da: null, 10130 a: null, 10131 rtg: null, 10132 rtc: null, 10133 ec: null, 10134 sp: null 10135 }; 10136 { 10137 instance.ctx = createDevRenderContext(instance); 10138 } 10139 instance.root = parent ? parent.root : instance; 10140 instance.emit = emit.bind(null, instance); 10141 if (vnode.ce) { 10142 vnode.ce(instance); 10143 } 10144 return instance; 10145 } 10146 let currentInstance = null; 10147 const getCurrentInstance = () => currentInstance || currentRenderingInstance; 10148 let internalSetCurrentInstance; 10149 let setInSSRSetupState; 10150 { 10151 internalSetCurrentInstance = (i) => { 10152 currentInstance = i; 10153 }; 10154 setInSSRSetupState = (v) => { 10155 isInSSRComponentSetup = v; 10156 }; 10157 } 10158 const setCurrentInstance = (instance) => { 10159 const prev = currentInstance; 10160 internalSetCurrentInstance(instance); 10161 instance.scope.on(); 10162 return () => { 10163 instance.scope.off(); 10164 internalSetCurrentInstance(prev); 10165 }; 10166 }; 10167 const unsetCurrentInstance = () => { 10168 currentInstance && currentInstance.scope.off(); 10169 internalSetCurrentInstance(null); 10170 }; 10171 const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component"); 10172 function validateComponentName(name, { isNativeTag }) { 10173 if (isBuiltInTag(name) || isNativeTag(name)) { 10174 warn$1( 10175 "Do not use built-in or reserved HTML elements as component id: " + name 10176 ); 10177 } 10178 } 10179 function isStatefulComponent(instance) { 10180 return instance.vnode.shapeFlag & 4; 10181 } 10182 let isInSSRComponentSetup = false; 10183 function setupComponent(instance, isSSR = false, optimized = false) { 10184 isSSR && setInSSRSetupState(isSSR); 10185 const { props, children } = instance.vnode; 10186 const isStateful = isStatefulComponent(instance); 10187 initProps(instance, props, isStateful, isSSR); 10188 initSlots(instance, children, optimized || isSSR); 10189 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; 10190 isSSR && setInSSRSetupState(false); 10191 return setupResult; 10192 } 10193 function setupStatefulComponent(instance, isSSR) { 10194 const Component = instance.type; 10195 { 10196 if (Component.name) { 10197 validateComponentName(Component.name, instance.appContext.config); 10198 } 10199 if (Component.components) { 10200 const names = Object.keys(Component.components); 10201 for (let i = 0; i < names.length; i++) { 10202 validateComponentName(names[i], instance.appContext.config); 10203 } 10204 } 10205 if (Component.directives) { 10206 const names = Object.keys(Component.directives); 10207 for (let i = 0; i < names.length; i++) { 10208 validateDirectiveName(names[i]); 10209 } 10210 } 10211 if (Component.compilerOptions && isRuntimeOnly()) { 10212 warn$1( 10213 `"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.` 10214 ); 10215 } 10216 } 10217 instance.accessCache = /* @__PURE__ */ Object.create(null); 10218 instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers); 10219 { 10220 exposePropsOnRenderContext(instance); 10221 } 10222 const { setup } = Component; 10223 if (setup) { 10224 pauseTracking(); 10225 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null; 10226 const reset = setCurrentInstance(instance); 10227 const setupResult = callWithErrorHandling( 10228 setup, 10229 instance, 10230 0, 10231 [ 10232 shallowReadonly(instance.props) , 10233 setupContext 10234 ] 10235 ); 10236 const isAsyncSetup = isPromise(setupResult); 10237 resetTracking(); 10238 reset(); 10239 if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) { 10240 markAsyncBoundary(instance); 10241 } 10242 if (isAsyncSetup) { 10243 setupResult.then(unsetCurrentInstance, unsetCurrentInstance); 10244 if (isSSR) { 10245 return setupResult.then((resolvedResult) => { 10246 handleSetupResult(instance, resolvedResult, isSSR); 10247 }).catch((e) => { 10248 handleError(e, instance, 0); 10249 }); 10250 } else { 10251 instance.asyncDep = setupResult; 10252 if (!instance.suspense) { 10253 const name = formatComponentName(instance, Component); 10254 warn$1( 10255 `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.` 10256 ); 10257 } 10258 } 10259 } else { 10260 handleSetupResult(instance, setupResult, isSSR); 10261 } 10262 } else { 10263 finishComponentSetup(instance, isSSR); 10264 } 10265 } 10266 function handleSetupResult(instance, setupResult, isSSR) { 10267 if (isFunction(setupResult)) { 10268 { 10269 instance.render = setupResult; 10270 } 10271 } else if (isObject(setupResult)) { 10272 if (isVNode(setupResult)) { 10273 warn$1( 10274 `setup() should not return VNodes directly - return a render function instead.` 10275 ); 10276 } 10277 { 10278 instance.devtoolsRawSetupState = setupResult; 10279 } 10280 instance.setupState = proxyRefs(setupResult); 10281 { 10282 exposeSetupStateOnRenderContext(instance); 10283 } 10284 } else if (setupResult !== void 0) { 10285 warn$1( 10286 `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}` 10287 ); 10288 } 10289 finishComponentSetup(instance, isSSR); 10290 }
vendor: 12,702 bytes, lines 10291-10684
10291 let compile$1; 10292 let installWithProxy; 10293 function registerRuntimeCompiler(_compile) { 10294 compile$1 = _compile; 10295 installWithProxy = (i) => { 10296 if (i.render._rc) { 10297 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers); 10298 } 10299 }; 10300 } 10301 const isRuntimeOnly = () => !compile$1; 10302 function finishComponentSetup(instance, isSSR, skipOptions) { 10303 const Component = instance.type; 10304 if (!instance.render) { 10305 if (!isSSR && compile$1 && !Component.render) { 10306 const template = Component.template || resolveMergedOptions(instance).template; 10307 if (template) { 10308 { 10309 startMeasure(instance, `compile`); 10310 } 10311 const { isCustomElement, compilerOptions } = instance.appContext.config; 10312 const { delimiters, compilerOptions: componentCompilerOptions } = Component; 10313 const finalCompilerOptions = extend( 10314 extend( 10315 { 10316 isCustomElement, 10317 delimiters 10318 }, 10319 compilerOptions 10320 ), 10321 componentCompilerOptions 10322 ); 10323 Component.render = compile$1(template, finalCompilerOptions); 10324 { 10325 endMeasure(instance, `compile`); 10326 } 10327 } 10328 } 10329 instance.render = Component.render || NOOP; 10330 if (installWithProxy) { 10331 installWithProxy(instance); 10332 } 10333 } 10334 { 10335 const reset = setCurrentInstance(instance); 10336 pauseTracking(); 10337 try { 10338 applyOptions(instance); 10339 } finally { 10340 resetTracking(); 10341 reset(); 10342 } 10343 } 10344 if (!Component.render && instance.render === NOOP && !isSSR) { 10345 if (!compile$1 && Component.template) { 10346 warn$1( 10347 `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` ) 10348 ); 10349 } else { 10350 warn$1(`Component is missing template or render function: `, Component); 10351 } 10352 } 10353 } 10354 const attrsProxyHandlers = { 10355 get(target, key) { 10356 markAttrsAccessed(); 10357 track(target, "get", ""); 10358 return target[key]; 10359 }, 10360 set() { 10361 warn$1(`setupContext.attrs is readonly.`); 10362 return false; 10363 }, 10364 deleteProperty() { 10365 warn$1(`setupContext.attrs is readonly.`); 10366 return false; 10367 } 10368 } ; 10369 function getSlotsProxy(instance) { 10370 return new Proxy(instance.slots, { 10371 get(target, key) { 10372 track(instance, "get", "$slots"); 10373 return target[key]; 10374 } 10375 }); 10376 } 10377 function createSetupContext(instance) { 10378 const expose = (exposed) => { 10379 { 10380 if (instance.exposed) { 10381 warn$1(`expose() should be called only once per setup().`); 10382 } 10383 if (exposed != null) { 10384 let exposedType = typeof exposed; 10385 if (exposedType === "object") { 10386 if (isArray(exposed)) { 10387 exposedType = "array"; 10388 } else if (isRef(exposed)) { 10389 exposedType = "ref"; 10390 } 10391 } 10392 if (exposedType !== "object") { 10393 warn$1( 10394 `expose() should be passed a plain object, received ${exposedType}.` 10395 ); 10396 } 10397 } 10398 } 10399 instance.exposed = exposed || {}; 10400 }; 10401 { 10402 let attrsProxy; 10403 let slotsProxy; 10404 return Object.freeze({ 10405 get attrs() { 10406 return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers)); 10407 }, 10408 get slots() { 10409 return slotsProxy || (slotsProxy = getSlotsProxy(instance)); 10410 }, 10411 get emit() { 10412 return (event, ...args) => instance.emit(event, ...args); 10413 }, 10414 expose 10415 }); 10416 } 10417 } 10418 function getComponentPublicInstance(instance) { 10419 if (instance.exposed) { 10420 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), { 10421 get(target, key) { 10422 if (key in target) { 10423 return target[key]; 10424 } else if (key in publicPropertiesMap) { 10425 return publicPropertiesMap[key](instance); 10426 } 10427 }, 10428 has(target, key) { 10429 return key in target || key in publicPropertiesMap; 10430 } 10431 })); 10432 } else { 10433 return instance.proxy; 10434 } 10435 } 10436 const classifyRE = /(?:^|[-_])\w/g; 10437 const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, ""); 10438 function getComponentName(Component, includeInferred = true) { 10439 return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; 10440 } 10441 function formatComponentName(instance, Component, isRoot = false) { 10442 let name = getComponentName(Component); 10443 if (!name && Component.__file) { 10444 const match = Component.__file.match(/([^/\\]+)\.\w+$/); 10445 if (match) { 10446 name = match[1]; 10447 } 10448 } 10449 if (!name && instance) { 10450 const inferFromRegistry = (registry) => { 10451 for (const key in registry) { 10452 if (registry[key] === Component) { 10453 return key; 10454 } 10455 } 10456 }; 10457 name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry( 10458 instance.parent.type.components 10459 ) || inferFromRegistry(instance.appContext.components); 10460 } 10461 return name ? classify(name) : isRoot ? `App` : `Anonymous`; 10462 } 10463 function isClassComponent(value) { 10464 return isFunction(value) && "__vccOpts" in value; 10465 } 10466 10467 const computed = (getterOrOptions, debugOptions) => { 10468 const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); 10469 { 10470 const i = getCurrentInstance(); 10471 if (i && i.appContext.config.warnRecursiveComputed) { 10472 c._warnRecursive = true; 10473 } 10474 } 10475 return c; 10476 }; 10477 10478 function h(type, propsOrChildren, children) { 10479 try { 10480 setBlockTracking(-1); 10481 const l = arguments.length; 10482 if (l === 2) { 10483 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) { 10484 if (isVNode(propsOrChildren)) { 10485 return createVNode(type, null, [propsOrChildren]); 10486 } 10487 return createVNode(type, propsOrChildren); 10488 } else { 10489 return createVNode(type, null, propsOrChildren); 10490 } 10491 } else { 10492 if (l > 3) { 10493 children = Array.prototype.slice.call(arguments, 2); 10494 } else if (l === 3 && isVNode(children)) { 10495 children = [children]; 10496 } 10497 return createVNode(type, propsOrChildren, children); 10498 } 10499 } finally { 10500 setBlockTracking(1); 10501 } 10502 } 10503 10504 function initCustomFormatter() { 10505 if (typeof window === "undefined") { 10506 return; 10507 } 10508 const vueStyle = { style: "color:#3ba776" }; 10509 const numberStyle = { style: "color:#1677ff" }; 10510 const stringStyle = { style: "color:#f5222d" }; 10511 const keywordStyle = { style: "color:#eb2f96" }; 10512 const formatter = { 10513 __vue_custom_formatter: true, 10514 header(obj) { 10515 if (!isObject(obj)) { 10516 return null; 10517 } 10518 if (obj.__isVue) { 10519 return ["div", vueStyle, `VueInstance`]; 10520 } else if (isRef(obj)) { 10521 pauseTracking(); 10522 const value = obj.value; 10523 resetTracking(); 10524 return [ 10525 "div", 10526 {}, 10527 ["span", vueStyle, genRefFlag(obj)], 10528 "<", 10529 formatValue(value), 10530 `>` 10531 ]; 10532 } else if (isReactive(obj)) { 10533 return [ 10534 "div", 10535 {}, 10536 ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"], 10537 "<", 10538 formatValue(obj), 10539 `>${isReadonly(obj) ? ` (readonly)` : ``}` 10540 ]; 10541 } else if (isReadonly(obj)) { 10542 return [ 10543 "div", 10544 {}, 10545 ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"], 10546 "<", 10547 formatValue(obj), 10548 ">" 10549 ]; 10550 } 10551 return null; 10552 }, 10553 hasBody(obj) { 10554 return obj && obj.__isVue; 10555 }, 10556 body(obj) { 10557 if (obj && obj.__isVue) { 10558 return [ 10559 "div", 10560 {}, 10561 ...formatInstance(obj.$) 10562 ]; 10563 } 10564 } 10565 }; 10566 function formatInstance(instance) { 10567 const blocks = []; 10568 if (instance.type.props && instance.props) { 10569 blocks.push(createInstanceBlock("props", toRaw(instance.props))); 10570 } 10571 if (instance.setupState !== EMPTY_OBJ) { 10572 blocks.push(createInstanceBlock("setup", instance.setupState)); 10573 } 10574 if (instance.data !== EMPTY_OBJ) { 10575 blocks.push(createInstanceBlock("data", toRaw(instance.data))); 10576 } 10577 const computed = extractKeys(instance, "computed"); 10578 if (computed) { 10579 blocks.push(createInstanceBlock("computed", computed)); 10580 } 10581 const injected = extractKeys(instance, "inject"); 10582 if (injected) { 10583 blocks.push(createInstanceBlock("injected", injected)); 10584 } 10585 blocks.push([ 10586 "div", 10587 {}, 10588 [ 10589 "span", 10590 { 10591 style: keywordStyle.style + ";opacity:0.66" 10592 }, 10593 "$ (internal): " 10594 ], 10595 ["object", { object: instance }] 10596 ]); 10597 return blocks; 10598 } 10599 function createInstanceBlock(type, target) { 10600 target = extend({}, target); 10601 if (!Object.keys(target).length) { 10602 return ["span", {}]; 10603 } 10604 return [ 10605 "div", 10606 { style: "line-height:1.25em;margin-bottom:0.6em" }, 10607 [ 10608 "div", 10609 { 10610 style: "color:#476582" 10611 }, 10612 type 10613 ], 10614 [ 10615 "div", 10616 { 10617 style: "padding-left:1.25em" 10618 }, 10619 ...Object.keys(target).map((key) => { 10620 return [ 10621 "div", 10622 {}, 10623 ["span", keywordStyle, key + ": "], 10624 formatValue(target[key], false) 10625 ]; 10626 }) 10627 ] 10628 ]; 10629 } 10630 function formatValue(v, asRaw = true) { 10631 if (typeof v === "number") { 10632 return ["span", numberStyle, v]; 10633 } else if (typeof v === "string") { 10634 return ["span", stringStyle, JSON.stringify(v)]; 10635 } else if (typeof v === "boolean") { 10636 return ["span", keywordStyle, v]; 10637 } else if (isObject(v)) { 10638 return ["object", { object: asRaw ? toRaw(v) : v }]; 10639 } else { 10640 return ["span", stringStyle, String(v)]; 10641 } 10642 } 10643 function extractKeys(instance, type) { 10644 const Comp = instance.type; 10645 if (isFunction(Comp)) { 10646 return; 10647 } 10648 const extracted = {}; 10649 for (const key in instance.ctx) { 10650 if (isKeyOfType(Comp, key, type)) { 10651 extracted[key] = instance.ctx[key]; 10652 } 10653 } 10654 return extracted; 10655 } 10656 function isKeyOfType(Comp, key, type) { 10657 const opts = Comp[type]; 10658 if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) { 10659 return true; 10660 } 10661 if (Comp.extends && isKeyOfType(Comp.extends, key, type)) { 10662 return true; 10663 } 10664 if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) { 10665 return true; 10666 } 10667 } 10668 function genRefFlag(v) { 10669 if (isShallow(v)) { 10670 return `ShallowRef`; 10671 } 10672 if (v.effect) { 10673 return `ComputedRef`; 10674 } 10675 return `Ref`; 10676 } 10677 if (window.devtoolsFormatters) { 10678 window.devtoolsFormatters.push(formatter); 10679 } else { 10680 window.devtoolsFormatters = [formatter]; 10681 } 10682 } 10683 10684 function withMemo(memo, render, cache, index) {
vendor: 1,585 bytes, lines 10685-10734
10685 const cached = cache[index]; 10686 if (cached && isMemoSame(cached, memo)) { 10687 return cached; 10688 } 10689 const ret = render(); 10690 ret.memo = memo.slice(); 10691 ret.cacheIndex = index; 10692 return cache[index] = ret; 10693 } 10694 function isMemoSame(cached, memo) { 10695 const prev = cached.memo; 10696 if (prev.length != memo.length) { 10697 return false; 10698 } 10699 for (let i = 0; i < prev.length; i++) { 10700 if (hasChanged(prev[i], memo[i])) { 10701 return false; 10702 } 10703 } 10704 if (isBlockTreeEnabled > 0 && currentBlock) { 10705 currentBlock.push(cached); 10706 } 10707 return true; 10708 } 10709 10710 const version = "3.5.26"; 10711 const warn = warn$1 ; 10712 const ErrorTypeStrings = ErrorTypeStrings$1 ; 10713 const devtools = devtools$1 ; 10714 const setDevtoolsHook = setDevtoolsHook$1 ; 10715 const ssrUtils = null; 10716 const resolveFilter = null; 10717 const compatUtils = null; 10718 const DeprecationTypes = null; 10719 10720 let policy = void 0; 10721 const tt = typeof window !== "undefined" && window.trustedTypes; 10722 if (tt) { 10723 try { 10724 policy = /* @__PURE__ */ tt.createPolicy("vue", { 10725 createHTML: (val) => val 10726 }); 10727 } catch (e) { 10728 warn(`Error creating trusted types policy: ${e}`); 10729 } 10730 } 10731 const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val; 10732 const svgNS = "http://www.w3.org/2000/svg"; 10733 const mathmlNS = "http://www.w3.org/1998/Math/MathML"; 10734 const doc = typeof document !== "undefined" ? document : null;
vendor: 8,458 bytes, lines 10735-10964
10735 const templateContainer = doc && /* @__PURE__ */ doc.createElement("template"); 10736 const nodeOps = { 10737 insert: (child, parent, anchor) => { 10738 parent.insertBefore(child, anchor || null); 10739 }, 10740 remove: (child) => { 10741 const parent = child.parentNode; 10742 if (parent) { 10743 parent.removeChild(child); 10744 } 10745 }, 10746 createElement: (tag, namespace, is, props) => { 10747 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag); 10748 if (tag === "select" && props && props.multiple != null) { 10749 el.setAttribute("multiple", props.multiple); 10750 } 10751 return el; 10752 }, 10753 createText: (text) => doc.createTextNode(text), 10754 createComment: (text) => doc.createComment(text), 10755 setText: (node, text) => { 10756 node.nodeValue = text; 10757 }, 10758 setElementText: (el, text) => { 10759 el.textContent = text; 10760 }, 10761 parentNode: (node) => node.parentNode, 10762 nextSibling: (node) => node.nextSibling, 10763 querySelector: (selector) => doc.querySelector(selector), 10764 setScopeId(el, id) { 10765 el.setAttribute(id, ""); 10766 }, 10767 // __UNSAFE__ 10768 // Reason: innerHTML. 10769 // Static content here can only come from compiled templates. 10770 // As long as the user only uses trusted templates, this is safe. 10771 insertStaticContent(content, parent, anchor, namespace, start, end) { 10772 const before = anchor ? anchor.previousSibling : parent.lastChild; 10773 if (start && (start === end || start.nextSibling)) { 10774 while (true) { 10775 parent.insertBefore(start.cloneNode(true), anchor); 10776 if (start === end || !(start = start.nextSibling)) break; 10777 } 10778 } else { 10779 templateContainer.innerHTML = unsafeToTrustedHTML( 10780 namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content 10781 ); 10782 const template = templateContainer.content; 10783 if (namespace === "svg" || namespace === "mathml") { 10784 const wrapper = template.firstChild; 10785 while (wrapper.firstChild) { 10786 template.appendChild(wrapper.firstChild); 10787 } 10788 template.removeChild(wrapper); 10789 } 10790 parent.insertBefore(template, anchor); 10791 } 10792 return [ 10793 // first 10794 before ? before.nextSibling : parent.firstChild, 10795 // last 10796 anchor ? anchor.previousSibling : parent.lastChild 10797 ]; 10798 } 10799 }; 10800 10801 const TRANSITION$1 = "transition"; 10802 const ANIMATION = "animation"; 10803 const vtcKey = /* @__PURE__ */ Symbol("_vtc"); 10804 const DOMTransitionPropsValidators = { 10805 name: String, 10806 type: String, 10807 css: { 10808 type: Boolean, 10809 default: true 10810 }, 10811 duration: [String, Number, Object], 10812 enterFromClass: String, 10813 enterActiveClass: String, 10814 enterToClass: String, 10815 appearFromClass: String, 10816 appearActiveClass: String, 10817 appearToClass: String, 10818 leaveFromClass: String, 10819 leaveActiveClass: String, 10820 leaveToClass: String 10821 }; 10822 const TransitionPropsValidators = /* @__PURE__ */ extend( 10823 {}, 10824 BaseTransitionPropsValidators, 10825 DOMTransitionPropsValidators 10826 ); 10827 const decorate$1 = (t) => { 10828 t.displayName = "Transition"; 10829 t.props = TransitionPropsValidators; 10830 return t; 10831 }; 10832 const Transition = /* @__PURE__ */ decorate$1( 10833 (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots) 10834 ); 10835 const callHook = (hook, args = []) => { 10836 if (isArray(hook)) { 10837 hook.forEach((h2) => h2(...args)); 10838 } else if (hook) { 10839 hook(...args); 10840 } 10841 }; 10842 const hasExplicitCallback = (hook) => { 10843 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; 10844 }; 10845 function resolveTransitionProps(rawProps) { 10846 const baseProps = {}; 10847 for (const key in rawProps) { 10848 if (!(key in DOMTransitionPropsValidators)) { 10849 baseProps[key] = rawProps[key]; 10850 } 10851 } 10852 if (rawProps.css === false) { 10853 return baseProps; 10854 } 10855 const { 10856 name = "v", 10857 type, 10858 duration, 10859 enterFromClass = `${name}-enter-from`, 10860 enterActiveClass = `${name}-enter-active`, 10861 enterToClass = `${name}-enter-to`, 10862 appearFromClass = enterFromClass, 10863 appearActiveClass = enterActiveClass, 10864 appearToClass = enterToClass, 10865 leaveFromClass = `${name}-leave-from`, 10866 leaveActiveClass = `${name}-leave-active`, 10867 leaveToClass = `${name}-leave-to` 10868 } = rawProps; 10869 const durations = normalizeDuration(duration); 10870 const enterDuration = durations && durations[0]; 10871 const leaveDuration = durations && durations[1]; 10872 const { 10873 onBeforeEnter, 10874 onEnter, 10875 onEnterCancelled, 10876 onLeave, 10877 onLeaveCancelled, 10878 onBeforeAppear = onBeforeEnter, 10879 onAppear = onEnter, 10880 onAppearCancelled = onEnterCancelled 10881 } = baseProps; 10882 const finishEnter = (el, isAppear, done, isCancelled) => { 10883 el._enterCancelled = isCancelled; 10884 removeTransitionClass(el, isAppear ? appearToClass : enterToClass); 10885 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass); 10886 done && done(); 10887 }; 10888 const finishLeave = (el, done) => { 10889 el._isLeaving = false; 10890 removeTransitionClass(el, leaveFromClass); 10891 removeTransitionClass(el, leaveToClass); 10892 removeTransitionClass(el, leaveActiveClass); 10893 done && done(); 10894 }; 10895 const makeEnterHook = (isAppear) => { 10896 return (el, done) => { 10897 const hook = isAppear ? onAppear : onEnter; 10898 const resolve = () => finishEnter(el, isAppear, done); 10899 callHook(hook, [el, resolve]); 10900 nextFrame(() => { 10901 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass); 10902 addTransitionClass(el, isAppear ? appearToClass : enterToClass); 10903 if (!hasExplicitCallback(hook)) { 10904 whenTransitionEnds(el, type, enterDuration, resolve); 10905 } 10906 }); 10907 }; 10908 }; 10909 return extend(baseProps, { 10910 onBeforeEnter(el) { 10911 callHook(onBeforeEnter, [el]); 10912 addTransitionClass(el, enterFromClass); 10913 addTransitionClass(el, enterActiveClass); 10914 }, 10915 onBeforeAppear(el) { 10916 callHook(onBeforeAppear, [el]); 10917 addTransitionClass(el, appearFromClass); 10918 addTransitionClass(el, appearActiveClass); 10919 }, 10920 onEnter: makeEnterHook(false), 10921 onAppear: makeEnterHook(true), 10922 onLeave(el, done) { 10923 el._isLeaving = true; 10924 const resolve = () => finishLeave(el, done); 10925 addTransitionClass(el, leaveFromClass); 10926 if (!el._enterCancelled) { 10927 forceReflow(el); 10928 addTransitionClass(el, leaveActiveClass); 10929 } else { 10930 addTransitionClass(el, leaveActiveClass); 10931 forceReflow(el); 10932 } 10933 nextFrame(() => { 10934 if (!el._isLeaving) { 10935 return; 10936 } 10937 removeTransitionClass(el, leaveFromClass); 10938 addTransitionClass(el, leaveToClass); 10939 if (!hasExplicitCallback(onLeave)) { 10940 whenTransitionEnds(el, type, leaveDuration, resolve); 10941 } 10942 }); 10943 callHook(onLeave, [el, resolve]); 10944 }, 10945 onEnterCancelled(el) { 10946 finishEnter(el, false, void 0, true); 10947 callHook(onEnterCancelled, [el]); 10948 }, 10949 onAppearCancelled(el) { 10950 finishEnter(el, true, void 0, true); 10951 callHook(onAppearCancelled, [el]); 10952 }, 10953 onLeaveCancelled(el) { 10954 finishLeave(el); 10955 callHook(onLeaveCancelled, [el]); 10956 } 10957 }); 10958 } 10959 function normalizeDuration(duration) { 10960 if (duration == null) { 10961 return null; 10962 } else if (isObject(duration)) { 10963 return [NumberOf(duration.enter), NumberOf(duration.leave)]; 10964 } else {
vendor: 6,988 bytes, lines 10965-11169
10965 const n = NumberOf(duration); 10966 return [n, n]; 10967 } 10968 } 10969 function NumberOf(val) { 10970 const res = toNumber(val); 10971 { 10972 assertNumber(res, "<transition> explicit duration"); 10973 } 10974 return res; 10975 } 10976 function addTransitionClass(el, cls) { 10977 cls.split(/\s+/).forEach((c) => c && el.classList.add(c)); 10978 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls); 10979 } 10980 function removeTransitionClass(el, cls) { 10981 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c)); 10982 const _vtc = el[vtcKey]; 10983 if (_vtc) { 10984 _vtc.delete(cls); 10985 if (!_vtc.size) { 10986 el[vtcKey] = void 0; 10987 } 10988 } 10989 } 10990 function nextFrame(cb) { 10991 requestAnimationFrame(() => { 10992 requestAnimationFrame(cb); 10993 }); 10994 } 10995 let endId = 0; 10996 function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) { 10997 const id = el._endId = ++endId; 10998 const resolveIfNotStale = () => { 10999 if (id === el._endId) { 11000 resolve(); 11001 } 11002 }; 11003 if (explicitTimeout != null) { 11004 return setTimeout(resolveIfNotStale, explicitTimeout); 11005 } 11006 const { type, timeout, propCount } = getTransitionInfo(el, expectedType); 11007 if (!type) { 11008 return resolve(); 11009 } 11010 const endEvent = type + "end"; 11011 let ended = 0; 11012 const end = () => { 11013 el.removeEventListener(endEvent, onEnd); 11014 resolveIfNotStale(); 11015 }; 11016 const onEnd = (e) => { 11017 if (e.target === el && ++ended >= propCount) { 11018 end(); 11019 } 11020 }; 11021 setTimeout(() => { 11022 if (ended < propCount) { 11023 end(); 11024 } 11025 }, timeout + 1); 11026 el.addEventListener(endEvent, onEnd); 11027 } 11028 function getTransitionInfo(el, expectedType) { 11029 const styles = window.getComputedStyle(el); 11030 const getStyleProperties = (key) => (styles[key] || "").split(", "); 11031 const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`); 11032 const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`); 11033 const transitionTimeout = getTimeout(transitionDelays, transitionDurations); 11034 const animationDelays = getStyleProperties(`${ANIMATION}Delay`); 11035 const animationDurations = getStyleProperties(`${ANIMATION}Duration`); 11036 const animationTimeout = getTimeout(animationDelays, animationDurations); 11037 let type = null; 11038 let timeout = 0; 11039 let propCount = 0; 11040 if (expectedType === TRANSITION$1) { 11041 if (transitionTimeout > 0) { 11042 type = TRANSITION$1; 11043 timeout = transitionTimeout; 11044 propCount = transitionDurations.length; 11045 } 11046 } else if (expectedType === ANIMATION) { 11047 if (animationTimeout > 0) { 11048 type = ANIMATION; 11049 timeout = animationTimeout; 11050 propCount = animationDurations.length; 11051 } 11052 } else { 11053 timeout = Math.max(transitionTimeout, animationTimeout); 11054 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null; 11055 propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0; 11056 } 11057 const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test( 11058 getStyleProperties(`${TRANSITION$1}Property`).toString() 11059 ); 11060 return { 11061 type, 11062 timeout, 11063 propCount, 11064 hasTransform 11065 }; 11066 } 11067 function getTimeout(delays, durations) { 11068 while (delays.length < durations.length) { 11069 delays = delays.concat(delays); 11070 } 11071 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i]))); 11072 } 11073 function toMs(s) { 11074 if (s === "auto") return 0; 11075 return Number(s.slice(0, -1).replace(",", ".")) * 1e3; 11076 } 11077 function forceReflow(el) { 11078 const targetDocument = el ? el.ownerDocument : document; 11079 return targetDocument.body.offsetHeight; 11080 } 11081 11082 function patchClass(el, value, isSVG) { 11083 const transitionClasses = el[vtcKey]; 11084 if (transitionClasses) { 11085 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" "); 11086 } 11087 if (value == null) { 11088 el.removeAttribute("class"); 11089 } else if (isSVG) { 11090 el.setAttribute("class", value); 11091 } else { 11092 el.className = value; 11093 } 11094 } 11095 11096 const vShowOriginalDisplay = /* @__PURE__ */ Symbol("_vod"); 11097 const vShowHidden = /* @__PURE__ */ Symbol("_vsh"); 11098 const vShow = { 11099 // used for prop mismatch check during hydration 11100 name: "show", 11101 beforeMount(el, { value }, { transition }) { 11102 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display; 11103 if (transition && value) { 11104 transition.beforeEnter(el); 11105 } else { 11106 setDisplay(el, value); 11107 } 11108 }, 11109 mounted(el, { value }, { transition }) { 11110 if (transition && value) { 11111 transition.enter(el); 11112 } 11113 }, 11114 updated(el, { value, oldValue }, { transition }) { 11115 if (!value === !oldValue) return; 11116 if (transition) { 11117 if (value) { 11118 transition.beforeEnter(el); 11119 setDisplay(el, true); 11120 transition.enter(el); 11121 } else { 11122 transition.leave(el, () => { 11123 setDisplay(el, false); 11124 }); 11125 } 11126 } else { 11127 setDisplay(el, value); 11128 } 11129 }, 11130 beforeUnmount(el, { value }) { 11131 setDisplay(el, value); 11132 } 11133 }; 11134 function setDisplay(el, value) { 11135 el.style.display = value ? el[vShowOriginalDisplay] : "none"; 11136 el[vShowHidden] = !value; 11137 } 11138 11139 const CSS_VAR_TEXT = /* @__PURE__ */ Symbol("CSS_VAR_TEXT" ); 11140 function useCssVars(getter) { 11141 const instance = getCurrentInstance(); 11142 if (!instance) { 11143 warn(`useCssVars is called without current active component instance.`); 11144 return; 11145 } 11146 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => { 11147 Array.from( 11148 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`) 11149 ).forEach((node) => setVarsOnNode(node, vars)); 11150 }; 11151 { 11152 instance.getCssVars = () => getter(instance.proxy); 11153 } 11154 const setVars = () => { 11155 const vars = getter(instance.proxy); 11156 if (instance.ce) { 11157 setVarsOnNode(instance.ce, vars); 11158 } else { 11159 setVarsOnVNode(instance.subTree, vars); 11160 } 11161 updateTeleports(vars); 11162 }; 11163 onBeforeUpdate(() => { 11164 queuePostFlushCb(setVars); 11165 }); 11166 onMounted(() => { 11167 watch(setVars, NOOP, { flush: "post" }); 11168 const ob = new MutationObserver(setVars); 11169 ob.observe(instance.subTree.el.parentNode, { childList: true });
vendor: 6,514 bytes, lines 11170-11369
11170 onUnmounted(() => ob.disconnect()); 11171 }); 11172 } 11173 function setVarsOnVNode(vnode, vars) { 11174 if (vnode.shapeFlag & 128) { 11175 const suspense = vnode.suspense; 11176 vnode = suspense.activeBranch; 11177 if (suspense.pendingBranch && !suspense.isHydrating) { 11178 suspense.effects.push(() => { 11179 setVarsOnVNode(suspense.activeBranch, vars); 11180 }); 11181 } 11182 } 11183 while (vnode.component) { 11184 vnode = vnode.component.subTree; 11185 } 11186 if (vnode.shapeFlag & 1 && vnode.el) { 11187 setVarsOnNode(vnode.el, vars); 11188 } else if (vnode.type === Fragment) { 11189 vnode.children.forEach((c) => setVarsOnVNode(c, vars)); 11190 } else if (vnode.type === Static) { 11191 let { el, anchor } = vnode; 11192 while (el) { 11193 setVarsOnNode(el, vars); 11194 if (el === anchor) break; 11195 el = el.nextSibling; 11196 } 11197 } 11198 } 11199 function setVarsOnNode(el, vars) { 11200 if (el.nodeType === 1) { 11201 const style = el.style; 11202 let cssText = ""; 11203 for (const key in vars) { 11204 const value = normalizeCssVarValue(vars[key]); 11205 style.setProperty(`--${key}`, value); 11206 cssText += `--${key}: ${value};`; 11207 } 11208 style[CSS_VAR_TEXT] = cssText; 11209 } 11210 } 11211 11212 const displayRE = /(?:^|;)\s*display\s*:/; 11213 function patchStyle(el, prev, next) { 11214 const style = el.style; 11215 const isCssString = isString(next); 11216 let hasControlledDisplay = false; 11217 if (next && !isCssString) { 11218 if (prev) { 11219 if (!isString(prev)) { 11220 for (const key in prev) { 11221 if (next[key] == null) { 11222 setStyle(style, key, ""); 11223 } 11224 } 11225 } else { 11226 for (const prevStyle of prev.split(";")) { 11227 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim(); 11228 if (next[key] == null) { 11229 setStyle(style, key, ""); 11230 } 11231 } 11232 } 11233 } 11234 for (const key in next) { 11235 if (key === "display") { 11236 hasControlledDisplay = true; 11237 } 11238 setStyle(style, key, next[key]); 11239 } 11240 } else { 11241 if (isCssString) { 11242 if (prev !== next) { 11243 const cssVarText = style[CSS_VAR_TEXT]; 11244 if (cssVarText) { 11245 next += ";" + cssVarText; 11246 } 11247 style.cssText = next; 11248 hasControlledDisplay = displayRE.test(next); 11249 } 11250 } else if (prev) { 11251 el.removeAttribute("style"); 11252 } 11253 } 11254 if (vShowOriginalDisplay in el) { 11255 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : ""; 11256 if (el[vShowHidden]) { 11257 style.display = "none"; 11258 } 11259 } 11260 } 11261 const semicolonRE = /[^\\];\s*$/; 11262 const importantRE = /\s*!important$/; 11263 function setStyle(style, name, val) { 11264 if (isArray(val)) { 11265 val.forEach((v) => setStyle(style, name, v)); 11266 } else { 11267 if (val == null) val = ""; 11268 { 11269 if (semicolonRE.test(val)) { 11270 warn( 11271 `Unexpected semicolon at the end of '${name}' style value: '${val}'` 11272 ); 11273 } 11274 } 11275 if (name.startsWith("--")) { 11276 style.setProperty(name, val); 11277 } else { 11278 const prefixed = autoPrefix(style, name); 11279 if (importantRE.test(val)) { 11280 style.setProperty( 11281 hyphenate(prefixed), 11282 val.replace(importantRE, ""), 11283 "important" 11284 ); 11285 } else { 11286 style[prefixed] = val; 11287 } 11288 } 11289 } 11290 } 11291 const prefixes = ["Webkit", "Moz", "ms"]; 11292 const prefixCache = {}; 11293 function autoPrefix(style, rawName) { 11294 const cached = prefixCache[rawName]; 11295 if (cached) { 11296 return cached; 11297 } 11298 let name = camelize(rawName); 11299 if (name !== "filter" && name in style) { 11300 return prefixCache[rawName] = name; 11301 } 11302 name = capitalize(name); 11303 for (let i = 0; i < prefixes.length; i++) { 11304 const prefixed = prefixes[i] + name; 11305 if (prefixed in style) { 11306 return prefixCache[rawName] = prefixed; 11307 } 11308 } 11309 return rawName; 11310 } 11311 11312 const xlinkNS = "http://www.w3.org/1999/xlink"; 11313 function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) { 11314 if (isSVG && key.startsWith("xlink:")) { 11315 if (value == null) { 11316 el.removeAttributeNS(xlinkNS, key.slice(6, key.length)); 11317 } else { 11318 el.setAttributeNS(xlinkNS, key, value); 11319 } 11320 } else { 11321 if (value == null || isBoolean && !includeBooleanAttr(value)) { 11322 el.removeAttribute(key); 11323 } else { 11324 el.setAttribute( 11325 key, 11326 isBoolean ? "" : isSymbol(value) ? String(value) : value 11327 ); 11328 } 11329 } 11330 } 11331 11332 function patchDOMProp(el, key, value, parentComponent, attrName) { 11333 if (key === "innerHTML" || key === "textContent") { 11334 if (value != null) { 11335 el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value; 11336 } 11337 return; 11338 } 11339 const tag = el.tagName; 11340 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally 11341 !tag.includes("-")) { 11342 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value; 11343 const newValue = value == null ? ( 11344 // #11647: value should be set as empty string for null and undefined, 11345 // but <input type="checkbox"> should be set as 'on'. 11346 el.type === "checkbox" ? "on" : "" 11347 ) : String(value); 11348 if (oldValue !== newValue || !("_value" in el)) { 11349 el.value = newValue; 11350 } 11351 if (value == null) { 11352 el.removeAttribute(key); 11353 } 11354 el._value = value; 11355 return; 11356 } 11357 let needRemove = false; 11358 if (value === "" || value == null) { 11359 const type = typeof el[key]; 11360 if (type === "boolean") { 11361 value = includeBooleanAttr(value); 11362 } else if (value == null && type === "string") { 11363 value = ""; 11364 needRemove = true; 11365 } else if (type === "number") { 11366 value = 0; 11367 needRemove = true; 11368 } 11369 }
vendor: 3,376 bytes, lines 11370-11469
11370 try { 11371 el[key] = value; 11372 } catch (e) { 11373 if (!needRemove) { 11374 warn( 11375 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`, 11376 e 11377 ); 11378 } 11379 } 11380 needRemove && el.removeAttribute(attrName || key); 11381 } 11382 11383 function addEventListener(el, event, handler, options) { 11384 el.addEventListener(event, handler, options); 11385 } 11386 function removeEventListener(el, event, handler, options) { 11387 el.removeEventListener(event, handler, options); 11388 } 11389 const veiKey = /* @__PURE__ */ Symbol("_vei"); 11390 function patchEvent(el, rawName, prevValue, nextValue, instance = null) { 11391 const invokers = el[veiKey] || (el[veiKey] = {}); 11392 const existingInvoker = invokers[rawName]; 11393 if (nextValue && existingInvoker) { 11394 existingInvoker.value = sanitizeEventValue(nextValue, rawName) ; 11395 } else { 11396 const [name, options] = parseName(rawName); 11397 if (nextValue) { 11398 const invoker = invokers[rawName] = createInvoker( 11399 sanitizeEventValue(nextValue, rawName) , 11400 instance 11401 ); 11402 addEventListener(el, name, invoker, options); 11403 } else if (existingInvoker) { 11404 removeEventListener(el, name, existingInvoker, options); 11405 invokers[rawName] = void 0; 11406 } 11407 } 11408 } 11409 const optionsModifierRE = /(?:Once|Passive|Capture)$/; 11410 function parseName(name) { 11411 let options; 11412 if (optionsModifierRE.test(name)) { 11413 options = {}; 11414 let m; 11415 while (m = name.match(optionsModifierRE)) { 11416 name = name.slice(0, name.length - m[0].length); 11417 options[m[0].toLowerCase()] = true; 11418 } 11419 } 11420 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)); 11421 return [event, options]; 11422 } 11423 let cachedNow = 0; 11424 const p = /* @__PURE__ */ Promise.resolve(); 11425 const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now()); 11426 function createInvoker(initialValue, instance) { 11427 const invoker = (e) => { 11428 if (!e._vts) { 11429 e._vts = Date.now(); 11430 } else if (e._vts <= invoker.attached) { 11431 return; 11432 } 11433 callWithAsyncErrorHandling( 11434 patchStopImmediatePropagation(e, invoker.value), 11435 instance, 11436 5, 11437 [e] 11438 ); 11439 }; 11440 invoker.value = initialValue; 11441 invoker.attached = getNow(); 11442 return invoker; 11443 } 11444 function sanitizeEventValue(value, propName) { 11445 if (isFunction(value) || isArray(value)) { 11446 return value; 11447 } 11448 warn( 11449 `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop? 11450 Expected function or array of functions, received type ${typeof value}.` 11451 ); 11452 return NOOP; 11453 } 11454 function patchStopImmediatePropagation(e, value) { 11455 if (isArray(value)) { 11456 const originalStop = e.stopImmediatePropagation; 11457 e.stopImmediatePropagation = () => { 11458 originalStop.call(e); 11459 e._stopped = true; 11460 }; 11461 return value.map( 11462 (fn) => (e2) => !e2._stopped && fn && fn(e2) 11463 ); 11464 } else { 11465 return value; 11466 } 11467 } 11468 11469 const isNativeOn = (key) =>
vendor: 13,828 bytes, lines 11469-11866
11469 key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter 11470 key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; 11471 const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => { 11472 const isSVG = namespace === "svg"; 11473 if (key === "class") { 11474 patchClass(el, nextValue, isSVG); 11475 } else if (key === "style") { 11476 patchStyle(el, prevValue, nextValue); 11477 } else if (isOn(key)) { 11478 if (!isModelListener(key)) { 11479 patchEvent(el, key, prevValue, nextValue, parentComponent); 11480 } 11481 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) { 11482 patchDOMProp(el, key, nextValue); 11483 if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) { 11484 patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value"); 11485 } 11486 } else if ( 11487 // #11081 force set props for possible async custom element 11488 el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue)) 11489 ) { 11490 patchDOMProp(el, camelize(key), nextValue, parentComponent, key); 11491 } else { 11492 if (key === "true-value") { 11493 el._trueValue = nextValue; 11494 } else if (key === "false-value") { 11495 el._falseValue = nextValue; 11496 } 11497 patchAttr(el, key, nextValue, isSVG); 11498 } 11499 }; 11500 function shouldSetAsProp(el, key, value, isSVG) { 11501 if (isSVG) { 11502 if (key === "innerHTML" || key === "textContent") { 11503 return true; 11504 } 11505 if (key in el && isNativeOn(key) && isFunction(value)) { 11506 return true; 11507 } 11508 return false; 11509 } 11510 if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") { 11511 return false; 11512 } 11513 if (key === "sandbox" && el.tagName === "IFRAME") { 11514 return false; 11515 } 11516 if (key === "form") { 11517 return false; 11518 } 11519 if (key === "list" && el.tagName === "INPUT") { 11520 return false; 11521 } 11522 if (key === "type" && el.tagName === "TEXTAREA") { 11523 return false; 11524 } 11525 if (key === "width" || key === "height") { 11526 const tag = el.tagName; 11527 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") { 11528 return false; 11529 } 11530 } 11531 if (isNativeOn(key) && isString(value)) { 11532 return false; 11533 } 11534 return key in el; 11535 } 11536 11537 const REMOVAL = {}; 11538 // @__NO_SIDE_EFFECTS__ 11539 function defineCustomElement(options, extraOptions, _createApp) { 11540 let Comp = defineComponent(options, extraOptions); 11541 if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions); 11542 class VueCustomElement extends VueElement { 11543 constructor(initialProps) { 11544 super(Comp, initialProps, _createApp); 11545 } 11546 } 11547 VueCustomElement.def = Comp; 11548 return VueCustomElement; 11549 } 11550 const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => { 11551 return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp); 11552 }); 11553 const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class { 11554 }; 11555 class VueElement extends BaseClass { 11556 constructor(_def, _props = {}, _createApp = createApp) { 11557 super(); 11558 this._def = _def; 11559 this._props = _props; 11560 this._createApp = _createApp; 11561 this._isVueCE = true; 11562 /** 11563 * @internal 11564 */ 11565 this._instance = null; 11566 /** 11567 * @internal 11568 */ 11569 this._app = null; 11570 /** 11571 * @internal 11572 */ 11573 this._nonce = this._def.nonce; 11574 this._connected = false; 11575 this._resolved = false; 11576 this._patching = false; 11577 this._dirty = false; 11578 this._numberProps = null; 11579 this._styleChildren = /* @__PURE__ */ new WeakSet(); 11580 this._ob = null; 11581 if (this.shadowRoot && _createApp !== createApp) { 11582 this._root = this.shadowRoot; 11583 } else { 11584 if (this.shadowRoot) { 11585 warn( 11586 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.` 11587 ); 11588 } 11589 if (_def.shadowRoot !== false) { 11590 this.attachShadow( 11591 extend({}, _def.shadowRootOptions, { 11592 mode: "open" 11593 }) 11594 ); 11595 this._root = this.shadowRoot; 11596 } else { 11597 this._root = this; 11598 } 11599 } 11600 } 11601 connectedCallback() { 11602 if (!this.isConnected) return; 11603 if (!this.shadowRoot && !this._resolved) { 11604 this._parseSlots(); 11605 } 11606 this._connected = true; 11607 let parent = this; 11608 while (parent = parent && (parent.parentNode || parent.host)) { 11609 if (parent instanceof VueElement) { 11610 this._parent = parent; 11611 break; 11612 } 11613 } 11614 if (!this._instance) { 11615 if (this._resolved) { 11616 this._mount(this._def); 11617 } else { 11618 if (parent && parent._pendingResolve) { 11619 this._pendingResolve = parent._pendingResolve.then(() => { 11620 this._pendingResolve = void 0; 11621 this._resolveDef(); 11622 }); 11623 } else { 11624 this._resolveDef(); 11625 } 11626 } 11627 } 11628 } 11629 _setParent(parent = this._parent) { 11630 if (parent) { 11631 this._instance.parent = parent._instance; 11632 this._inheritParentContext(parent); 11633 } 11634 } 11635 _inheritParentContext(parent = this._parent) { 11636 if (parent && this._app) { 11637 Object.setPrototypeOf( 11638 this._app._context.provides, 11639 parent._instance.provides 11640 ); 11641 } 11642 } 11643 disconnectedCallback() { 11644 this._connected = false; 11645 nextTick(() => { 11646 if (!this._connected) { 11647 if (this._ob) { 11648 this._ob.disconnect(); 11649 this._ob = null; 11650 } 11651 this._app && this._app.unmount(); 11652 if (this._instance) this._instance.ce = void 0; 11653 this._app = this._instance = null; 11654 if (this._teleportTargets) { 11655 this._teleportTargets.clear(); 11656 this._teleportTargets = void 0; 11657 } 11658 } 11659 }); 11660 } 11661 _processMutations(mutations) { 11662 for (const m of mutations) { 11663 this._setAttr(m.attributeName); 11664 } 11665 } 11666 /** 11667 * resolve inner component definition (handle possible async component) 11668 */ 11669 _resolveDef() { 11670 if (this._pendingResolve) { 11671 return; 11672 } 11673 for (let i = 0; i < this.attributes.length; i++) { 11674 this._setAttr(this.attributes[i].name); 11675 } 11676 this._ob = new MutationObserver(this._processMutations.bind(this)); 11677 this._ob.observe(this, { attributes: true }); 11678 const resolve = (def, isAsync = false) => { 11679 this._resolved = true; 11680 this._pendingResolve = void 0; 11681 const { props, styles } = def; 11682 let numberProps; 11683 if (props && !isArray(props)) { 11684 for (const key in props) { 11685 const opt = props[key]; 11686 if (opt === Number || opt && opt.type === Number) { 11687 if (key in this._props) { 11688 this._props[key] = toNumber(this._props[key]); 11689 } 11690 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true; 11691 } 11692 } 11693 } 11694 this._numberProps = numberProps; 11695 this._resolveProps(def); 11696 if (this.shadowRoot) { 11697 this._applyStyles(styles); 11698 } else if (styles) { 11699 warn( 11700 "Custom element style injection is not supported when using shadowRoot: false" 11701 ); 11702 } 11703 this._mount(def); 11704 }; 11705 const asyncDef = this._def.__asyncLoader; 11706 if (asyncDef) { 11707 this._pendingResolve = asyncDef().then((def) => { 11708 def.configureApp = this._def.configureApp; 11709 resolve(this._def = def, true); 11710 }); 11711 } else { 11712 resolve(this._def); 11713 } 11714 } 11715 _mount(def) { 11716 if (!def.name) { 11717 def.name = "VueElement"; 11718 } 11719 this._app = this._createApp(def); 11720 this._inheritParentContext(); 11721 if (def.configureApp) { 11722 def.configureApp(this._app); 11723 } 11724 this._app._ceVNode = this._createVNode(); 11725 this._app.mount(this._root); 11726 const exposed = this._instance && this._instance.exposed; 11727 if (!exposed) return; 11728 for (const key in exposed) { 11729 if (!hasOwn(this, key)) { 11730 Object.defineProperty(this, key, { 11731 // unwrap ref to be consistent with public instance behavior 11732 get: () => unref(exposed[key]) 11733 }); 11734 } else { 11735 warn(`Exposed property "${key}" already exists on custom element.`); 11736 } 11737 } 11738 } 11739 _resolveProps(def) { 11740 const { props } = def; 11741 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {}); 11742 for (const key of Object.keys(this)) { 11743 if (key[0] !== "_" && declaredPropKeys.includes(key)) { 11744 this._setProp(key, this[key]); 11745 } 11746 } 11747 for (const key of declaredPropKeys.map(camelize)) { 11748 Object.defineProperty(this, key, { 11749 get() { 11750 return this._getProp(key); 11751 }, 11752 set(val) { 11753 this._setProp(key, val, true, !this._patching); 11754 } 11755 }); 11756 } 11757 } 11758 _setAttr(key) { 11759 if (key.startsWith("data-v-")) return; 11760 const has = this.hasAttribute(key); 11761 let value = has ? this.getAttribute(key) : REMOVAL; 11762 const camelKey = camelize(key); 11763 if (has && this._numberProps && this._numberProps[camelKey]) { 11764 value = toNumber(value); 11765 } 11766 this._setProp(camelKey, value, false, true); 11767 } 11768 /** 11769 * @internal 11770 */ 11771 _getProp(key) { 11772 return this._props[key]; 11773 } 11774 /** 11775 * @internal 11776 */ 11777 _setProp(key, val, shouldReflect = true, shouldUpdate = false) { 11778 if (val !== this._props[key]) { 11779 this._dirty = true; 11780 if (val === REMOVAL) { 11781 delete this._props[key]; 11782 } else { 11783 this._props[key] = val; 11784 if (key === "key" && this._app) { 11785 this._app._ceVNode.key = val; 11786 } 11787 } 11788 if (shouldUpdate && this._instance) { 11789 this._update(); 11790 } 11791 if (shouldReflect) { 11792 const ob = this._ob; 11793 if (ob) { 11794 this._processMutations(ob.takeRecords()); 11795 ob.disconnect(); 11796 } 11797 if (val === true) { 11798 this.setAttribute(hyphenate(key), ""); 11799 } else if (typeof val === "string" || typeof val === "number") { 11800 this.setAttribute(hyphenate(key), val + ""); 11801 } else if (!val) { 11802 this.removeAttribute(hyphenate(key)); 11803 } 11804 ob && ob.observe(this, { attributes: true }); 11805 } 11806 } 11807 } 11808 _update() { 11809 const vnode = this._createVNode(); 11810 if (this._app) vnode.appContext = this._app._context; 11811 render(vnode, this._root); 11812 } 11813 _createVNode() { 11814 const baseProps = {}; 11815 if (!this.shadowRoot) { 11816 baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this); 11817 } 11818 const vnode = createVNode(this._def, extend(baseProps, this._props)); 11819 if (!this._instance) { 11820 vnode.ce = (instance) => { 11821 this._instance = instance; 11822 instance.ce = this; 11823 instance.isCE = true; 11824 { 11825 instance.ceReload = (newStyles) => { 11826 if (this._styles) { 11827 this._styles.forEach((s) => this._root.removeChild(s)); 11828 this._styles.length = 0; 11829 } 11830 this._applyStyles(newStyles); 11831 this._instance = null; 11832 this._update(); 11833 }; 11834 } 11835 const dispatch = (event, args) => { 11836 this.dispatchEvent( 11837 new CustomEvent( 11838 event, 11839 isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args } 11840 ) 11841 ); 11842 }; 11843 instance.emit = (event, ...args) => { 11844 dispatch(event, args); 11845 if (hyphenate(event) !== event) { 11846 dispatch(hyphenate(event), args); 11847 } 11848 }; 11849 this._setParent(); 11850 }; 11851 } 11852 return vnode; 11853 } 11854 _applyStyles(styles, owner) { 11855 if (!styles) return; 11856 if (owner) { 11857 if (owner === this._def || this._styleChildren.has(owner)) { 11858 return; 11859 } 11860 this._styleChildren.add(owner); 11861 } 11862 const nonce = this._nonce; 11863 for (let i = styles.length - 1; i >= 0; i--) { 11864 const s = document.createElement("style"); 11865 if (nonce) s.setAttribute("nonce", nonce); 11866 s.textContent = styles[i];
vendor: 5,349 bytes, lines 11867-12044
11867 this.shadowRoot.prepend(s); 11868 { 11869 if (owner) { 11870 if (owner.__hmrId) { 11871 if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map(); 11872 let entry = this._childStyles.get(owner.__hmrId); 11873 if (!entry) { 11874 this._childStyles.set(owner.__hmrId, entry = []); 11875 } 11876 entry.push(s); 11877 } 11878 } else { 11879 (this._styles || (this._styles = [])).push(s); 11880 } 11881 } 11882 } 11883 } 11884 /** 11885 * Only called when shadowRoot is false 11886 */ 11887 _parseSlots() { 11888 const slots = this._slots = {}; 11889 let n; 11890 while (n = this.firstChild) { 11891 const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default"; 11892 (slots[slotName] || (slots[slotName] = [])).push(n); 11893 this.removeChild(n); 11894 } 11895 } 11896 /** 11897 * Only called when shadowRoot is false 11898 */ 11899 _renderSlots() { 11900 const outlets = this._getSlots(); 11901 const scopeId = this._instance.type.__scopeId; 11902 for (let i = 0; i < outlets.length; i++) { 11903 const o = outlets[i]; 11904 const slotName = o.getAttribute("name") || "default"; 11905 const content = this._slots[slotName]; 11906 const parent = o.parentNode; 11907 if (content) { 11908 for (const n of content) { 11909 if (scopeId && n.nodeType === 1) { 11910 const id = scopeId + "-s"; 11911 const walker = document.createTreeWalker(n, 1); 11912 n.setAttribute(id, ""); 11913 let child; 11914 while (child = walker.nextNode()) { 11915 child.setAttribute(id, ""); 11916 } 11917 } 11918 parent.insertBefore(n, o); 11919 } 11920 } else { 11921 while (o.firstChild) parent.insertBefore(o.firstChild, o); 11922 } 11923 parent.removeChild(o); 11924 } 11925 } 11926 /** 11927 * @internal 11928 */ 11929 _getSlots() { 11930 const roots = [this]; 11931 if (this._teleportTargets) { 11932 roots.push(...this._teleportTargets); 11933 } 11934 const slots = /* @__PURE__ */ new Set(); 11935 for (const root of roots) { 11936 const found = root.querySelectorAll("slot"); 11937 for (let i = 0; i < found.length; i++) { 11938 slots.add(found[i]); 11939 } 11940 } 11941 return Array.from(slots); 11942 } 11943 /** 11944 * @internal 11945 */ 11946 _injectChildStyle(comp) { 11947 this._applyStyles(comp.styles, comp); 11948 } 11949 /** 11950 * @internal 11951 */ 11952 _beginPatch() { 11953 this._patching = true; 11954 this._dirty = false; 11955 } 11956 /** 11957 * @internal 11958 */ 11959 _endPatch() { 11960 this._patching = false; 11961 if (this._dirty && this._instance) { 11962 this._update(); 11963 } 11964 } 11965 /** 11966 * @internal 11967 */ 11968 _removeChildStyle(comp) { 11969 { 11970 this._styleChildren.delete(comp); 11971 if (this._childStyles && comp.__hmrId) { 11972 const oldStyles = this._childStyles.get(comp.__hmrId); 11973 if (oldStyles) { 11974 oldStyles.forEach((s) => this._root.removeChild(s)); 11975 oldStyles.length = 0; 11976 } 11977 } 11978 } 11979 } 11980 } 11981 function useHost(caller) { 11982 const instance = getCurrentInstance(); 11983 const el = instance && instance.ce; 11984 if (el) { 11985 return el; 11986 } else { 11987 if (!instance) { 11988 warn( 11989 `${caller || "useHost"} called without an active component instance.` 11990 ); 11991 } else { 11992 warn( 11993 `${caller || "useHost"} can only be used in components defined via defineCustomElement.` 11994 ); 11995 } 11996 } 11997 return null; 11998 } 11999 function useShadowRoot() { 12000 const el = useHost("useShadowRoot") ; 12001 return el && el.shadowRoot; 12002 } 12003 12004 function useCssModule(name = "$style") { 12005 { 12006 { 12007 warn(`useCssModule() is not supported in the global build.`); 12008 } 12009 return EMPTY_OBJ; 12010 } 12011 } 12012 12013 const positionMap = /* @__PURE__ */ new WeakMap(); 12014 const newPositionMap = /* @__PURE__ */ new WeakMap(); 12015 const moveCbKey = /* @__PURE__ */ Symbol("_moveCb"); 12016 const enterCbKey = /* @__PURE__ */ Symbol("_enterCb"); 12017 const decorate = (t) => { 12018 delete t.props.mode; 12019 return t; 12020 }; 12021 const TransitionGroupImpl = /* @__PURE__ */ decorate({ 12022 name: "TransitionGroup", 12023 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, { 12024 tag: String, 12025 moveClass: String 12026 }), 12027 setup(props, { slots }) { 12028 const instance = getCurrentInstance(); 12029 const state = useTransitionState(); 12030 let prevChildren; 12031 let children; 12032 onUpdated(() => { 12033 if (!prevChildren.length) { 12034 return; 12035 } 12036 const moveClass = props.moveClass || `${props.name || "v"}-move`; 12037 if (!hasCSSTransform( 12038 prevChildren[0].el, 12039 instance.vnode.el, 12040 moveClass 12041 )) { 12042 prevChildren = []; 12043 return; 12044 }
vendor: 11,333 bytes, lines 12045-12355
12045 prevChildren.forEach(callPendingCbs); 12046 prevChildren.forEach(recordPosition); 12047 const movedChildren = prevChildren.filter(applyTranslation); 12048 forceReflow(instance.vnode.el); 12049 movedChildren.forEach((c) => { 12050 const el = c.el; 12051 const style = el.style; 12052 addTransitionClass(el, moveClass); 12053 style.transform = style.webkitTransform = style.transitionDuration = ""; 12054 const cb = el[moveCbKey] = (e) => { 12055 if (e && e.target !== el) { 12056 return; 12057 } 12058 if (!e || e.propertyName.endsWith("transform")) { 12059 el.removeEventListener("transitionend", cb); 12060 el[moveCbKey] = null; 12061 removeTransitionClass(el, moveClass); 12062 } 12063 }; 12064 el.addEventListener("transitionend", cb); 12065 }); 12066 prevChildren = []; 12067 }); 12068 return () => { 12069 const rawProps = toRaw(props); 12070 const cssTransitionProps = resolveTransitionProps(rawProps); 12071 let tag = rawProps.tag || Fragment; 12072 prevChildren = []; 12073 if (children) { 12074 for (let i = 0; i < children.length; i++) { 12075 const child = children[i]; 12076 if (child.el && child.el instanceof Element) { 12077 prevChildren.push(child); 12078 setTransitionHooks( 12079 child, 12080 resolveTransitionHooks( 12081 child, 12082 cssTransitionProps, 12083 state, 12084 instance 12085 ) 12086 ); 12087 positionMap.set(child, { 12088 left: child.el.offsetLeft, 12089 top: child.el.offsetTop 12090 }); 12091 } 12092 } 12093 } 12094 children = slots.default ? getTransitionRawChildren(slots.default()) : []; 12095 for (let i = 0; i < children.length; i++) { 12096 const child = children[i]; 12097 if (child.key != null) { 12098 setTransitionHooks( 12099 child, 12100 resolveTransitionHooks(child, cssTransitionProps, state, instance) 12101 ); 12102 } else if (child.type !== Text) { 12103 warn(`<TransitionGroup> children must be keyed.`); 12104 } 12105 } 12106 return createVNode(tag, null, children); 12107 }; 12108 } 12109 }); 12110 const TransitionGroup = TransitionGroupImpl; 12111 function callPendingCbs(c) { 12112 const el = c.el; 12113 if (el[moveCbKey]) { 12114 el[moveCbKey](); 12115 } 12116 if (el[enterCbKey]) { 12117 el[enterCbKey](); 12118 } 12119 } 12120 function recordPosition(c) { 12121 newPositionMap.set(c, { 12122 left: c.el.offsetLeft, 12123 top: c.el.offsetTop 12124 }); 12125 } 12126 function applyTranslation(c) { 12127 const oldPos = positionMap.get(c); 12128 const newPos = newPositionMap.get(c); 12129 const dx = oldPos.left - newPos.left; 12130 const dy = oldPos.top - newPos.top; 12131 if (dx || dy) { 12132 const s = c.el.style; 12133 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`; 12134 s.transitionDuration = "0s"; 12135 return c; 12136 } 12137 } 12138 function hasCSSTransform(el, root, moveClass) { 12139 const clone = el.cloneNode(); 12140 const _vtc = el[vtcKey]; 12141 if (_vtc) { 12142 _vtc.forEach((cls) => { 12143 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c)); 12144 }); 12145 } 12146 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c)); 12147 clone.style.display = "none"; 12148 const container = root.nodeType === 1 ? root : root.parentNode; 12149 container.appendChild(clone); 12150 const { hasTransform } = getTransitionInfo(clone); 12151 container.removeChild(clone); 12152 return hasTransform; 12153 } 12154 12155 const getModelAssigner = (vnode) => { 12156 const fn = vnode.props["onUpdate:modelValue"] || false; 12157 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn; 12158 }; 12159 function onCompositionStart(e) { 12160 e.target.composing = true; 12161 } 12162 function onCompositionEnd(e) { 12163 const target = e.target; 12164 if (target.composing) { 12165 target.composing = false; 12166 target.dispatchEvent(new Event("input")); 12167 } 12168 } 12169 const assignKey = /* @__PURE__ */ Symbol("_assign"); 12170 function castValue(value, trim, number) { 12171 if (trim) value = value.trim(); 12172 if (number) value = looseToNumber(value); 12173 return value; 12174 } 12175 const vModelText = { 12176 created(el, { modifiers: { lazy, trim, number } }, vnode) { 12177 el[assignKey] = getModelAssigner(vnode); 12178 const castToNumber = number || vnode.props && vnode.props.type === "number"; 12179 addEventListener(el, lazy ? "change" : "input", (e) => { 12180 if (e.target.composing) return; 12181 el[assignKey](castValue(el.value, trim, castToNumber)); 12182 }); 12183 if (trim || castToNumber) { 12184 addEventListener(el, "change", () => { 12185 el.value = castValue(el.value, trim, castToNumber); 12186 }); 12187 } 12188 if (!lazy) { 12189 addEventListener(el, "compositionstart", onCompositionStart); 12190 addEventListener(el, "compositionend", onCompositionEnd); 12191 addEventListener(el, "change", onCompositionEnd); 12192 } 12193 }, 12194 // set value on mounted so it's after min/max for type="range" 12195 mounted(el, { value }) { 12196 el.value = value == null ? "" : value; 12197 }, 12198 beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) { 12199 el[assignKey] = getModelAssigner(vnode); 12200 if (el.composing) return; 12201 const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value; 12202 const newValue = value == null ? "" : value; 12203 if (elValue === newValue) { 12204 return; 12205 } 12206 if (document.activeElement === el && el.type !== "range") { 12207 if (lazy && value === oldValue) { 12208 return; 12209 } 12210 if (trim && el.value.trim() === newValue) { 12211 return; 12212 } 12213 } 12214 el.value = newValue; 12215 } 12216 }; 12217 const vModelCheckbox = { 12218 // #4096 array checkboxes need to be deep traversed 12219 deep: true, 12220 created(el, _, vnode) { 12221 el[assignKey] = getModelAssigner(vnode); 12222 addEventListener(el, "change", () => { 12223 const modelValue = el._modelValue; 12224 const elementValue = getValue(el); 12225 const checked = el.checked; 12226 const assign = el[assignKey]; 12227 if (isArray(modelValue)) { 12228 const index = looseIndexOf(modelValue, elementValue); 12229 const found = index !== -1; 12230 if (checked && !found) { 12231 assign(modelValue.concat(elementValue)); 12232 } else if (!checked && found) { 12233 const filtered = [...modelValue]; 12234 filtered.splice(index, 1); 12235 assign(filtered); 12236 } 12237 } else if (isSet(modelValue)) { 12238 const cloned = new Set(modelValue); 12239 if (checked) { 12240 cloned.add(elementValue); 12241 } else { 12242 cloned.delete(elementValue); 12243 } 12244 assign(cloned); 12245 } else { 12246 assign(getCheckboxValue(el, checked)); 12247 } 12248 }); 12249 }, 12250 // set initial checked on mount to wait for true-value/false-value 12251 mounted: setChecked, 12252 beforeUpdate(el, binding, vnode) { 12253 el[assignKey] = getModelAssigner(vnode); 12254 setChecked(el, binding, vnode); 12255 } 12256 }; 12257 function setChecked(el, { value, oldValue }, vnode) { 12258 el._modelValue = value; 12259 let checked; 12260 if (isArray(value)) { 12261 checked = looseIndexOf(value, vnode.props.value) > -1; 12262 } else if (isSet(value)) { 12263 checked = value.has(vnode.props.value); 12264 } else { 12265 if (value === oldValue) return; 12266 checked = looseEqual(value, getCheckboxValue(el, true)); 12267 } 12268 if (el.checked !== checked) { 12269 el.checked = checked; 12270 } 12271 } 12272 const vModelRadio = { 12273 created(el, { value }, vnode) { 12274 el.checked = looseEqual(value, vnode.props.value); 12275 el[assignKey] = getModelAssigner(vnode); 12276 addEventListener(el, "change", () => { 12277 el[assignKey](getValue(el)); 12278 }); 12279 }, 12280 beforeUpdate(el, { value, oldValue }, vnode) { 12281 el[assignKey] = getModelAssigner(vnode); 12282 if (value !== oldValue) { 12283 el.checked = looseEqual(value, vnode.props.value); 12284 } 12285 } 12286 }; 12287 const vModelSelect = { 12288 // <select multiple> value need to be deep traversed 12289 deep: true, 12290 created(el, { value, modifiers: { number } }, vnode) { 12291 const isSetModel = isSet(value); 12292 addEventListener(el, "change", () => { 12293 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map( 12294 (o) => number ? looseToNumber(getValue(o)) : getValue(o) 12295 ); 12296 el[assignKey]( 12297 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0] 12298 ); 12299 el._assigning = true; 12300 nextTick(() => { 12301 el._assigning = false; 12302 }); 12303 }); 12304 el[assignKey] = getModelAssigner(vnode); 12305 }, 12306 // set value in mounted & updated because <select> relies on its children 12307 // <option>s. 12308 mounted(el, { value }) { 12309 setSelected(el, value); 12310 }, 12311 beforeUpdate(el, _binding, vnode) { 12312 el[assignKey] = getModelAssigner(vnode); 12313 }, 12314 updated(el, { value }) { 12315 if (!el._assigning) { 12316 setSelected(el, value); 12317 } 12318 } 12319 }; 12320 function setSelected(el, value) { 12321 const isMultiple = el.multiple; 12322 const isArrayValue = isArray(value); 12323 if (isMultiple && !isArrayValue && !isSet(value)) { 12324 warn( 12325 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.` 12326 ); 12327 return; 12328 } 12329 for (let i = 0, l = el.options.length; i < l; i++) { 12330 const option = el.options[i]; 12331 const optionValue = getValue(option); 12332 if (isMultiple) { 12333 if (isArrayValue) { 12334 const optionType = typeof optionValue; 12335 if (optionType === "string" || optionType === "number") { 12336 option.selected = value.some((v) => String(v) === String(optionValue)); 12337 } else { 12338 option.selected = looseIndexOf(value, optionValue) > -1; 12339 } 12340 } else { 12341 option.selected = value.has(optionValue); 12342 } 12343 } else if (looseEqual(getValue(option), value)) { 12344 if (el.selectedIndex !== i) el.selectedIndex = i; 12345 return; 12346 } 12347 } 12348 if (!isMultiple && el.selectedIndex !== -1) { 12349 el.selectedIndex = -1; 12350 } 12351 } 12352 function getValue(el) { 12353 return "_value" in el ? el._value : el.value; 12354 } 12355 function getCheckboxValue(el, checked) {
vendor: 10,049 bytes, lines 12356-12636
12356 const key = checked ? "_trueValue" : "_falseValue"; 12357 return key in el ? el[key] : checked; 12358 } 12359 const vModelDynamic = { 12360 created(el, binding, vnode) { 12361 callModelHook(el, binding, vnode, null, "created"); 12362 }, 12363 mounted(el, binding, vnode) { 12364 callModelHook(el, binding, vnode, null, "mounted"); 12365 }, 12366 beforeUpdate(el, binding, vnode, prevVNode) { 12367 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate"); 12368 }, 12369 updated(el, binding, vnode, prevVNode) { 12370 callModelHook(el, binding, vnode, prevVNode, "updated"); 12371 } 12372 }; 12373 function resolveDynamicModel(tagName, type) { 12374 switch (tagName) { 12375 case "SELECT": 12376 return vModelSelect; 12377 case "TEXTAREA": 12378 return vModelText; 12379 default: 12380 switch (type) { 12381 case "checkbox": 12382 return vModelCheckbox; 12383 case "radio": 12384 return vModelRadio; 12385 default: 12386 return vModelText; 12387 } 12388 } 12389 } 12390 function callModelHook(el, binding, vnode, prevVNode, hook) { 12391 const modelToUse = resolveDynamicModel( 12392 el.tagName, 12393 vnode.props && vnode.props.type 12394 ); 12395 const fn = modelToUse[hook]; 12396 fn && fn(el, binding, vnode, prevVNode); 12397 } 12398 12399 const systemModifiers = ["ctrl", "shift", "alt", "meta"]; 12400 const modifierGuards = { 12401 stop: (e) => e.stopPropagation(), 12402 prevent: (e) => e.preventDefault(), 12403 self: (e) => e.target !== e.currentTarget, 12404 ctrl: (e) => !e.ctrlKey, 12405 shift: (e) => !e.shiftKey, 12406 alt: (e) => !e.altKey, 12407 meta: (e) => !e.metaKey, 12408 left: (e) => "button" in e && e.button !== 0, 12409 middle: (e) => "button" in e && e.button !== 1, 12410 right: (e) => "button" in e && e.button !== 2, 12411 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m)) 12412 }; 12413 const withModifiers = (fn, modifiers) => { 12414 const cache = fn._withMods || (fn._withMods = {}); 12415 const cacheKey = modifiers.join("."); 12416 return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => { 12417 for (let i = 0; i < modifiers.length; i++) { 12418 const guard = modifierGuards[modifiers[i]]; 12419 if (guard && guard(event, modifiers)) return; 12420 } 12421 return fn(event, ...args); 12422 })); 12423 }; 12424 const keyNames = { 12425 esc: "escape", 12426 space: " ", 12427 up: "arrow-up", 12428 left: "arrow-left", 12429 right: "arrow-right", 12430 down: "arrow-down", 12431 delete: "backspace" 12432 }; 12433 const withKeys = (fn, modifiers) => { 12434 const cache = fn._withKeys || (fn._withKeys = {}); 12435 const cacheKey = modifiers.join("."); 12436 return cache[cacheKey] || (cache[cacheKey] = ((event) => { 12437 if (!("key" in event)) { 12438 return; 12439 } 12440 const eventKey = hyphenate(event.key); 12441 if (modifiers.some( 12442 (k) => k === eventKey || keyNames[k] === eventKey 12443 )) { 12444 return fn(event); 12445 } 12446 })); 12447 }; 12448 12449 const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps); 12450 let renderer; 12451 let enabledHydration = false; 12452 function ensureRenderer() { 12453 return renderer || (renderer = createRenderer(rendererOptions)); 12454 } 12455 function ensureHydrationRenderer() { 12456 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions); 12457 enabledHydration = true; 12458 return renderer; 12459 } 12460 const render = ((...args) => { 12461 ensureRenderer().render(...args); 12462 }); 12463 const hydrate = ((...args) => { 12464 ensureHydrationRenderer().hydrate(...args); 12465 }); 12466 const createApp = ((...args) => { 12467 const app = ensureRenderer().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) return; 12476 const component = app._component; 12477 if (!isFunction(component) && !component.render && !component.template) { 12478 component.template = container.innerHTML; 12479 } 12480 if (container.nodeType === 1) { 12481 container.textContent = ""; 12482 } 12483 const proxy = mount(container, false, resolveRootNamespace(container)); 12484 if (container instanceof Element) { 12485 container.removeAttribute("v-cloak"); 12486 container.setAttribute("data-v-app", ""); 12487 } 12488 return proxy; 12489 }; 12490 return app; 12491 }); 12492 const createSSRApp = ((...args) => { 12493 const app = ensureHydrationRenderer().createApp(...args); 12494 { 12495 injectNativeTagCheck(app); 12496 injectCompilerOptionsCheck(app); 12497 } 12498 const { mount } = app; 12499 app.mount = (containerOrSelector) => { 12500 const container = normalizeContainer(containerOrSelector); 12501 if (container) { 12502 return mount(container, true, resolveRootNamespace(container)); 12503 } 12504 }; 12505 return app; 12506 }); 12507 function resolveRootNamespace(container) { 12508 if (container instanceof SVGElement) { 12509 return "svg"; 12510 } 12511 if (typeof MathMLElement === "function" && container instanceof MathMLElement) { 12512 return "mathml"; 12513 } 12514 } 12515 function injectNativeTagCheck(app) { 12516 Object.defineProperty(app.config, "isNativeTag", { 12517 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 12518 writable: false 12519 }); 12520 } 12521 function injectCompilerOptionsCheck(app) { 12522 if (isRuntimeOnly()) { 12523 const isCustomElement = app.config.isCustomElement; 12524 Object.defineProperty(app.config, "isCustomElement", { 12525 get() { 12526 return isCustomElement; 12527 }, 12528 set() { 12529 warn( 12530 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.` 12531 ); 12532 } 12533 }); 12534 const compilerOptions = app.config.compilerOptions; 12535 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. 12536 - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option. 12537 - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader 12538 - 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`; 12539 Object.defineProperty(app.config, "compilerOptions", { 12540 get() { 12541 warn(msg); 12542 return compilerOptions; 12543 }, 12544 set() { 12545 warn(msg); 12546 } 12547 }); 12548 } 12549 } 12550 function normalizeContainer(container) { 12551 if (isString(container)) { 12552 const res = document.querySelector(container); 12553 if (!res) { 12554 warn( 12555 `Failed to mount app: mount target selector "${container}" returned null.` 12556 ); 12557 } 12558 return res; 12559 } 12560 if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") { 12561 warn( 12562 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs` 12563 ); 12564 } 12565 return container; 12566 } 12567 const initDirectivesForSSR = NOOP; 12568 12569 function initDev() { 12570 { 12571 { 12572 console.info( 12573 `You are running a development build of Vue. 12574 Make sure to use the production build (*.prod.js) when deploying for production.` 12575 ); 12576 } 12577 initCustomFormatter(); 12578 } 12579 } 12580 12581 const FRAGMENT = /* @__PURE__ */ Symbol(`Fragment` ); 12582 const TELEPORT = /* @__PURE__ */ Symbol(`Teleport` ); 12583 const SUSPENSE = /* @__PURE__ */ Symbol(`Suspense` ); 12584 const KEEP_ALIVE = /* @__PURE__ */ Symbol(`KeepAlive` ); 12585 const BASE_TRANSITION = /* @__PURE__ */ Symbol( 12586 `BaseTransition` 12587 ); 12588 const OPEN_BLOCK = /* @__PURE__ */ Symbol(`openBlock` ); 12589 const CREATE_BLOCK = /* @__PURE__ */ Symbol(`createBlock` ); 12590 const CREATE_ELEMENT_BLOCK = /* @__PURE__ */ Symbol( 12591 `createElementBlock` 12592 ); 12593 const CREATE_VNODE = /* @__PURE__ */ Symbol(`createVNode` ); 12594 const CREATE_ELEMENT_VNODE = /* @__PURE__ */ Symbol( 12595 `createElementVNode` 12596 ); 12597 const CREATE_COMMENT = /* @__PURE__ */ Symbol( 12598 `createCommentVNode` 12599 ); 12600 const CREATE_TEXT = /* @__PURE__ */ Symbol( 12601 `createTextVNode` 12602 ); 12603 const CREATE_STATIC = /* @__PURE__ */ Symbol( 12604 `createStaticVNode` 12605 ); 12606 const RESOLVE_COMPONENT = /* @__PURE__ */ Symbol( 12607 `resolveComponent` 12608 ); 12609 const RESOLVE_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol( 12610 `resolveDynamicComponent` 12611 ); 12612 const RESOLVE_DIRECTIVE = /* @__PURE__ */ Symbol( 12613 `resolveDirective` 12614 ); 12615 const RESOLVE_FILTER = /* @__PURE__ */ Symbol( 12616 `resolveFilter` 12617 ); 12618 const WITH_DIRECTIVES = /* @__PURE__ */ Symbol( 12619 `withDirectives` 12620 ); 12621 const RENDER_LIST = /* @__PURE__ */ Symbol(`renderList` ); 12622 const RENDER_SLOT = /* @__PURE__ */ Symbol(`renderSlot` ); 12623 const CREATE_SLOTS = /* @__PURE__ */ Symbol(`createSlots` ); 12624 const TO_DISPLAY_STRING = /* @__PURE__ */ Symbol( 12625 `toDisplayString` 12626 ); 12627 const MERGE_PROPS = /* @__PURE__ */ Symbol(`mergeProps` ); 12628 const NORMALIZE_CLASS = /* @__PURE__ */ Symbol( 12629 `normalizeClass` 12630 ); 12631 const NORMALIZE_STYLE = /* @__PURE__ */ Symbol( 12632 `normalizeStyle` 12633 ); 12634 const NORMALIZE_PROPS = /* @__PURE__ */ Symbol( 12635 `normalizeProps` 12636 );
vendor: 42,583 bytes, lines 12637-13885
12637 const GUARD_REACTIVE_PROPS = /* @__PURE__ */ Symbol( 12638 `guardReactiveProps` 12639 ); 12640 const TO_HANDLERS = /* @__PURE__ */ Symbol(`toHandlers` ); 12641 const CAMELIZE = /* @__PURE__ */ Symbol(`camelize` ); 12642 const CAPITALIZE = /* @__PURE__ */ Symbol(`capitalize` ); 12643 const TO_HANDLER_KEY = /* @__PURE__ */ Symbol( 12644 `toHandlerKey` 12645 ); 12646 const SET_BLOCK_TRACKING = /* @__PURE__ */ Symbol( 12647 `setBlockTracking` 12648 ); 12649 const PUSH_SCOPE_ID = /* @__PURE__ */ Symbol(`pushScopeId` ); 12650 const POP_SCOPE_ID = /* @__PURE__ */ Symbol(`popScopeId` ); 12651 const WITH_CTX = /* @__PURE__ */ Symbol(`withCtx` ); 12652 const UNREF = /* @__PURE__ */ Symbol(`unref` ); 12653 const IS_REF = /* @__PURE__ */ Symbol(`isRef` ); 12654 const WITH_MEMO = /* @__PURE__ */ Symbol(`withMemo` ); 12655 const IS_MEMO_SAME = /* @__PURE__ */ Symbol(`isMemoSame` ); 12656 const helperNameMap = { 12657 [FRAGMENT]: `Fragment`, 12658 [TELEPORT]: `Teleport`, 12659 [SUSPENSE]: `Suspense`, 12660 [KEEP_ALIVE]: `KeepAlive`, 12661 [BASE_TRANSITION]: `BaseTransition`, 12662 [OPEN_BLOCK]: `openBlock`, 12663 [CREATE_BLOCK]: `createBlock`, 12664 [CREATE_ELEMENT_BLOCK]: `createElementBlock`, 12665 [CREATE_VNODE]: `createVNode`, 12666 [CREATE_ELEMENT_VNODE]: `createElementVNode`, 12667 [CREATE_COMMENT]: `createCommentVNode`, 12668 [CREATE_TEXT]: `createTextVNode`, 12669 [CREATE_STATIC]: `createStaticVNode`, 12670 [RESOLVE_COMPONENT]: `resolveComponent`, 12671 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`, 12672 [RESOLVE_DIRECTIVE]: `resolveDirective`, 12673 [RESOLVE_FILTER]: `resolveFilter`, 12674 [WITH_DIRECTIVES]: `withDirectives`, 12675 [RENDER_LIST]: `renderList`, 12676 [RENDER_SLOT]: `renderSlot`, 12677 [CREATE_SLOTS]: `createSlots`, 12678 [TO_DISPLAY_STRING]: `toDisplayString`, 12679 [MERGE_PROPS]: `mergeProps`, 12680 [NORMALIZE_CLASS]: `normalizeClass`, 12681 [NORMALIZE_STYLE]: `normalizeStyle`, 12682 [NORMALIZE_PROPS]: `normalizeProps`, 12683 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`, 12684 [TO_HANDLERS]: `toHandlers`, 12685 [CAMELIZE]: `camelize`, 12686 [CAPITALIZE]: `capitalize`, 12687 [TO_HANDLER_KEY]: `toHandlerKey`, 12688 [SET_BLOCK_TRACKING]: `setBlockTracking`, 12689 [PUSH_SCOPE_ID]: `pushScopeId`, 12690 [POP_SCOPE_ID]: `popScopeId`, 12691 [WITH_CTX]: `withCtx`, 12692 [UNREF]: `unref`, 12693 [IS_REF]: `isRef`, 12694 [WITH_MEMO]: `withMemo`, 12695 [IS_MEMO_SAME]: `isMemoSame` 12696 }; 12697 function registerRuntimeHelpers(helpers) { 12698 Object.getOwnPropertySymbols(helpers).forEach((s) => { 12699 helperNameMap[s] = helpers[s]; 12700 }); 12701 } 12702 12703 const locStub = { 12704 start: { line: 1, column: 1, offset: 0 }, 12705 end: { line: 1, column: 1, offset: 0 }, 12706 source: "" 12707 }; 12708 function createRoot(children, source = "") { 12709 return { 12710 type: 0, 12711 source, 12712 children, 12713 helpers: /* @__PURE__ */ new Set(), 12714 components: [], 12715 directives: [], 12716 hoists: [], 12717 imports: [], 12718 cached: [], 12719 temps: 0, 12720 codegenNode: void 0, 12721 loc: locStub 12722 }; 12723 } 12724 function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) { 12725 if (context) { 12726 if (isBlock) { 12727 context.helper(OPEN_BLOCK); 12728 context.helper(getVNodeBlockHelper(context.inSSR, isComponent)); 12729 } else { 12730 context.helper(getVNodeHelper(context.inSSR, isComponent)); 12731 } 12732 if (directives) { 12733 context.helper(WITH_DIRECTIVES); 12734 } 12735 } 12736 return { 12737 type: 13, 12738 tag, 12739 props, 12740 children, 12741 patchFlag, 12742 dynamicProps, 12743 directives, 12744 isBlock, 12745 disableTracking, 12746 isComponent, 12747 loc 12748 }; 12749 } 12750 function createArrayExpression(elements, loc = locStub) { 12751 return { 12752 type: 17, 12753 loc, 12754 elements 12755 }; 12756 } 12757 function createObjectExpression(properties, loc = locStub) { 12758 return { 12759 type: 15, 12760 loc, 12761 properties 12762 }; 12763 } 12764 function createObjectProperty(key, value) { 12765 return { 12766 type: 16, 12767 loc: locStub, 12768 key: isString(key) ? createSimpleExpression(key, true) : key, 12769 value 12770 }; 12771 } 12772 function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) { 12773 return { 12774 type: 4, 12775 loc, 12776 content, 12777 isStatic, 12778 constType: isStatic ? 3 : constType 12779 }; 12780 } 12781 function createCompoundExpression(children, loc = locStub) { 12782 return { 12783 type: 8, 12784 loc, 12785 children 12786 }; 12787 } 12788 function createCallExpression(callee, args = [], loc = locStub) { 12789 return { 12790 type: 14, 12791 loc, 12792 callee, 12793 arguments: args 12794 }; 12795 } 12796 function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) { 12797 return { 12798 type: 18, 12799 params, 12800 returns, 12801 newline, 12802 isSlot, 12803 loc 12804 }; 12805 } 12806 function createConditionalExpression(test, consequent, alternate, newline = true) { 12807 return { 12808 type: 19, 12809 test, 12810 consequent, 12811 alternate, 12812 newline, 12813 loc: locStub 12814 }; 12815 } 12816 function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) { 12817 return { 12818 type: 20, 12819 index, 12820 value, 12821 needPauseTracking, 12822 inVOnce, 12823 needArraySpread: false, 12824 loc: locStub 12825 }; 12826 } 12827 function createBlockStatement(body) { 12828 return { 12829 type: 21, 12830 body, 12831 loc: locStub 12832 }; 12833 } 12834 function getVNodeHelper(ssr, isComponent) { 12835 return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE; 12836 } 12837 function getVNodeBlockHelper(ssr, isComponent) { 12838 return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK; 12839 } 12840 function convertToBlock(node, { helper, removeHelper, inSSR }) { 12841 if (!node.isBlock) { 12842 node.isBlock = true; 12843 removeHelper(getVNodeHelper(inSSR, node.isComponent)); 12844 helper(OPEN_BLOCK); 12845 helper(getVNodeBlockHelper(inSSR, node.isComponent)); 12846 } 12847 } 12848 12849 const defaultDelimitersOpen = new Uint8Array([123, 123]); 12850 const defaultDelimitersClose = new Uint8Array([125, 125]); 12851 function isTagStartChar(c) { 12852 return c >= 97 && c <= 122 || c >= 65 && c <= 90; 12853 } 12854 function isWhitespace(c) { 12855 return c === 32 || c === 10 || c === 9 || c === 12 || c === 13; 12856 } 12857 function isEndOfTagSection(c) { 12858 return c === 47 || c === 62 || isWhitespace(c); 12859 } 12860 function toCharCodes(str) { 12861 const ret = new Uint8Array(str.length); 12862 for (let i = 0; i < str.length; i++) { 12863 ret[i] = str.charCodeAt(i); 12864 } 12865 return ret; 12866 } 12867 const Sequences = { 12868 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]), 12869 // CDATA[ 12870 CdataEnd: new Uint8Array([93, 93, 62]), 12871 // ]]> 12872 CommentEnd: new Uint8Array([45, 45, 62]), 12873 // `-->` 12874 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]), 12875 // `<\/script` 12876 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]), 12877 // `</style` 12878 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]), 12879 // `</title` 12880 TextareaEnd: new Uint8Array([ 12881 60, 12882 47, 12883 116, 12884 101, 12885 120, 12886 116, 12887 97, 12888 114, 12889 101, 12890 97 12891 ]) 12892 // `</textarea 12893 }; 12894 class Tokenizer { 12895 constructor(stack, cbs) { 12896 this.stack = stack; 12897 this.cbs = cbs; 12898 /** The current state the tokenizer is in. */ 12899 this.state = 1; 12900 /** The read buffer. */ 12901 this.buffer = ""; 12902 /** The beginning of the section that is currently being read. */ 12903 this.sectionStart = 0; 12904 /** The index within the buffer that we are currently looking at. */ 12905 this.index = 0; 12906 /** The start of the last entity. */ 12907 this.entityStart = 0; 12908 /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */ 12909 this.baseState = 1; 12910 /** For special parsing behavior inside of script and style tags. */ 12911 this.inRCDATA = false; 12912 /** For disabling RCDATA tags handling */ 12913 this.inXML = false; 12914 /** For disabling interpolation parsing in v-pre */ 12915 this.inVPre = false; 12916 /** Record newline positions for fast line / column calculation */ 12917 this.newlines = []; 12918 this.mode = 0; 12919 this.delimiterOpen = defaultDelimitersOpen; 12920 this.delimiterClose = defaultDelimitersClose; 12921 this.delimiterIndex = -1; 12922 this.currentSequence = void 0; 12923 this.sequenceIndex = 0; 12924 } 12925 get inSFCRoot() { 12926 return this.mode === 2 && this.stack.length === 0; 12927 } 12928 reset() { 12929 this.state = 1; 12930 this.mode = 0; 12931 this.buffer = ""; 12932 this.sectionStart = 0; 12933 this.index = 0; 12934 this.baseState = 1; 12935 this.inRCDATA = false; 12936 this.currentSequence = void 0; 12937 this.newlines.length = 0; 12938 this.delimiterOpen = defaultDelimitersOpen; 12939 this.delimiterClose = defaultDelimitersClose; 12940 } 12941 /** 12942 * Generate Position object with line / column information using recorded 12943 * newline positions. We know the index is always going to be an already 12944 * processed index, so all the newlines up to this index should have been 12945 * recorded. 12946 */ 12947 getPos(index) { 12948 let line = 1; 12949 let column = index + 1; 12950 const length = this.newlines.length; 12951 let j = -1; 12952 if (length > 100) { 12953 let l = -1; 12954 let r = length; 12955 while (l + 1 < r) { 12956 const m = l + r >>> 1; 12957 this.newlines[m] < index ? l = m : r = m; 12958 } 12959 j = l; 12960 } else { 12961 for (let i = length - 1; i >= 0; i--) { 12962 if (index > this.newlines[i]) { 12963 j = i; 12964 break; 12965 } 12966 } 12967 } 12968 if (j >= 0) { 12969 line = j + 2; 12970 column = index - this.newlines[j]; 12971 } 12972 return { 12973 column, 12974 line, 12975 offset: index 12976 }; 12977 } 12978 peek() { 12979 return this.buffer.charCodeAt(this.index + 1); 12980 } 12981 stateText(c) { 12982 if (c === 60) { 12983 if (this.index > this.sectionStart) { 12984 this.cbs.ontext(this.sectionStart, this.index); 12985 } 12986 this.state = 5; 12987 this.sectionStart = this.index; 12988 } else if (!this.inVPre && c === this.delimiterOpen[0]) { 12989 this.state = 2; 12990 this.delimiterIndex = 0; 12991 this.stateInterpolationOpen(c); 12992 } 12993 } 12994 stateInterpolationOpen(c) { 12995 if (c === this.delimiterOpen[this.delimiterIndex]) { 12996 if (this.delimiterIndex === this.delimiterOpen.length - 1) { 12997 const start = this.index + 1 - this.delimiterOpen.length; 12998 if (start > this.sectionStart) { 12999 this.cbs.ontext(this.sectionStart, start); 13000 } 13001 this.state = 3; 13002 this.sectionStart = start; 13003 } else { 13004 this.delimiterIndex++; 13005 } 13006 } else if (this.inRCDATA) { 13007 this.state = 32; 13008 this.stateInRCDATA(c); 13009 } else { 13010 this.state = 1; 13011 this.stateText(c); 13012 } 13013 } 13014 stateInterpolation(c) { 13015 if (c === this.delimiterClose[0]) { 13016 this.state = 4; 13017 this.delimiterIndex = 0; 13018 this.stateInterpolationClose(c); 13019 } 13020 } 13021 stateInterpolationClose(c) { 13022 if (c === this.delimiterClose[this.delimiterIndex]) { 13023 if (this.delimiterIndex === this.delimiterClose.length - 1) { 13024 this.cbs.oninterpolation(this.sectionStart, this.index + 1); 13025 if (this.inRCDATA) { 13026 this.state = 32; 13027 } else { 13028 this.state = 1; 13029 } 13030 this.sectionStart = this.index + 1; 13031 } else { 13032 this.delimiterIndex++; 13033 } 13034 } else { 13035 this.state = 3; 13036 this.stateInterpolation(c); 13037 } 13038 } 13039 stateSpecialStartSequence(c) { 13040 const isEnd = this.sequenceIndex === this.currentSequence.length; 13041 const isMatch = isEnd ? ( 13042 // If we are at the end of the sequence, make sure the tag name has ended 13043 isEndOfTagSection(c) 13044 ) : ( 13045 // Otherwise, do a case-insensitive comparison 13046 (c | 32) === this.currentSequence[this.sequenceIndex] 13047 ); 13048 if (!isMatch) { 13049 this.inRCDATA = false; 13050 } else if (!isEnd) { 13051 this.sequenceIndex++; 13052 return; 13053 } 13054 this.sequenceIndex = 0; 13055 this.state = 6; 13056 this.stateInTagName(c); 13057 } 13058 /** Look for an end tag. For <title> and <textarea>, also decode entities. */ 13059 stateInRCDATA(c) { 13060 if (this.sequenceIndex === this.currentSequence.length) { 13061 if (c === 62 || isWhitespace(c)) { 13062 const endOfText = this.index - this.currentSequence.length; 13063 if (this.sectionStart < endOfText) { 13064 const actualIndex = this.index; 13065 this.index = endOfText; 13066 this.cbs.ontext(this.sectionStart, endOfText); 13067 this.index = actualIndex; 13068 } 13069 this.sectionStart = endOfText + 2; 13070 this.stateInClosingTagName(c); 13071 this.inRCDATA = false; 13072 return; 13073 } 13074 this.sequenceIndex = 0; 13075 } 13076 if ((c | 32) === this.currentSequence[this.sequenceIndex]) { 13077 this.sequenceIndex += 1; 13078 } else if (this.sequenceIndex === 0) { 13079 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) { 13080 if (!this.inVPre && c === this.delimiterOpen[0]) { 13081 this.state = 2; 13082 this.delimiterIndex = 0; 13083 this.stateInterpolationOpen(c); 13084 } 13085 } else if (this.fastForwardTo(60)) { 13086 this.sequenceIndex = 1; 13087 } 13088 } else { 13089 this.sequenceIndex = Number(c === 60); 13090 } 13091 } 13092 stateCDATASequence(c) { 13093 if (c === Sequences.Cdata[this.sequenceIndex]) { 13094 if (++this.sequenceIndex === Sequences.Cdata.length) { 13095 this.state = 28; 13096 this.currentSequence = Sequences.CdataEnd; 13097 this.sequenceIndex = 0; 13098 this.sectionStart = this.index + 1; 13099 } 13100 } else { 13101 this.sequenceIndex = 0; 13102 this.state = 23; 13103 this.stateInDeclaration(c); 13104 } 13105 } 13106 /** 13107 * When we wait for one specific character, we can speed things up 13108 * by skipping through the buffer until we find it. 13109 * 13110 * @returns Whether the character was found. 13111 */ 13112 fastForwardTo(c) { 13113 while (++this.index < this.buffer.length) { 13114 const cc = this.buffer.charCodeAt(this.index); 13115 if (cc === 10) { 13116 this.newlines.push(this.index); 13117 } 13118 if (cc === c) { 13119 return true; 13120 } 13121 } 13122 this.index = this.buffer.length - 1; 13123 return false; 13124 } 13125 /** 13126 * Comments and CDATA end with `-->` and `]]>`. 13127 * 13128 * Their common qualities are: 13129 * - Their end sequences have a distinct character they start with. 13130 * - That character is then repeated, so we have to check multiple repeats. 13131 * - All characters but the start character of the sequence can be skipped. 13132 */ 13133 stateInCommentLike(c) { 13134 if (c === this.currentSequence[this.sequenceIndex]) { 13135 if (++this.sequenceIndex === this.currentSequence.length) { 13136 if (this.currentSequence === Sequences.CdataEnd) { 13137 this.cbs.oncdata(this.sectionStart, this.index - 2); 13138 } else { 13139 this.cbs.oncomment(this.sectionStart, this.index - 2); 13140 } 13141 this.sequenceIndex = 0; 13142 this.sectionStart = this.index + 1; 13143 this.state = 1; 13144 } 13145 } else if (this.sequenceIndex === 0) { 13146 if (this.fastForwardTo(this.currentSequence[0])) { 13147 this.sequenceIndex = 1; 13148 } 13149 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) { 13150 this.sequenceIndex = 0; 13151 } 13152 } 13153 startSpecial(sequence, offset) { 13154 this.enterRCDATA(sequence, offset); 13155 this.state = 31; 13156 } 13157 enterRCDATA(sequence, offset) { 13158 this.inRCDATA = true; 13159 this.currentSequence = sequence; 13160 this.sequenceIndex = offset; 13161 } 13162 stateBeforeTagName(c) { 13163 if (c === 33) { 13164 this.state = 22; 13165 this.sectionStart = this.index + 1; 13166 } else if (c === 63) { 13167 this.state = 24; 13168 this.sectionStart = this.index + 1; 13169 } else if (isTagStartChar(c)) { 13170 this.sectionStart = this.index; 13171 if (this.mode === 0) { 13172 this.state = 6; 13173 } else if (this.inSFCRoot) { 13174 this.state = 34; 13175 } else if (!this.inXML) { 13176 if (c === 116) { 13177 this.state = 30; 13178 } else { 13179 this.state = c === 115 ? 29 : 6; 13180 } 13181 } else { 13182 this.state = 6; 13183 } 13184 } else if (c === 47) { 13185 this.state = 8; 13186 } else { 13187 this.state = 1; 13188 this.stateText(c); 13189 } 13190 } 13191 stateInTagName(c) { 13192 if (isEndOfTagSection(c)) { 13193 this.handleTagName(c); 13194 } 13195 } 13196 stateInSFCRootTagName(c) { 13197 if (isEndOfTagSection(c)) { 13198 const tag = this.buffer.slice(this.sectionStart, this.index); 13199 if (tag !== "template") { 13200 this.enterRCDATA(toCharCodes(`</` + tag), 0); 13201 } 13202 this.handleTagName(c); 13203 } 13204 } 13205 handleTagName(c) { 13206 this.cbs.onopentagname(this.sectionStart, this.index); 13207 this.sectionStart = -1; 13208 this.state = 11; 13209 this.stateBeforeAttrName(c); 13210 } 13211 stateBeforeClosingTagName(c) { 13212 if (isWhitespace(c)) ; else if (c === 62) { 13213 { 13214 this.cbs.onerr(14, this.index); 13215 } 13216 this.state = 1; 13217 this.sectionStart = this.index + 1; 13218 } else { 13219 this.state = isTagStartChar(c) ? 9 : 27; 13220 this.sectionStart = this.index; 13221 } 13222 } 13223 stateInClosingTagName(c) { 13224 if (c === 62 || isWhitespace(c)) { 13225 this.cbs.onclosetag(this.sectionStart, this.index); 13226 this.sectionStart = -1; 13227 this.state = 10; 13228 this.stateAfterClosingTagName(c); 13229 } 13230 } 13231 stateAfterClosingTagName(c) { 13232 if (c === 62) { 13233 this.state = 1; 13234 this.sectionStart = this.index + 1; 13235 } 13236 } 13237 stateBeforeAttrName(c) { 13238 if (c === 62) { 13239 this.cbs.onopentagend(this.index); 13240 if (this.inRCDATA) { 13241 this.state = 32; 13242 } else { 13243 this.state = 1; 13244 } 13245 this.sectionStart = this.index + 1; 13246 } else if (c === 47) { 13247 this.state = 7; 13248 if (this.peek() !== 62) { 13249 this.cbs.onerr(22, this.index); 13250 } 13251 } else if (c === 60 && this.peek() === 47) { 13252 this.cbs.onopentagend(this.index); 13253 this.state = 5; 13254 this.sectionStart = this.index; 13255 } else if (!isWhitespace(c)) { 13256 if (c === 61) { 13257 this.cbs.onerr( 13258 19, 13259 this.index 13260 ); 13261 } 13262 this.handleAttrStart(c); 13263 } 13264 } 13265 handleAttrStart(c) { 13266 if (c === 118 && this.peek() === 45) { 13267 this.state = 13; 13268 this.sectionStart = this.index; 13269 } else if (c === 46 || c === 58 || c === 64 || c === 35) { 13270 this.cbs.ondirname(this.index, this.index + 1); 13271 this.state = 14; 13272 this.sectionStart = this.index + 1; 13273 } else { 13274 this.state = 12; 13275 this.sectionStart = this.index; 13276 } 13277 } 13278 stateInSelfClosingTag(c) { 13279 if (c === 62) { 13280 this.cbs.onselfclosingtag(this.index); 13281 this.state = 1; 13282 this.sectionStart = this.index + 1; 13283 this.inRCDATA = false; 13284 } else if (!isWhitespace(c)) { 13285 this.state = 11; 13286 this.stateBeforeAttrName(c); 13287 } 13288 } 13289 stateInAttrName(c) { 13290 if (c === 61 || isEndOfTagSection(c)) { 13291 this.cbs.onattribname(this.sectionStart, this.index); 13292 this.handleAttrNameEnd(c); 13293 } else if (c === 34 || c === 39 || c === 60) { 13294 this.cbs.onerr( 13295 17, 13296 this.index 13297 ); 13298 } 13299 } 13300 stateInDirName(c) { 13301 if (c === 61 || isEndOfTagSection(c)) { 13302 this.cbs.ondirname(this.sectionStart, this.index); 13303 this.handleAttrNameEnd(c); 13304 } else if (c === 58) { 13305 this.cbs.ondirname(this.sectionStart, this.index); 13306 this.state = 14; 13307 this.sectionStart = this.index + 1; 13308 } else if (c === 46) { 13309 this.cbs.ondirname(this.sectionStart, this.index); 13310 this.state = 16; 13311 this.sectionStart = this.index + 1; 13312 } 13313 } 13314 stateInDirArg(c) { 13315 if (c === 61 || isEndOfTagSection(c)) { 13316 this.cbs.ondirarg(this.sectionStart, this.index); 13317 this.handleAttrNameEnd(c); 13318 } else if (c === 91) { 13319 this.state = 15; 13320 } else if (c === 46) { 13321 this.cbs.ondirarg(this.sectionStart, this.index); 13322 this.state = 16; 13323 this.sectionStart = this.index + 1; 13324 } 13325 } 13326 stateInDynamicDirArg(c) { 13327 if (c === 93) { 13328 this.state = 14; 13329 } else if (c === 61 || isEndOfTagSection(c)) { 13330 this.cbs.ondirarg(this.sectionStart, this.index + 1); 13331 this.handleAttrNameEnd(c); 13332 { 13333 this.cbs.onerr( 13334 27, 13335 this.index 13336 ); 13337 } 13338 } 13339 } 13340 stateInDirModifier(c) { 13341 if (c === 61 || isEndOfTagSection(c)) { 13342 this.cbs.ondirmodifier(this.sectionStart, this.index); 13343 this.handleAttrNameEnd(c); 13344 } else if (c === 46) { 13345 this.cbs.ondirmodifier(this.sectionStart, this.index); 13346 this.sectionStart = this.index + 1; 13347 } 13348 } 13349 handleAttrNameEnd(c) { 13350 this.sectionStart = this.index; 13351 this.state = 17; 13352 this.cbs.onattribnameend(this.index); 13353 this.stateAfterAttrName(c); 13354 } 13355 stateAfterAttrName(c) { 13356 if (c === 61) { 13357 this.state = 18; 13358 } else if (c === 47 || c === 62) { 13359 this.cbs.onattribend(0, this.sectionStart); 13360 this.sectionStart = -1; 13361 this.state = 11; 13362 this.stateBeforeAttrName(c); 13363 } else if (!isWhitespace(c)) { 13364 this.cbs.onattribend(0, this.sectionStart); 13365 this.handleAttrStart(c); 13366 } 13367 } 13368 stateBeforeAttrValue(c) { 13369 if (c === 34) { 13370 this.state = 19; 13371 this.sectionStart = this.index + 1; 13372 } else if (c === 39) { 13373 this.state = 20; 13374 this.sectionStart = this.index + 1; 13375 } else if (!isWhitespace(c)) { 13376 this.sectionStart = this.index; 13377 this.state = 21; 13378 this.stateInAttrValueNoQuotes(c); 13379 } 13380 } 13381 handleInAttrValue(c, quote) { 13382 if (c === quote || this.fastForwardTo(quote)) { 13383 this.cbs.onattribdata(this.sectionStart, this.index); 13384 this.sectionStart = -1; 13385 this.cbs.onattribend( 13386 quote === 34 ? 3 : 2, 13387 this.index + 1 13388 ); 13389 this.state = 11; 13390 } 13391 } 13392 stateInAttrValueDoubleQuotes(c) { 13393 this.handleInAttrValue(c, 34); 13394 } 13395 stateInAttrValueSingleQuotes(c) { 13396 this.handleInAttrValue(c, 39); 13397 } 13398 stateInAttrValueNoQuotes(c) { 13399 if (isWhitespace(c) || c === 62) { 13400 this.cbs.onattribdata(this.sectionStart, this.index); 13401 this.sectionStart = -1; 13402 this.cbs.onattribend(1, this.index); 13403 this.state = 11; 13404 this.stateBeforeAttrName(c); 13405 } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) { 13406 this.cbs.onerr( 13407 18, 13408 this.index 13409 ); 13410 } else ; 13411 } 13412 stateBeforeDeclaration(c) { 13413 if (c === 91) { 13414 this.state = 26; 13415 this.sequenceIndex = 0; 13416 } else { 13417 this.state = c === 45 ? 25 : 23; 13418 } 13419 } 13420 stateInDeclaration(c) { 13421 if (c === 62 || this.fastForwardTo(62)) { 13422 this.state = 1; 13423 this.sectionStart = this.index + 1; 13424 } 13425 } 13426 stateInProcessingInstruction(c) { 13427 if (c === 62 || this.fastForwardTo(62)) { 13428 this.cbs.onprocessinginstruction(this.sectionStart, this.index); 13429 this.state = 1; 13430 this.sectionStart = this.index + 1; 13431 } 13432 } 13433 stateBeforeComment(c) { 13434 if (c === 45) { 13435 this.state = 28; 13436 this.currentSequence = Sequences.CommentEnd; 13437 this.sequenceIndex = 2; 13438 this.sectionStart = this.index + 1; 13439 } else { 13440 this.state = 23; 13441 } 13442 } 13443 stateInSpecialComment(c) { 13444 if (c === 62 || this.fastForwardTo(62)) { 13445 this.cbs.oncomment(this.sectionStart, this.index); 13446 this.state = 1; 13447 this.sectionStart = this.index + 1; 13448 } 13449 } 13450 stateBeforeSpecialS(c) { 13451 if (c === Sequences.ScriptEnd[3]) { 13452 this.startSpecial(Sequences.ScriptEnd, 4); 13453 } else if (c === Sequences.StyleEnd[3]) { 13454 this.startSpecial(Sequences.StyleEnd, 4); 13455 } else { 13456 this.state = 6; 13457 this.stateInTagName(c); 13458 } 13459 } 13460 stateBeforeSpecialT(c) { 13461 if (c === Sequences.TitleEnd[3]) { 13462 this.startSpecial(Sequences.TitleEnd, 4); 13463 } else if (c === Sequences.TextareaEnd[3]) { 13464 this.startSpecial(Sequences.TextareaEnd, 4); 13465 } else { 13466 this.state = 6; 13467 this.stateInTagName(c); 13468 } 13469 } 13470 startEntity() { 13471 } 13472 stateInEntity() { 13473 } 13474 /** 13475 * Iterates through the buffer, calling the function corresponding to the current state. 13476 * 13477 * States that are more likely to be hit are higher up, as a performance improvement. 13478 */ 13479 parse(input) { 13480 this.buffer = input; 13481 while (this.index < this.buffer.length) { 13482 const c = this.buffer.charCodeAt(this.index); 13483 if (c === 10 && this.state !== 33) { 13484 this.newlines.push(this.index); 13485 } 13486 switch (this.state) { 13487 case 1: { 13488 this.stateText(c); 13489 break; 13490 } 13491 case 2: { 13492 this.stateInterpolationOpen(c); 13493 break; 13494 } 13495 case 3: { 13496 this.stateInterpolation(c); 13497 break; 13498 } 13499 case 4: { 13500 this.stateInterpolationClose(c); 13501 break; 13502 } 13503 case 31: { 13504 this.stateSpecialStartSequence(c); 13505 break; 13506 } 13507 case 32: { 13508 this.stateInRCDATA(c); 13509 break; 13510 } 13511 case 26: { 13512 this.stateCDATASequence(c); 13513 break; 13514 } 13515 case 19: { 13516 this.stateInAttrValueDoubleQuotes(c); 13517 break; 13518 } 13519 case 12: { 13520 this.stateInAttrName(c); 13521 break; 13522 } 13523 case 13: { 13524 this.stateInDirName(c); 13525 break; 13526 } 13527 case 14: { 13528 this.stateInDirArg(c); 13529 break; 13530 } 13531 case 15: { 13532 this.stateInDynamicDirArg(c); 13533 break; 13534 } 13535 case 16: { 13536 this.stateInDirModifier(c); 13537 break; 13538 } 13539 case 28: { 13540 this.stateInCommentLike(c); 13541 break; 13542 } 13543 case 27: { 13544 this.stateInSpecialComment(c); 13545 break; 13546 } 13547 case 11: { 13548 this.stateBeforeAttrName(c); 13549 break; 13550 } 13551 case 6: { 13552 this.stateInTagName(c); 13553 break; 13554 } 13555 case 34: { 13556 this.stateInSFCRootTagName(c); 13557 break; 13558 } 13559 case 9: { 13560 this.stateInClosingTagName(c); 13561 break; 13562 } 13563 case 5: { 13564 this.stateBeforeTagName(c); 13565 break; 13566 } 13567 case 17: { 13568 this.stateAfterAttrName(c); 13569 break; 13570 } 13571 case 20: { 13572 this.stateInAttrValueSingleQuotes(c); 13573 break; 13574 } 13575 case 18: { 13576 this.stateBeforeAttrValue(c); 13577 break; 13578 } 13579 case 8: { 13580 this.stateBeforeClosingTagName(c); 13581 break; 13582 } 13583 case 10: { 13584 this.stateAfterClosingTagName(c); 13585 break; 13586 } 13587 case 29: { 13588 this.stateBeforeSpecialS(c); 13589 break; 13590 } 13591 case 30: { 13592 this.stateBeforeSpecialT(c); 13593 break; 13594 } 13595 case 21: { 13596 this.stateInAttrValueNoQuotes(c); 13597 break; 13598 } 13599 case 7: { 13600 this.stateInSelfClosingTag(c); 13601 break; 13602 } 13603 case 23: { 13604 this.stateInDeclaration(c); 13605 break; 13606 } 13607 case 22: { 13608 this.stateBeforeDeclaration(c); 13609 break; 13610 } 13611 case 25: { 13612 this.stateBeforeComment(c); 13613 break; 13614 } 13615 case 24: { 13616 this.stateInProcessingInstruction(c); 13617 break; 13618 } 13619 case 33: { 13620 this.stateInEntity(); 13621 break; 13622 } 13623 } 13624 this.index++; 13625 } 13626 this.cleanup(); 13627 this.finish(); 13628 } 13629 /** 13630 * Remove data that has already been consumed from the buffer. 13631 */ 13632 cleanup() { 13633 if (this.sectionStart !== this.index) { 13634 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) { 13635 this.cbs.ontext(this.sectionStart, this.index); 13636 this.sectionStart = this.index; 13637 } else if (this.state === 19 || this.state === 20 || this.state === 21) { 13638 this.cbs.onattribdata(this.sectionStart, this.index); 13639 this.sectionStart = this.index; 13640 } 13641 } 13642 } 13643 finish() { 13644 this.handleTrailingData(); 13645 this.cbs.onend(); 13646 } 13647 /** Handle any trailing data. */ 13648 handleTrailingData() { 13649 const endIndex = this.buffer.length; 13650 if (this.sectionStart >= endIndex) { 13651 return; 13652 } 13653 if (this.state === 28) { 13654 if (this.currentSequence === Sequences.CdataEnd) { 13655 this.cbs.oncdata(this.sectionStart, endIndex); 13656 } else { 13657 this.cbs.oncomment(this.sectionStart, endIndex); 13658 } 13659 } 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 { 13660 this.cbs.ontext(this.sectionStart, endIndex); 13661 } 13662 } 13663 emitCodePoint(cp, consumed) { 13664 } 13665 } 13666 13667 function defaultOnError(error) { 13668 throw error; 13669 } 13670 function defaultOnWarn(msg) { 13671 console.warn(`[Vue warn] ${msg.message}`); 13672 } 13673 function createCompilerError(code, loc, messages, additionalMessage) { 13674 const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ; 13675 const error = new SyntaxError(String(msg)); 13676 error.code = code; 13677 error.loc = loc; 13678 return error; 13679 } 13680 const errorMessages = { 13681 // parse errors 13682 [0]: "Illegal comment.", 13683 [1]: "CDATA section is allowed only in XML context.", 13684 [2]: "Duplicate attribute.", 13685 [3]: "End tag cannot have attributes.", 13686 [4]: "Illegal '/' in tags.", 13687 [5]: "Unexpected EOF in tag.", 13688 [6]: "Unexpected EOF in CDATA section.", 13689 [7]: "Unexpected EOF in comment.", 13690 [8]: "Unexpected EOF in script.", 13691 [9]: "Unexpected EOF in tag.", 13692 [10]: "Incorrectly closed comment.", 13693 [11]: "Incorrectly opened comment.", 13694 [12]: "Illegal tag name. Use '<' to print '<'.", 13695 [13]: "Attribute value was expected.", 13696 [14]: "End tag name was expected.", 13697 [15]: "Whitespace was expected.", 13698 [16]: "Unexpected '<!--' in comment.", 13699 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`, 13700 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).", 13701 [19]: "Attribute name cannot start with '='.", 13702 [21]: "'<?' is allowed only in XML context.", 13703 [20]: `Unexpected null character.`, 13704 [22]: "Illegal '/' in tags.", 13705 // Vue-specific parse errors 13706 [23]: "Invalid end tag.", 13707 [24]: "Element is missing end tag.", 13708 [25]: "Interpolation end sign was not found.", 13709 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.", 13710 [26]: "Legal directive name was expected.", 13711 // transform errors 13712 [28]: `v-if/v-else-if is missing expression.`, 13713 [29]: `v-if/else branches must use unique keys.`, 13714 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`, 13715 [31]: `v-for is missing expression.`, 13716 [32]: `v-for has invalid expression.`, 13717 [33]: `<template v-for> key should be placed on the <template> tag.`, 13718 [34]: `v-bind is missing expression.`, 13719 [53]: `v-bind with same-name shorthand only allows static argument.`, 13720 [35]: `v-on is missing expression.`, 13721 [36]: `Unexpected custom directive on <slot> outlet.`, 13722 [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.`, 13723 [38]: `Duplicate slot names found. `, 13724 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`, 13725 [40]: `v-slot can only be used on components or <template> tags.`, 13726 [41]: `v-model is missing expression.`, 13727 [42]: `v-model value must be a valid JavaScript member expression.`, 13728 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`, 13729 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable. 13730 Use a v-bind binding combined with a v-on listener that emits update:x event instead.`, 13731 [45]: `v-model cannot be used on a const binding because it is not writable.`, 13732 [46]: `Error parsing JavaScript expression: `, 13733 [47]: `<KeepAlive> expects exactly one child component.`, 13734 [52]: `@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.`, 13735 // generic errors 13736 [48]: `"prefixIdentifiers" option is not supported in this build of compiler.`, 13737 [49]: `ES module mode is not supported in this build of compiler.`, 13738 [50]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`, 13739 [51]: `"scopeId" option is only supported in module mode.`, 13740 // just to fulfill types 13741 [54]: `` 13742 }; 13743 13744 const isStaticExp = (p) => p.type === 4 && p.isStatic; 13745 function isCoreComponent(tag) { 13746 switch (tag) { 13747 case "Teleport": 13748 case "teleport": 13749 return TELEPORT; 13750 case "Suspense": 13751 case "suspense": 13752 return SUSPENSE; 13753 case "KeepAlive": 13754 case "keep-alive": 13755 return KEEP_ALIVE; 13756 case "BaseTransition": 13757 case "base-transition": 13758 return BASE_TRANSITION; 13759 } 13760 } 13761 const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/; 13762 const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name); 13763 const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/; 13764 const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/; 13765 const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g; 13766 const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source; 13767 const isMemberExpressionBrowser = (exp) => { 13768 const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim()); 13769 let state = 0 /* inMemberExp */; 13770 let stateStack = []; 13771 let currentOpenBracketCount = 0; 13772 let currentOpenParensCount = 0; 13773 let currentStringType = null; 13774 for (let i = 0; i < path.length; i++) { 13775 const char = path.charAt(i); 13776 switch (state) { 13777 case 0 /* inMemberExp */: 13778 if (char === "[") { 13779 stateStack.push(state); 13780 state = 1 /* inBrackets */; 13781 currentOpenBracketCount++; 13782 } else if (char === "(") { 13783 stateStack.push(state); 13784 state = 2 /* inParens */; 13785 currentOpenParensCount++; 13786 } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) { 13787 return false; 13788 } 13789 break; 13790 case 1 /* inBrackets */: 13791 if (char === `'` || char === `"` || char === "`") { 13792 stateStack.push(state); 13793 state = 3 /* inString */; 13794 currentStringType = char; 13795 } else if (char === `[`) { 13796 currentOpenBracketCount++; 13797 } else if (char === `]`) { 13798 if (!--currentOpenBracketCount) { 13799 state = stateStack.pop(); 13800 } 13801 } 13802 break; 13803 case 2 /* inParens */: 13804 if (char === `'` || char === `"` || char === "`") { 13805 stateStack.push(state); 13806 state = 3 /* inString */; 13807 currentStringType = char; 13808 } else if (char === `(`) { 13809 currentOpenParensCount++; 13810 } else if (char === `)`) { 13811 if (i === path.length - 1) { 13812 return false; 13813 } 13814 if (!--currentOpenParensCount) { 13815 state = stateStack.pop(); 13816 } 13817 } 13818 break; 13819 case 3 /* inString */: 13820 if (char === currentStringType) { 13821 state = stateStack.pop(); 13822 currentStringType = null; 13823 } 13824 break; 13825 } 13826 } 13827 return !currentOpenBracketCount && !currentOpenParensCount; 13828 }; 13829 const isMemberExpression = isMemberExpressionBrowser ; 13830 const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/; 13831 const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp)); 13832 const isFnExpression = isFnExpressionBrowser ; 13833 function assert(condition, msg) { 13834 if (!condition) { 13835 throw new Error(msg || `unexpected compiler condition`); 13836 } 13837 } 13838 function findDir(node, name, allowEmpty = false) { 13839 for (let i = 0; i < node.props.length; i++) { 13840 const p = node.props[i]; 13841 if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) { 13842 return p; 13843 } 13844 } 13845 } 13846 function findProp(node, name, dynamicOnly = false, allowEmpty = false) { 13847 for (let i = 0; i < node.props.length; i++) { 13848 const p = node.props[i]; 13849 if (p.type === 6) { 13850 if (dynamicOnly) continue; 13851 if (p.name === name && (p.value || allowEmpty)) { 13852 return p; 13853 } 13854 } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) { 13855 return p; 13856 } 13857 } 13858 } 13859 function isStaticArgOf(arg, name) { 13860 return !!(arg && isStaticExp(arg) && arg.content === name); 13861 } 13862 function hasDynamicKeyVBind(node) { 13863 return node.props.some( 13864 (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj" 13865 p.arg.type !== 4 || // v-bind:[_ctx.foo] 13866 !p.arg.isStatic) 13867 // v-bind:[foo] 13868 ); 13869 } 13870 function isText$1(node) { 13871 return node.type === 5 || node.type === 2; 13872 } 13873 function isVPre(p) { 13874 return p.type === 7 && p.name === "pre"; 13875 } 13876 function isVSlot(p) { 13877 return p.type === 7 && p.name === "slot"; 13878 } 13879 function isTemplateNode(node) { 13880 return node.type === 1 && node.tagType === 3; 13881 } 13882 function isSlotOutlet(node) { 13883 return node.type === 1 && node.tagType === 2; 13884 } 13885 const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROP
vendor: 4,100 bytes, lines 13885-14007
13885S]); 13886 function getUnnormalizedProps(props, callPath = []) { 13887 if (props && !isString(props) && props.type === 14) { 13888 const callee = props.callee; 13889 if (!isString(callee) && propsHelperSet.has(callee)) { 13890 return getUnnormalizedProps( 13891 props.arguments[0], 13892 callPath.concat(props) 13893 ); 13894 } 13895 } 13896 return [props, callPath]; 13897 } 13898 function injectProp(node, prop, context) { 13899 let propsWithInjection; 13900 let props = node.type === 13 ? node.props : node.arguments[2]; 13901 let callPath = []; 13902 let parentCall; 13903 if (props && !isString(props) && props.type === 14) { 13904 const ret = getUnnormalizedProps(props); 13905 props = ret[0]; 13906 callPath = ret[1]; 13907 parentCall = callPath[callPath.length - 1]; 13908 } 13909 if (props == null || isString(props)) { 13910 propsWithInjection = createObjectExpression([prop]); 13911 } else if (props.type === 14) { 13912 const first = props.arguments[0]; 13913 if (!isString(first) && first.type === 15) { 13914 if (!hasProp(prop, first)) { 13915 first.properties.unshift(prop); 13916 } 13917 } else { 13918 if (props.callee === TO_HANDLERS) { 13919 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 13920 createObjectExpression([prop]), 13921 props 13922 ]); 13923 } else { 13924 props.arguments.unshift(createObjectExpression([prop])); 13925 } 13926 } 13927 !propsWithInjection && (propsWithInjection = props); 13928 } else if (props.type === 15) { 13929 if (!hasProp(prop, props)) { 13930 props.properties.unshift(prop); 13931 } 13932 propsWithInjection = props; 13933 } else { 13934 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 13935 createObjectExpression([prop]), 13936 props 13937 ]); 13938 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) { 13939 parentCall = callPath[callPath.length - 2]; 13940 } 13941 } 13942 if (node.type === 13) { 13943 if (parentCall) { 13944 parentCall.arguments[0] = propsWithInjection; 13945 } else { 13946 node.props = propsWithInjection; 13947 } 13948 } else { 13949 if (parentCall) { 13950 parentCall.arguments[0] = propsWithInjection; 13951 } else { 13952 node.arguments[2] = propsWithInjection; 13953 } 13954 } 13955 } 13956 function hasProp(prop, props) { 13957 let result = false; 13958 if (prop.key.type === 4) { 13959 const propKeyName = prop.key.content; 13960 result = props.properties.some( 13961 (p) => p.key.type === 4 && p.key.content === propKeyName 13962 ); 13963 } 13964 return result; 13965 } 13966 function toValidAssetId(name, type) { 13967 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => { 13968 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString(); 13969 })}`; 13970 } 13971 function getMemoedVNodeCall(node) { 13972 if (node.type === 14 && node.callee === WITH_MEMO) { 13973 return node.arguments[1].returns; 13974 } else { 13975 return node; 13976 } 13977 } 13978 const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/; 13979 function isAllWhitespace(str) { 13980 for (let i = 0; i < str.length; i++) { 13981 if (!isWhitespace(str.charCodeAt(i))) { 13982 return false; 13983 } 13984 } 13985 return true; 13986 } 13987 function isWhitespaceText(node) { 13988 return node.type === 2 && isAllWhitespace(node.content) || node.type === 12 && isWhitespaceText(node.content); 13989 } 13990 function isCommentOrWhitespace(node) { 13991 return node.type === 3 || isWhitespaceText(node); 13992 } 13993 13994 const defaultParserOptions = { 13995 parseMode: "base", 13996 ns: 0, 13997 delimiters: [`{{`, `}}`], 13998 getNamespace: () => 0, 13999 isVoidTag: NO, 14000 isPreTag: NO, 14001 isIgnoreNewlineTag: NO, 14002 isCustomElement: NO, 14003 onError: defaultOnError, 14004 onWarn: defaultOnWarn, 14005 comments: true, 14006 prefixIdentifiers: false 14007 };
vendor: 119,628 bytes, lines 14008-17571
14008 let currentOptions = defaultParserOptions; 14009 let currentRoot = null; 14010 let currentInput = ""; 14011 let currentOpenTag = null; 14012 let currentProp = null; 14013 let currentAttrValue = ""; 14014 let currentAttrStartIndex = -1; 14015 let currentAttrEndIndex = -1; 14016 let inPre = 0; 14017 let inVPre = false; 14018 let currentVPreBoundary = null; 14019 const stack = []; 14020 const tokenizer = new Tokenizer(stack, { 14021 onerr: emitError, 14022 ontext(start, end) { 14023 onText(getSlice(start, end), start, end); 14024 }, 14025 ontextentity(char, start, end) { 14026 onText(char, start, end); 14027 }, 14028 oninterpolation(start, end) { 14029 if (inVPre) { 14030 return onText(getSlice(start, end), start, end); 14031 } 14032 let innerStart = start + tokenizer.delimiterOpen.length; 14033 let innerEnd = end - tokenizer.delimiterClose.length; 14034 while (isWhitespace(currentInput.charCodeAt(innerStart))) { 14035 innerStart++; 14036 } 14037 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) { 14038 innerEnd--; 14039 } 14040 let exp = getSlice(innerStart, innerEnd); 14041 if (exp.includes("&")) { 14042 { 14043 exp = currentOptions.decodeEntities(exp, false); 14044 } 14045 } 14046 addNode({ 14047 type: 5, 14048 content: createExp(exp, false, getLoc(innerStart, innerEnd)), 14049 loc: getLoc(start, end) 14050 }); 14051 }, 14052 onopentagname(start, end) { 14053 const name = getSlice(start, end); 14054 currentOpenTag = { 14055 type: 1, 14056 tag: name, 14057 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns), 14058 tagType: 0, 14059 // will be refined on tag close 14060 props: [], 14061 children: [], 14062 loc: getLoc(start - 1, end), 14063 codegenNode: void 0 14064 }; 14065 }, 14066 onopentagend(end) { 14067 endOpenTag(end); 14068 }, 14069 onclosetag(start, end) { 14070 const name = getSlice(start, end); 14071 if (!currentOptions.isVoidTag(name)) { 14072 let found = false; 14073 for (let i = 0; i < stack.length; i++) { 14074 const e = stack[i]; 14075 if (e.tag.toLowerCase() === name.toLowerCase()) { 14076 found = true; 14077 if (i > 0) { 14078 emitError(24, stack[0].loc.start.offset); 14079 } 14080 for (let j = 0; j <= i; j++) { 14081 const el = stack.shift(); 14082 onCloseTag(el, end, j < i); 14083 } 14084 break; 14085 } 14086 } 14087 if (!found) { 14088 emitError(23, backTrack(start, 60)); 14089 } 14090 } 14091 }, 14092 onselfclosingtag(end) { 14093 const name = currentOpenTag.tag; 14094 currentOpenTag.isSelfClosing = true; 14095 endOpenTag(end); 14096 if (stack[0] && stack[0].tag === name) { 14097 onCloseTag(stack.shift(), end); 14098 } 14099 }, 14100 onattribname(start, end) { 14101 currentProp = { 14102 type: 6, 14103 name: getSlice(start, end), 14104 nameLoc: getLoc(start, end), 14105 value: void 0, 14106 loc: getLoc(start) 14107 }; 14108 }, 14109 ondirname(start, end) { 14110 const raw = getSlice(start, end); 14111 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2); 14112 if (!inVPre && name === "") { 14113 emitError(26, start); 14114 } 14115 if (inVPre || name === "") { 14116 currentProp = { 14117 type: 6, 14118 name: raw, 14119 nameLoc: getLoc(start, end), 14120 value: void 0, 14121 loc: getLoc(start) 14122 }; 14123 } else { 14124 currentProp = { 14125 type: 7, 14126 name, 14127 rawName: raw, 14128 exp: void 0, 14129 arg: void 0, 14130 modifiers: raw === "." ? [createSimpleExpression("prop")] : [], 14131 loc: getLoc(start) 14132 }; 14133 if (name === "pre") { 14134 inVPre = tokenizer.inVPre = true; 14135 currentVPreBoundary = currentOpenTag; 14136 const props = currentOpenTag.props; 14137 for (let i = 0; i < props.length; i++) { 14138 if (props[i].type === 7) { 14139 props[i] = dirToAttr(props[i]); 14140 } 14141 } 14142 } 14143 } 14144 }, 14145 ondirarg(start, end) { 14146 if (start === end) return; 14147 const arg = getSlice(start, end); 14148 if (inVPre && !isVPre(currentProp)) { 14149 currentProp.name += arg; 14150 setLocEnd(currentProp.nameLoc, end); 14151 } else { 14152 const isStatic = arg[0] !== `[`; 14153 currentProp.arg = createExp( 14154 isStatic ? arg : arg.slice(1, -1), 14155 isStatic, 14156 getLoc(start, end), 14157 isStatic ? 3 : 0 14158 ); 14159 } 14160 }, 14161 ondirmodifier(start, end) { 14162 const mod = getSlice(start, end); 14163 if (inVPre && !isVPre(currentProp)) { 14164 currentProp.name += "." + mod; 14165 setLocEnd(currentProp.nameLoc, end); 14166 } else if (currentProp.name === "slot") { 14167 const arg = currentProp.arg; 14168 if (arg) { 14169 arg.content += "." + mod; 14170 setLocEnd(arg.loc, end); 14171 } 14172 } else { 14173 const exp = createSimpleExpression(mod, true, getLoc(start, end)); 14174 currentProp.modifiers.push(exp); 14175 } 14176 }, 14177 onattribdata(start, end) { 14178 currentAttrValue += getSlice(start, end); 14179 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 14180 currentAttrEndIndex = end; 14181 }, 14182 onattribentity(char, start, end) { 14183 currentAttrValue += char; 14184 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 14185 currentAttrEndIndex = end; 14186 }, 14187 onattribnameend(end) { 14188 const start = currentProp.loc.start.offset; 14189 const name = getSlice(start, end); 14190 if (currentProp.type === 7) { 14191 currentProp.rawName = name; 14192 } 14193 if (currentOpenTag.props.some( 14194 (p) => (p.type === 7 ? p.rawName : p.name) === name 14195 )) { 14196 emitError(2, start); 14197 } 14198 }, 14199 onattribend(quote, end) { 14200 if (currentOpenTag && currentProp) { 14201 setLocEnd(currentProp.loc, end); 14202 if (quote !== 0) { 14203 if (currentAttrValue.includes("&")) { 14204 currentAttrValue = currentOptions.decodeEntities( 14205 currentAttrValue, 14206 true 14207 ); 14208 } 14209 if (currentProp.type === 6) { 14210 if (currentProp.name === "class") { 14211 currentAttrValue = condense(currentAttrValue).trim(); 14212 } 14213 if (quote === 1 && !currentAttrValue) { 14214 emitError(13, end); 14215 } 14216 currentProp.value = { 14217 type: 2, 14218 content: currentAttrValue, 14219 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1) 14220 }; 14221 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") { 14222 tokenizer.enterRCDATA(toCharCodes(`</template`), 0); 14223 } 14224 } else { 14225 let expParseMode = 0 /* Normal */; 14226 currentProp.exp = createExp( 14227 currentAttrValue, 14228 false, 14229 getLoc(currentAttrStartIndex, currentAttrEndIndex), 14230 0, 14231 expParseMode 14232 ); 14233 if (currentProp.name === "for") { 14234 currentProp.forParseResult = parseForExpression(currentProp.exp); 14235 } 14236 } 14237 } 14238 if (currentProp.type !== 7 || currentProp.name !== "pre") { 14239 currentOpenTag.props.push(currentProp); 14240 } 14241 } 14242 currentAttrValue = ""; 14243 currentAttrStartIndex = currentAttrEndIndex = -1; 14244 }, 14245 oncomment(start, end) { 14246 if (currentOptions.comments) { 14247 addNode({ 14248 type: 3, 14249 content: getSlice(start, end), 14250 loc: getLoc(start - 4, end + 3) 14251 }); 14252 } 14253 }, 14254 onend() { 14255 const end = currentInput.length; 14256 if (tokenizer.state !== 1) { 14257 switch (tokenizer.state) { 14258 case 5: 14259 case 8: 14260 emitError(5, end); 14261 break; 14262 case 3: 14263 case 4: 14264 emitError( 14265 25, 14266 tokenizer.sectionStart 14267 ); 14268 break; 14269 case 28: 14270 if (tokenizer.currentSequence === Sequences.CdataEnd) { 14271 emitError(6, end); 14272 } else { 14273 emitError(7, end); 14274 } 14275 break; 14276 case 6: 14277 case 7: 14278 case 9: 14279 case 11: 14280 case 12: 14281 case 13: 14282 case 14: 14283 case 15: 14284 case 16: 14285 case 17: 14286 case 18: 14287 case 19: 14288 // " 14289 case 20: 14290 // ' 14291 case 21: 14292 emitError(9, end); 14293 break; 14294 } 14295 } 14296 for (let index = 0; index < stack.length; index++) { 14297 onCloseTag(stack[index], end - 1); 14298 emitError(24, stack[index].loc.start.offset); 14299 } 14300 }, 14301 oncdata(start, end) { 14302 if (stack[0].ns !== 0) { 14303 onText(getSlice(start, end), start, end); 14304 } else { 14305 emitError(1, start - 9); 14306 } 14307 }, 14308 onprocessinginstruction(start) { 14309 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 14310 emitError( 14311 21, 14312 start - 1 14313 ); 14314 } 14315 } 14316 }); 14317 const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 14318 const stripParensRE = /^\(|\)$/g; 14319 function parseForExpression(input) { 14320 const loc = input.loc; 14321 const exp = input.content; 14322 const inMatch = exp.match(forAliasRE); 14323 if (!inMatch) return; 14324 const [, LHS, RHS] = inMatch; 14325 const createAliasExpression = (content, offset, asParam = false) => { 14326 const start = loc.start.offset + offset; 14327 const end = start + content.length; 14328 return createExp( 14329 content, 14330 false, 14331 getLoc(start, end), 14332 0, 14333 asParam ? 1 /* Params */ : 0 /* Normal */ 14334 ); 14335 }; 14336 const result = { 14337 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)), 14338 value: void 0, 14339 key: void 0, 14340 index: void 0, 14341 finalized: false 14342 }; 14343 let valueContent = LHS.trim().replace(stripParensRE, "").trim(); 14344 const trimmedOffset = LHS.indexOf(valueContent); 14345 const iteratorMatch = valueContent.match(forIteratorRE); 14346 if (iteratorMatch) { 14347 valueContent = valueContent.replace(forIteratorRE, "").trim(); 14348 const keyContent = iteratorMatch[1].trim(); 14349 let keyOffset; 14350 if (keyContent) { 14351 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length); 14352 result.key = createAliasExpression(keyContent, keyOffset, true); 14353 } 14354 if (iteratorMatch[2]) { 14355 const indexContent = iteratorMatch[2].trim(); 14356 if (indexContent) { 14357 result.index = createAliasExpression( 14358 indexContent, 14359 exp.indexOf( 14360 indexContent, 14361 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length 14362 ), 14363 true 14364 ); 14365 } 14366 } 14367 } 14368 if (valueContent) { 14369 result.value = createAliasExpression(valueContent, trimmedOffset, true); 14370 } 14371 return result; 14372 } 14373 function getSlice(start, end) { 14374 return currentInput.slice(start, end); 14375 } 14376 function endOpenTag(end) { 14377 if (tokenizer.inSFCRoot) { 14378 currentOpenTag.innerLoc = getLoc(end + 1, end + 1); 14379 } 14380 addNode(currentOpenTag); 14381 const { tag, ns } = currentOpenTag; 14382 if (ns === 0 && currentOptions.isPreTag(tag)) { 14383 inPre++; 14384 } 14385 if (currentOptions.isVoidTag(tag)) { 14386 onCloseTag(currentOpenTag, end); 14387 } else { 14388 stack.unshift(currentOpenTag); 14389 if (ns === 1 || ns === 2) { 14390 tokenizer.inXML = true; 14391 } 14392 } 14393 currentOpenTag = null; 14394 } 14395 function onText(content, start, end) { 14396 { 14397 const tag = stack[0] && stack[0].tag; 14398 if (tag !== "script" && tag !== "style" && content.includes("&")) { 14399 content = currentOptions.decodeEntities(content, false); 14400 } 14401 } 14402 const parent = stack[0] || currentRoot; 14403 const lastNode = parent.children[parent.children.length - 1]; 14404 if (lastNode && lastNode.type === 2) { 14405 lastNode.content += content; 14406 setLocEnd(lastNode.loc, end); 14407 } else { 14408 parent.children.push({ 14409 type: 2, 14410 content, 14411 loc: getLoc(start, end) 14412 }); 14413 } 14414 } 14415 function onCloseTag(el, end, isImplied = false) { 14416 if (isImplied) { 14417 setLocEnd(el.loc, backTrack(end, 60)); 14418 } else { 14419 setLocEnd(el.loc, lookAhead(end, 62) + 1); 14420 } 14421 if (tokenizer.inSFCRoot) { 14422 if (el.children.length) { 14423 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end); 14424 } else { 14425 el.innerLoc.end = extend({}, el.innerLoc.start); 14426 } 14427 el.innerLoc.source = getSlice( 14428 el.innerLoc.start.offset, 14429 el.innerLoc.end.offset 14430 ); 14431 } 14432 const { tag, ns, children } = el; 14433 if (!inVPre) { 14434 if (tag === "slot") { 14435 el.tagType = 2; 14436 } else if (isFragmentTemplate(el)) { 14437 el.tagType = 3; 14438 } else if (isComponent(el)) { 14439 el.tagType = 1; 14440 } 14441 } 14442 if (!tokenizer.inRCDATA) { 14443 el.children = condenseWhitespace(children); 14444 } 14445 if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) { 14446 const first = children[0]; 14447 if (first && first.type === 2) { 14448 first.content = first.content.replace(/^\r?\n/, ""); 14449 } 14450 } 14451 if (ns === 0 && currentOptions.isPreTag(tag)) { 14452 inPre--; 14453 } 14454 if (currentVPreBoundary === el) { 14455 inVPre = tokenizer.inVPre = false; 14456 currentVPreBoundary = null; 14457 } 14458 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 14459 tokenizer.inXML = false; 14460 } 14461 } 14462 function lookAhead(index, c) { 14463 let i = index; 14464 while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++; 14465 return i; 14466 } 14467 function backTrack(index, c) { 14468 let i = index; 14469 while (currentInput.charCodeAt(i) !== c && i >= 0) i--; 14470 return i; 14471 } 14472 const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]); 14473 function isFragmentTemplate({ tag, props }) { 14474 if (tag === "template") { 14475 for (let i = 0; i < props.length; i++) { 14476 if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) { 14477 return true; 14478 } 14479 } 14480 } 14481 return false; 14482 } 14483 function isComponent({ tag, props }) { 14484 if (currentOptions.isCustomElement(tag)) { 14485 return false; 14486 } 14487 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) { 14488 return true; 14489 } 14490 for (let i = 0; i < props.length; i++) { 14491 const p = props[i]; 14492 if (p.type === 6) { 14493 if (p.name === "is" && p.value) { 14494 if (p.value.content.startsWith("vue:")) { 14495 return true; 14496 } 14497 } 14498 } 14499 } 14500 return false; 14501 } 14502 function isUpperCase(c) { 14503 return c > 64 && c < 91; 14504 } 14505 const windowsNewlineRE = /\r\n/g; 14506 function condenseWhitespace(nodes) { 14507 const shouldCondense = currentOptions.whitespace !== "preserve"; 14508 let removedWhitespace = false; 14509 for (let i = 0; i < nodes.length; i++) { 14510 const node = nodes[i]; 14511 if (node.type === 2) { 14512 if (!inPre) { 14513 if (isAllWhitespace(node.content)) { 14514 const prev = nodes[i - 1] && nodes[i - 1].type; 14515 const next = nodes[i + 1] && nodes[i + 1].type; 14516 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) { 14517 removedWhitespace = true; 14518 nodes[i] = null; 14519 } else { 14520 node.content = " "; 14521 } 14522 } else if (shouldCondense) { 14523 node.content = condense(node.content); 14524 } 14525 } else { 14526 node.content = node.content.replace(windowsNewlineRE, "\n"); 14527 } 14528 } 14529 } 14530 return removedWhitespace ? nodes.filter(Boolean) : nodes; 14531 } 14532 function hasNewlineChar(str) { 14533 for (let i = 0; i < str.length; i++) { 14534 const c = str.charCodeAt(i); 14535 if (c === 10 || c === 13) { 14536 return true; 14537 } 14538 } 14539 return false; 14540 } 14541 function condense(str) { 14542 let ret = ""; 14543 let prevCharIsWhitespace = false; 14544 for (let i = 0; i < str.length; i++) { 14545 if (isWhitespace(str.charCodeAt(i))) { 14546 if (!prevCharIsWhitespace) { 14547 ret += " "; 14548 prevCharIsWhitespace = true; 14549 } 14550 } else { 14551 ret += str[i]; 14552 prevCharIsWhitespace = false; 14553 } 14554 } 14555 return ret; 14556 } 14557 function addNode(node) { 14558 (stack[0] || currentRoot).children.push(node); 14559 } 14560 function getLoc(start, end) { 14561 return { 14562 start: tokenizer.getPos(start), 14563 // @ts-expect-error allow late attachment 14564 end: end == null ? end : tokenizer.getPos(end), 14565 // @ts-expect-error allow late attachment 14566 source: end == null ? end : getSlice(start, end) 14567 }; 14568 } 14569 function cloneLoc(loc) { 14570 return getLoc(loc.start.offset, loc.end.offset); 14571 } 14572 function setLocEnd(loc, end) { 14573 loc.end = tokenizer.getPos(end); 14574 loc.source = getSlice(loc.start.offset, end); 14575 } 14576 function dirToAttr(dir) { 14577 const attr = { 14578 type: 6, 14579 name: dir.rawName, 14580 nameLoc: getLoc( 14581 dir.loc.start.offset, 14582 dir.loc.start.offset + dir.rawName.length 14583 ), 14584 value: void 0, 14585 loc: dir.loc 14586 }; 14587 if (dir.exp) { 14588 const loc = dir.exp.loc; 14589 if (loc.end.offset < dir.loc.end.offset) { 14590 loc.start.offset--; 14591 loc.start.column--; 14592 loc.end.offset++; 14593 loc.end.column++; 14594 } 14595 attr.value = { 14596 type: 2, 14597 content: dir.exp.content, 14598 loc 14599 }; 14600 } 14601 return attr; 14602 } 14603 function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) { 14604 const exp = createSimpleExpression(content, isStatic, loc, constType); 14605 return exp; 14606 } 14607 function emitError(code, index, message) { 14608 currentOptions.onError( 14609 createCompilerError(code, getLoc(index, index), void 0, message) 14610 ); 14611 } 14612 function reset() { 14613 tokenizer.reset(); 14614 currentOpenTag = null; 14615 currentProp = null; 14616 currentAttrValue = ""; 14617 currentAttrStartIndex = -1; 14618 currentAttrEndIndex = -1; 14619 stack.length = 0; 14620 } 14621 function baseParse(input, options) { 14622 reset(); 14623 currentInput = input; 14624 currentOptions = extend({}, defaultParserOptions); 14625 if (options) { 14626 let key; 14627 for (key in options) { 14628 if (options[key] != null) { 14629 currentOptions[key] = options[key]; 14630 } 14631 } 14632 } 14633 { 14634 if (!currentOptions.decodeEntities) { 14635 throw new Error( 14636 `[@vue/compiler-core] decodeEntities option is required in browser builds.` 14637 ); 14638 } 14639 } 14640 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0; 14641 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2; 14642 const delimiters = options && options.delimiters; 14643 if (delimiters) { 14644 tokenizer.delimiterOpen = toCharCodes(delimiters[0]); 14645 tokenizer.delimiterClose = toCharCodes(delimiters[1]); 14646 } 14647 const root = currentRoot = createRoot([], input); 14648 tokenizer.parse(currentInput); 14649 root.loc = getLoc(0, input.length); 14650 root.children = condenseWhitespace(root.children); 14651 currentRoot = null; 14652 return root; 14653 } 14654 14655 function cacheStatic(root, context) { 14656 walk( 14657 root, 14658 void 0, 14659 context, 14660 // Root node is unfortunately non-hoistable due to potential parent 14661 // fallthrough attributes. 14662 !!getSingleElementRoot(root) 14663 ); 14664 } 14665 function getSingleElementRoot(root) { 14666 const children = root.children.filter((x) => x.type !== 3); 14667 return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null; 14668 } 14669 function walk(node, parent, context, doNotHoistNode = false, inFor = false) { 14670 const { children } = node; 14671 const toCache = []; 14672 for (let i = 0; i < children.length; i++) { 14673 const child = children[i]; 14674 if (child.type === 1 && child.tagType === 0) { 14675 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 14676 if (constantType > 0) { 14677 if (constantType >= 2) { 14678 child.codegenNode.patchFlag = -1; 14679 toCache.push(child); 14680 continue; 14681 } 14682 } else { 14683 const codegenNode = child.codegenNode; 14684 if (codegenNode.type === 13) { 14685 const flag = codegenNode.patchFlag; 14686 if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) { 14687 const props = getNodeProps(child); 14688 if (props) { 14689 codegenNode.props = context.hoist(props); 14690 } 14691 } 14692 if (codegenNode.dynamicProps) { 14693 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps); 14694 } 14695 } 14696 } 14697 } else if (child.type === 12) { 14698 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 14699 if (constantType >= 2) { 14700 if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) { 14701 child.codegenNode.arguments.push( 14702 -1 + (` /* ${PatchFlagNames[-1]} */` ) 14703 ); 14704 } 14705 toCache.push(child); 14706 continue; 14707 } 14708 } 14709 if (child.type === 1) { 14710 const isComponent = child.tagType === 1; 14711 if (isComponent) { 14712 context.scopes.vSlot++; 14713 } 14714 walk(child, node, context, false, inFor); 14715 if (isComponent) { 14716 context.scopes.vSlot--; 14717 } 14718 } else if (child.type === 11) { 14719 walk(child, node, context, child.children.length === 1, true); 14720 } else if (child.type === 9) { 14721 for (let i2 = 0; i2 < child.branches.length; i2++) { 14722 walk( 14723 child.branches[i2], 14724 node, 14725 context, 14726 child.branches[i2].children.length === 1, 14727 inFor 14728 ); 14729 } 14730 } 14731 } 14732 let cachedAsArray = false; 14733 if (toCache.length === children.length && node.type === 1) { 14734 if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) { 14735 node.codegenNode.children = getCacheExpression( 14736 createArrayExpression(node.codegenNode.children) 14737 ); 14738 cachedAsArray = true; 14739 } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) { 14740 const slot = getSlotNode(node.codegenNode, "default"); 14741 if (slot) { 14742 slot.returns = getCacheExpression( 14743 createArrayExpression(slot.returns) 14744 ); 14745 cachedAsArray = true; 14746 } 14747 } 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) { 14748 const slotName = findDir(node, "slot", true); 14749 const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); 14750 if (slot) { 14751 slot.returns = getCacheExpression( 14752 createArrayExpression(slot.returns) 14753 ); 14754 cachedAsArray = true; 14755 } 14756 } 14757 } 14758 if (!cachedAsArray) { 14759 for (const child of toCache) { 14760 child.codegenNode = context.cache(child.codegenNode); 14761 } 14762 } 14763 function getCacheExpression(value) { 14764 const exp = context.cache(value); 14765 exp.needArraySpread = true; 14766 return exp; 14767 } 14768 function getSlotNode(node2, name) { 14769 if (node2.children && !isArray(node2.children) && node2.children.type === 15) { 14770 const slot = node2.children.properties.find( 14771 (p) => p.key === name || p.key.content === name 14772 ); 14773 return slot && slot.value; 14774 } 14775 } 14776 if (toCache.length && context.transformHoist) { 14777 context.transformHoist(children, context, node); 14778 } 14779 } 14780 function getConstantType(node, context) { 14781 const { constantCache } = context; 14782 switch (node.type) { 14783 case 1: 14784 if (node.tagType !== 0) { 14785 return 0; 14786 } 14787 const cached = constantCache.get(node); 14788 if (cached !== void 0) { 14789 return cached; 14790 } 14791 const codegenNode = node.codegenNode; 14792 if (codegenNode.type !== 13) { 14793 return 0; 14794 } 14795 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") { 14796 return 0; 14797 } 14798 if (codegenNode.patchFlag === void 0) { 14799 let returnType2 = 3; 14800 const generatedPropsType = getGeneratedPropsConstantType(node, context); 14801 if (generatedPropsType === 0) { 14802 constantCache.set(node, 0); 14803 return 0; 14804 } 14805 if (generatedPropsType < returnType2) { 14806 returnType2 = generatedPropsType; 14807 } 14808 for (let i = 0; i < node.children.length; i++) { 14809 const childType = getConstantType(node.children[i], context); 14810 if (childType === 0) { 14811 constantCache.set(node, 0); 14812 return 0; 14813 } 14814 if (childType < returnType2) { 14815 returnType2 = childType; 14816 } 14817 } 14818 if (returnType2 > 1) { 14819 for (let i = 0; i < node.props.length; i++) { 14820 const p = node.props[i]; 14821 if (p.type === 7 && p.name === "bind" && p.exp) { 14822 const expType = getConstantType(p.exp, context); 14823 if (expType === 0) { 14824 constantCache.set(node, 0); 14825 return 0; 14826 } 14827 if (expType < returnType2) { 14828 returnType2 = expType; 14829 } 14830 } 14831 } 14832 } 14833 if (codegenNode.isBlock) { 14834 for (let i = 0; i < node.props.length; i++) { 14835 const p = node.props[i]; 14836 if (p.type === 7) { 14837 constantCache.set(node, 0); 14838 return 0; 14839 } 14840 } 14841 context.removeHelper(OPEN_BLOCK); 14842 context.removeHelper( 14843 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent) 14844 ); 14845 codegenNode.isBlock = false; 14846 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent)); 14847 } 14848 constantCache.set(node, returnType2); 14849 return returnType2; 14850 } else { 14851 constantCache.set(node, 0); 14852 return 0; 14853 } 14854 case 2: 14855 case 3: 14856 return 3; 14857 case 9: 14858 case 11: 14859 case 10: 14860 return 0; 14861 case 5: 14862 case 12: 14863 return getConstantType(node.content, context); 14864 case 4: 14865 return node.constType; 14866 case 8: 14867 let returnType = 3; 14868 for (let i = 0; i < node.children.length; i++) { 14869 const child = node.children[i]; 14870 if (isString(child) || isSymbol(child)) { 14871 continue; 14872 } 14873 const childType = getConstantType(child, context); 14874 if (childType === 0) { 14875 return 0; 14876 } else if (childType < returnType) { 14877 returnType = childType; 14878 } 14879 } 14880 return returnType; 14881 case 20: 14882 return 2; 14883 default: 14884 return 0; 14885 } 14886 } 14887 const allowHoistedHelperSet = /* @__PURE__ */ new Set([ 14888 NORMALIZE_CLASS, 14889 NORMALIZE_STYLE, 14890 NORMALIZE_PROPS, 14891 GUARD_REACTIVE_PROPS 14892 ]); 14893 function getConstantTypeOfHelperCall(value, context) { 14894 if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) { 14895 const arg = value.arguments[0]; 14896 if (arg.type === 4) { 14897 return getConstantType(arg, context); 14898 } else if (arg.type === 14) { 14899 return getConstantTypeOfHelperCall(arg, context); 14900 } 14901 } 14902 return 0; 14903 } 14904 function getGeneratedPropsConstantType(node, context) { 14905 let returnType = 3; 14906 const props = getNodeProps(node); 14907 if (props && props.type === 15) { 14908 const { properties } = props; 14909 for (let i = 0; i < properties.length; i++) { 14910 const { key, value } = properties[i]; 14911 const keyType = getConstantType(key, context); 14912 if (keyType === 0) { 14913 return keyType; 14914 } 14915 if (keyType < returnType) { 14916 returnType = keyType; 14917 } 14918 let valueType; 14919 if (value.type === 4) { 14920 valueType = getConstantType(value, context); 14921 } else if (value.type === 14) { 14922 valueType = getConstantTypeOfHelperCall(value, context); 14923 } else { 14924 valueType = 0; 14925 } 14926 if (valueType === 0) { 14927 return valueType; 14928 } 14929 if (valueType < returnType) { 14930 returnType = valueType; 14931 } 14932 } 14933 } 14934 return returnType; 14935 } 14936 function getNodeProps(node) { 14937 const codegenNode = node.codegenNode; 14938 if (codegenNode.type === 13) { 14939 return codegenNode.props; 14940 } 14941 } 14942 14943 function createTransformContext(root, { 14944 filename = "", 14945 prefixIdentifiers = false, 14946 hoistStatic = false, 14947 hmr = false, 14948 cacheHandlers = false, 14949 nodeTransforms = [], 14950 directiveTransforms = {}, 14951 transformHoist = null, 14952 isBuiltInComponent = NOOP, 14953 isCustomElement = NOOP, 14954 expressionPlugins = [], 14955 scopeId = null, 14956 slotted = true, 14957 ssr = false, 14958 inSSR = false, 14959 ssrCssVars = ``, 14960 bindingMetadata = EMPTY_OBJ, 14961 inline = false, 14962 isTS = false, 14963 onError = defaultOnError, 14964 onWarn = defaultOnWarn, 14965 compatConfig 14966 }) { 14967 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/); 14968 const context = { 14969 // options 14970 filename, 14971 selfName: nameMatch && capitalize(camelize(nameMatch[1])), 14972 prefixIdentifiers, 14973 hoistStatic, 14974 hmr, 14975 cacheHandlers, 14976 nodeTransforms, 14977 directiveTransforms, 14978 transformHoist, 14979 isBuiltInComponent, 14980 isCustomElement, 14981 expressionPlugins, 14982 scopeId, 14983 slotted, 14984 ssr, 14985 inSSR, 14986 ssrCssVars, 14987 bindingMetadata, 14988 inline, 14989 isTS, 14990 onError, 14991 onWarn, 14992 compatConfig, 14993 // state 14994 root, 14995 helpers: /* @__PURE__ */ new Map(), 14996 components: /* @__PURE__ */ new Set(), 14997 directives: /* @__PURE__ */ new Set(), 14998 hoists: [], 14999 imports: [], 15000 cached: [], 15001 constantCache: /* @__PURE__ */ new WeakMap(), 15002 temps: 0, 15003 identifiers: /* @__PURE__ */ Object.create(null), 15004 scopes: { 15005 vFor: 0, 15006 vSlot: 0, 15007 vPre: 0, 15008 vOnce: 0 15009 }, 15010 parent: null, 15011 grandParent: null, 15012 currentNode: root, 15013 childIndex: 0, 15014 inVOnce: false, 15015 // methods 15016 helper(name) { 15017 const count = context.helpers.get(name) || 0; 15018 context.helpers.set(name, count + 1); 15019 return name; 15020 }, 15021 removeHelper(name) { 15022 const count = context.helpers.get(name); 15023 if (count) { 15024 const currentCount = count - 1; 15025 if (!currentCount) { 15026 context.helpers.delete(name); 15027 } else { 15028 context.helpers.set(name, currentCount); 15029 } 15030 } 15031 }, 15032 helperString(name) { 15033 return `_${helperNameMap[context.helper(name)]}`; 15034 }, 15035 replaceNode(node) { 15036 { 15037 if (!context.currentNode) { 15038 throw new Error(`Node being replaced is already removed.`); 15039 } 15040 if (!context.parent) { 15041 throw new Error(`Cannot replace root node.`); 15042 } 15043 } 15044 context.parent.children[context.childIndex] = context.currentNode = node; 15045 }, 15046 removeNode(node) { 15047 if (!context.parent) { 15048 throw new Error(`Cannot remove root node.`); 15049 } 15050 const list = context.parent.children; 15051 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1; 15052 if (removalIndex < 0) { 15053 throw new Error(`node being removed is not a child of current parent`); 15054 } 15055 if (!node || node === context.currentNode) { 15056 context.currentNode = null; 15057 context.onNodeRemoved(); 15058 } else { 15059 if (context.childIndex > removalIndex) { 15060 context.childIndex--; 15061 context.onNodeRemoved(); 15062 } 15063 } 15064 context.parent.children.splice(removalIndex, 1); 15065 }, 15066 onNodeRemoved: NOOP, 15067 addIdentifiers(exp) { 15068 }, 15069 removeIdentifiers(exp) { 15070 }, 15071 hoist(exp) { 15072 if (isString(exp)) exp = createSimpleExpression(exp); 15073 context.hoists.push(exp); 15074 const identifier = createSimpleExpression( 15075 `_hoisted_${context.hoists.length}`, 15076 false, 15077 exp.loc, 15078 2 15079 ); 15080 identifier.hoisted = exp; 15081 return identifier; 15082 }, 15083 cache(exp, isVNode = false, inVOnce = false) { 15084 const cacheExp = createCacheExpression( 15085 context.cached.length, 15086 exp, 15087 isVNode, 15088 inVOnce 15089 ); 15090 context.cached.push(cacheExp); 15091 return cacheExp; 15092 } 15093 }; 15094 return context; 15095 } 15096 function transform(root, options) { 15097 const context = createTransformContext(root, options); 15098 traverseNode(root, context); 15099 if (options.hoistStatic) { 15100 cacheStatic(root, context); 15101 } 15102 if (!options.ssr) { 15103 createRootCodegen(root, context); 15104 } 15105 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]); 15106 root.components = [...context.components]; 15107 root.directives = [...context.directives]; 15108 root.imports = context.imports; 15109 root.hoists = context.hoists; 15110 root.temps = context.temps; 15111 root.cached = context.cached; 15112 root.transformed = true; 15113 } 15114 function createRootCodegen(root, context) { 15115 const { helper } = context; 15116 const { children } = root; 15117 if (children.length === 1) { 15118 const singleElementRootChild = getSingleElementRoot(root); 15119 if (singleElementRootChild && singleElementRootChild.codegenNode) { 15120 const codegenNode = singleElementRootChild.codegenNode; 15121 if (codegenNode.type === 13) { 15122 convertToBlock(codegenNode, context); 15123 } 15124 root.codegenNode = codegenNode; 15125 } else { 15126 root.codegenNode = children[0]; 15127 } 15128 } else if (children.length > 1) { 15129 let patchFlag = 64; 15130 if (children.filter((c) => c.type !== 3).length === 1) { 15131 patchFlag |= 2048; 15132 } 15133 root.codegenNode = createVNodeCall( 15134 context, 15135 helper(FRAGMENT), 15136 void 0, 15137 root.children, 15138 patchFlag, 15139 void 0, 15140 void 0, 15141 true, 15142 void 0, 15143 false 15144 ); 15145 } else ; 15146 } 15147 function traverseChildren(parent, context) { 15148 let i = 0; 15149 const nodeRemoved = () => { 15150 i--; 15151 }; 15152 for (; i < parent.children.length; i++) { 15153 const child = parent.children[i]; 15154 if (isString(child)) continue; 15155 context.grandParent = context.parent; 15156 context.parent = parent; 15157 context.childIndex = i; 15158 context.onNodeRemoved = nodeRemoved; 15159 traverseNode(child, context); 15160 } 15161 } 15162 function traverseNode(node, context) { 15163 context.currentNode = node; 15164 const { nodeTransforms } = context; 15165 const exitFns = []; 15166 for (let i2 = 0; i2 < nodeTransforms.length; i2++) { 15167 const onExit = nodeTransforms[i2](node, context); 15168 if (onExit) { 15169 if (isArray(onExit)) { 15170 exitFns.push(...onExit); 15171 } else { 15172 exitFns.push(onExit); 15173 } 15174 } 15175 if (!context.currentNode) { 15176 return; 15177 } else { 15178 node = context.currentNode; 15179 } 15180 } 15181 switch (node.type) { 15182 case 3: 15183 if (!context.ssr) { 15184 context.helper(CREATE_COMMENT); 15185 } 15186 break; 15187 case 5: 15188 if (!context.ssr) { 15189 context.helper(TO_DISPLAY_STRING); 15190 } 15191 break; 15192 // for container types, further traverse downwards 15193 case 9: 15194 for (let i2 = 0; i2 < node.branches.length; i2++) { 15195 traverseNode(node.branches[i2], context); 15196 } 15197 break; 15198 case 10: 15199 case 11: 15200 case 1: 15201 case 0: 15202 traverseChildren(node, context); 15203 break; 15204 } 15205 context.currentNode = node; 15206 let i = exitFns.length; 15207 while (i--) { 15208 exitFns[i](); 15209 } 15210 } 15211 function createStructuralDirectiveTransform(name, fn) { 15212 const matches = isString(name) ? (n) => n === name : (n) => name.test(n); 15213 return (node, context) => { 15214 if (node.type === 1) { 15215 const { props } = node; 15216 if (node.tagType === 3 && props.some(isVSlot)) { 15217 return; 15218 } 15219 const exitFns = []; 15220 for (let i = 0; i < props.length; i++) { 15221 const prop = props[i]; 15222 if (prop.type === 7 && matches(prop.name)) { 15223 props.splice(i, 1); 15224 i--; 15225 const onExit = fn(node, prop, context); 15226 if (onExit) exitFns.push(onExit); 15227 } 15228 } 15229 return exitFns; 15230 } 15231 }; 15232 } 15233 15234 const PURE_ANNOTATION = `/*@__PURE__*/`; 15235 const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`; 15236 function createCodegenContext(ast, { 15237 mode = "function", 15238 prefixIdentifiers = mode === "module", 15239 sourceMap = false, 15240 filename = `template.vue.html`, 15241 scopeId = null, 15242 optimizeImports = false, 15243 runtimeGlobalName = `Vue`, 15244 runtimeModuleName = `vue`, 15245 ssrRuntimeModuleName = "vue/server-renderer", 15246 ssr = false, 15247 isTS = false, 15248 inSSR = false 15249 }) { 15250 const context = { 15251 mode, 15252 prefixIdentifiers, 15253 sourceMap, 15254 filename, 15255 scopeId, 15256 optimizeImports, 15257 runtimeGlobalName, 15258 runtimeModuleName, 15259 ssrRuntimeModuleName, 15260 ssr, 15261 isTS, 15262 inSSR, 15263 source: ast.source, 15264 code: ``, 15265 column: 1, 15266 line: 1, 15267 offset: 0, 15268 indentLevel: 0, 15269 pure: false, 15270 map: void 0, 15271 helper(key) { 15272 return `_${helperNameMap[key]}`; 15273 }, 15274 push(code, newlineIndex = -2 /* None */, node) { 15275 context.code += code; 15276 }, 15277 indent() { 15278 newline(++context.indentLevel); 15279 }, 15280 deindent(withoutNewLine = false) { 15281 if (withoutNewLine) { 15282 --context.indentLevel; 15283 } else { 15284 newline(--context.indentLevel); 15285 } 15286 }, 15287 newline() { 15288 newline(context.indentLevel); 15289 } 15290 }; 15291 function newline(n) { 15292 context.push("\n" + ` `.repeat(n), 0 /* Start */); 15293 } 15294 return context; 15295 } 15296 function generate(ast, options = {}) { 15297 const context = createCodegenContext(ast, options); 15298 if (options.onContextCreated) options.onContextCreated(context); 15299 const { 15300 mode, 15301 push, 15302 prefixIdentifiers, 15303 indent, 15304 deindent, 15305 newline, 15306 scopeId, 15307 ssr 15308 } = context; 15309 const helpers = Array.from(ast.helpers); 15310 const hasHelpers = helpers.length > 0; 15311 const useWithBlock = !prefixIdentifiers && mode !== "module"; 15312 const preambleContext = context; 15313 { 15314 genFunctionPreamble(ast, preambleContext); 15315 } 15316 const functionName = ssr ? `ssrRender` : `render`; 15317 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"]; 15318 const signature = args.join(", "); 15319 { 15320 push(`function ${functionName}(${signature}) {`); 15321 } 15322 indent(); 15323 if (useWithBlock) { 15324 push(`with (_ctx) {`); 15325 indent(); 15326 if (hasHelpers) { 15327 push( 15328 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue 15329 `, 15330 -1 /* End */ 15331 ); 15332 newline(); 15333 } 15334 } 15335 if (ast.components.length) { 15336 genAssets(ast.components, "component", context); 15337 if (ast.directives.length || ast.temps > 0) { 15338 newline(); 15339 } 15340 } 15341 if (ast.directives.length) { 15342 genAssets(ast.directives, "directive", context); 15343 if (ast.temps > 0) { 15344 newline(); 15345 } 15346 } 15347 if (ast.temps > 0) { 15348 push(`let `); 15349 for (let i = 0; i < ast.temps; i++) { 15350 push(`${i > 0 ? `, ` : ``}_temp${i}`); 15351 } 15352 } 15353 if (ast.components.length || ast.directives.length || ast.temps) { 15354 push(` 15355 `, 0 /* Start */); 15356 newline(); 15357 } 15358 if (!ssr) { 15359 push(`return `); 15360 } 15361 if (ast.codegenNode) { 15362 genNode(ast.codegenNode, context); 15363 } else { 15364 push(`null`); 15365 } 15366 if (useWithBlock) { 15367 deindent(); 15368 push(`}`); 15369 } 15370 deindent(); 15371 push(`}`); 15372 return { 15373 ast, 15374 code: context.code, 15375 preamble: ``, 15376 map: context.map ? context.map.toJSON() : void 0 15377 }; 15378 } 15379 function genFunctionPreamble(ast, context) { 15380 const { 15381 ssr, 15382 prefixIdentifiers, 15383 push, 15384 newline, 15385 runtimeModuleName, 15386 runtimeGlobalName, 15387 ssrRuntimeModuleName 15388 } = context; 15389 const VueBinding = runtimeGlobalName; 15390 const helpers = Array.from(ast.helpers); 15391 if (helpers.length > 0) { 15392 { 15393 push(`const _Vue = ${VueBinding} 15394 `, -1 /* End */); 15395 if (ast.hoists.length) { 15396 const staticHelpers = [ 15397 CREATE_VNODE, 15398 CREATE_ELEMENT_VNODE, 15399 CREATE_COMMENT, 15400 CREATE_TEXT, 15401 CREATE_STATIC 15402 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", "); 15403 push(`const { ${staticHelpers} } = _Vue 15404 `, -1 /* End */); 15405 } 15406 } 15407 } 15408 genHoists(ast.hoists, context); 15409 newline(); 15410 push(`return `); 15411 } 15412 function genAssets(assets, type, { helper, push, newline, isTS }) { 15413 const resolver = helper( 15414 type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE 15415 ); 15416 for (let i = 0; i < assets.length; i++) { 15417 let id = assets[i]; 15418 const maybeSelfReference = id.endsWith("__self"); 15419 if (maybeSelfReference) { 15420 id = id.slice(0, -6); 15421 } 15422 push( 15423 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}` 15424 ); 15425 if (i < assets.length - 1) { 15426 newline(); 15427 } 15428 } 15429 } 15430 function genHoists(hoists, context) { 15431 if (!hoists.length) { 15432 return; 15433 } 15434 context.pure = true; 15435 const { push, newline } = context; 15436 newline(); 15437 for (let i = 0; i < hoists.length; i++) { 15438 const exp = hoists[i]; 15439 if (exp) { 15440 push(`const _hoisted_${i + 1} = `); 15441 genNode(exp, context); 15442 newline(); 15443 } 15444 } 15445 context.pure = false; 15446 } 15447 function isText(n) { 15448 return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8; 15449 } 15450 function genNodeListAsArray(nodes, context) { 15451 const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n)); 15452 context.push(`[`); 15453 multilines && context.indent(); 15454 genNodeList(nodes, context, multilines); 15455 multilines && context.deindent(); 15456 context.push(`]`); 15457 } 15458 function genNodeList(nodes, context, multilines = false, comma = true) { 15459 const { push, newline } = context; 15460 for (let i = 0; i < nodes.length; i++) { 15461 const node = nodes[i]; 15462 if (isString(node)) { 15463 push(node, -3 /* Unknown */); 15464 } else if (isArray(node)) { 15465 genNodeListAsArray(node, context); 15466 } else { 15467 genNode(node, context); 15468 } 15469 if (i < nodes.length - 1) { 15470 if (multilines) { 15471 comma && push(","); 15472 newline(); 15473 } else { 15474 comma && push(", "); 15475 } 15476 } 15477 } 15478 } 15479 function genNode(node, context) { 15480 if (isString(node)) { 15481 context.push(node, -3 /* Unknown */); 15482 return; 15483 } 15484 if (isSymbol(node)) { 15485 context.push(context.helper(node)); 15486 return; 15487 } 15488 switch (node.type) { 15489 case 1: 15490 case 9: 15491 case 11: 15492 assert( 15493 node.codegenNode != null, 15494 `Codegen node is missing for element/if/for node. Apply appropriate transforms first.` 15495 ); 15496 genNode(node.codegenNode, context); 15497 break; 15498 case 2: 15499 genText(node, context); 15500 break; 15501 case 4: 15502 genExpression(node, context); 15503 break; 15504 case 5: 15505 genInterpolation(node, context); 15506 break; 15507 case 12: 15508 genNode(node.codegenNode, context); 15509 break; 15510 case 8: 15511 genCompoundExpression(node, context); 15512 break; 15513 case 3: 15514 genComment(node, context); 15515 break; 15516 case 13: 15517 genVNodeCall(node, context); 15518 break; 15519 case 14: 15520 genCallExpression(node, context); 15521 break; 15522 case 15: 15523 genObjectExpression(node, context); 15524 break; 15525 case 17: 15526 genArrayExpression(node, context); 15527 break; 15528 case 18: 15529 genFunctionExpression(node, context); 15530 break; 15531 case 19: 15532 genConditionalExpression(node, context); 15533 break; 15534 case 20: 15535 genCacheExpression(node, context); 15536 break; 15537 case 21: 15538 genNodeList(node.body, context, true, false); 15539 break; 15540 // SSR only types 15541 case 22: 15542 break; 15543 case 23: 15544 break; 15545 case 24: 15546 break; 15547 case 25: 15548 break; 15549 case 26: 15550 break; 15551 /* v8 ignore start */ 15552 case 10: 15553 break; 15554 default: 15555 { 15556 assert(false, `unhandled codegen node type: ${node.type}`); 15557 const exhaustiveCheck = node; 15558 return exhaustiveCheck; 15559 } 15560 } 15561 } 15562 function genText(node, context) { 15563 context.push(JSON.stringify(node.content), -3 /* Unknown */, node); 15564 } 15565 function genExpression(node, context) { 15566 const { content, isStatic } = node; 15567 context.push( 15568 isStatic ? JSON.stringify(content) : content, 15569 -3 /* Unknown */, 15570 node 15571 ); 15572 } 15573 function genInterpolation(node, context) { 15574 const { push, helper, pure } = context; 15575 if (pure) push(PURE_ANNOTATION); 15576 push(`${helper(TO_DISPLAY_STRING)}(`); 15577 genNode(node.content, context); 15578 push(`)`); 15579 } 15580 function genCompoundExpression(node, context) { 15581 for (let i = 0; i < node.children.length; i++) { 15582 const child = node.children[i]; 15583 if (isString(child)) { 15584 context.push(child, -3 /* Unknown */); 15585 } else { 15586 genNode(child, context); 15587 } 15588 } 15589 } 15590 function genExpressionAsPropertyKey(node, context) { 15591 const { push } = context; 15592 if (node.type === 8) { 15593 push(`[`); 15594 genCompoundExpression(node, context); 15595 push(`]`); 15596 } else if (node.isStatic) { 15597 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content); 15598 push(text, -2 /* None */, node); 15599 } else { 15600 push(`[${node.content}]`, -3 /* Unknown */, node); 15601 } 15602 } 15603 function genComment(node, context) { 15604 const { push, helper, pure } = context; 15605 if (pure) { 15606 push(PURE_ANNOTATION); 15607 } 15608 push( 15609 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, 15610 -3 /* Unknown */, 15611 node 15612 ); 15613 } 15614 function genVNodeCall(node, context) { 15615 const { push, helper, pure } = context; 15616 const { 15617 tag, 15618 props, 15619 children, 15620 patchFlag, 15621 dynamicProps, 15622 directives, 15623 isBlock, 15624 disableTracking, 15625 isComponent 15626 } = node; 15627 let patchFlagString; 15628 if (patchFlag) { 15629 { 15630 if (patchFlag < 0) { 15631 patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`; 15632 } else { 15633 const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `); 15634 patchFlagString = patchFlag + ` /* ${flagNames} */`; 15635 } 15636 } 15637 } 15638 if (directives) { 15639 push(helper(WITH_DIRECTIVES) + `(`); 15640 } 15641 if (isBlock) { 15642 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `); 15643 } 15644 if (pure) { 15645 push(PURE_ANNOTATION); 15646 } 15647 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent); 15648 push(helper(callHelper) + `(`, -2 /* None */, node); 15649 genNodeList( 15650 genNullableArgs([tag, props, children, patchFlagString, dynamicProps]), 15651 context 15652 ); 15653 push(`)`); 15654 if (isBlock) { 15655 push(`)`); 15656 } 15657 if (directives) { 15658 push(`, `); 15659 genNode(directives, context); 15660 push(`)`); 15661 } 15662 } 15663 function genNullableArgs(args) { 15664 let i = args.length; 15665 while (i--) { 15666 if (args[i] != null) break; 15667 } 15668 return args.slice(0, i + 1).map((arg) => arg || `null`); 15669 } 15670 function genCallExpression(node, context) { 15671 const { push, helper, pure } = context; 15672 const callee = isString(node.callee) ? node.callee : helper(node.callee); 15673 if (pure) { 15674 push(PURE_ANNOTATION); 15675 } 15676 push(callee + `(`, -2 /* None */, node); 15677 genNodeList(node.arguments, context); 15678 push(`)`); 15679 } 15680 function genObjectExpression(node, context) { 15681 const { push, indent, deindent, newline } = context; 15682 const { properties } = node; 15683 if (!properties.length) { 15684 push(`{}`, -2 /* None */, node); 15685 return; 15686 } 15687 const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4); 15688 push(multilines ? `{` : `{ `); 15689 multilines && indent(); 15690 for (let i = 0; i < properties.length; i++) { 15691 const { key, value } = properties[i]; 15692 genExpressionAsPropertyKey(key, context); 15693 push(`: `); 15694 genNode(value, context); 15695 if (i < properties.length - 1) { 15696 push(`,`); 15697 newline(); 15698 } 15699 } 15700 multilines && deindent(); 15701 push(multilines ? `}` : ` }`); 15702 } 15703 function genArrayExpression(node, context) { 15704 genNodeListAsArray(node.elements, context); 15705 } 15706 function genFunctionExpression(node, context) { 15707 const { push, indent, deindent } = context; 15708 const { params, returns, body, newline, isSlot } = node; 15709 if (isSlot) { 15710 push(`_${helperNameMap[WITH_CTX]}(`); 15711 } 15712 push(`(`, -2 /* None */, node); 15713 if (isArray(params)) { 15714 genNodeList(params, context); 15715 } else if (params) { 15716 genNode(params, context); 15717 } 15718 push(`) => `); 15719 if (newline || body) { 15720 push(`{`); 15721 indent(); 15722 } 15723 if (returns) { 15724 if (newline) { 15725 push(`return `); 15726 } 15727 if (isArray(returns)) { 15728 genNodeListAsArray(returns, context); 15729 } else { 15730 genNode(returns, context); 15731 } 15732 } else if (body) { 15733 genNode(body, context); 15734 } 15735 if (newline || body) { 15736 deindent(); 15737 push(`}`); 15738 } 15739 if (isSlot) { 15740 push(`)`); 15741 } 15742 } 15743 function genConditionalExpression(node, context) { 15744 const { test, consequent, alternate, newline: needNewline } = node; 15745 const { push, indent, deindent, newline } = context; 15746 if (test.type === 4) { 15747 const needsParens = !isSimpleIdentifier(test.content); 15748 needsParens && push(`(`); 15749 genExpression(test, context); 15750 needsParens && push(`)`); 15751 } else { 15752 push(`(`); 15753 genNode(test, context); 15754 push(`)`); 15755 } 15756 needNewline && indent(); 15757 context.indentLevel++; 15758 needNewline || push(` `); 15759 push(`? `); 15760 genNode(consequent, context); 15761 context.indentLevel--; 15762 needNewline && newline(); 15763 needNewline || push(` `); 15764 push(`: `); 15765 const isNested = alternate.type === 19; 15766 if (!isNested) { 15767 context.indentLevel++; 15768 } 15769 genNode(alternate, context); 15770 if (!isNested) { 15771 context.indentLevel--; 15772 } 15773 needNewline && deindent( 15774 true 15775 /* without newline */ 15776 ); 15777 } 15778 function genCacheExpression(node, context) { 15779 const { push, helper, indent, deindent, newline } = context; 15780 const { needPauseTracking, needArraySpread } = node; 15781 if (needArraySpread) { 15782 push(`[...(`); 15783 } 15784 push(`_cache[${node.index}] || (`); 15785 if (needPauseTracking) { 15786 indent(); 15787 push(`${helper(SET_BLOCK_TRACKING)}(-1`); 15788 if (node.inVOnce) push(`, true`); 15789 push(`),`); 15790 newline(); 15791 push(`(`); 15792 } 15793 push(`_cache[${node.index}] = `); 15794 genNode(node.value, context); 15795 if (needPauseTracking) { 15796 push(`).cacheIndex = ${node.index},`); 15797 newline(); 15798 push(`${helper(SET_BLOCK_TRACKING)}(1),`); 15799 newline(); 15800 push(`_cache[${node.index}]`); 15801 deindent(); 15802 } 15803 push(`)`); 15804 if (needArraySpread) { 15805 push(`)]`); 15806 } 15807 } 15808 15809 const prohibitedKeywordRE = new RegExp( 15810 "\\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" 15811 ); 15812 const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; 15813 function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) { 15814 const exp = node.content; 15815 if (!exp.trim()) { 15816 return; 15817 } 15818 try { 15819 new Function( 15820 asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}` 15821 ); 15822 } catch (e) { 15823 let message = e.message; 15824 const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE); 15825 if (keywordMatch) { 15826 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`; 15827 } 15828 context.onError( 15829 createCompilerError( 15830 46, 15831 node.loc, 15832 void 0, 15833 message 15834 ) 15835 ); 15836 } 15837 } 15838 15839 const transformExpression = (node, context) => { 15840 if (node.type === 5) { 15841 node.content = processExpression( 15842 node.content, 15843 context 15844 ); 15845 } else if (node.type === 1) { 15846 const memo = findDir(node, "memo"); 15847 for (let i = 0; i < node.props.length; i++) { 15848 const dir = node.props[i]; 15849 if (dir.type === 7 && dir.name !== "for") { 15850 const exp = dir.exp; 15851 const arg = dir.arg; 15852 if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor) 15853 !(memo && arg && arg.type === 4 && arg.content === "key")) { 15854 dir.exp = processExpression( 15855 exp, 15856 context, 15857 // slot args must be processed as function params 15858 dir.name === "slot" 15859 ); 15860 } 15861 if (arg && arg.type === 4 && !arg.isStatic) { 15862 dir.arg = processExpression(arg, context); 15863 } 15864 } 15865 } 15866 } 15867 }; 15868 function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) { 15869 { 15870 { 15871 validateBrowserExpression(node, context, asParams, asRawStatements); 15872 } 15873 return node; 15874 } 15875 } 15876 15877 const transformIf = createStructuralDirectiveTransform( 15878 /^(?:if|else|else-if)$/, 15879 (node, dir, context) => { 15880 return processIf(node, dir, context, (ifNode, branch, isRoot) => { 15881 const siblings = context.parent.children; 15882 let i = siblings.indexOf(ifNode); 15883 let key = 0; 15884 while (i-- >= 0) { 15885 const sibling = siblings[i]; 15886 if (sibling && sibling.type === 9) { 15887 key += sibling.branches.length; 15888 } 15889 } 15890 return () => { 15891 if (isRoot) { 15892 ifNode.codegenNode = createCodegenNodeForBranch( 15893 branch, 15894 key, 15895 context 15896 ); 15897 } else { 15898 const parentCondition = getParentCondition(ifNode.codegenNode); 15899 parentCondition.alternate = createCodegenNodeForBranch( 15900 branch, 15901 key + ifNode.branches.length - 1, 15902 context 15903 ); 15904 } 15905 }; 15906 }); 15907 } 15908 ); 15909 function processIf(node, dir, context, processCodegen) { 15910 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) { 15911 const loc = dir.exp ? dir.exp.loc : node.loc; 15912 context.onError( 15913 createCompilerError(28, dir.loc) 15914 ); 15915 dir.exp = createSimpleExpression(`true`, false, loc); 15916 } 15917 if (dir.exp) { 15918 validateBrowserExpression(dir.exp, context); 15919 } 15920 if (dir.name === "if") { 15921 const branch = createIfBranch(node, dir); 15922 const ifNode = { 15923 type: 9, 15924 loc: cloneLoc(node.loc), 15925 branches: [branch] 15926 }; 15927 context.replaceNode(ifNode); 15928 if (processCodegen) { 15929 return processCodegen(ifNode, branch, true); 15930 } 15931 } else { 15932 const siblings = context.parent.children; 15933 const comments = []; 15934 let i = siblings.indexOf(node); 15935 while (i-- >= -1) { 15936 const sibling = siblings[i]; 15937 if (sibling && isCommentOrWhitespace(sibling)) { 15938 context.removeNode(sibling); 15939 if (sibling.type === 3) { 15940 comments.unshift(sibling); 15941 } 15942 continue; 15943 } 15944 if (sibling && sibling.type === 9) { 15945 if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) { 15946 context.onError( 15947 createCompilerError(30, node.loc) 15948 ); 15949 } 15950 context.removeNode(); 15951 const branch = createIfBranch(node, dir); 15952 if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition> 15953 !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) { 15954 branch.children = [...comments, ...branch.children]; 15955 } 15956 { 15957 const key = branch.userKey; 15958 if (key) { 15959 sibling.branches.forEach(({ userKey }) => { 15960 if (isSameKey(userKey, key)) { 15961 context.onError( 15962 createCompilerError( 15963 29, 15964 branch.userKey.loc 15965 ) 15966 ); 15967 } 15968 }); 15969 } 15970 } 15971 sibling.branches.push(branch); 15972 const onExit = processCodegen && processCodegen(sibling, branch, false); 15973 traverseNode(branch, context); 15974 if (onExit) onExit(); 15975 context.currentNode = null; 15976 } else { 15977 context.onError( 15978 createCompilerError(30, node.loc) 15979 ); 15980 } 15981 break; 15982 } 15983 } 15984 } 15985 function createIfBranch(node, dir) { 15986 const isTemplateIf = node.tagType === 3; 15987 return { 15988 type: 10, 15989 loc: node.loc, 15990 condition: dir.name === "else" ? void 0 : dir.exp, 15991 children: isTemplateIf && !findDir(node, "for") ? node.children : [node], 15992 userKey: findProp(node, `key`), 15993 isTemplateIf 15994 }; 15995 } 15996 function createCodegenNodeForBranch(branch, keyIndex, context) { 15997 if (branch.condition) { 15998 return createConditionalExpression( 15999 branch.condition, 16000 createChildrenCodegenNode(branch, keyIndex, context), 16001 // make sure to pass in asBlock: true so that the comment node call 16002 // closes the current block. 16003 createCallExpression(context.helper(CREATE_COMMENT), [ 16004 '"v-if"' , 16005 "true" 16006 ]) 16007 ); 16008 } else { 16009 return createChildrenCodegenNode(branch, keyIndex, context); 16010 } 16011 } 16012 function createChildrenCodegenNode(branch, keyIndex, context) { 16013 const { helper } = context; 16014 const keyProperty = createObjectProperty( 16015 `key`, 16016 createSimpleExpression( 16017 `${keyIndex}`, 16018 false, 16019 locStub, 16020 2 16021 ) 16022 ); 16023 const { children } = branch; 16024 const firstChild = children[0]; 16025 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1; 16026 if (needFragmentWrapper) { 16027 if (children.length === 1 && firstChild.type === 11) { 16028 const vnodeCall = firstChild.codegenNode; 16029 injectProp(vnodeCall, keyProperty, context); 16030 return vnodeCall; 16031 } else { 16032 let patchFlag = 64; 16033 if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) { 16034 patchFlag |= 2048; 16035 } 16036 return createVNodeCall( 16037 context, 16038 helper(FRAGMENT), 16039 createObjectExpression([keyProperty]), 16040 children, 16041 patchFlag, 16042 void 0, 16043 void 0, 16044 true, 16045 false, 16046 false, 16047 branch.loc 16048 ); 16049 } 16050 } else { 16051 const ret = firstChild.codegenNode; 16052 const vnodeCall = getMemoedVNodeCall(ret); 16053 if (vnodeCall.type === 13) { 16054 convertToBlock(vnodeCall, context); 16055 } 16056 injectProp(vnodeCall, keyProperty, context); 16057 return ret; 16058 } 16059 } 16060 function isSameKey(a, b) { 16061 if (!a || a.type !== b.type) { 16062 return false; 16063 } 16064 if (a.type === 6) { 16065 if (a.value.content !== b.value.content) { 16066 return false; 16067 } 16068 } else { 16069 const exp = a.exp; 16070 const branchExp = b.exp; 16071 if (exp.type !== branchExp.type) { 16072 return false; 16073 } 16074 if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) { 16075 return false; 16076 } 16077 } 16078 return true; 16079 } 16080 function getParentCondition(node) { 16081 while (true) { 16082 if (node.type === 19) { 16083 if (node.alternate.type === 19) { 16084 node = node.alternate; 16085 } else { 16086 return node; 16087 } 16088 } else if (node.type === 20) { 16089 node = node.value; 16090 } 16091 } 16092 } 16093 16094 const transformFor = createStructuralDirectiveTransform( 16095 "for", 16096 (node, dir, context) => { 16097 const { helper, removeHelper } = context; 16098 return processFor(node, dir, context, (forNode) => { 16099 const renderExp = createCallExpression(helper(RENDER_LIST), [ 16100 forNode.source 16101 ]); 16102 const isTemplate = isTemplateNode(node); 16103 const memo = findDir(node, "memo"); 16104 const keyProp = findProp(node, `key`, false, true); 16105 keyProp && keyProp.type === 7; 16106 let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp); 16107 const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null; 16108 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0; 16109 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256; 16110 forNode.codegenNode = createVNodeCall( 16111 context, 16112 helper(FRAGMENT), 16113 void 0, 16114 renderExp, 16115 fragmentFlag, 16116 void 0, 16117 void 0, 16118 true, 16119 !isStableFragment, 16120 false, 16121 node.loc 16122 ); 16123 return () => { 16124 let childBlock; 16125 const { children } = forNode; 16126 if (isTemplate) { 16127 node.children.some((c) => { 16128 if (c.type === 1) { 16129 const key = findProp(c, "key"); 16130 if (key) { 16131 context.onError( 16132 createCompilerError( 16133 33, 16134 key.loc 16135 ) 16136 ); 16137 return true; 16138 } 16139 } 16140 }); 16141 } 16142 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1; 16143 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null; 16144 if (slotOutlet) { 16145 childBlock = slotOutlet.codegenNode; 16146 if (isTemplate && keyProperty) { 16147 injectProp(childBlock, keyProperty, context); 16148 } 16149 } else if (needFragmentWrapper) { 16150 childBlock = createVNodeCall( 16151 context, 16152 helper(FRAGMENT), 16153 keyProperty ? createObjectExpression([keyProperty]) : void 0, 16154 node.children, 16155 64, 16156 void 0, 16157 void 0, 16158 true, 16159 void 0, 16160 false 16161 ); 16162 } else { 16163 childBlock = children[0].codegenNode; 16164 if (isTemplate && keyProperty) { 16165 injectProp(childBlock, keyProperty, context); 16166 } 16167 if (childBlock.isBlock !== !isStableFragment) { 16168 if (childBlock.isBlock) { 16169 removeHelper(OPEN_BLOCK); 16170 removeHelper( 16171 getVNodeBlockHelper(context.inSSR, childBlock.isComponent) 16172 ); 16173 } else { 16174 removeHelper( 16175 getVNodeHelper(context.inSSR, childBlock.isComponent) 16176 ); 16177 } 16178 } 16179 childBlock.isBlock = !isStableFragment; 16180 if (childBlock.isBlock) { 16181 helper(OPEN_BLOCK); 16182 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent)); 16183 } else { 16184 helper(getVNodeHelper(context.inSSR, childBlock.isComponent)); 16185 } 16186 } 16187 if (memo) { 16188 const loop = createFunctionExpression( 16189 createForLoopParams(forNode.parseResult, [ 16190 createSimpleExpression(`_cached`) 16191 ]) 16192 ); 16193 loop.body = createBlockStatement([ 16194 createCompoundExpression([`const _memo = (`, memo.exp, `)`]), 16195 createCompoundExpression([ 16196 `if (_cached`, 16197 ...keyExp ? [` && _cached.key === `, keyExp] : [], 16198 ` && ${context.helperString( 16199 IS_MEMO_SAME 16200 )}(_cached, _memo)) return _cached` 16201 ]), 16202 createCompoundExpression([`const _item = `, childBlock]), 16203 createSimpleExpression(`_item.memo = _memo`), 16204 createSimpleExpression(`return _item`) 16205 ]); 16206 renderExp.arguments.push( 16207 loop, 16208 createSimpleExpression(`_cache`), 16209 createSimpleExpression(String(context.cached.length)) 16210 ); 16211 context.cached.push(null); 16212 } else { 16213 renderExp.arguments.push( 16214 createFunctionExpression( 16215 createForLoopParams(forNode.parseResult), 16216 childBlock, 16217 true 16218 ) 16219 ); 16220 } 16221 }; 16222 }); 16223 } 16224 ); 16225 function processFor(node, dir, context, processCodegen) { 16226 if (!dir.exp) { 16227 context.onError( 16228 createCompilerError(31, dir.loc) 16229 ); 16230 return; 16231 } 16232 const parseResult = dir.forParseResult; 16233 if (!parseResult) { 16234 context.onError( 16235 createCompilerError(32, dir.loc) 16236 ); 16237 return; 16238 } 16239 finalizeForParseResult(parseResult, context); 16240 const { addIdentifiers, removeIdentifiers, scopes } = context; 16241 const { source, value, key, index } = parseResult; 16242 const forNode = { 16243 type: 11, 16244 loc: dir.loc, 16245 source, 16246 valueAlias: value, 16247 keyAlias: key, 16248 objectIndexAlias: index, 16249 parseResult, 16250 children: isTemplateNode(node) ? node.children : [node] 16251 }; 16252 context.replaceNode(forNode); 16253 scopes.vFor++; 16254 const onExit = processCodegen && processCodegen(forNode); 16255 return () => { 16256 scopes.vFor--; 16257 if (onExit) onExit(); 16258 }; 16259 } 16260 function finalizeForParseResult(result, context) { 16261 if (result.finalized) return; 16262 { 16263 validateBrowserExpression(result.source, context); 16264 if (result.key) { 16265 validateBrowserExpression( 16266 result.key, 16267 context, 16268 true 16269 ); 16270 } 16271 if (result.index) { 16272 validateBrowserExpression( 16273 result.index, 16274 context, 16275 true 16276 ); 16277 } 16278 if (result.value) { 16279 validateBrowserExpression( 16280 result.value, 16281 context, 16282 true 16283 ); 16284 } 16285 } 16286 result.finalized = true; 16287 } 16288 function createForLoopParams({ value, key, index }, memoArgs = []) { 16289 return createParamsList([value, key, index, ...memoArgs]); 16290 } 16291 function createParamsList(args) { 16292 let i = args.length; 16293 while (i--) { 16294 if (args[i]) break; 16295 } 16296 return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false)); 16297 } 16298 16299 const defaultFallback = createSimpleExpression(`undefined`, false); 16300 const trackSlotScopes = (node, context) => { 16301 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) { 16302 const vSlot = findDir(node, "slot"); 16303 if (vSlot) { 16304 vSlot.exp; 16305 context.scopes.vSlot++; 16306 return () => { 16307 context.scopes.vSlot--; 16308 }; 16309 } 16310 } 16311 }; 16312 const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression( 16313 props, 16314 children, 16315 false, 16316 true, 16317 children.length ? children[0].loc : loc 16318 ); 16319 function buildSlots(node, context, buildSlotFn = buildClientSlotFn) { 16320 context.helper(WITH_CTX); 16321 const { children, loc } = node; 16322 const slotsProperties = []; 16323 const dynamicSlots = []; 16324 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0; 16325 const onComponentSlot = findDir(node, "slot", true); 16326 if (onComponentSlot) { 16327 const { arg, exp } = onComponentSlot; 16328 if (arg && !isStaticExp(arg)) { 16329 hasDynamicSlots = true; 16330 } 16331 slotsProperties.push( 16332 createObjectProperty( 16333 arg || createSimpleExpression("default", true), 16334 buildSlotFn(exp, void 0, children, loc) 16335 ) 16336 ); 16337 } 16338 let hasTemplateSlots = false; 16339 let hasNamedDefaultSlot = false; 16340 const implicitDefaultChildren = []; 16341 const seenSlotNames = /* @__PURE__ */ new Set(); 16342 let conditionalBranchIndex = 0; 16343 for (let i = 0; i < children.length; i++) { 16344 const slotElement = children[i]; 16345 let slotDir; 16346 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) { 16347 if (slotElement.type !== 3) { 16348 implicitDefaultChildren.push(slotElement); 16349 } 16350 continue; 16351 } 16352 if (onComponentSlot) { 16353 context.onError( 16354 createCompilerError(37, slotDir.loc) 16355 ); 16356 break; 16357 } 16358 hasTemplateSlots = true; 16359 const { children: slotChildren, loc: slotLoc } = slotElement; 16360 const { 16361 arg: slotName = createSimpleExpression(`default`, true), 16362 exp: slotProps, 16363 loc: dirLoc 16364 } = slotDir; 16365 let staticSlotName; 16366 if (isStaticExp(slotName)) { 16367 staticSlotName = slotName ? slotName.content : `default`; 16368 } else { 16369 hasDynamicSlots = true; 16370 } 16371 const vFor = findDir(slotElement, "for"); 16372 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc); 16373 let vIf; 16374 let vElse; 16375 if (vIf = findDir(slotElement, "if")) { 16376 hasDynamicSlots = true; 16377 dynamicSlots.push( 16378 createConditionalExpression( 16379 vIf.exp, 16380 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), 16381 defaultFallback 16382 ) 16383 ); 16384 } else if (vElse = findDir( 16385 slotElement, 16386 /^else(?:-if)?$/, 16387 true 16388 /* allowEmpty */ 16389 )) { 16390 let j = i; 16391 let prev; 16392 while (j--) { 16393 prev = children[j]; 16394 if (!isCommentOrWhitespace(prev)) { 16395 break; 16396 } 16397 } 16398 if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) { 16399 let conditional = dynamicSlots[dynamicSlots.length - 1]; 16400 while (conditional.alternate.type === 19) { 16401 conditional = conditional.alternate; 16402 } 16403 conditional.alternate = vElse.exp ? createConditionalExpression( 16404 vElse.exp, 16405 buildDynamicSlot( 16406 slotName, 16407 slotFunction, 16408 conditionalBranchIndex++ 16409 ), 16410 defaultFallback 16411 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++); 16412 } else { 16413 context.onError( 16414 createCompilerError(30, vElse.loc) 16415 ); 16416 } 16417 } else if (vFor) { 16418 hasDynamicSlots = true; 16419 const parseResult = vFor.forParseResult; 16420 if (parseResult) { 16421 finalizeForParseResult(parseResult, context); 16422 dynamicSlots.push( 16423 createCallExpression(context.helper(RENDER_LIST), [ 16424 parseResult.source, 16425 createFunctionExpression( 16426 createForLoopParams(parseResult), 16427 buildDynamicSlot(slotName, slotFunction), 16428 true 16429 ) 16430 ]) 16431 ); 16432 } else { 16433 context.onError( 16434 createCompilerError( 16435 32, 16436 vFor.loc 16437 ) 16438 ); 16439 } 16440 } else { 16441 if (staticSlotName) { 16442 if (seenSlotNames.has(staticSlotName)) { 16443 context.onError( 16444 createCompilerError( 16445 38, 16446 dirLoc 16447 ) 16448 ); 16449 continue; 16450 } 16451 seenSlotNames.add(staticSlotName); 16452 if (staticSlotName === "default") { 16453 hasNamedDefaultSlot = true; 16454 } 16455 } 16456 slotsProperties.push(createObjectProperty(slotName, slotFunction)); 16457 } 16458 } 16459 if (!onComponentSlot) { 16460 const buildDefaultSlotProperty = (props, children2) => { 16461 const fn = buildSlotFn(props, void 0, children2, loc); 16462 return createObjectProperty(`default`, fn); 16463 }; 16464 if (!hasTemplateSlots) { 16465 slotsProperties.push(buildDefaultSlotProperty(void 0, children)); 16466 } else if (implicitDefaultChildren.length && // #3766 16467 // with whitespace: 'preserve', whitespaces between slots will end up in 16468 // implicitDefaultChildren. Ignore if all implicit children are whitespaces. 16469 !implicitDefaultChildren.every(isWhitespaceText)) { 16470 if (hasNamedDefaultSlot) { 16471 context.onError( 16472 createCompilerError( 16473 39, 16474 implicitDefaultChildren[0].loc 16475 ) 16476 ); 16477 } else { 16478 slotsProperties.push( 16479 buildDefaultSlotProperty(void 0, implicitDefaultChildren) 16480 ); 16481 } 16482 } 16483 } 16484 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1; 16485 let slots = createObjectExpression( 16486 slotsProperties.concat( 16487 createObjectProperty( 16488 `_`, 16489 // 2 = compiled but dynamic = can skip normalization, but must run diff 16490 // 1 = compiled and static = can skip normalization AND diff as optimized 16491 createSimpleExpression( 16492 slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ), 16493 false 16494 ) 16495 ) 16496 ), 16497 loc 16498 ); 16499 if (dynamicSlots.length) { 16500 slots = createCallExpression(context.helper(CREATE_SLOTS), [ 16501 slots, 16502 createArrayExpression(dynamicSlots) 16503 ]); 16504 } 16505 return { 16506 slots, 16507 hasDynamicSlots 16508 }; 16509 } 16510 function buildDynamicSlot(name, fn, index) { 16511 const props = [ 16512 createObjectProperty(`name`, name), 16513 createObjectProperty(`fn`, fn) 16514 ]; 16515 if (index != null) { 16516 props.push( 16517 createObjectProperty(`key`, createSimpleExpression(String(index), true)) 16518 ); 16519 } 16520 return createObjectExpression(props); 16521 } 16522 function hasForwardedSlots(children) { 16523 for (let i = 0; i < children.length; i++) { 16524 const child = children[i]; 16525 switch (child.type) { 16526 case 1: 16527 if (child.tagType === 2 || hasForwardedSlots(child.children)) { 16528 return true; 16529 } 16530 break; 16531 case 9: 16532 if (hasForwardedSlots(child.branches)) return true; 16533 break; 16534 case 10: 16535 case 11: 16536 if (hasForwardedSlots(child.children)) return true; 16537 break; 16538 } 16539 } 16540 return false; 16541 } 16542 16543 const directiveImportMap = /* @__PURE__ */ new WeakMap(); 16544 const transformElement = (node, context) => { 16545 return function postTransformElement() { 16546 node = context.currentNode; 16547 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) { 16548 return; 16549 } 16550 const { tag, props } = node; 16551 const isComponent = node.tagType === 1; 16552 let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`; 16553 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT; 16554 let vnodeProps; 16555 let vnodeChildren; 16556 let patchFlag = 0; 16557 let vnodeDynamicProps; 16558 let dynamicPropNames; 16559 let vnodeDirectives; 16560 let shouldUseBlock = ( 16561 // dynamic component may resolve to plain elements 16562 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block 16563 // updates inside get proper isSVG flag at runtime. (#639, #643) 16564 // This is technically web-specific, but splitting the logic out of core 16565 // leads to too much unnecessary complexity. 16566 (tag === "svg" || tag === "foreignObject" || tag === "math") 16567 ); 16568 if (props.length > 0) { 16569 const propsBuildResult = buildProps( 16570 node, 16571 context, 16572 void 0, 16573 isComponent, 16574 isDynamicComponent 16575 ); 16576 vnodeProps = propsBuildResult.props; 16577 patchFlag = propsBuildResult.patchFlag; 16578 dynamicPropNames = propsBuildResult.dynamicPropNames; 16579 const directives = propsBuildResult.directives; 16580 vnodeDirectives = directives && directives.length ? createArrayExpression( 16581 directives.map((dir) => buildDirectiveArgs(dir, context)) 16582 ) : void 0; 16583 if (propsBuildResult.shouldUseBlock) { 16584 shouldUseBlock = true; 16585 } 16586 } 16587 if (node.children.length > 0) { 16588 if (vnodeTag === KEEP_ALIVE) { 16589 shouldUseBlock = true; 16590 patchFlag |= 1024; 16591 if (node.children.length > 1) { 16592 context.onError( 16593 createCompilerError(47, { 16594 start: node.children[0].loc.start, 16595 end: node.children[node.children.length - 1].loc.end, 16596 source: "" 16597 }) 16598 ); 16599 } 16600 } 16601 const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling 16602 vnodeTag !== TELEPORT && // explained above. 16603 vnodeTag !== KEEP_ALIVE; 16604 if (shouldBuildAsSlots) { 16605 const { slots, hasDynamicSlots } = buildSlots(node, context); 16606 vnodeChildren = slots; 16607 if (hasDynamicSlots) { 16608 patchFlag |= 1024; 16609 } 16610 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) { 16611 const child = node.children[0]; 16612 const type = child.type; 16613 const hasDynamicTextChild = type === 5 || type === 8; 16614 if (hasDynamicTextChild && getConstantType(child, context) === 0) { 16615 patchFlag |= 1; 16616 } 16617 if (hasDynamicTextChild || type === 2) { 16618 vnodeChildren = child; 16619 } else { 16620 vnodeChildren = node.children; 16621 } 16622 } else { 16623 vnodeChildren = node.children; 16624 } 16625 } 16626 if (dynamicPropNames && dynamicPropNames.length) { 16627 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames); 16628 } 16629 node.codegenNode = createVNodeCall( 16630 context, 16631 vnodeTag, 16632 vnodeProps, 16633 vnodeChildren, 16634 patchFlag === 0 ? void 0 : patchFlag, 16635 vnodeDynamicProps, 16636 vnodeDirectives, 16637 !!shouldUseBlock, 16638 false, 16639 isComponent, 16640 node.loc 16641 ); 16642 }; 16643 }; 16644 function resolveComponentType(node, context, ssr = false) { 16645 let { tag } = node; 16646 const isExplicitDynamic = isComponentTag(tag); 16647 const isProp = findProp( 16648 node, 16649 "is", 16650 false, 16651 true 16652 /* allow empty */ 16653 ); 16654 if (isProp) { 16655 if (isExplicitDynamic || false) { 16656 let exp; 16657 if (isProp.type === 6) { 16658 exp = isProp.value && createSimpleExpression(isProp.value.content, true); 16659 } else { 16660 exp = isProp.exp; 16661 if (!exp) { 16662 exp = createSimpleExpression(`is`, false, isProp.arg.loc); 16663 } 16664 } 16665 if (exp) { 16666 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [ 16667 exp 16668 ]); 16669 } 16670 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) { 16671 tag = isProp.value.content.slice(4); 16672 } 16673 } 16674 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag); 16675 if (builtIn) { 16676 if (!ssr) context.helper(builtIn); 16677 return builtIn; 16678 } 16679 context.helper(RESOLVE_COMPONENT); 16680 context.components.add(tag); 16681 return toValidAssetId(tag, `component`); 16682 } 16683 function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) { 16684 const { tag, loc: elementLoc, children } = node; 16685 let properties = []; 16686 const mergeArgs = []; 16687 const runtimeDirectives = []; 16688 const hasChildren = children.length > 0; 16689 let shouldUseBlock = false; 16690 let patchFlag = 0; 16691 let hasRef = false; 16692 let hasClassBinding = false; 16693 let hasStyleBinding = false; 16694 let hasHydrationEventBinding = false; 16695 let hasDynamicKeys = false; 16696 let hasVnodeHook = false; 16697 const dynamicPropNames = []; 16698 const pushMergeArg = (arg) => { 16699 if (properties.length) { 16700 mergeArgs.push( 16701 createObjectExpression(dedupeProperties(properties), elementLoc) 16702 ); 16703 properties = []; 16704 } 16705 if (arg) mergeArgs.push(arg); 16706 }; 16707 const pushRefVForMarker = () => { 16708 if (context.scopes.vFor > 0) { 16709 properties.push( 16710 createObjectProperty( 16711 createSimpleExpression("ref_for", true), 16712 createSimpleExpression("true") 16713 ) 16714 ); 16715 } 16716 }; 16717 const analyzePatchFlag = ({ key, value }) => { 16718 if (isStaticExp(key)) { 16719 const name = key.content; 16720 const isEventHandler = isOn(name); 16721 if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click 16722 // dedicated fast path. 16723 name.toLowerCase() !== "onclick" && // omit v-model handlers 16724 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks 16725 !isReservedProp(name)) { 16726 hasHydrationEventBinding = true; 16727 } 16728 if (isEventHandler && isReservedProp(name)) { 16729 hasVnodeHook = true; 16730 } 16731 if (isEventHandler && value.type === 14) { 16732 value = value.arguments[0]; 16733 } 16734 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) { 16735 return; 16736 } 16737 if (name === "ref") { 16738 hasRef = true; 16739 } else if (name === "class") { 16740 hasClassBinding = true; 16741 } else if (name === "style") { 16742 hasStyleBinding = true; 16743 } else if (name !== "key" && !dynamicPropNames.includes(name)) { 16744 dynamicPropNames.push(name); 16745 } 16746 if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) { 16747 dynamicPropNames.push(name); 16748 } 16749 } else { 16750 hasDynamicKeys = true; 16751 } 16752 }; 16753 for (let i = 0; i < props.length; i++) { 16754 const prop = props[i]; 16755 if (prop.type === 6) { 16756 const { loc, name, nameLoc, value } = prop; 16757 let isStatic = true; 16758 if (name === "ref") { 16759 hasRef = true; 16760 pushRefVForMarker(); 16761 } 16762 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) { 16763 continue; 16764 } 16765 properties.push( 16766 createObjectProperty( 16767 createSimpleExpression(name, true, nameLoc), 16768 createSimpleExpression( 16769 value ? value.content : "", 16770 isStatic, 16771 value ? value.loc : loc 16772 ) 16773 ) 16774 ); 16775 } else { 16776 const { name, arg, exp, loc, modifiers } = prop; 16777 const isVBind = name === "bind"; 16778 const isVOn = name === "on"; 16779 if (name === "slot") { 16780 if (!isComponent) { 16781 context.onError( 16782 createCompilerError(40, loc) 16783 ); 16784 } 16785 continue; 16786 } 16787 if (name === "once" || name === "memo") { 16788 continue; 16789 } 16790 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) { 16791 continue; 16792 } 16793 if (isVOn && ssr) { 16794 continue; 16795 } 16796 if ( 16797 // #938: elements with dynamic keys should be forced into blocks 16798 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked 16799 // before children 16800 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update") 16801 ) { 16802 shouldUseBlock = true; 16803 } 16804 if (isVBind && isStaticArgOf(arg, "ref")) { 16805 pushRefVForMarker(); 16806 } 16807 if (!arg && (isVBind || isVOn)) { 16808 hasDynamicKeys = true; 16809 if (exp) { 16810 if (isVBind) { 16811 pushRefVForMarker(); 16812 pushMergeArg(); 16813 mergeArgs.push(exp); 16814 } else { 16815 pushMergeArg({ 16816 type: 14, 16817 loc, 16818 callee: context.helper(TO_HANDLERS), 16819 arguments: isComponent ? [exp] : [exp, `true`] 16820 }); 16821 } 16822 } else { 16823 context.onError( 16824 createCompilerError( 16825 isVBind ? 34 : 35, 16826 loc 16827 ) 16828 ); 16829 } 16830 continue; 16831 } 16832 if (isVBind && modifiers.some((mod) => mod.content === "prop")) { 16833 patchFlag |= 32; 16834 } 16835 const directiveTransform = context.directiveTransforms[name]; 16836 if (directiveTransform) { 16837 const { props: props2, needRuntime } = directiveTransform(prop, node, context); 16838 !ssr && props2.forEach(analyzePatchFlag); 16839 if (isVOn && arg && !isStaticExp(arg)) { 16840 pushMergeArg(createObjectExpression(props2, elementLoc)); 16841 } else { 16842 properties.push(...props2); 16843 } 16844 if (needRuntime) { 16845 runtimeDirectives.push(prop); 16846 if (isSymbol(needRuntime)) { 16847 directiveImportMap.set(prop, needRuntime); 16848 } 16849 } 16850 } else if (!isBuiltInDirective(name)) { 16851 runtimeDirectives.push(prop); 16852 if (hasChildren) { 16853 shouldUseBlock = true; 16854 } 16855 } 16856 } 16857 } 16858 let propsExpression = void 0; 16859 if (mergeArgs.length) { 16860 pushMergeArg(); 16861 if (mergeArgs.length > 1) { 16862 propsExpression = createCallExpression( 16863 context.helper(MERGE_PROPS), 16864 mergeArgs, 16865 elementLoc 16866 ); 16867 } else { 16868 propsExpression = mergeArgs[0]; 16869 } 16870 } else if (properties.length) { 16871 propsExpression = createObjectExpression( 16872 dedupeProperties(properties), 16873 elementLoc 16874 ); 16875 } 16876 if (hasDynamicKeys) { 16877 patchFlag |= 16; 16878 } else { 16879 if (hasClassBinding && !isComponent) { 16880 patchFlag |= 2; 16881 } 16882 if (hasStyleBinding && !isComponent) { 16883 patchFlag |= 4; 16884 } 16885 if (dynamicPropNames.length) { 16886 patchFlag |= 8; 16887 } 16888 if (hasHydrationEventBinding) { 16889 patchFlag |= 32; 16890 } 16891 } 16892 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) { 16893 patchFlag |= 512; 16894 } 16895 if (!context.inSSR && propsExpression) { 16896 switch (propsExpression.type) { 16897 case 15: 16898 let classKeyIndex = -1; 16899 let styleKeyIndex = -1; 16900 let hasDynamicKey = false; 16901 for (let i = 0; i < propsExpression.properties.length; i++) { 16902 const key = propsExpression.properties[i].key; 16903 if (isStaticExp(key)) { 16904 if (key.content === "class") { 16905 classKeyIndex = i; 16906 } else if (key.content === "style") { 16907 styleKeyIndex = i; 16908 } 16909 } else if (!key.isHandlerKey) { 16910 hasDynamicKey = true; 16911 } 16912 } 16913 const classProp = propsExpression.properties[classKeyIndex]; 16914 const styleProp = propsExpression.properties[styleKeyIndex]; 16915 if (!hasDynamicKey) { 16916 if (classProp && !isStaticExp(classProp.value)) { 16917 classProp.value = createCallExpression( 16918 context.helper(NORMALIZE_CLASS), 16919 [classProp.value] 16920 ); 16921 } 16922 if (styleProp && // the static style is compiled into an object, 16923 // so use `hasStyleBinding` to ensure that it is a dynamic style binding 16924 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist, 16925 // v-bind:style with static literal object 16926 styleProp.value.type === 17)) { 16927 styleProp.value = createCallExpression( 16928 context.helper(NORMALIZE_STYLE), 16929 [styleProp.value] 16930 ); 16931 } 16932 } else { 16933 propsExpression = createCallExpression( 16934 context.helper(NORMALIZE_PROPS), 16935 [propsExpression] 16936 ); 16937 } 16938 break; 16939 case 14: 16940 break; 16941 default: 16942 propsExpression = createCallExpression( 16943 context.helper(NORMALIZE_PROPS), 16944 [ 16945 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [ 16946 propsExpression 16947 ]) 16948 ] 16949 ); 16950 break; 16951 } 16952 } 16953 return { 16954 props: propsExpression, 16955 directives: runtimeDirectives, 16956 patchFlag, 16957 dynamicPropNames, 16958 shouldUseBlock 16959 }; 16960 } 16961 function dedupeProperties(properties) { 16962 const knownProps = /* @__PURE__ */ new Map(); 16963 const deduped = []; 16964 for (let i = 0; i < properties.length; i++) { 16965 const prop = properties[i]; 16966 if (prop.key.type === 8 || !prop.key.isStatic) { 16967 deduped.push(prop); 16968 continue; 16969 } 16970 const name = prop.key.content; 16971 const existing = knownProps.get(name); 16972 if (existing) { 16973 if (name === "style" || name === "class" || isOn(name)) { 16974 mergeAsArray(existing, prop); 16975 } 16976 } else { 16977 knownProps.set(name, prop); 16978 deduped.push(prop); 16979 } 16980 } 16981 return deduped; 16982 } 16983 function mergeAsArray(existing, incoming) { 16984 if (existing.value.type === 17) { 16985 existing.value.elements.push(incoming.value); 16986 } else { 16987 existing.value = createArrayExpression( 16988 [existing.value, incoming.value], 16989 existing.loc 16990 ); 16991 } 16992 } 16993 function buildDirectiveArgs(dir, context) { 16994 const dirArgs = []; 16995 const runtime = directiveImportMap.get(dir); 16996 if (runtime) { 16997 dirArgs.push(context.helperString(runtime)); 16998 } else { 16999 { 17000 context.helper(RESOLVE_DIRECTIVE); 17001 context.directives.add(dir.name); 17002 dirArgs.push(toValidAssetId(dir.name, `directive`)); 17003 } 17004 } 17005 const { loc } = dir; 17006 if (dir.exp) dirArgs.push(dir.exp); 17007 if (dir.arg) { 17008 if (!dir.exp) { 17009 dirArgs.push(`void 0`); 17010 } 17011 dirArgs.push(dir.arg); 17012 } 17013 if (Object.keys(dir.modifiers).length) { 17014 if (!dir.arg) { 17015 if (!dir.exp) { 17016 dirArgs.push(`void 0`); 17017 } 17018 dirArgs.push(`void 0`); 17019 } 17020 const trueExpression = createSimpleExpression(`true`, false, loc); 17021 dirArgs.push( 17022 createObjectExpression( 17023 dir.modifiers.map( 17024 (modifier) => createObjectProperty(modifier, trueExpression) 17025 ), 17026 loc 17027 ) 17028 ); 17029 } 17030 return createArrayExpression(dirArgs, dir.loc); 17031 } 17032 function stringifyDynamicPropNames(props) { 17033 let propsNamesString = `[`; 17034 for (let i = 0, l = props.length; i < l; i++) { 17035 propsNamesString += JSON.stringify(props[i]); 17036 if (i < l - 1) propsNamesString += ", "; 17037 } 17038 return propsNamesString + `]`; 17039 } 17040 function isComponentTag(tag) { 17041 return tag === "component" || tag === "Component"; 17042 } 17043 17044 const transformSlotOutlet = (node, context) => { 17045 if (isSlotOutlet(node)) { 17046 const { children, loc } = node; 17047 const { slotName, slotProps } = processSlotOutlet(node, context); 17048 const slotArgs = [ 17049 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`, 17050 slotName, 17051 "{}", 17052 "undefined", 17053 "true" 17054 ]; 17055 let expectedLen = 2; 17056 if (slotProps) { 17057 slotArgs[2] = slotProps; 17058 expectedLen = 3; 17059 } 17060 if (children.length) { 17061 slotArgs[3] = createFunctionExpression([], children, false, false, loc); 17062 expectedLen = 4; 17063 } 17064 if (context.scopeId && !context.slotted) { 17065 expectedLen = 5; 17066 } 17067 slotArgs.splice(expectedLen); 17068 node.codegenNode = createCallExpression( 17069 context.helper(RENDER_SLOT), 17070 slotArgs, 17071 loc 17072 ); 17073 } 17074 }; 17075 function processSlotOutlet(node, context) { 17076 let slotName = `"default"`; 17077 let slotProps = void 0; 17078 const nonNameProps = []; 17079 for (let i = 0; i < node.props.length; i++) { 17080 const p = node.props[i]; 17081 if (p.type === 6) { 17082 if (p.value) { 17083 if (p.name === "name") { 17084 slotName = JSON.stringify(p.value.content); 17085 } else { 17086 p.name = camelize(p.name); 17087 nonNameProps.push(p); 17088 } 17089 } 17090 } else { 17091 if (p.name === "bind" && isStaticArgOf(p.arg, "name")) { 17092 if (p.exp) { 17093 slotName = p.exp; 17094 } else if (p.arg && p.arg.type === 4) { 17095 const name = camelize(p.arg.content); 17096 slotName = p.exp = createSimpleExpression(name, false, p.arg.loc); 17097 } 17098 } else { 17099 if (p.name === "bind" && p.arg && isStaticExp(p.arg)) { 17100 p.arg.content = camelize(p.arg.content); 17101 } 17102 nonNameProps.push(p); 17103 } 17104 } 17105 } 17106 if (nonNameProps.length > 0) { 17107 const { props, directives } = buildProps( 17108 node, 17109 context, 17110 nonNameProps, 17111 false, 17112 false 17113 ); 17114 slotProps = props; 17115 if (directives.length) { 17116 context.onError( 17117 createCompilerError( 17118 36, 17119 directives[0].loc 17120 ) 17121 ); 17122 } 17123 } 17124 return { 17125 slotName, 17126 slotProps 17127 }; 17128 } 17129 17130 const transformOn$1 = (dir, node, context, augmentor) => { 17131 const { loc, modifiers, arg } = dir; 17132 if (!dir.exp && !modifiers.length) { 17133 context.onError(createCompilerError(35, loc)); 17134 } 17135 let eventName; 17136 if (arg.type === 4) { 17137 if (arg.isStatic) { 17138 let rawName = arg.content; 17139 if (rawName.startsWith("vnode")) { 17140 context.onError(createCompilerError(52, arg.loc)); 17141 } 17142 if (rawName.startsWith("vue:")) { 17143 rawName = `vnode-${rawName.slice(4)}`; 17144 } 17145 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? ( 17146 // for non-element and vnode lifecycle event listeners, auto convert 17147 // it to camelCase. See issue #2249 17148 toHandlerKey(camelize(rawName)) 17149 ) : ( 17150 // preserve case for plain element listeners that have uppercase 17151 // letters, as these may be custom elements' custom events 17152 `on:${rawName}` 17153 ); 17154 eventName = createSimpleExpression(eventString, true, arg.loc); 17155 } else { 17156 eventName = createCompoundExpression([ 17157 `${context.helperString(TO_HANDLER_KEY)}(`, 17158 arg, 17159 `)` 17160 ]); 17161 } 17162 } else { 17163 eventName = arg; 17164 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`); 17165 eventName.children.push(`)`); 17166 } 17167 let exp = dir.exp; 17168 if (exp && !exp.content.trim()) { 17169 exp = void 0; 17170 } 17171 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce; 17172 if (exp) { 17173 const isMemberExp = isMemberExpression(exp); 17174 const isInlineStatement = !(isMemberExp || isFnExpression(exp)); 17175 const hasMultipleStatements = exp.content.includes(`;`); 17176 { 17177 validateBrowserExpression( 17178 exp, 17179 context, 17180 false, 17181 hasMultipleStatements 17182 ); 17183 } 17184 if (isInlineStatement || shouldCache && isMemberExp) { 17185 exp = createCompoundExpression([ 17186 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`, 17187 exp, 17188 hasMultipleStatements ? `}` : `)` 17189 ]); 17190 } 17191 } 17192 let ret = { 17193 props: [ 17194 createObjectProperty( 17195 eventName, 17196 exp || createSimpleExpression(`() => {}`, false, loc) 17197 ) 17198 ] 17199 }; 17200 if (augmentor) { 17201 ret = augmentor(ret); 17202 } 17203 if (shouldCache) { 17204 ret.props[0].value = context.cache(ret.props[0].value); 17205 } 17206 ret.props.forEach((p) => p.key.isHandlerKey = true); 17207 return ret; 17208 }; 17209 17210 const transformBind = (dir, _node, context) => { 17211 const { modifiers, loc } = dir; 17212 const arg = dir.arg; 17213 let { exp } = dir; 17214 if (exp && exp.type === 4 && !exp.content.trim()) { 17215 { 17216 exp = void 0; 17217 } 17218 } 17219 if (arg.type !== 4) { 17220 arg.children.unshift(`(`); 17221 arg.children.push(`) || ""`); 17222 } else if (!arg.isStatic) { 17223 arg.content = arg.content ? `${arg.content} || ""` : `""`; 17224 } 17225 if (modifiers.some((mod) => mod.content === "camel")) { 17226 if (arg.type === 4) { 17227 if (arg.isStatic) { 17228 arg.content = camelize(arg.content); 17229 } else { 17230 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`; 17231 } 17232 } else { 17233 arg.children.unshift(`${context.helperString(CAMELIZE)}(`); 17234 arg.children.push(`)`); 17235 } 17236 } 17237 if (!context.inSSR) { 17238 if (modifiers.some((mod) => mod.content === "prop")) { 17239 injectPrefix(arg, "."); 17240 } 17241 if (modifiers.some((mod) => mod.content === "attr")) { 17242 injectPrefix(arg, "^"); 17243 } 17244 } 17245 return { 17246 props: [createObjectProperty(arg, exp)] 17247 }; 17248 }; 17249 const injectPrefix = (arg, prefix) => { 17250 if (arg.type === 4) { 17251 if (arg.isStatic) { 17252 arg.content = prefix + arg.content; 17253 } else { 17254 arg.content = `\`${prefix}\${${arg.content}}\``; 17255 } 17256 } else { 17257 arg.children.unshift(`'${prefix}' + (`); 17258 arg.children.push(`)`); 17259 } 17260 }; 17261 17262 const transformText = (node, context) => { 17263 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) { 17264 return () => { 17265 const children = node.children; 17266 let currentContainer = void 0; 17267 let hasText = false; 17268 for (let i = 0; i < children.length; i++) { 17269 const child = children[i]; 17270 if (isText$1(child)) { 17271 hasText = true; 17272 for (let j = i + 1; j < children.length; j++) { 17273 const next = children[j]; 17274 if (isText$1(next)) { 17275 if (!currentContainer) { 17276 currentContainer = children[i] = createCompoundExpression( 17277 [child], 17278 child.loc 17279 ); 17280 } 17281 currentContainer.children.push(` + `, next); 17282 children.splice(j, 1); 17283 j--; 17284 } else { 17285 currentContainer = void 0; 17286 break; 17287 } 17288 } 17289 } 17290 } 17291 if (!hasText || // if this is a plain element with a single text child, leave it 17292 // as-is since the runtime has dedicated fast path for this by directly 17293 // setting textContent of the element. 17294 // for component root it's always normalized anyway. 17295 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756 17296 // custom directives can potentially add DOM elements arbitrarily, 17297 // we need to avoid setting textContent of the element at runtime 17298 // to avoid accidentally overwriting the DOM elements added 17299 // by the user through custom directives. 17300 !node.props.find( 17301 (p) => p.type === 7 && !context.directiveTransforms[p.name] 17302 ) && // in compat mode, <template> tags with no special directives 17303 // will be rendered as a fragment so its children must be 17304 // converted into vnodes. 17305 true)) { 17306 return; 17307 } 17308 for (let i = 0; i < children.length; i++) { 17309 const child = children[i]; 17310 if (isText$1(child) || child.type === 8) { 17311 const callArgs = []; 17312 if (child.type !== 2 || child.content !== " ") { 17313 callArgs.push(child); 17314 } 17315 if (!context.ssr && getConstantType(child, context) === 0) { 17316 callArgs.push( 17317 1 + (` /* ${PatchFlagNames[1]} */` ) 17318 ); 17319 } 17320 children[i] = { 17321 type: 12, 17322 content: child, 17323 loc: child.loc, 17324 codegenNode: createCallExpression( 17325 context.helper(CREATE_TEXT), 17326 callArgs 17327 ) 17328 }; 17329 } 17330 } 17331 }; 17332 } 17333 }; 17334 17335 const seen$1 = /* @__PURE__ */ new WeakSet(); 17336 const transformOnce = (node, context) => { 17337 if (node.type === 1 && findDir(node, "once", true)) { 17338 if (seen$1.has(node) || context.inVOnce || context.inSSR) { 17339 return; 17340 } 17341 seen$1.add(node); 17342 context.inVOnce = true; 17343 context.helper(SET_BLOCK_TRACKING); 17344 return () => { 17345 context.inVOnce = false; 17346 const cur = context.currentNode; 17347 if (cur.codegenNode) { 17348 cur.codegenNode = context.cache( 17349 cur.codegenNode, 17350 true, 17351 true 17352 ); 17353 } 17354 }; 17355 } 17356 }; 17357 17358 const transformModel$1 = (dir, node, context) => { 17359 const { exp, arg } = dir; 17360 if (!exp) { 17361 context.onError( 17362 createCompilerError(41, dir.loc) 17363 ); 17364 return createTransformProps(); 17365 } 17366 const rawExp = exp.loc.source.trim(); 17367 const expString = exp.type === 4 ? exp.content : rawExp; 17368 const bindingType = context.bindingMetadata[rawExp]; 17369 if (bindingType === "props" || bindingType === "props-aliased") { 17370 context.onError(createCompilerError(44, exp.loc)); 17371 return createTransformProps(); 17372 } 17373 if (bindingType === "literal-const" || bindingType === "setup-const") { 17374 context.onError(createCompilerError(45, exp.loc)); 17375 return createTransformProps(); 17376 } 17377 if (!expString.trim() || !isMemberExpression(exp) && true) { 17378 context.onError( 17379 createCompilerError(42, exp.loc) 17380 ); 17381 return createTransformProps(); 17382 } 17383 const propName = arg ? arg : createSimpleExpression("modelValue", true); 17384 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`; 17385 let assignmentExp; 17386 const eventArg = context.isTS ? `($event: any)` : `$event`; 17387 { 17388 assignmentExp = createCompoundExpression([ 17389 `${eventArg} => ((`, 17390 exp, 17391 `) = $event)` 17392 ]); 17393 } 17394 const props = [ 17395 // modelValue: foo 17396 createObjectProperty(propName, dir.exp), 17397 // "onUpdate:modelValue": $event => (foo = $event) 17398 createObjectProperty(eventName, assignmentExp) 17399 ]; 17400 if (dir.modifiers.length && node.tagType === 1) { 17401 const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `); 17402 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`; 17403 props.push( 17404 createObjectProperty( 17405 modifiersKey, 17406 createSimpleExpression( 17407 `{ ${modifiers} }`, 17408 false, 17409 dir.loc, 17410 2 17411 ) 17412 ) 17413 ); 17414 } 17415 return createTransformProps(props); 17416 }; 17417 function createTransformProps(props = []) { 17418 return { props }; 17419 } 17420 17421 const seen = /* @__PURE__ */ new WeakSet(); 17422 const transformMemo = (node, context) => { 17423 if (node.type === 1) { 17424 const dir = findDir(node, "memo"); 17425 if (!dir || seen.has(node) || context.inSSR) { 17426 return; 17427 } 17428 seen.add(node); 17429 return () => { 17430 const codegenNode = node.codegenNode || context.currentNode.codegenNode; 17431 if (codegenNode && codegenNode.type === 13) { 17432 if (node.tagType !== 1) { 17433 convertToBlock(codegenNode, context); 17434 } 17435 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [ 17436 dir.exp, 17437 createFunctionExpression(void 0, codegenNode), 17438 `_cache`, 17439 String(context.cached.length) 17440 ]); 17441 context.cached.push(null); 17442 } 17443 }; 17444 } 17445 }; 17446 17447 const transformVBindShorthand = (node, context) => { 17448 if (node.type === 1) { 17449 for (const prop of node.props) { 17450 if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser 17451 prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) { 17452 const arg = prop.arg; 17453 if (arg.type !== 4 || !arg.isStatic) { 17454 context.onError( 17455 createCompilerError( 17456 53, 17457 arg.loc 17458 ) 17459 ); 17460 prop.exp = createSimpleExpression("", true, arg.loc); 17461 } else { 17462 const propName = camelize(arg.content); 17463 if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424 17464 propName[0] === "-") { 17465 prop.exp = createSimpleExpression(propName, false, arg.loc); 17466 } 17467 } 17468 } 17469 } 17470 } 17471 }; 17472 17473 function getBaseTransformPreset(prefixIdentifiers) { 17474 return [ 17475 [ 17476 transformVBindShorthand, 17477 transformOnce, 17478 transformIf, 17479 transformMemo, 17480 transformFor, 17481 ...[], 17482 ...[transformExpression] , 17483 transformSlotOutlet, 17484 transformElement, 17485 trackSlotScopes, 17486 transformText 17487 ], 17488 { 17489 on: transformOn$1, 17490 bind: transformBind, 17491 model: transformModel$1 17492 } 17493 ]; 17494 } 17495 function baseCompile(source, options = {}) { 17496 const onError = options.onError || defaultOnError; 17497 const isModuleMode = options.mode === "module"; 17498 { 17499 if (options.prefixIdentifiers === true) { 17500 onError(createCompilerError(48)); 17501 } else if (isModuleMode) { 17502 onError(createCompilerError(49)); 17503 } 17504 } 17505 const prefixIdentifiers = false; 17506 if (options.cacheHandlers) { 17507 onError(createCompilerError(50)); 17508 } 17509 if (options.scopeId && !isModuleMode) { 17510 onError(createCompilerError(51)); 17511 } 17512 const resolvedOptions = extend({}, options, { 17513 prefixIdentifiers 17514 }); 17515 const ast = isString(source) ? baseParse(source, resolvedOptions) : source; 17516 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(); 17517 transform( 17518 ast, 17519 extend({}, resolvedOptions, { 17520 nodeTransforms: [ 17521 ...nodeTransforms, 17522 ...options.nodeTransforms || [] 17523 // user transforms 17524 ], 17525 directiveTransforms: extend( 17526 {}, 17527 directiveTransforms, 17528 options.directiveTransforms || {} 17529 // user transforms 17530 ) 17531 }) 17532 ); 17533 return generate(ast, resolvedOptions); 17534 } 17535 17536 const noopDirectiveTransform = () => ({ props: [] }); 17537 17538 const V_MODEL_RADIO = /* @__PURE__ */ Symbol(`vModelRadio` ); 17539 const V_MODEL_CHECKBOX = /* @__PURE__ */ Symbol( 17540 `vModelCheckbox` 17541 ); 17542 const V_MODEL_TEXT = /* @__PURE__ */ Symbol(`vModelText` ); 17543 const V_MODEL_SELECT = /* @__PURE__ */ Symbol( 17544 `vModelSelect` 17545 ); 17546 const V_MODEL_DYNAMIC = /* @__PURE__ */ Symbol( 17547 `vModelDynamic` 17548 ); 17549 const V_ON_WITH_MODIFIERS = /* @__PURE__ */ Symbol( 17550 `vOnModifiersGuard` 17551 ); 17552 const V_ON_WITH_KEYS = /* @__PURE__ */ Symbol( 17553 `vOnKeysGuard` 17554 ); 17555 const V_SHOW = /* @__PURE__ */ Symbol(`vShow` ); 17556 const TRANSITION = /* @__PURE__ */ Symbol(`Transition` ); 17557 const TRANSITION_GROUP = /* @__PURE__ */ Symbol( 17558 `TransitionGroup` 17559 ); 17560 registerRuntimeHelpers({ 17561 [V_MODEL_RADIO]: `vModelRadio`, 17562 [V_MODEL_CHECKBOX]: `vModelCheckbox`, 17563 [V_MODEL_TEXT]: `vModelText`, 17564 [V_MODEL_SELECT]: `vModelSelect`, 17565 [V_MODEL_DYNAMIC]: `vModelDynamic`, 17566 [V_ON_WITH_MODIFIERS]: `withModifiers`, 17567 [V_ON_WITH_KEYS]: `withKeys`, 17568 [V_SHOW]: `vShow`, 17569 [TRANSITION]: `Transition`, 17570 [TRANSITION_GROUP]: `TransitionGroup` 17571 });
17572 17573 let decoder; 17574 function decodeHtmlBrowser(raw, asAttr = false) { 17575 if (!decoder) { 17576 decoder = document.createElement("div"); 17577 } 17578 if (asAttr) { 17579 decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`; 17580 return decoder.children[0].getAttribute("foo"); 17581 } else { 17582 decoder.innerHTML = raw; 17583 return decoder.textContent; 17584 } 17585 } 17586 17587 const parserOptions = { 17588 parseMode: "html", 17589 isVoidTag, 17590 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 17591 isPreTag: (tag) => tag === "pre", 17592 isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea", 17593 decodeEntities: decodeHtmlBrowser , 17594 isBuiltInComponent: (tag) => { 17595 if (tag === "Transition" || tag === "transition") { 17596 return TRANSITION; 17597 } else if (tag === "TransitionGroup" || tag === "transition-group") { 17598 return TRANSITION_GROUP; 17599 } 17600 }, 17601 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher 17602 getNamespace(tag, parent, rootNamespace) { 17603 let ns = parent ? parent.ns : rootNamespace; 17604 if (parent && ns === 2) { 17605 if (parent.tag === "annotation-xml") { 17606 if (tag === "svg") { 17607 return 1; 17608 } 17609 if (parent.props.some( 17610 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml") 17611 )) { 17612 ns = 0; 17613 } 17614 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") { 17615 ns = 0; 17616 } 17617 } else if (parent && ns === 1) { 17618 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") { 17619 ns = 0; 17620 } 17621 } 17622 if (ns === 0) { 17623 if (tag === "svg") { 17624 return 1; 17625 } 17626 if (tag === "math") { 17627 return 2; 17628 } 17629 } 17630 return ns; 17631 } 17632 }; 17633 17634 const transformStyle = (node) => { 17635 if (node.type === 1) { 17636 node.props.forEach((p, i) => { 17637 if (p.type === 6 && p.name === "style" && p.value) { 17638 node.props[i] = { 17639 type: 7, 17640 name: `bind`, 17641 arg: createSimpleExpression(`style`, true, p.loc), 17642 exp: parseInlineCSS(p.value.content, p.loc), 17643 modifiers: [], 17644 loc: p.loc 17645 }; 17646 } 17647 }); 17648 } 17649 }; 17650 const parseInlineCSS = (cssText, loc) => { 17651 const normalized = parseStringStyle(cssText); 17652 return createSimpleExpression( 17653 JSON.stringify(normalized), 17654 false, 17655 loc, 17656 3 17657 ); 17658 }; 17659 17660 function createDOMCompilerError(code, loc) { 17661 return createCompilerError( 17662 code, 17663 loc, 17664 DOMErrorMessages 17665 ); 17666 } 17667 const DOMErrorMessages = { 17668 [54]: `v-html is missing expression.`, 17669 [55]: `v-html will override element children.`, 17670 [56]: `v-text is missing expression.`, 17671 [57]: `v-text will override element children.`, 17672 [58]: `v-model can only be used on <input>, <textarea> and <select> elements.`, 17673 [59]: `v-model argument is not supported on plain elements.`, 17674 [60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`, 17675 [61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`, 17676 [62]: `v-show is missing expression.`, 17677 [63]: `<Transition> expects exactly one child element or component.`, 17678 [64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.` 17679 }; 17680 17681 const transformVHtml = (dir, node, context) => { 17682 const { exp, loc } = dir; 17683 if (!exp) { 17684 context.onError( 17685 createDOMCompilerError(54, loc) 17686 ); 17687 } 17688 if (node.children.length) { 17689 context.onError( 17690 createDOMCompilerError(55, loc) 17691 ); 17692 node.children.length = 0; 17693 } 17694 return { 17695 props: [ 17696 createObjectProperty( 17697 createSimpleExpression(`innerHTML`, true, loc), 17698 exp || createSimpleExpression("", true) 17699 ) 17700 ] 17701 }; 17702 }; 17703 17704 const transformVText = (dir, node, context) => { 17705 const { exp, loc } = dir; 17706 if (!exp) { 17707 context.onError( 17708 createDOMCompilerError(56, loc) 17709 ); 17710 } 17711 if (node.children.length) { 17712 context.onError( 17713 createDOMCompilerError(57, loc) 17714 ); 17715 node.children.length = 0; 17716 } 17717 return { 17718 props: [ 17719 createObjectProperty( 17720 createSimpleExpression(`textContent`, true), 17721 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression( 17722 context.helperString(TO_DISPLAY_STRING), 17723 [exp], 17724 loc 17725 ) : createSimpleExpression("", true) 17726 ) 17727 ] 17728 }; 17729 }; 17730 17731 const transformModel = (dir, node, context) => { 17732 const baseResult = transformModel$1(dir, node, context); 17733 if (!baseResult.props.length || node.tagType === 1) { 17734 return baseResult; 17735 } 17736 if (dir.arg) { 17737 context.onError( 17738 createDOMCompilerError( 17739 59, 17740 dir.arg.loc 17741 ) 17742 ); 17743 } 17744 function checkDuplicatedValue() { 17745 const value = findDir(node, "bind"); 17746 if (value && isStaticArgOf(value.arg, "value")) { 17747 context.onError( 17748 createDOMCompilerError( 17749 61, 17750 value.loc 17751 ) 17752 ); 17753 } 17754 } 17755 const { tag } = node;
vendor: 5,812 bytes, lines 17756-17915
17756 const isCustomElement = context.isCustomElement(tag); 17757 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) { 17758 let directiveToUse = V_MODEL_TEXT; 17759 let isInvalidType = false; 17760 if (tag === "input" || isCustomElement) { 17761 const type = findProp(node, `type`); 17762 if (type) { 17763 if (type.type === 7) { 17764 directiveToUse = V_MODEL_DYNAMIC; 17765 } else if (type.value) { 17766 switch (type.value.content) { 17767 case "radio": 17768 directiveToUse = V_MODEL_RADIO; 17769 break; 17770 case "checkbox": 17771 directiveToUse = V_MODEL_CHECKBOX; 17772 break; 17773 case "file": 17774 isInvalidType = true; 17775 context.onError( 17776 createDOMCompilerError( 17777 60, 17778 dir.loc 17779 ) 17780 ); 17781 break; 17782 default: 17783 checkDuplicatedValue(); 17784 break; 17785 } 17786 } 17787 } else if (hasDynamicKeyVBind(node)) { 17788 directiveToUse = V_MODEL_DYNAMIC; 17789 } else { 17790 checkDuplicatedValue(); 17791 } 17792 } else if (tag === "select") { 17793 directiveToUse = V_MODEL_SELECT; 17794 } else { 17795 checkDuplicatedValue(); 17796 } 17797 if (!isInvalidType) { 17798 baseResult.needRuntime = context.helper(directiveToUse); 17799 } 17800 } else { 17801 context.onError( 17802 createDOMCompilerError( 17803 58, 17804 dir.loc 17805 ) 17806 ); 17807 } 17808 baseResult.props = baseResult.props.filter( 17809 (p) => !(p.key.type === 4 && p.key.content === "modelValue") 17810 ); 17811 return baseResult; 17812 }; 17813 17814 const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`); 17815 const isNonKeyModifier = /* @__PURE__ */ makeMap( 17816 // event propagation management 17817 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle` 17818 ); 17819 const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right"); 17820 const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`); 17821 const resolveModifiers = (key, modifiers, context, loc) => { 17822 const keyModifiers = []; 17823 const nonKeyModifiers = []; 17824 const eventOptionModifiers = []; 17825 for (let i = 0; i < modifiers.length; i++) { 17826 const modifier = modifiers[i].content; 17827 if (isEventOptionModifier(modifier)) { 17828 eventOptionModifiers.push(modifier); 17829 } else { 17830 if (maybeKeyModifier(modifier)) { 17831 if (isStaticExp(key)) { 17832 if (isKeyboardEvent(key.content.toLowerCase())) { 17833 keyModifiers.push(modifier); 17834 } else { 17835 nonKeyModifiers.push(modifier); 17836 } 17837 } else { 17838 keyModifiers.push(modifier); 17839 nonKeyModifiers.push(modifier); 17840 } 17841 } else { 17842 if (isNonKeyModifier(modifier)) { 17843 nonKeyModifiers.push(modifier); 17844 } else { 17845 keyModifiers.push(modifier); 17846 } 17847 } 17848 } 17849 } 17850 return { 17851 keyModifiers, 17852 nonKeyModifiers, 17853 eventOptionModifiers 17854 }; 17855 }; 17856 const transformClick = (key, event) => { 17857 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick"; 17858 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([ 17859 `(`, 17860 key, 17861 `) === "onClick" ? "${event}" : (`, 17862 key, 17863 `)` 17864 ]) : key; 17865 }; 17866 const transformOn = (dir, node, context) => { 17867 return transformOn$1(dir, node, context, (baseResult) => { 17868 const { modifiers } = dir; 17869 if (!modifiers.length) return baseResult; 17870 let { key, value: handlerExp } = baseResult.props[0]; 17871 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc); 17872 if (nonKeyModifiers.includes("right")) { 17873 key = transformClick(key, `onContextmenu`); 17874 } 17875 if (nonKeyModifiers.includes("middle")) { 17876 key = transformClick(key, `onMouseup`); 17877 } 17878 if (nonKeyModifiers.length) { 17879 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [ 17880 handlerExp, 17881 JSON.stringify(nonKeyModifiers) 17882 ]); 17883 } 17884 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard 17885 (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) { 17886 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [ 17887 handlerExp, 17888 JSON.stringify(keyModifiers) 17889 ]); 17890 } 17891 if (eventOptionModifiers.length) { 17892 const modifierPostfix = eventOptionModifiers.map(capitalize).join(""); 17893 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]); 17894 } 17895 return { 17896 props: [createObjectProperty(key, handlerExp)] 17897 }; 17898 }); 17899 }; 17900 17901 const transformShow = (dir, node, context) => { 17902 const { exp, loc } = dir; 17903 if (!exp) { 17904 context.onError( 17905 createDOMCompilerError(62, loc) 17906 ); 17907 } 17908 return { 17909 props: [], 17910 needRuntime: context.helper(V_SHOW) 17911 }; 17912 }; 17913 17914 const transformTransition = (node, context) => { 17915 if (node.type === 1 && node.tagType === 1) {
vendor: 12,631 bytes, lines 17916-18303
17916 const component = context.isBuiltInComponent(node.tag); 17917 if (component === TRANSITION) { 17918 return () => { 17919 if (!node.children.length) { 17920 return; 17921 } 17922 if (hasMultipleChildren(node)) { 17923 context.onError( 17924 createDOMCompilerError( 17925 63, 17926 { 17927 start: node.children[0].loc.start, 17928 end: node.children[node.children.length - 1].loc.end, 17929 source: "" 17930 } 17931 ) 17932 ); 17933 } 17934 const child = node.children[0]; 17935 if (child.type === 1) { 17936 for (const p of child.props) { 17937 if (p.type === 7 && p.name === "show") { 17938 node.props.push({ 17939 type: 6, 17940 name: "persisted", 17941 nameLoc: node.loc, 17942 value: void 0, 17943 loc: node.loc 17944 }); 17945 } 17946 } 17947 } 17948 }; 17949 } 17950 } 17951 }; 17952 function hasMultipleChildren(node) { 17953 const children = node.children = node.children.filter( 17954 (c) => !isCommentOrWhitespace(c) 17955 ); 17956 const child = children[0]; 17957 return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren); 17958 } 17959 17960 const ignoreSideEffectTags = (node, context) => { 17961 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) { 17962 context.onError( 17963 createDOMCompilerError( 17964 64, 17965 node.loc 17966 ) 17967 ); 17968 context.removeNode(); 17969 } 17970 }; 17971 17972 function isValidHTMLNesting(parent, child) { 17973 if (parent === "template") { 17974 return true; 17975 } 17976 if (parent in onlyValidChildren) { 17977 return onlyValidChildren[parent].has(child); 17978 } 17979 if (child in onlyValidParents) { 17980 return onlyValidParents[child].has(parent); 17981 } 17982 if (parent in knownInvalidChildren) { 17983 if (knownInvalidChildren[parent].has(child)) return false; 17984 } 17985 if (child in knownInvalidParents) { 17986 if (knownInvalidParents[child].has(parent)) return false; 17987 } 17988 return true; 17989 } 17990 const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]); 17991 const emptySet = /* @__PURE__ */ new Set([]); 17992 const onlyValidChildren = { 17993 head: /* @__PURE__ */ new Set([ 17994 "base", 17995 "basefront", 17996 "bgsound", 17997 "link", 17998 "meta", 17999 "title", 18000 "noscript", 18001 "noframes", 18002 "style", 18003 "script", 18004 "template" 18005 ]), 18006 optgroup: /* @__PURE__ */ new Set(["option"]), 18007 select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]), 18008 // table 18009 table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]), 18010 tr: /* @__PURE__ */ new Set(["td", "th"]), 18011 colgroup: /* @__PURE__ */ new Set(["col"]), 18012 tbody: /* @__PURE__ */ new Set(["tr"]), 18013 thead: /* @__PURE__ */ new Set(["tr"]), 18014 tfoot: /* @__PURE__ */ new Set(["tr"]), 18015 // these elements can not have any children elements 18016 script: emptySet, 18017 iframe: emptySet, 18018 option: emptySet, 18019 textarea: emptySet, 18020 style: emptySet, 18021 title: emptySet 18022 }; 18023 const onlyValidParents = { 18024 // sections 18025 html: emptySet, 18026 body: /* @__PURE__ */ new Set(["html"]), 18027 head: /* @__PURE__ */ new Set(["html"]), 18028 // table 18029 td: /* @__PURE__ */ new Set(["tr"]), 18030 colgroup: /* @__PURE__ */ new Set(["table"]), 18031 caption: /* @__PURE__ */ new Set(["table"]), 18032 tbody: /* @__PURE__ */ new Set(["table"]), 18033 tfoot: /* @__PURE__ */ new Set(["table"]), 18034 col: /* @__PURE__ */ new Set(["colgroup"]), 18035 th: /* @__PURE__ */ new Set(["tr"]), 18036 thead: /* @__PURE__ */ new Set(["table"]), 18037 tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]), 18038 // data list 18039 dd: /* @__PURE__ */ new Set(["dl", "div"]), 18040 dt: /* @__PURE__ */ new Set(["dl", "div"]), 18041 // other 18042 figcaption: /* @__PURE__ */ new Set(["figure"]), 18043 // li: new Set(["ul", "ol"]), 18044 summary: /* @__PURE__ */ new Set(["details"]), 18045 area: /* @__PURE__ */ new Set(["map"]) 18046 }; 18047 const knownInvalidChildren = { 18048 p: /* @__PURE__ */ new Set([ 18049 "address", 18050 "article", 18051 "aside", 18052 "blockquote", 18053 "center", 18054 "details", 18055 "dialog", 18056 "dir", 18057 "div", 18058 "dl", 18059 "fieldset", 18060 "figure", 18061 "footer", 18062 "form", 18063 "h1", 18064 "h2", 18065 "h3", 18066 "h4", 18067 "h5", 18068 "h6", 18069 "header", 18070 "hgroup", 18071 "hr", 18072 "li", 18073 "main", 18074 "nav", 18075 "menu", 18076 "ol", 18077 "p", 18078 "pre", 18079 "section", 18080 "table", 18081 "ul" 18082 ]), 18083 svg: /* @__PURE__ */ new Set([ 18084 "b", 18085 "blockquote", 18086 "br", 18087 "code", 18088 "dd", 18089 "div", 18090 "dl", 18091 "dt", 18092 "em", 18093 "embed", 18094 "h1", 18095 "h2", 18096 "h3", 18097 "h4", 18098 "h5", 18099 "h6", 18100 "hr", 18101 "i", 18102 "img", 18103 "li", 18104 "menu", 18105 "meta", 18106 "ol", 18107 "p", 18108 "pre", 18109 "ruby", 18110 "s", 18111 "small", 18112 "span", 18113 "strong", 18114 "sub", 18115 "sup", 18116 "table", 18117 "u", 18118 "ul", 18119 "var" 18120 ]) 18121 }; 18122 const knownInvalidParents = { 18123 a: /* @__PURE__ */ new Set(["a"]), 18124 button: /* @__PURE__ */ new Set(["button"]), 18125 dd: /* @__PURE__ */ new Set(["dd", "dt"]), 18126 dt: /* @__PURE__ */ new Set(["dd", "dt"]), 18127 form: /* @__PURE__ */ new Set(["form"]), 18128 li: /* @__PURE__ */ new Set(["li"]), 18129 h1: headings, 18130 h2: headings, 18131 h3: headings, 18132 h4: headings, 18133 h5: headings, 18134 h6: headings 18135 }; 18136 18137 const validateHtmlNesting = (node, context) => { 18138 if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) { 18139 const error = new SyntaxError( 18140 `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.` 18141 ); 18142 error.loc = node.loc; 18143 context.onWarn(error); 18144 } 18145 }; 18146 18147 const DOMNodeTransforms = [ 18148 transformStyle, 18149 ...[transformTransition, validateHtmlNesting] 18150 ]; 18151 const DOMDirectiveTransforms = { 18152 cloak: noopDirectiveTransform, 18153 html: transformVHtml, 18154 text: transformVText, 18155 model: transformModel, 18156 // override compiler-core 18157 on: transformOn, 18158 // override compiler-core 18159 show: transformShow 18160 }; 18161 function compile(src, options = {}) { 18162 return baseCompile( 18163 src, 18164 extend({}, parserOptions, options, { 18165 nodeTransforms: [ 18166 // ignore <script> and <tag> 18167 // this is not put inside DOMNodeTransforms because that list is used 18168 // by compiler-ssr to generate vnode fallback branches 18169 ignoreSideEffectTags, 18170 ...DOMNodeTransforms, 18171 ...options.nodeTransforms || [] 18172 ], 18173 directiveTransforms: extend( 18174 {}, 18175 DOMDirectiveTransforms, 18176 options.directiveTransforms || {} 18177 ), 18178 transformHoist: null 18179 }) 18180 ); 18181 } 18182 18183 { 18184 initDev(); 18185 } 18186 const compileCache = /* @__PURE__ */ Object.create(null); 18187 function compileToFunction(template, options) { 18188 if (!isString(template)) { 18189 if (template.nodeType) { 18190 template = template.innerHTML; 18191 } else { 18192 warn(`invalid template option: `, template); 18193 return NOOP; 18194 } 18195 } 18196 const key = genCacheKey(template, options); 18197 const cached = compileCache[key]; 18198 if (cached) { 18199 return cached; 18200 } 18201 if (template[0] === "#") { 18202 const el = document.querySelector(template); 18203 if (!el) { 18204 warn(`Template element not found or is empty: ${template}`); 18205 } 18206 template = el ? el.innerHTML : ``; 18207 } 18208 const opts = extend( 18209 { 18210 hoistStatic: true, 18211 onError: onError , 18212 onWarn: (e) => onError(e, true) 18213 }, 18214 options 18215 ); 18216 if (!opts.isCustomElement && typeof customElements !== "undefined") { 18217 opts.isCustomElement = (tag) => !!customElements.get(tag); 18218 } 18219 const { code } = compile(template, opts); 18220 function onError(err, asWarning = false) { 18221 const message = asWarning ? err.message : `Template compilation error: ${err.message}`; 18222 const codeFrame = err.loc && generateCodeFrame( 18223 template, 18224 err.loc.start.offset, 18225 err.loc.end.offset 18226 ); 18227 warn(codeFrame ? `${message} 18228 ${codeFrame}` : message); 18229 } 18230 const render = new Function(code)() ; 18231 render._rc = true; 18232 return compileCache[key] = render; 18233 } 18234 registerRuntimeCompiler(compileToFunction); 18235 18236 exports.BaseTransition = BaseTransition; 18237 exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators; 18238 exports.Comment = Comment; 18239 exports.DeprecationTypes = DeprecationTypes; 18240 exports.EffectScope = EffectScope; 18241 exports.ErrorCodes = ErrorCodes; 18242 exports.ErrorTypeStrings = ErrorTypeStrings; 18243 exports.Fragment = Fragment; 18244 exports.KeepAlive = KeepAlive; 18245 exports.ReactiveEffect = ReactiveEffect; 18246 exports.Static = Static; 18247 exports.Suspense = Suspense; 18248 exports.Teleport = Teleport; 18249 exports.Text = Text; 18250 exports.TrackOpTypes = TrackOpTypes; 18251 exports.Transition = Transition; 18252 exports.TransitionGroup = TransitionGroup; 18253 exports.TriggerOpTypes = TriggerOpTypes; 18254 exports.VueElement = VueElement; 18255 exports.assertNumber = assertNumber; 18256 exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling; 18257 exports.callWithErrorHandling = callWithErrorHandling; 18258 exports.camelize = camelize; 18259 exports.capitalize = capitalize; 18260 exports.cloneVNode = cloneVNode; 18261 exports.compatUtils = compatUtils; 18262 exports.compile = compileToFunction; 18263 exports.computed = computed; 18264 exports.createApp = createApp; 18265 exports.createBlock = createBlock; 18266 exports.createCommentVNode = createCommentVNode; 18267 exports.createElementBlock = createElementBlock; 18268 exports.createElementVNode = createBaseVNode; 18269 exports.createHydrationRenderer = createHydrationRenderer; 18270 exports.createPropsRestProxy = createPropsRestProxy; 18271 exports.createRenderer = createRenderer; 18272 exports.createSSRApp = createSSRApp; 18273 exports.createSlots = createSlots; 18274 exports.createStaticVNode = createStaticVNode; 18275 exports.createTextVNode = createTextVNode; 18276 exports.createVNode = createVNode; 18277 exports.customRef = customRef; 18278 exports.defineAsyncComponent = defineAsyncComponent; 18279 exports.defineComponent = defineComponent; 18280 exports.defineCustomElement = defineCustomElement; 18281 exports.defineEmits = defineEmits; 18282 exports.defineExpose = defineExpose; 18283 exports.defineModel = defineModel; 18284 exports.defineOptions = defineOptions; 18285 exports.defineProps = defineProps; 18286 exports.defineSSRCustomElement = defineSSRCustomElement; 18287 exports.defineSlots = defineSlots; 18288 exports.devtools = devtools; 18289 exports.effect = effect; 18290 exports.effectScope = effectScope; 18291 exports.getCurrentInstance = getCurrentInstance; 18292 exports.getCurrentScope = getCurrentScope; 18293 exports.getCurrentWatcher = getCurrentWatcher; 18294 exports.getTransitionRawChildren = getTransitionRawChildren; 18295 exports.guardReactiveProps = guardReactiveProps; 18296 exports.h = h; 18297 exports.handleError = handleError; 18298 exports.hasInjectionContext = hasInjectionContext; 18299 exports.hydrate = hydrate; 18300 exports.hydrateOnIdle = hydrateOnIdle; 18301 exports.hydrateOnInteraction = hydrateOnInteraction; 18302 exports.hydrateOnMediaQuery = hydrateOnMediaQuery; 18303 exports.hydrateOnVisible = hydrateOnVisible;
18304 exports.initCustomFormatter = initCustomFormatter; 18305 exports.initDirectivesForSSR = initDirectivesForSSR; 18306 exports.inject = inject; 18307 exports.isMemoSame = isMemoSame; 18308 exports.isProxy = isProxy; 18309 exports.isReactive = isReactive; 18310 exports.isReadonly = isReadonly; 18311 exports.isRef = isRef; 18312 exports.isRuntimeOnly = isRuntimeOnly; 18313 exports.isShallow = isShallow; 18314 exports.isVNode = isVNode; 18315 exports.markRaw = markRaw; 18316 exports.mergeDefaults = mergeDefaults; 18317 exports.mergeModels = mergeModels; 18318 exports.mergeProps = mergeProps; 18319 exports.nextTick = nextTick; 18320 exports.nodeOps = nodeOps; 18321 exports.normalizeClass = normalizeClass; 18322 exports.normalizeProps = normalizeProps; 18323 exports.normalizeStyle = normalizeStyle; 18324 exports.onActivated = onActivated; 18325 exports.onBeforeMount = onBeforeMount; 18326 exports.onBeforeUnmount = onBeforeUnmount; 18327 exports.onBeforeUpdate = onBeforeUpdate; 18328 exports.onDeactivated = onDeactivated; 18329 exports.onErrorCaptured = onErrorCaptured; 18330 exports.onMounted = onMounted; 18331 exports.onRenderTracked = onRenderTracked; 18332 exports.onRenderTriggered = onRenderTriggered; 18333 exports.onScopeDispose = onScopeDispose; 18334 exports.onServerPrefetch = onServerPrefetch; 18335 exports.onUnmounted = onUnmounted; 18336 exports.onUpdated = onUpdated; 18337 exports.onWatcherCleanup = onWatcherCleanup; 18338 exports.openBlock = openBlock; 18339 exports.patchProp = patchProp; 18340 exports.popScopeId = popScopeId; 18341 exports.provide = provide; 18342 exports.proxyRefs = proxyRefs; 18343 exports.pushScopeId = pushScopeId; 18344 exports.queuePostFlushCb = queuePostFlushCb; 18345 exports.reactive = reactive; 18346 exports.readonly = readonly; 18347 exports.ref = ref; 18348 exports.registerRuntimeCompiler = registerRuntimeCompiler; 18349 exports.render = render; 18350 exports.renderList = renderList; 18351 exports.renderSlot = renderSlot; 18352 exports.resolveComponent = resolveComponent; 18353 exports.resolveDirective = resolveDirective; 18354 exports.resolveDynamicComponent = resolveDynamicComponent; 18355 exports.resolveFilter = resolveFilter; 18356 exports.resolveTransitionHooks = resolveTransitionHooks; 18357 exports.setBlockTracking = setBlockTracking; 18358 exports.setDevtoolsHook = setDevtoolsHook; 18359 exports.setTransitionHooks = setTransitionHooks; 18360 exports.shallowReactive = shallowReactive; 18361 exports.shallowReadonly = shallowReadonly; 18362 exports.shallowRef = shallowRef; 18363 exports.ssrContextKey = ssrContextKey; 18364 exports.ssrUtils = ssrUtils; 18365 exports.stop = stop; 18366 exports.toDisplayString = toDisplayString; 18367 exports.toHandlerKey = toHandlerKey; 18368 exports.toHandlers = toHandlers; 18369 exports.toRaw = toRaw; 18370 exports.toRef = toRef; 18371 exports.toRefs = toRefs; 18372 exports.toValue = toValue; 18373 exports.transformVNodeArgs = transformVNodeArgs; 18374 exports.triggerRef = triggerRef; 18375 exports.unref = unref; 18376 exports.useAttrs = useAttrs; 18377 exports.useCssModule = useCssModule; 18378 exports.useCssVars = useCssVars; 18379 exports.useHost = useHost; 18380 exports.useId = useId; 18381 exports.useModel = useModel; 18382 exports.useSSRContext = useSSRContext; 18383 exports.useShadowRoot = useShadowRoot; 18384 exports.useSlots = useSlots; 18385 exports.useTemplateRef = useTemplateRef; 18386 exports.useTransitionState = useTransitionState; 18387 exports.vModelCheckbox = vModelCheckbox; 18388 exports.vModelDynamic = vModelDynamic; 18389 exports.vModelRadio = vModelRadio; 18390 exports.vModelSelect = vModelSelect; 18391 exports.vModelText = vModelText; 18392 exports.vShow = vShow; 18393 exports.version = version; 18394 exports.warn = warn; 18395 exports.watch = watch; 18396 exports.watchEffect = watchEffect; 18397 exports.watchPostEffect = watchPostEffect; 18398 exports.watchSyncEffect = watchSyncEffect; 18399 exports.withAsyncContext = withAsyncContext; 18400 exports.withCtx = withCtx; 18401 exports.withDefaults = withDefaults; 18402 exports.withDirectives = withDirectives; 18403 exports.withKeys = withKeys; 18404 exports.withMemo = withMemo; 18405 exports.withModifiers = withModifiers; 18406 exports.withScopeId = withScopeId; 18407 18408 return exports; 18409 18410 })({}); 18411
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.