vendor: 4,907 bytes, lines 1-141
1/** 2* vue v3.5.21 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,451 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: 26,394 bytes, lines 282-1241
282-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` 283 ); 284 function isRenderableAttrValue(value) { 285 if (value == null) { 286 return false; 287 } 288 const type = typeof value; 289 return type === "string" || type === "number" || type === "boolean"; 290 } 291 292 const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g; 293 function getEscapedCssVarName(key, doubleEscape) { 294 return key.replace( 295 cssVarNameEscapeSymbolsRE, 296 (s) => `\\${s}` 297 ); 298 } 299 300 function looseCompareArrays(a, b) { 301 if (a.length !== b.length) return false; 302 let equal = true; 303 for (let i = 0; equal && i < a.length; i++) { 304 equal = looseEqual(a[i], b[i]); 305 } 306 return equal; 307 } 308 function looseEqual(a, b) { 309 if (a === b) return true; 310 let aValidType = isDate(a); 311 let bValidType = isDate(b); 312 if (aValidType || bValidType) { 313 return aValidType && bValidType ? a.getTime() === b.getTime() : false; 314 } 315 aValidType = isSymbol(a); 316 bValidType = isSymbol(b); 317 if (aValidType || bValidType) { 318 return a === b; 319 } 320 aValidType = isArray(a); 321 bValidType = isArray(b); 322 if (aValidType || bValidType) { 323 return aValidType && bValidType ? looseCompareArrays(a, b) : false; 324 } 325 aValidType = isObject(a); 326 bValidType = isObject(b); 327 if (aValidType || bValidType) { 328 if (!aValidType || !bValidType) { 329 return false; 330 } 331 const aKeysCount = Object.keys(a).length; 332 const bKeysCount = Object.keys(b).length; 333 if (aKeysCount !== bKeysCount) { 334 return false; 335 } 336 for (const key in a) { 337 const aHasKey = a.hasOwnProperty(key); 338 const bHasKey = b.hasOwnProperty(key); 339 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { 340 return false; 341 } 342 } 343 } 344 return String(a) === String(b); 345 } 346 function looseIndexOf(arr, val) { 347 return arr.findIndex((item) => looseEqual(item, val)); 348 } 349 350 const isRef$1 = (val) => { 351 return !!(val && val["__v_isRef"] === true); 352 }; 353 const toDisplayString = (val) => { 354 return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); 355 }; 356 const replacer = (_key, val) => { 357 if (isRef$1(val)) { 358 return replacer(_key, val.value); 359 } else if (isMap(val)) { 360 return { 361 [`Map(${val.size})`]: [...val.entries()].reduce( 362 (entries, [key, val2], i) => { 363 entries[stringifySymbol(key, i) + " =>"] = val2; 364 return entries; 365 }, 366 {} 367 ) 368 }; 369 } else if (isSet(val)) { 370 return { 371 [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) 372 }; 373 } else if (isSymbol(val)) { 374 return stringifySymbol(val); 375 } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { 376 return String(val); 377 } 378 return val; 379 }; 380 const stringifySymbol = (v, i = "") => { 381 var _a; 382 return ( 383 // Symbol.description in es2019+ so we need to cast here to pass 384 // the lib: es2016 check 385 isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v 386 ); 387 }; 388 389 function normalizeCssVarValue(value) { 390 if (value == null) { 391 return "initial"; 392 } 393 if (typeof value === "string") { 394 return value === "" ? " " : value; 395 } 396 if (typeof value !== "number" || !Number.isFinite(value)) { 397 { 398 console.warn( 399 "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", 400 value 401 ); 402 } 403 } 404 return String(value); 405 } 406 407 function warn$2(msg, ...args) { 408 console.warn(`[Vue warn] ${msg}`, ...args); 409 } 410 411 let activeEffectScope; 412 class EffectScope { 413 constructor(detached = false) { 414 this.detached = detached; 415 /** 416 * @internal 417 */ 418 this._active = true; 419 /** 420 * @internal track `on` calls, allow `on` call multiple times 421 */ 422 this._on = 0; 423 /** 424 * @internal 425 */ 426 this.effects = []; 427 /** 428 * @internal 429 */ 430 this.cleanups = []; 431 this._isPaused = false; 432 this.parent = activeEffectScope; 433 if (!detached && activeEffectScope) { 434 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( 435 this 436 ) - 1; 437 } 438 } 439 get active() { 440 return this._active; 441 } 442 pause() { 443 if (this._active) { 444 this._isPaused = true; 445 let i, l; 446 if (this.scopes) { 447 for (i = 0, l = this.scopes.length; i < l; i++) { 448 this.scopes[i].pause(); 449 } 450 } 451 for (i = 0, l = this.effects.length; i < l; i++) { 452 this.effects[i].pause(); 453 } 454 } 455 } 456 /** 457 * Resumes the effect scope, including all child scopes and effects. 458 */ 459 resume() { 460 if (this._active) { 461 if (this._isPaused) { 462 this._isPaused = false; 463 let i, l; 464 if (this.scopes) { 465 for (i = 0, l = this.scopes.length; i < l; i++) { 466 this.scopes[i].resume(); 467 } 468 } 469 for (i = 0, l = this.effects.length; i < l; i++) { 470 this.effects[i].resume(); 471 } 472 } 473 } 474 } 475 run(fn) { 476 if (this._active) { 477 const currentEffectScope = activeEffectScope; 478 try { 479 activeEffectScope = this; 480 return fn(); 481 } finally { 482 activeEffectScope = currentEffectScope; 483 } 484 } else { 485 warn$2(`cannot run an inactive effect scope.`); 486 } 487 } 488 /** 489 * This should only be called on non-detached scopes 490 * @internal 491 */ 492 on() { 493 if (++this._on === 1) { 494 this.prevScope = activeEffectScope; 495 activeEffectScope = this; 496 } 497 } 498 /** 499 * This should only be called on non-detached scopes 500 * @internal 501 */ 502 off() { 503 if (this._on > 0 && --this._on === 0) { 504 activeEffectScope = this.prevScope; 505 this.prevScope = void 0; 506 } 507 } 508 stop(fromParent) { 509 if (this._active) { 510 this._active = false; 511 let i, l; 512 for (i = 0, l = this.effects.length; i < l; i++) { 513 this.effects[i].stop(); 514 } 515 this.effects.length = 0; 516 for (i = 0, l = this.cleanups.length; i < l; i++) { 517 this.cleanups[i](); 518 } 519 this.cleanups.length = 0; 520 if (this.scopes) { 521 for (i = 0, l = this.scopes.length; i < l; i++) { 522 this.scopes[i].stop(true); 523 } 524 this.scopes.length = 0; 525 } 526 if (!this.detached && this.parent && !fromParent) { 527 const last = this.parent.scopes.pop(); 528 if (last && last !== this) { 529 this.parent.scopes[this.index] = last; 530 last.index = this.index; 531 } 532 } 533 this.parent = void 0; 534 } 535 } 536 } 537 function effectScope(detached) { 538 return new EffectScope(detached); 539 } 540 function getCurrentScope() { 541 return activeEffectScope; 542 } 543 function onScopeDispose(fn, failSilently = false) { 544 if (activeEffectScope) { 545 activeEffectScope.cleanups.push(fn); 546 } else if (!failSilently) { 547 warn$2( 548 `onScopeDispose() is called when there is no active effect scope to be associated with.` 549 ); 550 } 551 } 552 553 let activeSub; 554 const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); 555 class ReactiveEffect { 556 constructor(fn) { 557 this.fn = fn; 558 /** 559 * @internal 560 */ 561 this.deps = void 0; 562 /** 563 * @internal 564 */ 565 this.depsTail = void 0; 566 /** 567 * @internal 568 */ 569 this.flags = 1 | 4; 570 /** 571 * @internal 572 */ 573 this.next = void 0; 574 /** 575 * @internal 576 */ 577 this.cleanup = void 0; 578 this.scheduler = void 0; 579 if (activeEffectScope && activeEffectScope.active) { 580 activeEffectScope.effects.push(this); 581 } 582 } 583 pause() { 584 this.flags |= 64; 585 } 586 resume() { 587 if (this.flags & 64) { 588 this.flags &= -65; 589 if (pausedQueueEffects.has(this)) { 590 pausedQueueEffects.delete(this); 591 this.trigger(); 592 } 593 } 594 } 595 /** 596 * @internal 597 */ 598 notify() { 599 if (this.flags & 2 && !(this.flags & 32)) { 600 return; 601 } 602 if (!(this.flags & 8)) { 603 batch(this); 604 } 605 } 606 run() { 607 if (!(this.flags & 1)) { 608 return this.fn(); 609 } 610 this.flags |= 2; 611 cleanupEffect(this); 612 prepareDeps(this); 613 const prevEffect = activeSub; 614 const prevShouldTrack = shouldTrack; 615 activeSub = this; 616 shouldTrack = true; 617 try { 618 return this.fn(); 619 } finally { 620 if (activeSub !== this) { 621 warn$2( 622 "Active effect was not restored correctly - this is likely a Vue internal bug." 623 ); 624 } 625 cleanupDeps(this); 626 activeSub = prevEffect; 627 shouldTrack = prevShouldTrack; 628 this.flags &= -3; 629 } 630 } 631 stop() { 632 if (this.flags & 1) { 633 for (let link = this.deps; link; link = link.nextDep) { 634 removeSub(link); 635 } 636 this.deps = this.depsTail = void 0; 637 cleanupEffect(this); 638 this.onStop && this.onStop(); 639 this.flags &= -2; 640 } 641 } 642 trigger() { 643 if (this.flags & 64) { 644 pausedQueueEffects.add(this); 645 } else if (this.scheduler) { 646 this.scheduler(); 647 } else { 648 this.runIfDirty(); 649 } 650 } 651 /** 652 * @internal 653 */ 654 runIfDirty() { 655 if (isDirty(this)) { 656 this.run(); 657 } 658 } 659 get dirty() { 660 return isDirty(this); 661 } 662 } 663 let batchDepth = 0; 664 let batchedSub; 665 let batchedComputed; 666 function batch(sub, isComputed = false) { 667 sub.flags |= 8; 668 if (isComputed) { 669 sub.next = batchedComputed; 670 batchedComputed = sub; 671 return; 672 } 673 sub.next = batchedSub; 674 batchedSub = sub; 675 } 676 function startBatch() { 677 batchDepth++; 678 } 679 function endBatch() { 680 if (--batchDepth > 0) { 681 return; 682 } 683 if (batchedComputed) { 684 let e = batchedComputed; 685 batchedComputed = void 0; 686 while (e) { 687 const next = e.next; 688 e.next = void 0; 689 e.flags &= -9; 690 e = next; 691 } 692 } 693 let error; 694 while (batchedSub) { 695 let e = batchedSub; 696 batchedSub = void 0; 697 while (e) { 698 const next = e.next; 699 e.next = void 0; 700 e.flags &= -9; 701 if (e.flags & 1) { 702 try { 703 ; 704 e.trigger(); 705 } catch (err) { 706 if (!error) error = err; 707 } 708 } 709 e = next; 710 } 711 } 712 if (error) throw error; 713 } 714 function prepareDeps(sub) { 715 for (let link = sub.deps; link; link = link.nextDep) { 716 link.version = -1; 717 link.prevActiveLink = link.dep.activeLink; 718 link.dep.activeLink = link; 719 } 720 } 721 function cleanupDeps(sub) { 722 let head; 723 let tail = sub.depsTail; 724 let link = tail; 725 while (link) { 726 const prev = link.prevDep; 727 if (link.version === -1) { 728 if (link === tail) tail = prev; 729 removeSub(link); 730 removeDep(link); 731 } else { 732 head = link; 733 } 734 link.dep.activeLink = link.prevActiveLink; 735 link.prevActiveLink = void 0; 736 link = prev; 737 } 738 sub.deps = head; 739 sub.depsTail = tail; 740 } 741 function isDirty(sub) { 742 for (let link = sub.deps; link; link = link.nextDep) { 743 if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) { 744 return true; 745 } 746 } 747 if (sub._dirty) { 748 return true; 749 } 750 return false; 751 } 752 function refreshComputed(computed) { 753 if (computed.flags & 4 && !(computed.flags & 16)) { 754 return; 755 } 756 computed.flags &= -17; 757 if (computed.globalVersion === globalVersion) { 758 return; 759 } 760 computed.globalVersion = globalVersion; 761 if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) { 762 return; 763 } 764 computed.flags |= 2; 765 const dep = computed.dep; 766 const prevSub = activeSub; 767 const prevShouldTrack = shouldTrack; 768 activeSub = computed; 769 shouldTrack = true; 770 try { 771 prepareDeps(computed); 772 const value = computed.fn(computed._value); 773 if (dep.version === 0 || hasChanged(value, computed._value)) { 774 computed.flags |= 128; 775 computed._value = value; 776 dep.version++; 777 } 778 } catch (err) { 779 dep.version++; 780 throw err; 781 } finally { 782 activeSub = prevSub; 783 shouldTrack = prevShouldTrack; 784 cleanupDeps(computed); 785 computed.flags &= -3; 786 } 787 } 788 function removeSub(link, soft = false) { 789 const { dep, prevSub, nextSub } = link; 790 if (prevSub) { 791 prevSub.nextSub = nextSub; 792 link.prevSub = void 0; 793 } 794 if (nextSub) { 795 nextSub.prevSub = prevSub; 796 link.nextSub = void 0; 797 } 798 if (dep.subsHead === link) { 799 dep.subsHead = nextSub; 800 } 801 if (dep.subs === link) { 802 dep.subs = prevSub; 803 if (!prevSub && dep.computed) { 804 dep.computed.flags &= -5; 805 for (let l = dep.computed.deps; l; l = l.nextDep) { 806 removeSub(l, true); 807 } 808 } 809 } 810 if (!soft && !--dep.sc && dep.map) { 811 dep.map.delete(dep.key); 812 } 813 } 814 function removeDep(link) { 815 const { prevDep, nextDep } = link; 816 if (prevDep) { 817 prevDep.nextDep = nextDep; 818 link.prevDep = void 0; 819 } 820 if (nextDep) { 821 nextDep.prevDep = prevDep; 822 link.nextDep = void 0; 823 } 824 } 825 function effect(fn, options) { 826 if (fn.effect instanceof ReactiveEffect) { 827 fn = fn.effect.fn; 828 } 829 const e = new ReactiveEffect(fn); 830 if (options) { 831 extend(e, options); 832 } 833 try { 834 e.run(); 835 } catch (err) { 836 e.stop(); 837 throw err; 838 } 839 const runner = e.run.bind(e); 840 runner.effect = e; 841 return runner; 842 } 843 function stop(runner) { 844 runner.effect.stop(); 845 } 846 let shouldTrack = true; 847 const trackStack = []; 848 function pauseTracking() { 849 trackStack.push(shouldTrack); 850 shouldTrack = false; 851 } 852 function resetTracking() { 853 const last = trackStack.pop(); 854 shouldTrack = last === void 0 ? true : last; 855 } 856 function cleanupEffect(e) { 857 const { cleanup } = e; 858 e.cleanup = void 0; 859 if (cleanup) { 860 const prevSub = activeSub; 861 activeSub = void 0; 862 try { 863 cleanup(); 864 } finally { 865 activeSub = prevSub; 866 } 867 } 868 } 869 870 let globalVersion = 0; 871 class Link { 872 constructor(sub, dep) { 873 this.sub = sub; 874 this.dep = dep; 875 this.version = dep.version; 876 this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0; 877 } 878 } 879 class Dep { 880 // TODO isolatedDeclarations "__v_skip" 881 constructor(computed) { 882 this.computed = computed; 883 this.version = 0; 884 /** 885 * Link between this dep and the current active effect 886 */ 887 this.activeLink = void 0; 888 /** 889 * Doubly linked list representing the subscribing effects (tail) 890 */ 891 this.subs = void 0; 892 /** 893 * For object property deps cleanup 894 */ 895 this.map = void 0; 896 this.key = void 0; 897 /** 898 * Subscriber counter 899 */ 900 this.sc = 0; 901 /** 902 * @internal 903 */ 904 this.__v_skip = true; 905 { 906 this.subsHead = void 0; 907 } 908 } 909 track(debugInfo) { 910 if (!activeSub || !shouldTrack || activeSub === this.computed) { 911 return; 912 } 913 let link = this.activeLink; 914 if (link === void 0 || link.sub !== activeSub) { 915 link = this.activeLink = new Link(activeSub, this); 916 if (!activeSub.deps) { 917 activeSub.deps = activeSub.depsTail = link; 918 } else { 919 link.prevDep = activeSub.depsTail; 920 activeSub.depsTail.nextDep = link; 921 activeSub.depsTail = link; 922 } 923 addSub(link); 924 } else if (link.version === -1) { 925 link.version = this.version; 926 if (link.nextDep) { 927 const next = link.nextDep; 928 next.prevDep = link.prevDep; 929 if (link.prevDep) { 930 link.prevDep.nextDep = next; 931 } 932 link.prevDep = activeSub.depsTail; 933 link.nextDep = void 0; 934 activeSub.depsTail.nextDep = link; 935 activeSub.depsTail = link; 936 if (activeSub.deps === link) { 937 activeSub.deps = next; 938 } 939 } 940 } 941 if (activeSub.onTrack) { 942 activeSub.onTrack( 943 extend( 944 { 945 effect: activeSub 946 }, 947 debugInfo 948 ) 949 ); 950 } 951 return link; 952 } 953 trigger(debugInfo) { 954 this.version++; 955 globalVersion++; 956 this.notify(debugInfo); 957 } 958 notify(debugInfo) { 959 startBatch(); 960 try { 961 if (true) { 962 for (let head = this.subsHead; head; head = head.nextSub) { 963 if (head.sub.onTrigger && !(head.sub.flags & 8)) { 964 head.sub.onTrigger( 965 extend( 966 { 967 effect: head.sub 968 }, 969 debugInfo 970 ) 971 ); 972 } 973 } 974 } 975 for (let link = this.subs; link; link = link.prevSub) { 976 if (link.sub.notify()) { 977 ; 978 link.sub.dep.notify(); 979 } 980 } 981 } finally { 982 endBatch(); 983 } 984 } 985 } 986 function addSub(link) { 987 link.dep.sc++; 988 if (link.sub.flags & 4) { 989 const computed = link.dep.computed; 990 if (computed && !link.dep.subs) { 991 computed.flags |= 4 | 16; 992 for (let l = computed.deps; l; l = l.nextDep) { 993 addSub(l); 994 } 995 } 996 const currentTail = link.dep.subs; 997 if (currentTail !== link) { 998 link.prevSub = currentTail; 999 if (currentTail) currentTail.nextSub = link; 1000 } 1001 if (link.dep.subsHead === void 0) { 1002 link.dep.subsHead = link; 1003 } 1004 link.dep.subs = link; 1005 } 1006 } 1007 const targetMap = /* @__PURE__ */ new WeakMap(); 1008 const ITERATE_KEY = Symbol( 1009 "Object iterate" 1010 ); 1011 const MAP_KEY_ITERATE_KEY = Symbol( 1012 "Map keys iterate" 1013 ); 1014 const ARRAY_ITERATE_KEY = Symbol( 1015 "Array iterate" 1016 ); 1017 function track(target, type, key) { 1018 if (shouldTrack && activeSub) { 1019 let depsMap = targetMap.get(target); 1020 if (!depsMap) { 1021 targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); 1022 } 1023 let dep = depsMap.get(key); 1024 if (!dep) { 1025 depsMap.set(key, dep = new Dep()); 1026 dep.map = depsMap; 1027 dep.key = key; 1028 } 1029 { 1030 dep.track({ 1031 target, 1032 type, 1033 key 1034 }); 1035 } 1036 } 1037 } 1038 function trigger(target, type, key, newValue, oldValue, oldTarget) { 1039 const depsMap = targetMap.get(target); 1040 if (!depsMap) { 1041 globalVersion++; 1042 return; 1043 } 1044 const run = (dep) => { 1045 if (dep) { 1046 { 1047 dep.trigger({ 1048 target, 1049 type, 1050 key, 1051 newValue, 1052 oldValue, 1053 oldTarget 1054 }); 1055 } 1056 } 1057 }; 1058 startBatch(); 1059 if (type === "clear") { 1060 depsMap.forEach(run); 1061 } else { 1062 const targetIsArray = isArray(target); 1063 const isArrayIndex = targetIsArray && isIntegerKey(key); 1064 if (targetIsArray && key === "length") { 1065 const newLength = Number(newValue); 1066 depsMap.forEach((dep, key2) => { 1067 if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) { 1068 run(dep); 1069 } 1070 }); 1071 } else { 1072 if (key !== void 0 || depsMap.has(void 0)) { 1073 run(depsMap.get(key)); 1074 } 1075 if (isArrayIndex) { 1076 run(depsMap.get(ARRAY_ITERATE_KEY)); 1077 } 1078 switch (type) { 1079 case "add": 1080 if (!targetIsArray) { 1081 run(depsMap.get(ITERATE_KEY)); 1082 if (isMap(target)) { 1083 run(depsMap.get(MAP_KEY_ITERATE_KEY)); 1084 } 1085 } else if (isArrayIndex) { 1086 run(depsMap.get("length")); 1087 } 1088 break; 1089 case "delete": 1090 if (!targetIsArray) { 1091 run(depsMap.get(ITERATE_KEY)); 1092 if (isMap(target)) { 1093 run(depsMap.get(MAP_KEY_ITERATE_KEY)); 1094 } 1095 } 1096 break; 1097 case "set": 1098 if (isMap(target)) { 1099 run(depsMap.get(ITERATE_KEY)); 1100 } 1101 break; 1102 } 1103 } 1104 } 1105 endBatch(); 1106 } 1107 function getDepFromReactive(object, key) { 1108 const depMap = targetMap.get(object); 1109 return depMap && depMap.get(key); 1110 } 1111 1112 function reactiveReadArray(array) { 1113 const raw = toRaw(array); 1114 if (raw === array) return raw; 1115 track(raw, "iterate", ARRAY_ITERATE_KEY); 1116 return isShallow(array) ? raw : raw.map(toReactive); 1117 } 1118 function shallowReadArray(arr) { 1119 track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY); 1120 return arr; 1121 } 1122 const arrayInstrumentations = { 1123 __proto__: null, 1124 [Symbol.iterator]() { 1125 return iterator(this, Symbol.iterator, toReactive); 1126 }, 1127 concat(...args) { 1128 return reactiveReadArray(this).concat( 1129 ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x) 1130 ); 1131 }, 1132 entries() { 1133 return iterator(this, "entries", (value) => { 1134 value[1] = toReactive(value[1]); 1135 return value; 1136 }); 1137 }, 1138 every(fn, thisArg) { 1139 return apply(this, "every", fn, thisArg, void 0, arguments); 1140 }, 1141 filter(fn, thisArg) { 1142 return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments); 1143 }, 1144 find(fn, thisArg) { 1145 return apply(this, "find", fn, thisArg, toReactive, arguments); 1146 }, 1147 findIndex(fn, thisArg) { 1148 return apply(this, "findIndex", fn, thisArg, void 0, arguments); 1149 }, 1150 findLast(fn, thisArg) { 1151 return apply(this, "findLast", fn, thisArg, toReactive, arguments); 1152 }, 1153 findLastIndex(fn, thisArg) { 1154 return apply(this, "findLastIndex", fn, thisArg, void 0, arguments); 1155 }, 1156 // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement 1157 forEach(fn, thisArg) { 1158 return apply(this, "forEach", fn, thisArg, void 0, arguments); 1159 }, 1160 includes(...args) { 1161 return searchProxy(this, "includes", args); 1162 }, 1163 indexOf(...args) { 1164 return searchProxy(this, "indexOf", args); 1165 }, 1166 join(separator) { 1167 return reactiveReadArray(this).join(separator); 1168 }, 1169 // keys() iterator only reads `length`, no optimization required 1170 lastIndexOf(...args) { 1171 return searchProxy(this, "lastIndexOf", args); 1172 }, 1173 map(fn, thisArg) { 1174 return apply(this, "map", fn, thisArg, void 0, arguments); 1175 }, 1176 pop() { 1177 return noTracking(this, "pop"); 1178 }, 1179 push(...args) { 1180 return noTracking(this, "push", args); 1181 }, 1182 reduce(fn, ...args) { 1183 return reduce(this, "reduce", fn, args); 1184 }, 1185 reduceRight(fn, ...args) { 1186 return reduce(this, "reduceRight", fn, args); 1187 }, 1188 shift() { 1189 return noTracking(this, "shift"); 1190 }, 1191 // slice could use ARRAY_ITERATE but also seems to beg for range tracking 1192 some(fn, thisArg) { 1193 return apply(this, "some", fn, thisArg, void 0, arguments); 1194 }, 1195 splice(...args) { 1196 return noTracking(this, "splice", args); 1197 }, 1198 toReversed() { 1199 return reactiveReadArray(this).toReversed(); 1200 }, 1201 toSorted(comparer) { 1202 return reactiveReadArray(this).toSorted(comparer); 1203 }, 1204 toSpliced(...args) { 1205 return reactiveReadArray(this).toSpliced(...args); 1206 }, 1207 unshift(...args) { 1208 return noTracking(this, "unshift", args); 1209 }, 1210 values() { 1211 return iterator(this, "values", toReactive); 1212 } 1213 }; 1214 function iterator(self, method, wrapValue) { 1215 const arr = shallowReadArray(self); 1216 const iter = arr[method](); 1217 if (arr !== self && !isShallow(self)) { 1218 iter._next = iter.next; 1219 iter.next = () => { 1220 const result = iter._next(); 1221 if (result.value) { 1222 result.value = wrapValue(result.value); 1223 } 1224 return result; 1225 }; 1226 } 1227 return iter; 1228 } 1229 const arrayProto = Array.prototype; 1230 function apply(self, method, fn, thisArg, wrappedRetFn, args) { 1231 const arr = shallowReadArray(self); 1232 const needsWrap = arr !== self && !isShallow(self); 1233 const methodFn = arr[method]; 1234 if (methodFn !== arrayProto[method]) { 1235 const result2 = methodFn.apply(self, args); 1236 return needsWrap ? toReactive(result2) : result2; 1237 } 1238 let wrappedFn = fn; 1239 if (arr !== self) { 1240 if (needsWrap) { 1241 wrappedFn = function(item, index) {
vendor: 5,743 bytes, lines 1242-1409
1242 return fn.call(this, toReactive(item), index, self); 1243 }; 1244 } else if (fn.length > 2) { 1245 wrappedFn = function(item, index) { 1246 return fn.call(this, item, index, self); 1247 }; 1248 } 1249 } 1250 const result = methodFn.call(arr, wrappedFn, thisArg); 1251 return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result; 1252 } 1253 function reduce(self, method, fn, args) { 1254 const arr = shallowReadArray(self); 1255 let wrappedFn = fn; 1256 if (arr !== self) { 1257 if (!isShallow(self)) { 1258 wrappedFn = function(acc, item, index) { 1259 return fn.call(this, acc, toReactive(item), index, self); 1260 }; 1261 } else if (fn.length > 3) { 1262 wrappedFn = function(acc, item, index) { 1263 return fn.call(this, acc, item, index, self); 1264 }; 1265 } 1266 } 1267 return arr[method](wrappedFn, ...args); 1268 } 1269 function searchProxy(self, method, args) { 1270 const arr = toRaw(self); 1271 track(arr, "iterate", ARRAY_ITERATE_KEY); 1272 const res = arr[method](...args); 1273 if ((res === -1 || res === false) && isProxy(args[0])) { 1274 args[0] = toRaw(args[0]); 1275 return arr[method](...args); 1276 } 1277 return res; 1278 } 1279 function noTracking(self, method, args = []) { 1280 pauseTracking(); 1281 startBatch(); 1282 const res = toRaw(self)[method].apply(self, args); 1283 endBatch(); 1284 resetTracking(); 1285 return res; 1286 } 1287 1288 const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); 1289 const builtInSymbols = new Set( 1290 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) 1291 ); 1292 function hasOwnProperty(key) { 1293 if (!isSymbol(key)) key = String(key); 1294 const obj = toRaw(this); 1295 track(obj, "has", key); 1296 return obj.hasOwnProperty(key); 1297 } 1298 class BaseReactiveHandler { 1299 constructor(_isReadonly = false, _isShallow = false) { 1300 this._isReadonly = _isReadonly; 1301 this._isShallow = _isShallow; 1302 } 1303 get(target, key, receiver) { 1304 if (key === "__v_skip") return target["__v_skip"]; 1305 const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; 1306 if (key === "__v_isReactive") { 1307 return !isReadonly2; 1308 } else if (key === "__v_isReadonly") { 1309 return isReadonly2; 1310 } else if (key === "__v_isShallow") { 1311 return isShallow2; 1312 } else if (key === "__v_raw") { 1313 if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype 1314 // this means the receiver is a user proxy of the reactive proxy 1315 Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { 1316 return target; 1317 } 1318 return; 1319 } 1320 const targetIsArray = isArray(target); 1321 if (!isReadonly2) { 1322 let fn; 1323 if (targetIsArray && (fn = arrayInstrumentations[key])) { 1324 return fn; 1325 } 1326 if (key === "hasOwnProperty") { 1327 return hasOwnProperty; 1328 } 1329 } 1330 const res = Reflect.get( 1331 target, 1332 key, 1333 // if this is a proxy wrapping a ref, return methods using the raw ref 1334 // as receiver so that we don't have to call `toRaw` on the ref in all 1335 // its class methods 1336 isRef(target) ? target : receiver 1337 ); 1338 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { 1339 return res; 1340 } 1341 if (!isReadonly2) { 1342 track(target, "get", key); 1343 } 1344 if (isShallow2) { 1345 return res; 1346 } 1347 if (isRef(res)) { 1348 return targetIsArray && isIntegerKey(key) ? res : res.value; 1349 } 1350 if (isObject(res)) { 1351 return isReadonly2 ? readonly(res) : reactive(res); 1352 } 1353 return res; 1354 } 1355 } 1356 class MutableReactiveHandler extends BaseReactiveHandler { 1357 constructor(isShallow2 = false) { 1358 super(false, isShallow2); 1359 } 1360 set(target, key, value, receiver) { 1361 let oldValue = target[key]; 1362 if (!this._isShallow) { 1363 const isOldValueReadonly = isReadonly(oldValue); 1364 if (!isShallow(value) && !isReadonly(value)) { 1365 oldValue = toRaw(oldValue); 1366 value = toRaw(value); 1367 } 1368 if (!isArray(target) && isRef(oldValue) && !isRef(value)) { 1369 if (isOldValueReadonly) { 1370 { 1371 warn$2( 1372 `Set operation on key "${String(key)}" failed: target is readonly.`, 1373 target[key] 1374 ); 1375 } 1376 return true; 1377 } else { 1378 oldValue.value = value; 1379 return true; 1380 } 1381 } 1382 } 1383 const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); 1384 const result = Reflect.set( 1385 target, 1386 key, 1387 value, 1388 isRef(target) ? target : receiver 1389 ); 1390 if (target === toRaw(receiver)) { 1391 if (!hadKey) { 1392 trigger(target, "add", key, value); 1393 } else if (hasChanged(value, oldValue)) { 1394 trigger(target, "set", key, value, oldValue); 1395 } 1396 } 1397 return result; 1398 } 1399 deleteProperty(target, key) { 1400 const hadKey = hasOwn(target, key); 1401 const oldValue = target[key]; 1402 const result = Reflect.deleteProperty(target, key); 1403 if (result && hadKey) { 1404 trigger(target, "delete", key, void 0, oldValue); 1405 } 1406 return result; 1407 } 1408 has(target, key) { 1409 const result = Reflect.has(target, key);
vendor: 29,433 bytes, lines 1410-2379
1410 if (!isSymbol(key) || !builtInSymbols.has(key)) { 1411 track(target, "has", key); 1412 } 1413 return result; 1414 } 1415 ownKeys(target) { 1416 track( 1417 target, 1418 "iterate", 1419 isArray(target) ? "length" : ITERATE_KEY 1420 ); 1421 return Reflect.ownKeys(target); 1422 } 1423 } 1424 class ReadonlyReactiveHandler extends BaseReactiveHandler { 1425 constructor(isShallow2 = false) { 1426 super(true, isShallow2); 1427 } 1428 set(target, key) { 1429 { 1430 warn$2( 1431 `Set operation on key "${String(key)}" failed: target is readonly.`, 1432 target 1433 ); 1434 } 1435 return true; 1436 } 1437 deleteProperty(target, key) { 1438 { 1439 warn$2( 1440 `Delete operation on key "${String(key)}" failed: target is readonly.`, 1441 target 1442 ); 1443 } 1444 return true; 1445 } 1446 } 1447 const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); 1448 const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); 1449 const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true); 1450 const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); 1451 1452 const toShallow = (value) => value; 1453 const getProto = (v) => Reflect.getPrototypeOf(v); 1454 function createIterableMethod(method, isReadonly2, isShallow2) { 1455 return function(...args) { 1456 const target = this["__v_raw"]; 1457 const rawTarget = toRaw(target); 1458 const targetIsMap = isMap(rawTarget); 1459 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; 1460 const isKeyOnly = method === "keys" && targetIsMap; 1461 const innerIterator = target[method](...args); 1462 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; 1463 !isReadonly2 && track( 1464 rawTarget, 1465 "iterate", 1466 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY 1467 ); 1468 return { 1469 // iterator protocol 1470 next() { 1471 const { value, done } = innerIterator.next(); 1472 return done ? { value, done } : { 1473 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), 1474 done 1475 }; 1476 }, 1477 // iterable protocol 1478 [Symbol.iterator]() { 1479 return this; 1480 } 1481 }; 1482 }; 1483 } 1484 function createReadonlyMethod(type) { 1485 return function(...args) { 1486 { 1487 const key = args[0] ? `on key "${args[0]}" ` : ``; 1488 warn$2( 1489 `${capitalize(type)} operation ${key}failed: target is readonly.`, 1490 toRaw(this) 1491 ); 1492 } 1493 return type === "delete" ? false : type === "clear" ? void 0 : this; 1494 }; 1495 } 1496 function createInstrumentations(readonly, shallow) { 1497 const instrumentations = { 1498 get(key) { 1499 const target = this["__v_raw"]; 1500 const rawTarget = toRaw(target); 1501 const rawKey = toRaw(key); 1502 if (!readonly) { 1503 if (hasChanged(key, rawKey)) { 1504 track(rawTarget, "get", key); 1505 } 1506 track(rawTarget, "get", rawKey); 1507 } 1508 const { has } = getProto(rawTarget); 1509 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive; 1510 if (has.call(rawTarget, key)) { 1511 return wrap(target.get(key)); 1512 } else if (has.call(rawTarget, rawKey)) { 1513 return wrap(target.get(rawKey)); 1514 } else if (target !== rawTarget) { 1515 target.get(key); 1516 } 1517 }, 1518 get size() { 1519 const target = this["__v_raw"]; 1520 !readonly && track(toRaw(target), "iterate", ITERATE_KEY); 1521 return target.size; 1522 }, 1523 has(key) { 1524 const target = this["__v_raw"]; 1525 const rawTarget = toRaw(target); 1526 const rawKey = toRaw(key); 1527 if (!readonly) { 1528 if (hasChanged(key, rawKey)) { 1529 track(rawTarget, "has", key); 1530 } 1531 track(rawTarget, "has", rawKey); 1532 } 1533 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); 1534 }, 1535 forEach(callback, thisArg) { 1536 const observed = this; 1537 const target = observed["__v_raw"]; 1538 const rawTarget = toRaw(target); 1539 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive; 1540 !readonly && track(rawTarget, "iterate", ITERATE_KEY); 1541 return target.forEach((value, key) => { 1542 return callback.call(thisArg, wrap(value), wrap(key), observed); 1543 }); 1544 } 1545 }; 1546 extend( 1547 instrumentations, 1548 readonly ? { 1549 add: createReadonlyMethod("add"), 1550 set: createReadonlyMethod("set"), 1551 delete: createReadonlyMethod("delete"), 1552 clear: createReadonlyMethod("clear") 1553 } : { 1554 add(value) { 1555 if (!shallow && !isShallow(value) && !isReadonly(value)) { 1556 value = toRaw(value); 1557 } 1558 const target = toRaw(this); 1559 const proto = getProto(target); 1560 const hadKey = proto.has.call(target, value); 1561 if (!hadKey) { 1562 target.add(value); 1563 trigger(target, "add", value, value); 1564 } 1565 return this; 1566 }, 1567 set(key, value) { 1568 if (!shallow && !isShallow(value) && !isReadonly(value)) { 1569 value = toRaw(value); 1570 } 1571 const target = toRaw(this); 1572 const { has, get } = getProto(target); 1573 let hadKey = has.call(target, key); 1574 if (!hadKey) { 1575 key = toRaw(key); 1576 hadKey = has.call(target, key); 1577 } else { 1578 checkIdentityKeys(target, has, key); 1579 } 1580 const oldValue = get.call(target, key); 1581 target.set(key, value); 1582 if (!hadKey) { 1583 trigger(target, "add", key, value); 1584 } else if (hasChanged(value, oldValue)) { 1585 trigger(target, "set", key, value, oldValue); 1586 } 1587 return this; 1588 }, 1589 delete(key) { 1590 const target = toRaw(this); 1591 const { has, get } = getProto(target); 1592 let hadKey = has.call(target, key); 1593 if (!hadKey) { 1594 key = toRaw(key); 1595 hadKey = has.call(target, key); 1596 } else { 1597 checkIdentityKeys(target, has, key); 1598 } 1599 const oldValue = get ? get.call(target, key) : void 0; 1600 const result = target.delete(key); 1601 if (hadKey) { 1602 trigger(target, "delete", key, void 0, oldValue); 1603 } 1604 return result; 1605 }, 1606 clear() { 1607 const target = toRaw(this); 1608 const hadItems = target.size !== 0; 1609 const oldTarget = isMap(target) ? new Map(target) : new Set(target) ; 1610 const result = target.clear(); 1611 if (hadItems) { 1612 trigger( 1613 target, 1614 "clear", 1615 void 0, 1616 void 0, 1617 oldTarget 1618 ); 1619 } 1620 return result; 1621 } 1622 } 1623 ); 1624 const iteratorMethods = [ 1625 "keys", 1626 "values", 1627 "entries", 1628 Symbol.iterator 1629 ]; 1630 iteratorMethods.forEach((method) => { 1631 instrumentations[method] = createIterableMethod(method, readonly, shallow); 1632 }); 1633 return instrumentations; 1634 } 1635 function createInstrumentationGetter(isReadonly2, shallow) { 1636 const instrumentations = createInstrumentations(isReadonly2, shallow); 1637 return (target, key, receiver) => { 1638 if (key === "__v_isReactive") { 1639 return !isReadonly2; 1640 } else if (key === "__v_isReadonly") { 1641 return isReadonly2; 1642 } else if (key === "__v_raw") { 1643 return target; 1644 } 1645 return Reflect.get( 1646 hasOwn(instrumentations, key) && key in target ? instrumentations : target, 1647 key, 1648 receiver 1649 ); 1650 }; 1651 } 1652 const mutableCollectionHandlers = { 1653 get: /* @__PURE__ */ createInstrumentationGetter(false, false) 1654 }; 1655 const shallowCollectionHandlers = { 1656 get: /* @__PURE__ */ createInstrumentationGetter(false, true) 1657 }; 1658 const readonlyCollectionHandlers = { 1659 get: /* @__PURE__ */ createInstrumentationGetter(true, false) 1660 }; 1661 const shallowReadonlyCollectionHandlers = { 1662 get: /* @__PURE__ */ createInstrumentationGetter(true, true) 1663 }; 1664 function checkIdentityKeys(target, has, key) { 1665 const rawKey = toRaw(key); 1666 if (rawKey !== key && has.call(target, rawKey)) { 1667 const type = toRawType(target); 1668 warn$2( 1669 `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.` 1670 ); 1671 } 1672 } 1673 1674 const reactiveMap = /* @__PURE__ */ new WeakMap(); 1675 const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); 1676 const readonlyMap = /* @__PURE__ */ new WeakMap(); 1677 const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); 1678 function targetTypeMap(rawType) { 1679 switch (rawType) { 1680 case "Object": 1681 case "Array": 1682 return 1 /* COMMON */; 1683 case "Map": 1684 case "Set": 1685 case "WeakMap": 1686 case "WeakSet": 1687 return 2 /* COLLECTION */; 1688 default: 1689 return 0 /* INVALID */; 1690 } 1691 } 1692 function getTargetType(value) { 1693 return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value)); 1694 } 1695 function reactive(target) { 1696 if (isReadonly(target)) { 1697 return target; 1698 } 1699 return createReactiveObject( 1700 target, 1701 false, 1702 mutableHandlers, 1703 mutableCollectionHandlers, 1704 reactiveMap 1705 ); 1706 } 1707 function shallowReactive(target) { 1708 return createReactiveObject( 1709 target, 1710 false, 1711 shallowReactiveHandlers, 1712 shallowCollectionHandlers, 1713 shallowReactiveMap 1714 ); 1715 } 1716 function readonly(target) { 1717 return createReactiveObject( 1718 target, 1719 true, 1720 readonlyHandlers, 1721 readonlyCollectionHandlers, 1722 readonlyMap 1723 ); 1724 } 1725 function shallowReadonly(target) { 1726 return createReactiveObject( 1727 target, 1728 true, 1729 shallowReadonlyHandlers, 1730 shallowReadonlyCollectionHandlers, 1731 shallowReadonlyMap 1732 ); 1733 } 1734 function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { 1735 if (!isObject(target)) { 1736 { 1737 warn$2( 1738 `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( 1739 target 1740 )}` 1741 ); 1742 } 1743 return target; 1744 } 1745 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { 1746 return target; 1747 } 1748 const targetType = getTargetType(target); 1749 if (targetType === 0 /* INVALID */) { 1750 return target; 1751 } 1752 const existingProxy = proxyMap.get(target); 1753 if (existingProxy) { 1754 return existingProxy; 1755 } 1756 const proxy = new Proxy( 1757 target, 1758 targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers 1759 ); 1760 proxyMap.set(target, proxy); 1761 return proxy; 1762 } 1763 function isReactive(value) { 1764 if (isReadonly(value)) { 1765 return isReactive(value["__v_raw"]); 1766 } 1767 return !!(value && value["__v_isReactive"]); 1768 } 1769 function isReadonly(value) { 1770 return !!(value && value["__v_isReadonly"]); 1771 } 1772 function isShallow(value) { 1773 return !!(value && value["__v_isShallow"]); 1774 } 1775 function isProxy(value) { 1776 return value ? !!value["__v_raw"] : false; 1777 } 1778 function toRaw(observed) { 1779 const raw = observed && observed["__v_raw"]; 1780 return raw ? toRaw(raw) : observed; 1781 } 1782 function markRaw(value) { 1783 if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) { 1784 def(value, "__v_skip", true); 1785 } 1786 return value; 1787 } 1788 const toReactive = (value) => isObject(value) ? reactive(value) : value; 1789 const toReadonly = (value) => isObject(value) ? readonly(value) : value; 1790 1791 function isRef(r) { 1792 return r ? r["__v_isRef"] === true : false; 1793 } 1794 function ref(value) { 1795 return createRef(value, false); 1796 } 1797 function shallowRef(value) { 1798 return createRef(value, true); 1799 } 1800 function createRef(rawValue, shallow) { 1801 if (isRef(rawValue)) { 1802 return rawValue; 1803 } 1804 return new RefImpl(rawValue, shallow); 1805 } 1806 class RefImpl { 1807 constructor(value, isShallow2) { 1808 this.dep = new Dep(); 1809 this["__v_isRef"] = true; 1810 this["__v_isShallow"] = false; 1811 this._rawValue = isShallow2 ? value : toRaw(value); 1812 this._value = isShallow2 ? value : toReactive(value); 1813 this["__v_isShallow"] = isShallow2; 1814 } 1815 get value() { 1816 { 1817 this.dep.track({ 1818 target: this, 1819 type: "get", 1820 key: "value" 1821 }); 1822 } 1823 return this._value; 1824 } 1825 set value(newValue) { 1826 const oldValue = this._rawValue; 1827 const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue); 1828 newValue = useDirectValue ? newValue : toRaw(newValue); 1829 if (hasChanged(newValue, oldValue)) { 1830 this._rawValue = newValue; 1831 this._value = useDirectValue ? newValue : toReactive(newValue); 1832 { 1833 this.dep.trigger({ 1834 target: this, 1835 type: "set", 1836 key: "value", 1837 newValue, 1838 oldValue 1839 }); 1840 } 1841 } 1842 } 1843 } 1844 function triggerRef(ref2) { 1845 if (ref2.dep) { 1846 { 1847 ref2.dep.trigger({ 1848 target: ref2, 1849 type: "set", 1850 key: "value", 1851 newValue: ref2._value 1852 }); 1853 } 1854 } 1855 } 1856 function unref(ref2) { 1857 return isRef(ref2) ? ref2.value : ref2; 1858 } 1859 function toValue(source) { 1860 return isFunction(source) ? source() : unref(source); 1861 } 1862 const shallowUnwrapHandlers = { 1863 get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)), 1864 set: (target, key, value, receiver) => { 1865 const oldValue = target[key]; 1866 if (isRef(oldValue) && !isRef(value)) { 1867 oldValue.value = value; 1868 return true; 1869 } else { 1870 return Reflect.set(target, key, value, receiver); 1871 } 1872 } 1873 }; 1874 function proxyRefs(objectWithRefs) { 1875 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); 1876 } 1877 class CustomRefImpl { 1878 constructor(factory) { 1879 this["__v_isRef"] = true; 1880 this._value = void 0; 1881 const dep = this.dep = new Dep(); 1882 const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep)); 1883 this._get = get; 1884 this._set = set; 1885 } 1886 get value() { 1887 return this._value = this._get(); 1888 } 1889 set value(newVal) { 1890 this._set(newVal); 1891 } 1892 } 1893 function customRef(factory) { 1894 return new CustomRefImpl(factory); 1895 } 1896 function toRefs(object) { 1897 if (!isProxy(object)) { 1898 warn$2(`toRefs() expects a reactive object but received a plain one.`); 1899 } 1900 const ret = isArray(object) ? new Array(object.length) : {}; 1901 for (const key in object) { 1902 ret[key] = propertyToRef(object, key); 1903 } 1904 return ret; 1905 } 1906 class ObjectRefImpl { 1907 constructor(_object, _key, _defaultValue) { 1908 this._object = _object; 1909 this._key = _key; 1910 this._defaultValue = _defaultValue; 1911 this["__v_isRef"] = true; 1912 this._value = void 0; 1913 } 1914 get value() { 1915 const val = this._object[this._key]; 1916 return this._value = val === void 0 ? this._defaultValue : val; 1917 } 1918 set value(newVal) { 1919 this._object[this._key] = newVal; 1920 } 1921 get dep() { 1922 return getDepFromReactive(toRaw(this._object), this._key); 1923 } 1924 } 1925 class GetterRefImpl { 1926 constructor(_getter) { 1927 this._getter = _getter; 1928 this["__v_isRef"] = true; 1929 this["__v_isReadonly"] = true; 1930 this._value = void 0; 1931 } 1932 get value() { 1933 return this._value = this._getter(); 1934 } 1935 } 1936 function toRef(source, key, defaultValue) { 1937 if (isRef(source)) { 1938 return source; 1939 } else if (isFunction(source)) { 1940 return new GetterRefImpl(source); 1941 } else if (isObject(source) && arguments.length > 1) { 1942 return propertyToRef(source, key, defaultValue); 1943 } else { 1944 return ref(source); 1945 } 1946 } 1947 function propertyToRef(source, key, defaultValue) { 1948 const val = source[key]; 1949 return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); 1950 } 1951 1952 class ComputedRefImpl { 1953 constructor(fn, setter, isSSR) { 1954 this.fn = fn; 1955 this.setter = setter; 1956 /** 1957 * @internal 1958 */ 1959 this._value = void 0; 1960 /** 1961 * @internal 1962 */ 1963 this.dep = new Dep(this); 1964 /** 1965 * @internal 1966 */ 1967 this.__v_isRef = true; 1968 // TODO isolatedDeclarations "__v_isReadonly" 1969 // A computed is also a subscriber that tracks other deps 1970 /** 1971 * @internal 1972 */ 1973 this.deps = void 0; 1974 /** 1975 * @internal 1976 */ 1977 this.depsTail = void 0; 1978 /** 1979 * @internal 1980 */ 1981 this.flags = 16; 1982 /** 1983 * @internal 1984 */ 1985 this.globalVersion = globalVersion - 1; 1986 /** 1987 * @internal 1988 */ 1989 this.next = void 0; 1990 // for backwards compat 1991 this.effect = this; 1992 this["__v_isReadonly"] = !setter; 1993 this.isSSR = isSSR; 1994 } 1995 /** 1996 * @internal 1997 */ 1998 notify() { 1999 this.flags |= 16; 2000 if (!(this.flags & 8) && // avoid infinite self recursion 2001 activeSub !== this) { 2002 batch(this, true); 2003 return true; 2004 } 2005 } 2006 get value() { 2007 const link = this.dep.track({ 2008 target: this, 2009 type: "get", 2010 key: "value" 2011 }) ; 2012 refreshComputed(this); 2013 if (link) { 2014 link.version = this.dep.version; 2015 } 2016 return this._value; 2017 } 2018 set value(newValue) { 2019 if (this.setter) { 2020 this.setter(newValue); 2021 } else { 2022 warn$2("Write operation failed: computed value is readonly"); 2023 } 2024 } 2025 } 2026 function computed$1(getterOrOptions, debugOptions, isSSR = false) { 2027 let getter; 2028 let setter; 2029 if (isFunction(getterOrOptions)) { 2030 getter = getterOrOptions; 2031 } else { 2032 getter = getterOrOptions.get; 2033 setter = getterOrOptions.set; 2034 } 2035 const cRef = new ComputedRefImpl(getter, setter, isSSR); 2036 if (debugOptions && !isSSR) { 2037 cRef.onTrack = debugOptions.onTrack; 2038 cRef.onTrigger = debugOptions.onTrigger; 2039 } 2040 return cRef; 2041 } 2042 2043 const TrackOpTypes = { 2044 "GET": "get", 2045 "HAS": "has", 2046 "ITERATE": "iterate" 2047 }; 2048 const TriggerOpTypes = { 2049 "SET": "set", 2050 "ADD": "add", 2051 "DELETE": "delete", 2052 "CLEAR": "clear" 2053 }; 2054 2055 const INITIAL_WATCHER_VALUE = {}; 2056 const cleanupMap = /* @__PURE__ */ new WeakMap(); 2057 let activeWatcher = void 0; 2058 function getCurrentWatcher() { 2059 return activeWatcher; 2060 } 2061 function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) { 2062 if (owner) { 2063 let cleanups = cleanupMap.get(owner); 2064 if (!cleanups) cleanupMap.set(owner, cleanups = []); 2065 cleanups.push(cleanupFn); 2066 } else if (!failSilently) { 2067 warn$2( 2068 `onWatcherCleanup() was called when there was no active watcher to associate with.` 2069 ); 2070 } 2071 } 2072 function watch$1(source, cb, options = EMPTY_OBJ) { 2073 const { immediate, deep, once, scheduler, augmentJob, call } = options; 2074 const warnInvalidSource = (s) => { 2075 (options.onWarn || warn$2)( 2076 `Invalid watch source: `, 2077 s, 2078 `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.` 2079 ); 2080 }; 2081 const reactiveGetter = (source2) => { 2082 if (deep) return source2; 2083 if (isShallow(source2) || deep === false || deep === 0) 2084 return traverse(source2, 1); 2085 return traverse(source2); 2086 }; 2087 let effect; 2088 let getter; 2089 let cleanup; 2090 let boundCleanup; 2091 let forceTrigger = false; 2092 let isMultiSource = false; 2093 if (isRef(source)) { 2094 getter = () => source.value; 2095 forceTrigger = isShallow(source); 2096 } else if (isReactive(source)) { 2097 getter = () => reactiveGetter(source); 2098 forceTrigger = true; 2099 } else if (isArray(source)) { 2100 isMultiSource = true; 2101 forceTrigger = source.some((s) => isReactive(s) || isShallow(s)); 2102 getter = () => source.map((s) => { 2103 if (isRef(s)) { 2104 return s.value; 2105 } else if (isReactive(s)) { 2106 return reactiveGetter(s); 2107 } else if (isFunction(s)) { 2108 return call ? call(s, 2) : s(); 2109 } else { 2110 warnInvalidSource(s); 2111 } 2112 }); 2113 } else if (isFunction(source)) { 2114 if (cb) { 2115 getter = call ? () => call(source, 2) : source; 2116 } else { 2117 getter = () => { 2118 if (cleanup) { 2119 pauseTracking(); 2120 try { 2121 cleanup(); 2122 } finally { 2123 resetTracking(); 2124 } 2125 } 2126 const currentEffect = activeWatcher; 2127 activeWatcher = effect; 2128 try { 2129 return call ? call(source, 3, [boundCleanup]) : source(boundCleanup); 2130 } finally { 2131 activeWatcher = currentEffect; 2132 } 2133 }; 2134 } 2135 } else { 2136 getter = NOOP; 2137 warnInvalidSource(source); 2138 } 2139 if (cb && deep) { 2140 const baseGetter = getter; 2141 const depth = deep === true ? Infinity : deep; 2142 getter = () => traverse(baseGetter(), depth); 2143 } 2144 const scope = getCurrentScope(); 2145 const watchHandle = () => { 2146 effect.stop(); 2147 if (scope && scope.active) { 2148 remove(scope.effects, effect); 2149 } 2150 }; 2151 if (once && cb) { 2152 const _cb = cb; 2153 cb = (...args) => { 2154 _cb(...args); 2155 watchHandle(); 2156 }; 2157 } 2158 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; 2159 const job = (immediateFirstRun) => { 2160 if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) { 2161 return; 2162 } 2163 if (cb) { 2164 const newValue = effect.run(); 2165 if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) { 2166 if (cleanup) { 2167 cleanup(); 2168 } 2169 const currentWatcher = activeWatcher; 2170 activeWatcher = effect; 2171 try { 2172 const args = [ 2173 newValue, 2174 // pass undefined as the old value when it's changed for the first time 2175 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, 2176 boundCleanup 2177 ]; 2178 oldValue = newValue; 2179 call ? call(cb, 3, args) : ( 2180 // @ts-expect-error 2181 cb(...args) 2182 ); 2183 } finally { 2184 activeWatcher = currentWatcher; 2185 } 2186 } 2187 } else { 2188 effect.run(); 2189 } 2190 }; 2191 if (augmentJob) { 2192 augmentJob(job); 2193 } 2194 effect = new ReactiveEffect(getter); 2195 effect.scheduler = scheduler ? () => scheduler(job, false) : job; 2196 boundCleanup = (fn) => onWatcherCleanup(fn, false, effect); 2197 cleanup = effect.onStop = () => { 2198 const cleanups = cleanupMap.get(effect); 2199 if (cleanups) { 2200 if (call) { 2201 call(cleanups, 4); 2202 } else { 2203 for (const cleanup2 of cleanups) cleanup2(); 2204 } 2205 cleanupMap.delete(effect); 2206 } 2207 }; 2208 { 2209 effect.onTrack = options.onTrack; 2210 effect.onTrigger = options.onTrigger; 2211 } 2212 if (cb) { 2213 if (immediate) { 2214 job(true); 2215 } else { 2216 oldValue = effect.run(); 2217 } 2218 } else if (scheduler) { 2219 scheduler(job.bind(null, true), true); 2220 } else { 2221 effect.run(); 2222 } 2223 watchHandle.pause = effect.pause.bind(effect); 2224 watchHandle.resume = effect.resume.bind(effect); 2225 watchHandle.stop = watchHandle; 2226 return watchHandle; 2227 } 2228 function traverse(value, depth = Infinity, seen) { 2229 if (depth <= 0 || !isObject(value) || value["__v_skip"]) { 2230 return value; 2231 } 2232 seen = seen || /* @__PURE__ */ new Map(); 2233 if ((seen.get(value) || 0) >= depth) { 2234 return value; 2235 } 2236 seen.set(value, depth); 2237 depth--; 2238 if (isRef(value)) { 2239 traverse(value.value, depth, seen); 2240 } else if (isArray(value)) { 2241 for (let i = 0; i < value.length; i++) { 2242 traverse(value[i], depth, seen); 2243 } 2244 } else if (isSet(value) || isMap(value)) { 2245 value.forEach((v) => { 2246 traverse(v, depth, seen); 2247 }); 2248 } else if (isPlainObject(value)) { 2249 for (const key in value) { 2250 traverse(value[key], depth, seen); 2251 } 2252 for (const key of Object.getOwnPropertySymbols(value)) { 2253 if (Object.prototype.propertyIsEnumerable.call(value, key)) { 2254 traverse(value[key], depth, seen); 2255 } 2256 } 2257 } 2258 return value; 2259 } 2260 2261 const stack$1 = []; 2262 function pushWarningContext(vnode) { 2263 stack$1.push(vnode); 2264 } 2265 function popWarningContext() { 2266 stack$1.pop(); 2267 } 2268 let isWarning = false; 2269 function warn$1(msg, ...args) { 2270 if (isWarning) return; 2271 isWarning = true; 2272 pauseTracking(); 2273 const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null; 2274 const appWarnHandler = instance && instance.appContext.config.warnHandler; 2275 const trace = getComponentTrace(); 2276 if (appWarnHandler) { 2277 callWithErrorHandling( 2278 appWarnHandler, 2279 instance, 2280 11, 2281 [ 2282 // eslint-disable-next-line no-restricted-syntax 2283 msg + args.map((a) => { 2284 var _a, _b; 2285 return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a); 2286 }).join(""), 2287 instance && instance.proxy, 2288 trace.map( 2289 ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>` 2290 ).join("\n"), 2291 trace 2292 ] 2293 ); 2294 } else { 2295 const warnArgs = [`[Vue warn]: ${msg}`, ...args]; 2296 if (trace.length && // avoid spamming console during tests 2297 true) { 2298 warnArgs.push(` 2299`, ...formatTrace(trace)); 2300 } 2301 console.warn(...warnArgs); 2302 } 2303 resetTracking(); 2304 isWarning = false; 2305 } 2306 function getComponentTrace() { 2307 let currentVNode = stack$1[stack$1.length - 1]; 2308 if (!currentVNode) { 2309 return []; 2310 } 2311 const normalizedStack = []; 2312 while (currentVNode) { 2313 const last = normalizedStack[0]; 2314 if (last && last.vnode === currentVNode) { 2315 last.recurseCount++; 2316 } else { 2317 normalizedStack.push({ 2318 vnode: currentVNode, 2319 recurseCount: 0 2320 }); 2321 } 2322 const parentInstance = currentVNode.component && currentVNode.component.parent; 2323 currentVNode = parentInstance && parentInstance.vnode; 2324 } 2325 return normalizedStack; 2326 } 2327 function formatTrace(trace) { 2328 const logs = []; 2329 trace.forEach((entry, i) => { 2330 logs.push(...i === 0 ? [] : [` 2331`], ...formatTraceEntry(entry)); 2332 }); 2333 return logs; 2334 } 2335 function formatTraceEntry({ vnode, recurseCount }) { 2336 const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``; 2337 const isRoot = vnode.component ? vnode.component.parent == null : false; 2338 const open = ` at <${formatComponentName( 2339 vnode.component, 2340 vnode.type, 2341 isRoot 2342 )}`; 2343 const close = `>` + postfix; 2344 return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close]; 2345 } 2346 function formatProps(props) { 2347 const res = []; 2348 const keys = Object.keys(props); 2349 keys.slice(0, 3).forEach((key) => { 2350 res.push(...formatProp(key, props[key])); 2351 }); 2352 if (keys.length > 3) { 2353 res.push(` ...`); 2354 } 2355 return res; 2356 } 2357 function formatProp(key, value, raw) { 2358 if (isString(value)) { 2359 value = JSON.stringify(value); 2360 return raw ? value : [`${key}=${value}`]; 2361 } else if (typeof value === "number" || typeof value === "boolean" || value == null) { 2362 return raw ? value : [`${key}=${value}`]; 2363 } else if (isRef(value)) { 2364 value = formatProp(key, toRaw(value.value), true); 2365 return raw ? value : [`${key}=Ref<`, value, `>`]; 2366 } else if (isFunction(value)) { 2367 return [`${key}=fn${value.name ? `<${value.name}>` : ``}`]; 2368 } else { 2369 value = toRaw(value); 2370 return raw ? value : [`${key}=`, value]; 2371 } 2372 } 2373 function assertNumber(val, type) { 2374 if (val === void 0) { 2375 return; 2376 } else if (typeof val !== "number") { 2377 warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`); 2378 } else if (isNaN(val)) { 2379 warn$1(`${type}
2379 is NaN - the duration expression might be incorrect.`); 2380 } 2381 } 2382 2383 const ErrorCodes = { 2384 "SETUP_FUNCTION": 0, 2385 "0": "SETUP_FUNCTION", 2386 "RENDER_FUNCTION": 1, 2387 "1": "RENDER_FUNCTION", 2388 "NATIVE_EVENT_HANDLER": 5, 2389 "5": "NATIVE_EVENT_HANDLER", 2390 "COMPONENT_EVENT_HANDLER": 6, 2391 "6": "COMPONENT_EVENT_HANDLER", 2392 "VNODE_HOOK": 7, 2393 "7": "VNODE_HOOK", 2394 "DIRECTIVE_HOOK": 8, 2395 "8": "DIRECTIVE_HOOK", 2396 "TRANSITION_HOOK": 9, 2397 "9": "TRANSITION_HOOK", 2398 "APP_ERROR_HANDLER": 10, 2399 "10": "APP_ERROR_HANDLER", 2400 "APP_WARN_HANDLER": 11, 2401 "11": "APP_WARN_HANDLER", 2402 "FUNCTION_REF": 12, 2403 "12": "FUNCTION_REF", 2404 "ASYNC_COMPONENT_LOADER": 13, 2405 "13": "ASYNC_COMPONENT_LOADER", 2406 "SCHEDULER": 14, 2407 "14": "SCHEDULER", 2408 "COMPONENT_UPDATE": 15, 2409 "15": "COMPONENT_UPDATE", 2410 "APP_UNMOUNT_CLEANUP": 16, 2411 "16": "APP_UNMOUNT_CLEANUP" 2412 }; 2413 const ErrorTypeStrings$1 = { 2414 ["sp"]: "serverPrefetch hook", 2415 ["bc"]: "beforeCreate hook", 2416 ["c"]: "created hook", 2417 ["bm"]: "beforeMount hook", 2418 ["m"]: "mounted hook", 2419 ["bu"]: "beforeUpdate hook", 2420 ["u"]: "updated", 2421 ["bum"]: "beforeUnmount hook", 2422 ["um"]: "unmounted hook", 2423 ["a"]: "activated hook", 2424 ["da"]: "deactivated hook", 2425 ["ec"]: "errorCaptured hook", 2426 ["rtc"]: "renderTracked hook", 2427 ["rtg"]: "renderTriggered hook", 2428 [0]: "setup function", 2429 [1]: "render function", 2430 [2]: "watcher getter", 2431 [3]: "watcher callback", 2432 [4]: "watcher cleanup function", 2433 [5]: "native event handler", 2434 [6]: "component event handler", 2435 [7]: "vnode hook", 2436 [8]: "directive hook", 2437 [9]: "transition hook", 2438 [10]: "app errorHandler", 2439 [11]: "app warnHandler", 2440 [12]: "ref function", 2441 [13]: "async component loader", 2442 [14]: "scheduler flush", 2443 [15]: "component update", 2444 [16]: "app unmount cleanup function" 2445 }; 2446 function callWithErrorHandling(fn, instance, type, args) { 2447 try { 2448 return args ? fn(...args) : fn(); 2449 } catch (err) { 2450 handleError(err, instance, type); 2451 } 2452 } 2453 function callWithAsyncErrorHandling(fn, instance, type, args) { 2454 if (isFunction(fn)) { 2455 const res = callWithErrorHandling(fn, instance, type, args); 2456 if (res && isPromise(res)) { 2457 res.catch((err) => { 2458 handleError(err, instance, type); 2459 }); 2460 } 2461 return res; 2462 } 2463 if (isArray(fn)) { 2464 const values = []; 2465 for (let i = 0; i < fn.length; i++) { 2466 values.push(callWithAsyncErrorHandling(fn[i], instance, type, args)); 2467 } 2468 return values; 2469 } else { 2470 warn$1( 2471 `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}` 2472 ); 2473 } 2474 } 2475 function handleError(err, instance, type, throwInDev = true) { 2476 const contextVNode = instance ? instance.vnode : null; 2477 const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ; 2478 if (instance) { 2479 let cur = instance.parent; 2480 const exposedInstance = instance.proxy; 2481 const errorInfo = ErrorTypeStrings$1[type] ; 2482 while (cur) {
vendor: 14,420 bytes, lines 2483-2941
2483 const errorCapturedHooks = cur.ec; 2484 if (errorCapturedHooks) { 2485 for (let i = 0; i < errorCapturedHooks.length; i++) { 2486 if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) { 2487 return; 2488 } 2489 } 2490 } 2491 cur = cur.parent; 2492 } 2493 if (errorHandler) { 2494 pauseTracking(); 2495 callWithErrorHandling(errorHandler, null, 10, [ 2496 err, 2497 exposedInstance, 2498 errorInfo 2499 ]); 2500 resetTracking(); 2501 return; 2502 } 2503 } 2504 logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction); 2505 } 2506 function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) { 2507 { 2508 const info = ErrorTypeStrings$1[type]; 2509 if (contextVNode) { 2510 pushWarningContext(contextVNode); 2511 } 2512 warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`); 2513 if (contextVNode) { 2514 popWarningContext(); 2515 } 2516 if (throwInDev) { 2517 throw err; 2518 } else { 2519 console.error(err); 2520 } 2521 } 2522 } 2523 2524 const queue = []; 2525 let flushIndex = -1; 2526 const pendingPostFlushCbs = []; 2527 let activePostFlushCbs = null; 2528 let postFlushIndex = 0; 2529 const resolvedPromise = /* @__PURE__ */ Promise.resolve(); 2530 let currentFlushPromise = null; 2531 const RECURSION_LIMIT = 100; 2532 function nextTick(fn) { 2533 const p = currentFlushPromise || resolvedPromise; 2534 return fn ? p.then(this ? fn.bind(this) : fn) : p; 2535 } 2536 function findInsertionIndex(id) { 2537 let start = flushIndex + 1; 2538 let end = queue.length; 2539 while (start < end) { 2540 const middle = start + end >>> 1; 2541 const middleJob = queue[middle]; 2542 const middleJobId = getId(middleJob); 2543 if (middleJobId < id || middleJobId === id && middleJob.flags & 2) { 2544 start = middle + 1; 2545 } else { 2546 end = middle; 2547 } 2548 } 2549 return start; 2550 } 2551 function queueJob(job) { 2552 if (!(job.flags & 1)) { 2553 const jobId = getId(job); 2554 const lastJob = queue[queue.length - 1]; 2555 if (!lastJob || // fast path when the job id is larger than the tail 2556 !(job.flags & 2) && jobId >= getId(lastJob)) { 2557 queue.push(job); 2558 } else { 2559 queue.splice(findInsertionIndex(jobId), 0, job); 2560 } 2561 job.flags |= 1; 2562 queueFlush(); 2563 } 2564 } 2565 function queueFlush() { 2566 if (!currentFlushPromise) { 2567 currentFlushPromise = resolvedPromise.then(flushJobs); 2568 } 2569 } 2570 function queuePostFlushCb(cb) { 2571 if (!isArray(cb)) { 2572 if (activePostFlushCbs && cb.id === -1) { 2573 activePostFlushCbs.splice(postFlushIndex + 1, 0, cb); 2574 } else if (!(cb.flags & 1)) { 2575 pendingPostFlushCbs.push(cb); 2576 cb.flags |= 1; 2577 } 2578 } else { 2579 pendingPostFlushCbs.push(...cb); 2580 } 2581 queueFlush(); 2582 } 2583 function flushPreFlushCbs(instance, seen, i = flushIndex + 1) { 2584 { 2585 seen = seen || /* @__PURE__ */ new Map(); 2586 } 2587 for (; i < queue.length; i++) { 2588 const cb = queue[i]; 2589 if (cb && cb.flags & 2) { 2590 if (instance && cb.id !== instance.uid) { 2591 continue; 2592 } 2593 if (checkRecursiveUpdates(seen, cb)) { 2594 continue; 2595 } 2596 queue.splice(i, 1); 2597 i--; 2598 if (cb.flags & 4) { 2599 cb.flags &= -2; 2600 } 2601 cb(); 2602 if (!(cb.flags & 4)) { 2603 cb.flags &= -2; 2604 } 2605 } 2606 } 2607 } 2608 function flushPostFlushCbs(seen) { 2609 if (pendingPostFlushCbs.length) { 2610 const deduped = [...new Set(pendingPostFlushCbs)].sort( 2611 (a, b) => getId(a) - getId(b) 2612 ); 2613 pendingPostFlushCbs.length = 0; 2614 if (activePostFlushCbs) { 2615 activePostFlushCbs.push(...deduped); 2616 return; 2617 } 2618 activePostFlushCbs = deduped; 2619 { 2620 seen = seen || /* @__PURE__ */ new Map(); 2621 } 2622 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) { 2623 const cb = activePostFlushCbs[postFlushIndex]; 2624 if (checkRecursiveUpdates(seen, cb)) { 2625 continue; 2626 } 2627 if (cb.flags & 4) { 2628 cb.flags &= -2; 2629 } 2630 if (!(cb.flags & 8)) cb(); 2631 cb.flags &= -2; 2632 } 2633 activePostFlushCbs = null; 2634 postFlushIndex = 0; 2635 } 2636 } 2637 const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id; 2638 function flushJobs(seen) { 2639 { 2640 seen = seen || /* @__PURE__ */ new Map(); 2641 } 2642 const check = (job) => checkRecursiveUpdates(seen, job) ; 2643 try { 2644 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { 2645 const job = queue[flushIndex]; 2646 if (job && !(job.flags & 8)) { 2647 if (check(job)) { 2648 continue; 2649 } 2650 if (job.flags & 4) { 2651 job.flags &= ~1; 2652 } 2653 callWithErrorHandling( 2654 job, 2655 job.i, 2656 job.i ? 15 : 14 2657 ); 2658 if (!(job.flags & 4)) { 2659 job.flags &= ~1; 2660 } 2661 } 2662 } 2663 } finally { 2664 for (; flushIndex < queue.length; flushIndex++) { 2665 const job = queue[flushIndex]; 2666 if (job) { 2667 job.flags &= -2; 2668 } 2669 } 2670 flushIndex = -1; 2671 queue.length = 0; 2672 flushPostFlushCbs(seen); 2673 currentFlushPromise = null; 2674 if (queue.length || pendingPostFlushCbs.length) { 2675 flushJobs(seen); 2676 } 2677 } 2678 } 2679 function checkRecursiveUpdates(seen, fn) { 2680 const count = seen.get(fn) || 0; 2681 if (count > RECURSION_LIMIT) { 2682 const instance = fn.i; 2683 const componentName = instance && getComponentName(instance.type); 2684 handleError( 2685 `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.`, 2686 null, 2687 10 2688 ); 2689 return true; 2690 } 2691 seen.set(fn, count + 1); 2692 return false; 2693 } 2694 2695 let isHmrUpdating = false; 2696 const hmrDirtyComponents = /* @__PURE__ */ new Map(); 2697 { 2698 const g = getGlobalThis(); 2699 if (!g.__VUE_HMR_RUNTIME__) { 2700 g.__VUE_HMR_RUNTIME__ = { 2701 createRecord: tryWrap(createRecord), 2702 rerender: tryWrap(rerender), 2703 reload: tryWrap(reload) 2704 }; 2705 } 2706 } 2707 const map = /* @__PURE__ */ new Map(); 2708 function registerHMR(instance) { 2709 const id = instance.type.__hmrId; 2710 let record = map.get(id); 2711 if (!record) { 2712 createRecord(id, instance.type); 2713 record = map.get(id); 2714 } 2715 record.instances.add(instance); 2716 } 2717 function unregisterHMR(instance) { 2718 map.get(instance.type.__hmrId).instances.delete(instance); 2719 } 2720 function createRecord(id, initialDef) { 2721 if (map.has(id)) { 2722 return false; 2723 } 2724 map.set(id, { 2725 initialDef: normalizeClassComponent(initialDef), 2726 instances: /* @__PURE__ */ new Set() 2727 }); 2728 return true; 2729 } 2730 function normalizeClassComponent(component) { 2731 return isClassComponent(component) ? component.__vccOpts : component; 2732 } 2733 function rerender(id, newRender) { 2734 const record = map.get(id); 2735 if (!record) { 2736 return; 2737 } 2738 record.initialDef.render = newRender; 2739 [...record.instances].forEach((instance) => { 2740 if (newRender) { 2741 instance.render = newRender; 2742 normalizeClassComponent(instance.type).render = newRender; 2743 } 2744 instance.renderCache = []; 2745 isHmrUpdating = true; 2746 if (!(instance.job.flags & 8)) { 2747 instance.update(); 2748 } 2749 isHmrUpdating = false; 2750 }); 2751 } 2752 function reload(id, newComp) { 2753 const record = map.get(id); 2754 if (!record) return; 2755 newComp = normalizeClassComponent(newComp); 2756 updateComponentDef(record.initialDef, newComp); 2757 const instances = [...record.instances]; 2758 for (let i = 0; i < instances.length; i++) { 2759 const instance = instances[i]; 2760 const oldComp = normalizeClassComponent(instance.type); 2761 let dirtyInstances = hmrDirtyComponents.get(oldComp); 2762 if (!dirtyInstances) { 2763 if (oldComp !== record.initialDef) { 2764 updateComponentDef(oldComp, newComp); 2765 } 2766 hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set()); 2767 } 2768 dirtyInstances.add(instance); 2769 instance.appContext.propsCache.delete(instance.type); 2770 instance.appContext.emitsCache.delete(instance.type); 2771 instance.appContext.optionsCache.delete(instance.type); 2772 if (instance.ceReload) { 2773 dirtyInstances.add(instance); 2774 instance.ceReload(newComp.styles); 2775 dirtyInstances.delete(instance); 2776 } else if (instance.parent) { 2777 queueJob(() => { 2778 if (!(instance.job.flags & 8)) { 2779 isHmrUpdating = true; 2780 instance.parent.update(); 2781 isHmrUpdating = false; 2782 dirtyInstances.delete(instance); 2783 } 2784 }); 2785 } else if (instance.appContext.reload) { 2786 instance.appContext.reload(); 2787 } else if (typeof window !== "undefined") { 2788 window.location.reload(); 2789 } else { 2790 console.warn( 2791 "[HMR] Root or manually mounted instance modified. Full reload required." 2792 ); 2793 } 2794 if (instance.root.ce && instance !== instance.root) { 2795 instance.root.ce._removeChildStyle(oldComp); 2796 } 2797 } 2798 queuePostFlushCb(() => { 2799 hmrDirtyComponents.clear(); 2800 }); 2801 } 2802 function updateComponentDef(oldComp, newComp) { 2803 extend(oldComp, newComp); 2804 for (const key in oldComp) { 2805 if (key !== "__file" && !(key in newComp)) { 2806 delete oldComp[key]; 2807 } 2808 } 2809 } 2810 function tryWrap(fn) { 2811 return (id, arg) => { 2812 try { 2813 return fn(id, arg); 2814 } catch (e) { 2815 console.error(e); 2816 console.warn( 2817 `[HMR] Something went wrong during Vue component hot-reload. Full reload required.` 2818 ); 2819 } 2820 }; 2821 } 2822 2823 let devtools$1; 2824 let buffer = []; 2825 let devtoolsNotInstalled = false; 2826 function emit$1(event, ...args) { 2827 if (devtools$1) { 2828 devtools$1.emit(event, ...args); 2829 } else if (!devtoolsNotInstalled) { 2830 buffer.push({ event, args }); 2831 } 2832 } 2833 function setDevtoolsHook$1(hook, target) { 2834 var _a, _b; 2835 devtools$1 = hook; 2836 if (devtools$1) { 2837 devtools$1.enabled = true; 2838 buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args)); 2839 buffer = []; 2840 } else if ( 2841 // handle late devtools injection - only do this if we are in an actual 2842 // browser environment to avoid the timer handle stalling test runner exit 2843 // (#4815) 2844 typeof window !== "undefined" && // some envs mock window but not fully 2845 window.HTMLElement && // also exclude jsdom 2846 // eslint-disable-next-line no-restricted-syntax 2847 !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom")) 2848 ) { 2849 const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; 2850 replay.push((newHook) => { 2851 setDevtoolsHook$1(newHook, target); 2852 }); 2853 setTimeout(() => { 2854 if (!devtools$1) { 2855 target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null; 2856 devtoolsNotInstalled = true; 2857 buffer = []; 2858 } 2859 }, 3e3); 2860 } else { 2861 devtoolsNotInstalled = true; 2862 buffer = []; 2863 } 2864 } 2865 function devtoolsInitApp(app, version) { 2866 emit$1("app:init" /* APP_INIT */, app, version, { 2867 Fragment, 2868 Text, 2869 Comment, 2870 Static 2871 }); 2872 } 2873 function devtoolsUnmountApp(app) { 2874 emit$1("app:unmount" /* APP_UNMOUNT */, app); 2875 } 2876 const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */); 2877 const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */); 2878 const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook( 2879 "component:removed" /* COMPONENT_REMOVED */ 2880 ); 2881 const devtoolsComponentRemoved = (component) => { 2882 if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered 2883 !devtools$1.cleanupBuffer(component)) { 2884 _devtoolsComponentRemoved(component); 2885 } 2886 }; 2887 // @__NO_SIDE_EFFECTS__ 2888 function createDevtoolsComponentHook(hook) { 2889 return (component) => { 2890 emit$1( 2891 hook, 2892 component.appContext.app, 2893 component.uid, 2894 component.parent ? component.parent.uid : void 0, 2895 component 2896 ); 2897 }; 2898 } 2899 const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */); 2900 const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */); 2901 function createDevtoolsPerformanceHook(hook) { 2902 return (component, type, time) => { 2903 emit$1(hook, component.appContext.app, component.uid, component, type, time); 2904 }; 2905 } 2906 function devtoolsComponentEmit(component, event, params) { 2907 emit$1( 2908 "component:emit" /* COMPONENT_EMIT */, 2909 component.appContext.app, 2910 component, 2911 event, 2912 params 2913 ); 2914 } 2915 2916 let currentRenderingInstance = null; 2917 let currentScopeId = null; 2918 function setCurrentRenderingInstance(instance) { 2919 const prev = currentRenderingInstance; 2920 currentRenderingInstance = instance; 2921 currentScopeId = instance && instance.type.__scopeId || null; 2922 return prev; 2923 } 2924 function pushScopeId(id) { 2925 currentScopeId = id; 2926 } 2927 function popScopeId() { 2928 currentScopeId = null; 2929 } 2930 const withScopeId = (_id) => withCtx; 2931 function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) { 2932 if (!ctx) return fn; 2933 if (fn._n) { 2934 return fn; 2935 } 2936 const renderFnWithContext = (...args) => { 2937 if (renderFnWithContext._d) { 2938 setBlockTracking(-1); 2939 } 2940 const prevInstance = setCurrentRenderingInstance(ctx); 2941 let res;
vendor: 14,295 bytes, lines 2942-3390
2942 try { 2943 res = fn(...args); 2944 } finally { 2945 setCurrentRenderingInstance(prevInstance); 2946 if (renderFnWithContext._d) { 2947 setBlockTracking(1); 2948 } 2949 } 2950 { 2951 devtoolsComponentUpdated(ctx); 2952 } 2953 return res; 2954 }; 2955 renderFnWithContext._n = true; 2956 renderFnWithContext._c = true; 2957 renderFnWithContext._d = true; 2958 return renderFnWithContext; 2959 } 2960 2961 function validateDirectiveName(name) { 2962 if (isBuiltInDirective(name)) { 2963 warn$1("Do not use built-in directive ids as custom directive id: " + name); 2964 } 2965 } 2966 function withDirectives(vnode, directives) { 2967 if (currentRenderingInstance === null) { 2968 warn$1(`withDirectives can only be used inside render functions.`); 2969 return vnode; 2970 } 2971 const instance = getComponentPublicInstance(currentRenderingInstance); 2972 const bindings = vnode.dirs || (vnode.dirs = []); 2973 for (let i = 0; i < directives.length; i++) { 2974 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i]; 2975 if (dir) { 2976 if (isFunction(dir)) { 2977 dir = { 2978 mounted: dir, 2979 updated: dir 2980 }; 2981 } 2982 if (dir.deep) { 2983 traverse(value); 2984 } 2985 bindings.push({ 2986 dir, 2987 instance, 2988 value, 2989 oldValue: void 0, 2990 arg, 2991 modifiers 2992 }); 2993 } 2994 } 2995 return vnode; 2996 } 2997 function invokeDirectiveHook(vnode, prevVNode, instance, name) { 2998 const bindings = vnode.dirs; 2999 const oldBindings = prevVNode && prevVNode.dirs; 3000 for (let i = 0; i < bindings.length; i++) { 3001 const binding = bindings[i]; 3002 if (oldBindings) { 3003 binding.oldValue = oldBindings[i].value; 3004 } 3005 let hook = binding.dir[name]; 3006 if (hook) { 3007 pauseTracking(); 3008 callWithAsyncErrorHandling(hook, instance, 8, [ 3009 vnode.el, 3010 binding, 3011 vnode, 3012 prevVNode 3013 ]); 3014 resetTracking(); 3015 } 3016 } 3017 } 3018 3019 const TeleportEndKey = Symbol("_vte"); 3020 const isTeleport = (type) => type.__isTeleport; 3021 const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === ""); 3022 const isTeleportDeferred = (props) => props && (props.defer || props.defer === ""); 3023 const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement; 3024 const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement; 3025 const resolveTarget = (props, select) => { 3026 const targetSelector = props && props.to; 3027 if (isString(targetSelector)) { 3028 if (!select) { 3029 warn$1( 3030 `Current renderer does not support string target for Teleports. (missing querySelector renderer option)` 3031 ); 3032 return null; 3033 } else { 3034 const target = select(targetSelector); 3035 if (!target && !isTeleportDisabled(props)) { 3036 warn$1( 3037 `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.` 3038 ); 3039 } 3040 return target; 3041 } 3042 } else { 3043 if (!targetSelector && !isTeleportDisabled(props)) { 3044 warn$1(`Invalid Teleport target: ${targetSelector}`); 3045 } 3046 return targetSelector; 3047 } 3048 }; 3049 const TeleportImpl = { 3050 name: "Teleport", 3051 __isTeleport: true, 3052 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) { 3053 const { 3054 mc: mountChildren, 3055 pc: patchChildren, 3056 pbc: patchBlockChildren, 3057 o: { insert, querySelector, createText, createComment } 3058 } = internals; 3059 const disabled = isTeleportDisabled(n2.props); 3060 let { shapeFlag, children, dynamicChildren } = n2; 3061 if (isHmrUpdating) { 3062 optimized = false; 3063 dynamicChildren = null; 3064 } 3065 if (n1 == null) { 3066 const placeholder = n2.el = createComment("teleport start") ; 3067 const mainAnchor = n2.anchor = createComment("teleport end") ; 3068 insert(placeholder, container, anchor); 3069 insert(mainAnchor, container, anchor); 3070 const mount = (container2, anchor2) => { 3071 if (shapeFlag & 16) { 3072 if (parentComponent && parentComponent.isCE) { 3073 parentComponent.ce._teleportTarget = container2; 3074 } 3075 mountChildren( 3076 children, 3077 container2, 3078 anchor2, 3079 parentComponent, 3080 parentSuspense, 3081 namespace, 3082 slotScopeIds, 3083 optimized 3084 ); 3085 } 3086 }; 3087 const mountToTarget = () => { 3088 const target = n2.target = resolveTarget(n2.props, querySelector); 3089 const targetAnchor = prepareAnchor(target, n2, createText, insert); 3090 if (target) { 3091 if (namespace !== "svg" && isTargetSVG(target)) { 3092 namespace = "svg"; 3093 } else if (namespace !== "mathml" && isTargetMathML(target)) { 3094 namespace = "mathml"; 3095 } 3096 if (!disabled) { 3097 mount(target, targetAnchor); 3098 updateCssVars(n2, false); 3099 } 3100 } else if (!disabled) { 3101 warn$1( 3102 "Invalid Teleport target on mount:", 3103 target, 3104 `(${typeof target})` 3105 ); 3106 } 3107 }; 3108 if (disabled) { 3109 mount(container, mainAnchor); 3110 updateCssVars(n2, true); 3111 } 3112 if (isTeleportDeferred(n2.props)) { 3113 n2.el.__isMounted = false; 3114 queuePostRenderEffect(() => { 3115 mountToTarget(); 3116 delete n2.el.__isMounted; 3117 }, parentSuspense); 3118 } else { 3119 mountToTarget(); 3120 } 3121 } else { 3122 if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) { 3123 queuePostRenderEffect(() => { 3124 TeleportImpl.process( 3125 n1, 3126 n2, 3127 container, 3128 anchor, 3129 parentComponent, 3130 parentSuspense, 3131 namespace, 3132 slotScopeIds, 3133 optimized, 3134 internals 3135 ); 3136 }, parentSuspense); 3137 return; 3138 } 3139 n2.el = n1.el; 3140 n2.targetStart = n1.targetStart; 3141 const mainAnchor = n2.anchor = n1.anchor; 3142 const target = n2.target = n1.target; 3143 const targetAnchor = n2.targetAnchor = n1.targetAnchor; 3144 const wasDisabled = isTeleportDisabled(n1.props); 3145 const currentContainer = wasDisabled ? container : target; 3146 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor; 3147 if (namespace === "svg" || isTargetSVG(target)) { 3148 namespace = "svg"; 3149 } else if (namespace === "mathml" || isTargetMathML(target)) { 3150 namespace = "mathml"; 3151 } 3152 if (dynamicChildren) { 3153 patchBlockChildren( 3154 n1.dynamicChildren, 3155 dynamicChildren, 3156 currentContainer, 3157 parentComponent, 3158 parentSuspense, 3159 namespace, 3160 slotScopeIds 3161 ); 3162 traverseStaticChildren(n1, n2, false); 3163 } else if (!optimized) { 3164 patchChildren( 3165 n1, 3166 n2, 3167 currentContainer, 3168 currentAnchor, 3169 parentComponent, 3170 parentSuspense, 3171 namespace, 3172 slotScopeIds, 3173 false 3174 ); 3175 } 3176 if (disabled) { 3177 if (!wasDisabled) { 3178 moveTeleport( 3179 n2, 3180 container, 3181 mainAnchor, 3182 internals, 3183 1 3184 ); 3185 } else { 3186 if (n2.props && n1.props && n2.props.to !== n1.props.to) { 3187 n2.props.to = n1.props.to; 3188 } 3189 } 3190 } else { 3191 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) { 3192 const nextTarget = n2.target = resolveTarget( 3193 n2.props, 3194 querySelector 3195 ); 3196 if (nextTarget) { 3197 moveTeleport( 3198 n2, 3199 nextTarget, 3200 null, 3201 internals, 3202 0 3203 ); 3204 } else { 3205 warn$1( 3206 "Invalid Teleport target on update:", 3207 target, 3208 `(${typeof target})` 3209 ); 3210 } 3211 } else if (wasDisabled) { 3212 moveTeleport( 3213 n2, 3214 target, 3215 targetAnchor, 3216 internals, 3217 1 3218 ); 3219 } 3220 } 3221 updateCssVars(n2, disabled); 3222 } 3223 }, 3224 remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) { 3225 const { 3226 shapeFlag, 3227 children, 3228 anchor, 3229 targetStart, 3230 targetAnchor, 3231 target, 3232 props 3233 } = vnode; 3234 if (target) { 3235 hostRemove(targetStart); 3236 hostRemove(targetAnchor); 3237 } 3238 doRemove && hostRemove(anchor); 3239 if (shapeFlag & 16) { 3240 const shouldRemove = doRemove || !isTeleportDisabled(props); 3241 for (let i = 0; i < children.length; i++) { 3242 const child = children[i]; 3243 unmount( 3244 child, 3245 parentComponent, 3246 parentSuspense, 3247 shouldRemove, 3248 !!child.dynamicChildren 3249 ); 3250 } 3251 } 3252 }, 3253 move: moveTeleport, 3254 hydrate: hydrateTeleport 3255 }; 3256 function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) { 3257 if (moveType === 0) { 3258 insert(vnode.targetAnchor, container, parentAnchor); 3259 } 3260 const { el, anchor, shapeFlag, children, props } = vnode; 3261 const isReorder = moveType === 2; 3262 if (isReorder) { 3263 insert(el, container, parentAnchor); 3264 } 3265 if (!isReorder || isTeleportDisabled(props)) { 3266 if (shapeFlag & 16) { 3267 for (let i = 0; i < children.length; i++) { 3268 move( 3269 children[i], 3270 container, 3271 parentAnchor, 3272 2 3273 ); 3274 } 3275 } 3276 } 3277 if (isReorder) { 3278 insert(anchor, container, parentAnchor); 3279 } 3280 } 3281 function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { 3282 o: { nextSibling, parentNode, querySelector, insert, createText } 3283 }, hydrateChildren) { 3284 function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) { 3285 vnode2.anchor = hydrateChildren( 3286 nextSibling(node2), 3287 vnode2, 3288 parentNode(node2), 3289 parentComponent, 3290 parentSuspense, 3291 slotScopeIds, 3292 optimized 3293 ); 3294 vnode2.targetStart = targetStart; 3295 vnode2.targetAnchor = targetAnchor; 3296 } 3297 const target = vnode.target = resolveTarget( 3298 vnode.props, 3299 querySelector 3300 ); 3301 const disabled = isTeleportDisabled(vnode.props); 3302 if (target) { 3303 const targetNode = target._lpa || target.firstChild; 3304 if (vnode.shapeFlag & 16) { 3305 if (disabled) { 3306 hydrateDisabledTeleport( 3307 node, 3308 vnode, 3309 targetNode, 3310 targetNode && nextSibling(targetNode) 3311 ); 3312 } else { 3313 vnode.anchor = nextSibling(node); 3314 let targetAnchor = targetNode; 3315 while (targetAnchor) { 3316 if (targetAnchor && targetAnchor.nodeType === 8) { 3317 if (targetAnchor.data === "teleport start anchor") { 3318 vnode.targetStart = targetAnchor; 3319 } else if (targetAnchor.data === "teleport anchor") { 3320 vnode.targetAnchor = targetAnchor; 3321 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor); 3322 break; 3323 } 3324 } 3325 targetAnchor = nextSibling(targetAnchor); 3326 } 3327 if (!vnode.targetAnchor) { 3328 prepareAnchor(target, vnode, createText, insert); 3329 } 3330 hydrateChildren( 3331 targetNode && nextSibling(targetNode), 3332 vnode, 3333 target, 3334 parentComponent, 3335 parentSuspense, 3336 slotScopeIds, 3337 optimized 3338 ); 3339 } 3340 } 3341 updateCssVars(vnode, disabled); 3342 } else if (disabled) { 3343 if (vnode.shapeFlag & 16) { 3344 hydrateDisabledTeleport(node, vnode, node, nextSibling(node)); 3345 } 3346 } 3347 return vnode.anchor && nextSibling(vnode.anchor); 3348 } 3349 const Teleport = TeleportImpl; 3350 function updateCssVars(vnode, isDisabled) { 3351 const ctx = vnode.ctx; 3352 if (ctx && ctx.ut) { 3353 let node, anchor; 3354 if (isDisabled) { 3355 node = vnode.el; 3356 anchor = vnode.anchor; 3357 } else { 3358 node = vnode.targetStart; 3359 anchor = vnode.targetAnchor; 3360 } 3361 while (node && node !== anchor) { 3362 if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid); 3363 node = node.nextSibling; 3364 } 3365 ctx.ut(); 3366 } 3367 } 3368 function prepareAnchor(target, vnode, createText, insert) { 3369 const targetStart = vnode.targetStart = createText(""); 3370 const targetAnchor = vnode.targetAnchor = createText(""); 3371 targetStart[TeleportEndKey] = targetAnchor; 3372 if (target) { 3373 insert(targetStart, target); 3374 insert(targetAnchor, target); 3375 } 3376 return targetAnchor; 3377 } 3378 3379 const leaveCbKey = Symbol("_leaveCb"); 3380 const enterCbKey$1 = Symbol("_enterCb"); 3381 function useTransitionState() { 3382 const state = { 3383 isMounted: false, 3384 isLeaving: false, 3385 isUnmounting: false, 3386 leavingVNodes: /* @__PURE__ */ new Map() 3387 }; 3388 onMounted(() => { 3389 state.isMounted = true; 3390 });
vendor: 42,150 bytes, lines 3391-4660
3391 onBeforeUnmount(() => { 3392 state.isUnmounting = true; 3393 }); 3394 return state; 3395 } 3396 const TransitionHookValidator = [Function, Array]; 3397 const BaseTransitionPropsValidators = { 3398 mode: String, 3399 appear: Boolean, 3400 persisted: Boolean, 3401 // enter 3402 onBeforeEnter: TransitionHookValidator, 3403 onEnter: TransitionHookValidator, 3404 onAfterEnter: TransitionHookValidator, 3405 onEnterCancelled: TransitionHookValidator, 3406 // leave 3407 onBeforeLeave: TransitionHookValidator, 3408 onLeave: TransitionHookValidator, 3409 onAfterLeave: TransitionHookValidator, 3410 onLeaveCancelled: TransitionHookValidator, 3411 // appear 3412 onBeforeAppear: TransitionHookValidator, 3413 onAppear: TransitionHookValidator, 3414 onAfterAppear: TransitionHookValidator, 3415 onAppearCancelled: TransitionHookValidator 3416 }; 3417 const recursiveGetSubtree = (instance) => { 3418 const subTree = instance.subTree; 3419 return subTree.component ? recursiveGetSubtree(subTree.component) : subTree; 3420 }; 3421 const BaseTransitionImpl = { 3422 name: `BaseTransition`, 3423 props: BaseTransitionPropsValidators, 3424 setup(props, { slots }) { 3425 const instance = getCurrentInstance(); 3426 const state = useTransitionState(); 3427 return () => { 3428 const children = slots.default && getTransitionRawChildren(slots.default(), true); 3429 if (!children || !children.length) { 3430 return; 3431 } 3432 const child = findNonCommentChild(children); 3433 const rawProps = toRaw(props); 3434 const { mode } = rawProps; 3435 if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") { 3436 warn$1(`invalid <transition> mode: ${mode}`); 3437 } 3438 if (state.isLeaving) { 3439 return emptyPlaceholder(child); 3440 } 3441 const innerChild = getInnerChild$1(child); 3442 if (!innerChild) { 3443 return emptyPlaceholder(child); 3444 } 3445 let enterHooks = resolveTransitionHooks( 3446 innerChild, 3447 rawProps, 3448 state, 3449 instance, 3450 // #11061, ensure enterHooks is fresh after clone 3451 (hooks) => enterHooks = hooks 3452 ); 3453 if (innerChild.type !== Comment) { 3454 setTransitionHooks(innerChild, enterHooks); 3455 } 3456 let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree); 3457 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) { 3458 let leavingHooks = resolveTransitionHooks( 3459 oldInnerChild, 3460 rawProps, 3461 state, 3462 instance 3463 ); 3464 setTransitionHooks(oldInnerChild, leavingHooks); 3465 if (mode === "out-in" && innerChild.type !== Comment) { 3466 state.isLeaving = true; 3467 leavingHooks.afterLeave = () => { 3468 state.isLeaving = false; 3469 if (!(instance.job.flags & 8)) { 3470 instance.update(); 3471 } 3472 delete leavingHooks.afterLeave; 3473 oldInnerChild = void 0; 3474 }; 3475 return emptyPlaceholder(child); 3476 } else if (mode === "in-out" && innerChild.type !== Comment) { 3477 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { 3478 const leavingVNodesCache = getLeavingNodesForType( 3479 state, 3480 oldInnerChild 3481 ); 3482 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; 3483 el[leaveCbKey] = () => { 3484 earlyRemove(); 3485 el[leaveCbKey] = void 0; 3486 delete enterHooks.delayedLeave; 3487 oldInnerChild = void 0; 3488 }; 3489 enterHooks.delayedLeave = () => { 3490 delayedLeave(); 3491 delete enterHooks.delayedLeave; 3492 oldInnerChild = void 0; 3493 }; 3494 }; 3495 } else { 3496 oldInnerChild = void 0; 3497 } 3498 } else if (oldInnerChild) { 3499 oldInnerChild = void 0; 3500 } 3501 return child; 3502 }; 3503 } 3504 }; 3505 function findNonCommentChild(children) { 3506 let child = children[0]; 3507 if (children.length > 1) { 3508 let hasFound = false; 3509 for (const c of children) { 3510 if (c.type !== Comment) { 3511 if (hasFound) { 3512 warn$1( 3513 "<transition> can only be used on a single element or component. Use <transition-group> for lists." 3514 ); 3515 break; 3516 } 3517 child = c; 3518 hasFound = true; 3519 } 3520 } 3521 } 3522 return child; 3523 } 3524 const BaseTransition = BaseTransitionImpl; 3525 function getLeavingNodesForType(state, vnode) { 3526 const { leavingVNodes } = state; 3527 let leavingVNodesCache = leavingVNodes.get(vnode.type); 3528 if (!leavingVNodesCache) { 3529 leavingVNodesCache = /* @__PURE__ */ Object.create(null); 3530 leavingVNodes.set(vnode.type, leavingVNodesCache); 3531 } 3532 return leavingVNodesCache; 3533 } 3534 function resolveTransitionHooks(vnode, props, state, instance, postClone) { 3535 const { 3536 appear, 3537 mode, 3538 persisted = false, 3539 onBeforeEnter, 3540 onEnter, 3541 onAfterEnter, 3542 onEnterCancelled, 3543 onBeforeLeave, 3544 onLeave, 3545 onAfterLeave, 3546 onLeaveCancelled, 3547 onBeforeAppear, 3548 onAppear, 3549 onAfterAppear, 3550 onAppearCancelled 3551 } = props; 3552 const key = String(vnode.key); 3553 const leavingVNodesCache = getLeavingNodesForType(state, vnode); 3554 const callHook = (hook, args) => { 3555 hook && callWithAsyncErrorHandling( 3556 hook, 3557 instance, 3558 9, 3559 args 3560 ); 3561 }; 3562 const callAsyncHook = (hook, args) => { 3563 const done = args[1]; 3564 callHook(hook, args); 3565 if (isArray(hook)) { 3566 if (hook.every((hook2) => hook2.length <= 1)) done(); 3567 } else if (hook.length <= 1) { 3568 done(); 3569 } 3570 }; 3571 const hooks = { 3572 mode, 3573 persisted, 3574 beforeEnter(el) { 3575 let hook = onBeforeEnter; 3576 if (!state.isMounted) { 3577 if (appear) { 3578 hook = onBeforeAppear || onBeforeEnter; 3579 } else { 3580 return; 3581 } 3582 } 3583 if (el[leaveCbKey]) { 3584 el[leaveCbKey]( 3585 true 3586 /* cancelled */ 3587 ); 3588 } 3589 const leavingVNode = leavingVNodesCache[key]; 3590 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) { 3591 leavingVNode.el[leaveCbKey](); 3592 } 3593 callHook(hook, [el]); 3594 }, 3595 enter(el) { 3596 let hook = onEnter; 3597 let afterHook = onAfterEnter; 3598 let cancelHook = onEnterCancelled; 3599 if (!state.isMounted) { 3600 if (appear) { 3601 hook = onAppear || onEnter; 3602 afterHook = onAfterAppear || onAfterEnter; 3603 cancelHook = onAppearCancelled || onEnterCancelled; 3604 } else { 3605 return; 3606 } 3607 } 3608 let called = false; 3609 const done = el[enterCbKey$1] = (cancelled) => { 3610 if (called) return; 3611 called = true; 3612 if (cancelled) { 3613 callHook(cancelHook, [el]); 3614 } else { 3615 callHook(afterHook, [el]); 3616 } 3617 if (hooks.delayedLeave) { 3618 hooks.delayedLeave(); 3619 } 3620 el[enterCbKey$1] = void 0; 3621 }; 3622 if (hook) { 3623 callAsyncHook(hook, [el, done]); 3624 } else { 3625 done(); 3626 } 3627 }, 3628 leave(el, remove) { 3629 const key2 = String(vnode.key); 3630 if (el[enterCbKey$1]) { 3631 el[enterCbKey$1]( 3632 true 3633 /* cancelled */ 3634 ); 3635 } 3636 if (state.isUnmounting) { 3637 return remove(); 3638 } 3639 callHook(onBeforeLeave, [el]); 3640 let called = false; 3641 const done = el[leaveCbKey] = (cancelled) => { 3642 if (called) return; 3643 called = true; 3644 remove(); 3645 if (cancelled) { 3646 callHook(onLeaveCancelled, [el]); 3647 } else { 3648 callHook(onAfterLeave, [el]); 3649 } 3650 el[leaveCbKey] = void 0; 3651 if (leavingVNodesCache[key2] === vnode) { 3652 delete leavingVNodesCache[key2]; 3653 } 3654 }; 3655 leavingVNodesCache[key2] = vnode; 3656 if (onLeave) { 3657 callAsyncHook(onLeave, [el, done]); 3658 } else { 3659 done(); 3660 } 3661 }, 3662 clone(vnode2) { 3663 const hooks2 = resolveTransitionHooks( 3664 vnode2, 3665 props, 3666 state, 3667 instance, 3668 postClone 3669 ); 3670 if (postClone) postClone(hooks2); 3671 return hooks2; 3672 } 3673 }; 3674 return hooks; 3675 } 3676 function emptyPlaceholder(vnode) { 3677 if (isKeepAlive(vnode)) { 3678 vnode = cloneVNode(vnode); 3679 vnode.children = null; 3680 return vnode; 3681 } 3682 } 3683 function getInnerChild$1(vnode) { 3684 if (!isKeepAlive(vnode)) { 3685 if (isTeleport(vnode.type) && vnode.children) { 3686 return findNonCommentChild(vnode.children); 3687 } 3688 return vnode; 3689 } 3690 if (vnode.component) { 3691 return vnode.component.subTree; 3692 } 3693 const { shapeFlag, children } = vnode; 3694 if (children) { 3695 if (shapeFlag & 16) { 3696 return children[0]; 3697 } 3698 if (shapeFlag & 32 && isFunction(children.default)) { 3699 return children.default(); 3700 } 3701 } 3702 } 3703 function setTransitionHooks(vnode, hooks) { 3704 if (vnode.shapeFlag & 6 && vnode.component) { 3705 vnode.transition = hooks; 3706 setTransitionHooks(vnode.component.subTree, hooks); 3707 } else if (vnode.shapeFlag & 128) { 3708 vnode.ssContent.transition = hooks.clone(vnode.ssContent); 3709 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback); 3710 } else { 3711 vnode.transition = hooks; 3712 } 3713 } 3714 function getTransitionRawChildren(children, keepComment = false, parentKey) { 3715 let ret = []; 3716 let keyedFragmentCount = 0; 3717 for (let i = 0; i < children.length; i++) { 3718 let child = children[i]; 3719 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i); 3720 if (child.type === Fragment) { 3721 if (child.patchFlag & 128) keyedFragmentCount++; 3722 ret = ret.concat( 3723 getTransitionRawChildren(child.children, keepComment, key) 3724 ); 3725 } else if (keepComment || child.type !== Comment) { 3726 ret.push(key != null ? cloneVNode(child, { key }) : child); 3727 } 3728 } 3729 if (keyedFragmentCount > 1) { 3730 for (let i = 0; i < ret.length; i++) { 3731 ret[i].patchFlag = -2; 3732 } 3733 } 3734 return ret; 3735 } 3736 3737 // @__NO_SIDE_EFFECTS__ 3738 function defineComponent(options, extraOptions) { 3739 return isFunction(options) ? ( 3740 // #8236: extend call and options.name access are considered side-effects 3741 // by Rollup, so we have to wrap it in a pure-annotated IIFE. 3742 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))() 3743 ) : options; 3744 } 3745 3746 function useId() { 3747 const i = getCurrentInstance(); 3748 if (i) { 3749 return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++; 3750 } else { 3751 warn$1( 3752 `useId() is called when there is no active component instance to be associated with.` 3753 ); 3754 } 3755 return ""; 3756 } 3757 function markAsyncBoundary(instance) { 3758 instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0]; 3759 } 3760 3761 const knownTemplateRefs = /* @__PURE__ */ new WeakSet(); 3762 function useTemplateRef(key) { 3763 const i = getCurrentInstance(); 3764 const r = shallowRef(null); 3765 if (i) { 3766 const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs; 3767 let desc; 3768 if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) { 3769 warn$1(`useTemplateRef('${key}') already exists.`); 3770 } else { 3771 Object.defineProperty(refs, key, { 3772 enumerable: true, 3773 get: () => r.value, 3774 set: (val) => r.value = val 3775 }); 3776 } 3777 } else { 3778 warn$1( 3779 `useTemplateRef() is called when there is no active component instance to be associated with.` 3780 ); 3781 } 3782 const ret = readonly(r) ; 3783 { 3784 knownTemplateRefs.add(ret); 3785 } 3786 return ret; 3787 } 3788 3789 const pendingSetRefMap = /* @__PURE__ */ new WeakMap(); 3790 function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { 3791 if (isArray(rawRef)) { 3792 rawRef.forEach( 3793 (r, i) => setRef( 3794 r, 3795 oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), 3796 parentSuspense, 3797 vnode, 3798 isUnmount 3799 ) 3800 ); 3801 return; 3802 } 3803 if (isAsyncWrapper(vnode) && !isUnmount) { 3804 if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) { 3805 setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree); 3806 } 3807 return; 3808 } 3809 const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el; 3810 const value = isUnmount ? null : refValue; 3811 const { i: owner, r: ref } = rawRef; 3812 if (!owner) { 3813 warn$1( 3814 `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.` 3815 ); 3816 return; 3817 } 3818 const oldRef = oldRawRef && oldRawRef.r; 3819 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs; 3820 const setupState = owner.setupState; 3821 const rawSetupState = toRaw(setupState); 3822 const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => { 3823 { 3824 if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) { 3825 warn$1( 3826 `Template ref "${key}" used on a non-ref value. It will not work in the production build.` 3827 ); 3828 } 3829 if (knownTemplateRefs.has(rawSetupState[key])) { 3830 return false; 3831 } 3832 } 3833 return hasOwn(rawSetupState, key); 3834 }; 3835 const canSetRef = (ref2) => { 3836 return !knownTemplateRefs.has(ref2); 3837 }; 3838 if (oldRef != null && oldRef !== ref) { 3839 invalidatePendingSetRef(oldRawRef); 3840 if (isString(oldRef)) { 3841 refs[oldRef] = null; 3842 if (canSetSetupRef(oldRef)) { 3843 setupState[oldRef] = null; 3844 } 3845 } else if (isRef(oldRef)) { 3846 if (canSetRef(oldRef)) { 3847 oldRef.value = null; 3848 } 3849 const oldRawRefAtom = oldRawRef; 3850 if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null; 3851 } 3852 } 3853 if (isFunction(ref)) { 3854 callWithErrorHandling(ref, owner, 12, [value, refs]); 3855 } else { 3856 const _isString = isString(ref); 3857 const _isRef = isRef(ref); 3858 if (_isString || _isRef) { 3859 const doSet = () => { 3860 if (rawRef.f) { 3861 const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k]; 3862 if (isUnmount) { 3863 isArray(existing) && remove(existing, refValue); 3864 } else { 3865 if (!isArray(existing)) { 3866 if (_isString) { 3867 refs[ref] = [refValue]; 3868 if (canSetSetupRef(ref)) { 3869 setupState[ref] = refs[ref]; 3870 } 3871 } else { 3872 const newVal = [refValue]; 3873 if (canSetRef(ref)) { 3874 ref.value = newVal; 3875 } 3876 if (rawRef.k) refs[rawRef.k] = newVal; 3877 } 3878 } else if (!existing.includes(refValue)) { 3879 existing.push(refValue); 3880 } 3881 } 3882 } else if (_isString) { 3883 refs[ref] = value; 3884 if (canSetSetupRef(ref)) { 3885 setupState[ref] = value; 3886 } 3887 } else if (_isRef) { 3888 if (canSetRef(ref)) { 3889 ref.value = value; 3890 } 3891 if (rawRef.k) refs[rawRef.k] = value; 3892 } else { 3893 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 3894 } 3895 }; 3896 if (value) { 3897 const job = () => { 3898 doSet(); 3899 pendingSetRefMap.delete(rawRef); 3900 }; 3901 job.id = -1; 3902 pendingSetRefMap.set(rawRef, job); 3903 queuePostRenderEffect(job, parentSuspense); 3904 } else { 3905 invalidatePendingSetRef(rawRef); 3906 doSet(); 3907 } 3908 } else { 3909 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 3910 } 3911 } 3912 } 3913 function invalidatePendingSetRef(rawRef) { 3914 const pendingSetRef = pendingSetRefMap.get(rawRef); 3915 if (pendingSetRef) { 3916 pendingSetRef.flags |= 8; 3917 pendingSetRefMap.delete(rawRef); 3918 } 3919 } 3920 3921 let hasLoggedMismatchError = false; 3922 const logMismatchError = () => { 3923 if (hasLoggedMismatchError) { 3924 return; 3925 } 3926 console.error("Hydration completed but contains mismatches."); 3927 hasLoggedMismatchError = true; 3928 }; 3929 const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject"; 3930 const isMathMLContainer = (container) => container.namespaceURI.includes("MathML"); 3931 const getContainerType = (container) => { 3932 if (container.nodeType !== 1) return void 0; 3933 if (isSVGContainer(container)) return "svg"; 3934 if (isMathMLContainer(container)) return "mathml"; 3935 return void 0; 3936 }; 3937 const isComment = (node) => node.nodeType === 8; 3938 function createHydrationFunctions(rendererInternals) { 3939 const { 3940 mt: mountComponent, 3941 p: patch, 3942 o: { 3943 patchProp, 3944 createText, 3945 nextSibling, 3946 parentNode, 3947 remove, 3948 insert, 3949 createComment 3950 } 3951 } = rendererInternals; 3952 const hydrate = (vnode, container) => { 3953 if (!container.hasChildNodes()) { 3954 warn$1( 3955 `Attempting to hydrate existing markup but container is empty. Performing full mount instead.` 3956 ); 3957 patch(null, vnode, container); 3958 flushPostFlushCbs(); 3959 container._vnode = vnode; 3960 return; 3961 } 3962 hydrateNode(container.firstChild, vnode, null, null, null); 3963 flushPostFlushCbs(); 3964 container._vnode = vnode; 3965 }; 3966 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => { 3967 optimized = optimized || !!vnode.dynamicChildren; 3968 const isFragmentStart = isComment(node) && node.data === "["; 3969 const onMismatch = () => handleMismatch( 3970 node, 3971 vnode, 3972 parentComponent, 3973 parentSuspense, 3974 slotScopeIds, 3975 isFragmentStart 3976 ); 3977 const { type, ref, shapeFlag, patchFlag } = vnode; 3978 let domType = node.nodeType; 3979 vnode.el = node; 3980 { 3981 def(node, "__vnode", vnode, true); 3982 def(node, "__vueParentComponent", parentComponent, true); 3983 } 3984 if (patchFlag === -2) { 3985 optimized = false; 3986 vnode.dynamicChildren = null; 3987 } 3988 let nextNode = null; 3989 switch (type) { 3990 case Text: 3991 if (domType !== 3) { 3992 if (vnode.children === "") { 3993 insert(vnode.el = createText(""), parentNode(node), node); 3994 nextNode = node; 3995 } else { 3996 nextNode = onMismatch(); 3997 } 3998 } else { 3999 if (node.data !== vnode.children) { 4000 warn$1( 4001 `Hydration text mismatch in`, 4002 node.parentNode, 4003 ` 4004 - rendered on server: ${JSON.stringify( 4005 node.data 4006 )} 4007 - expected on client: ${JSON.stringify(vnode.children)}` 4008 ); 4009 logMismatchError(); 4010 node.data = vnode.children; 4011 } 4012 nextNode = nextSibling(node); 4013 } 4014 break; 4015 case Comment: 4016 if (isTemplateNode(node)) { 4017 nextNode = nextSibling(node); 4018 replaceNode( 4019 vnode.el = node.content.firstChild, 4020 node, 4021 parentComponent 4022 ); 4023 } else if (domType !== 8 || isFragmentStart) { 4024 nextNode = onMismatch(); 4025 } else { 4026 nextNode = nextSibling(node); 4027 } 4028 break; 4029 case Static: 4030 if (isFragmentStart) { 4031 node = nextSibling(node); 4032 domType = node.nodeType; 4033 } 4034 if (domType === 1 || domType === 3) { 4035 nextNode = node; 4036 const needToAdoptContent = !vnode.children.length; 4037 for (let i = 0; i < vnode.staticCount; i++) { 4038 if (needToAdoptContent) 4039 vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data; 4040 if (i === vnode.staticCount - 1) { 4041 vnode.anchor = nextNode; 4042 } 4043 nextNode = nextSibling(nextNode); 4044 } 4045 return isFragmentStart ? nextSibling(nextNode) : nextNode; 4046 } else { 4047 onMismatch(); 4048 } 4049 break; 4050 case Fragment: 4051 if (!isFragmentStart) { 4052 nextNode = onMismatch(); 4053 } else { 4054 nextNode = hydrateFragment( 4055 node, 4056 vnode, 4057 parentComponent, 4058 parentSuspense, 4059 slotScopeIds, 4060 optimized 4061 ); 4062 } 4063 break; 4064 default: 4065 if (shapeFlag & 1) { 4066 if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) { 4067 nextNode = onMismatch(); 4068 } else { 4069 nextNode = hydrateElement( 4070 node, 4071 vnode, 4072 parentComponent, 4073 parentSuspense, 4074 slotScopeIds, 4075 optimized 4076 ); 4077 } 4078 } else if (shapeFlag & 6) { 4079 vnode.slotScopeIds = slotScopeIds; 4080 const container = parentNode(node); 4081 if (isFragmentStart) { 4082 nextNode = locateClosingAnchor(node); 4083 } else if (isComment(node) && node.data === "teleport start") { 4084 nextNode = locateClosingAnchor(node, node.data, "teleport end"); 4085 } else { 4086 nextNode = nextSibling(node); 4087 } 4088 mountComponent( 4089 vnode, 4090 container, 4091 null, 4092 parentComponent, 4093 parentSuspense, 4094 getContainerType(container), 4095 optimized 4096 ); 4097 if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) { 4098 let subTree; 4099 if (isFragmentStart) { 4100 subTree = createVNode(Fragment); 4101 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild; 4102 } else { 4103 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div"); 4104 } 4105 subTree.el = node; 4106 vnode.component.subTree = subTree; 4107 } 4108 } else if (shapeFlag & 64) { 4109 if (domType !== 8) { 4110 nextNode = onMismatch(); 4111 } else { 4112 nextNode = vnode.type.hydrate( 4113 node, 4114 vnode, 4115 parentComponent, 4116 parentSuspense, 4117 slotScopeIds, 4118 optimized, 4119 rendererInternals, 4120 hydrateChildren 4121 ); 4122 } 4123 } else if (shapeFlag & 128) { 4124 nextNode = vnode.type.hydrate( 4125 node, 4126 vnode, 4127 parentComponent, 4128 parentSuspense, 4129 getContainerType(parentNode(node)), 4130 slotScopeIds, 4131 optimized, 4132 rendererInternals, 4133 hydrateNode 4134 ); 4135 } else { 4136 warn$1("Invalid HostVNode type:", type, `(${typeof type})`); 4137 } 4138 } 4139 if (ref != null) { 4140 setRef(ref, null, parentSuspense, vnode); 4141 } 4142 return nextNode; 4143 }; 4144 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4145 optimized = optimized || !!vnode.dynamicChildren; 4146 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode; 4147 const forcePatch = type === "input" || type === "option"; 4148 { 4149 if (dirs) { 4150 invokeDirectiveHook(vnode, null, parentComponent, "created"); 4151 } 4152 let needCallTransitionHooks = false; 4153 if (isTemplateNode(el)) { 4154 needCallTransitionHooks = needTransition( 4155 null, 4156 // no need check parentSuspense in hydration 4157 transition 4158 ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; 4159 const content = el.content.firstChild; 4160 if (needCallTransitionHooks) { 4161 const cls = content.getAttribute("class"); 4162 if (cls) content.$cls = cls; 4163 transition.beforeEnter(content); 4164 } 4165 replaceNode(content, el, parentComponent); 4166 vnode.el = el = content; 4167 } 4168 if (shapeFlag & 16 && // skip if element has innerHTML / textContent 4169 !(props && (props.innerHTML || props.textContent))) { 4170 let next = hydrateChildren( 4171 el.firstChild, 4172 vnode, 4173 el, 4174 parentComponent, 4175 parentSuspense, 4176 slotScopeIds, 4177 optimized 4178 ); 4179 let hasWarned = false; 4180 while (next) { 4181 if (!isMismatchAllowed(el, 1 /* CHILDREN */)) { 4182 if (!hasWarned) { 4183 warn$1( 4184 `Hydration children mismatch on`, 4185 el, 4186 ` 4187Server rendered element contains more child nodes than client vdom.` 4188 ); 4189 hasWarned = true; 4190 } 4191 logMismatchError(); 4192 } 4193 const cur = next; 4194 next = next.nextSibling; 4195 remove(cur); 4196 } 4197 } else if (shapeFlag & 8) { 4198 let clientText = vnode.children; 4199 if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) { 4200 clientText = clientText.slice(1); 4201 } 4202 if (el.textContent !== clientText) { 4203 if (!isMismatchAllowed(el, 0 /* TEXT */)) { 4204 warn$1( 4205 `Hydration text content mismatch on`, 4206 el, 4207 ` 4208 - rendered on server: ${el.textContent} 4209 - expected on client: ${vnode.children}` 4210 ); 4211 logMismatchError(); 4212 } 4213 el.textContent = vnode.children; 4214 } 4215 } 4216 if (props) { 4217 { 4218 const isCustomElement = el.tagName.includes("-"); 4219 for (const key in props) { 4220 if (// #11189 skip if this node has directives that have created hooks 4221 // as it could have mutated the DOM in any possible way 4222 !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) { 4223 logMismatchError(); 4224 } 4225 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers 4226 key[0] === "." || isCustomElement) { 4227 patchProp(el, key, null, props[key], void 0, parentComponent); 4228 } 4229 } 4230 } 4231 } 4232 let vnodeHooks; 4233 if (vnodeHooks = props && props.onVnodeBeforeMount) { 4234 invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4235 } 4236 if (dirs) { 4237 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 4238 } 4239 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) { 4240 queueEffectWithSuspense(() => { 4241 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4242 needCallTransitionHooks && transition.enter(el); 4243 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 4244 }, parentSuspense); 4245 } 4246 } 4247 return el.nextSibling; 4248 }; 4249 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4250 optimized = optimized || !!parentVNode.dynamicChildren; 4251 const children = parentVNode.children; 4252 const l = children.length; 4253 let hasWarned = false; 4254 for (let i = 0; i < l; i++) { 4255 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]); 4256 const isText = vnode.type === Text; 4257 if (node) { 4258 if (isText && !optimized) { 4259 if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) { 4260 insert( 4261 createText( 4262 node.data.slice(vnode.children.length) 4263 ), 4264 container, 4265 nextSibling(node) 4266 ); 4267 node.data = vnode.children; 4268 } 4269 } 4270 node = hydrateNode( 4271 node, 4272 vnode, 4273 parentComponent, 4274 parentSuspense, 4275 slotScopeIds, 4276 optimized 4277 ); 4278 } else if (isText && !vnode.children) { 4279 insert(vnode.el = createText(""), container); 4280 } else { 4281 if (!isMismatchAllowed(container, 1 /* CHILDREN */)) { 4282 if (!hasWarned) { 4283 warn$1( 4284 `Hydration children mismatch on`, 4285 container, 4286 ` 4287Server rendered element contains fewer child nodes than client vdom.` 4288 ); 4289 hasWarned = true; 4290 } 4291 logMismatchError(); 4292 } 4293 patch( 4294 null, 4295 vnode, 4296 container, 4297 null, 4298 parentComponent, 4299 parentSuspense, 4300 getContainerType(container), 4301 slotScopeIds 4302 ); 4303 } 4304 } 4305 return node; 4306 }; 4307 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4308 const { slotScopeIds: fragmentSlotScopeIds } = vnode; 4309 if (fragmentSlotScopeIds) { 4310 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 4311 } 4312 const container = parentNode(node); 4313 const next = hydrateChildren( 4314 nextSibling(node), 4315 vnode, 4316 container, 4317 parentComponent, 4318 parentSuspense, 4319 slotScopeIds, 4320 optimized 4321 ); 4322 if (next && isComment(next) && next.data === "]") { 4323 return nextSibling(vnode.anchor = next); 4324 } else { 4325 logMismatchError(); 4326 insert(vnode.anchor = createComment(`]`), container, next); 4327 return next; 4328 } 4329 }; 4330 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => { 4331 if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) { 4332 warn$1( 4333 `Hydration node mismatch: 4334- rendered on server:`, 4335 node, 4336 node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``, 4337 ` 4338- expected on client:`, 4339 vnode.type 4340 ); 4341 logMismatchError(); 4342 } 4343 vnode.el = null; 4344 if (isFragment) { 4345 const end = locateClosingAnchor(node); 4346 while (true) { 4347 const next2 = nextSibling(node); 4348 if (next2 && next2 !== end) { 4349 remove(next2); 4350 } else { 4351 break; 4352 } 4353 } 4354 } 4355 const next = nextSibling(node); 4356 const container = parentNode(node); 4357 remove(node); 4358 patch( 4359 null, 4360 vnode, 4361 container, 4362 next, 4363 parentComponent, 4364 parentSuspense, 4365 getContainerType(container), 4366 slotScopeIds 4367 ); 4368 if (parentComponent) { 4369 parentComponent.vnode.el = vnode.el; 4370 updateHOCHostEl(parentComponent, vnode.el); 4371 } 4372 return next; 4373 }; 4374 const locateClosingAnchor = (node, open = "[", close = "]") => { 4375 let match = 0; 4376 while (node) { 4377 node = nextSibling(node); 4378 if (node && isComment(node)) { 4379 if (node.data === open) match++; 4380 if (node.data === close) { 4381 if (match === 0) { 4382 return nextSibling(node); 4383 } else { 4384 match--; 4385 } 4386 } 4387 } 4388 } 4389 return node; 4390 }; 4391 const replaceNode = (newNode, oldNode, parentComponent) => { 4392 const parentNode2 = oldNode.parentNode; 4393 if (parentNode2) { 4394 parentNode2.replaceChild(newNode, oldNode); 4395 } 4396 let parent = parentComponent; 4397 while (parent) { 4398 if (parent.vnode.el === oldNode) { 4399 parent.vnode.el = parent.subTree.el = newNode; 4400 } 4401 parent = parent.parent; 4402 } 4403 }; 4404 const isTemplateNode = (node) => { 4405 return node.nodeType === 1 && node.tagName === "TEMPLATE"; 4406 }; 4407 return [hydrate, hydrateNode]; 4408 } 4409 function propHasMismatch(el, key, clientValue, vnode, instance) { 4410 let mismatchType; 4411 let mismatchKey; 4412 let actual; 4413 let expected; 4414 if (key === "class") { 4415 if (el.$cls) { 4416 actual = el.$cls; 4417 delete el.$cls; 4418 } else { 4419 actual = el.getAttribute("class"); 4420 } 4421 expected = normalizeClass(clientValue); 4422 if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { 4423 mismatchType = 2 /* CLASS */; 4424 mismatchKey = `class`; 4425 } 4426 } else if (key === "style") { 4427 actual = el.getAttribute("style") || ""; 4428 expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue)); 4429 const actualMap = toStyleMap(actual); 4430 const expectedMap = toStyleMap(expected); 4431 if (vnode.dirs) { 4432 for (const { dir, value } of vnode.dirs) { 4433 if (dir.name === "show" && !value) { 4434 expectedMap.set("display", "none"); 4435 } 4436 } 4437 } 4438 if (instance) { 4439 resolveCssVars(instance, vnode, expectedMap); 4440 } 4441 if (!isMapEqual(actualMap, expectedMap)) { 4442 mismatchType = 3 /* STYLE */; 4443 mismatchKey = "style"; 4444 } 4445 } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) { 4446 if (isBooleanAttr(key)) { 4447 actual = el.hasAttribute(key); 4448 expected = includeBooleanAttr(clientValue); 4449 } else if (clientValue == null) { 4450 actual = el.hasAttribute(key); 4451 expected = false; 4452 } else { 4453 if (el.hasAttribute(key)) { 4454 actual = el.getAttribute(key); 4455 } else if (key === "value" && el.tagName === "TEXTAREA") { 4456 actual = el.value; 4457 } else { 4458 actual = false; 4459 } 4460 expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false; 4461 } 4462 if (actual !== expected) { 4463 mismatchType = 4 /* ATTRIBUTE */; 4464 mismatchKey = key; 4465 } 4466 } 4467 if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) { 4468 const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`; 4469 const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`; 4470 const postSegment = ` 4471 - rendered on server: ${format(actual)} 4472 - expected on client: ${format(expected)} 4473 Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead. 4474 You should fix the source of the mismatch.`; 4475 { 4476 warn$1(preSegment, el, postSegment); 4477 } 4478 return true; 4479 } 4480 return false; 4481 } 4482 function toClassSet(str) { 4483 return new Set(str.trim().split(/\s+/)); 4484 } 4485 function isSetEqual(a, b) { 4486 if (a.size !== b.size) { 4487 return false; 4488 } 4489 for (const s of a) { 4490 if (!b.has(s)) { 4491 return false; 4492 } 4493 } 4494 return true; 4495 } 4496 function toStyleMap(str) { 4497 const styleMap = /* @__PURE__ */ new Map(); 4498 for (const item of str.split(";")) { 4499 let [key, value] = item.split(":"); 4500 key = key.trim(); 4501 value = value && value.trim(); 4502 if (key && value) { 4503 styleMap.set(key, value); 4504 } 4505 } 4506 return styleMap; 4507 } 4508 function isMapEqual(a, b) { 4509 if (a.size !== b.size) { 4510 return false; 4511 } 4512 for (const [key, value] of a) { 4513 if (value !== b.get(key)) { 4514 return false; 4515 } 4516 } 4517 return true; 4518 } 4519 function resolveCssVars(instance, vnode, expectedMap) { 4520 const root = instance.subTree; 4521 if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) { 4522 const cssVars = instance.getCssVars(); 4523 for (const key in cssVars) { 4524 const value = normalizeCssVarValue(cssVars[key]); 4525 expectedMap.set(`--${getEscapedCssVarName(key)}`, value); 4526 } 4527 } 4528 if (vnode === root && instance.parent) { 4529 resolveCssVars(instance.parent, instance.vnode, expectedMap); 4530 } 4531 } 4532 const allowMismatchAttr = "data-allow-mismatch"; 4533 const MismatchTypeString = { 4534 [0 /* TEXT */]: "text", 4535 [1 /* CHILDREN */]: "children", 4536 [2 /* CLASS */]: "class", 4537 [3 /* STYLE */]: "style", 4538 [4 /* ATTRIBUTE */]: "attribute" 4539 }; 4540 function isMismatchAllowed(el, allowedType) { 4541 if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) { 4542 while (el && !el.hasAttribute(allowMismatchAttr)) { 4543 el = el.parentElement; 4544 } 4545 } 4546 const allowedAttr = el && el.getAttribute(allowMismatchAttr); 4547 if (allowedAttr == null) { 4548 return false; 4549 } else if (allowedAttr === "") { 4550 return true; 4551 } else { 4552 const list = allowedAttr.split(","); 4553 if (allowedType === 0 /* TEXT */ && list.includes("children")) { 4554 return true; 4555 } 4556 return list.includes(MismatchTypeString[allowedType]); 4557 } 4558 } 4559 4560 const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1)); 4561 const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id)); 4562 const hydrateOnIdle = (timeout = 1e4) => (hydrate) => { 4563 const id = requestIdleCallback(hydrate, { timeout }); 4564 return () => cancelIdleCallback(id); 4565 }; 4566 function elementIsVisibleInViewport(el) { 4567 const { top, left, bottom, right } = el.getBoundingClientRect(); 4568 const { innerHeight, innerWidth } = window; 4569 return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth); 4570 } 4571 const hydrateOnVisible = (opts) => (hydrate, forEach) => { 4572 const ob = new IntersectionObserver((entries) => { 4573 for (const e of entries) { 4574 if (!e.isIntersecting) continue; 4575 ob.disconnect(); 4576 hydrate(); 4577 break; 4578 } 4579 }, opts); 4580 forEach((el) => { 4581 if (!(el instanceof Element)) return; 4582 if (elementIsVisibleInViewport(el)) { 4583 hydrate(); 4584 ob.disconnect(); 4585 return false; 4586 } 4587 ob.observe(el); 4588 }); 4589 return () => ob.disconnect(); 4590 }; 4591 const hydrateOnMediaQuery = (query) => (hydrate) => { 4592 if (query) { 4593 const mql = matchMedia(query); 4594 if (mql.matches) { 4595 hydrate(); 4596 } else { 4597 mql.addEventListener("change", hydrate, { once: true }); 4598 return () => mql.removeEventListener("change", hydrate); 4599 } 4600 } 4601 }; 4602 const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => { 4603 if (isString(interactions)) interactions = [interactions]; 4604 let hasHydrated = false; 4605 const doHydrate = (e) => { 4606 if (!hasHydrated) { 4607 hasHydrated = true; 4608 teardown(); 4609 hydrate(); 4610 e.target.dispatchEvent(new e.constructor(e.type, e)); 4611 } 4612 }; 4613 const teardown = () => { 4614 forEach((el) => { 4615 for (const i of interactions) { 4616 el.removeEventListener(i, doHydrate); 4617 } 4618 }); 4619 }; 4620 forEach((el) => { 4621 for (const i of interactions) { 4622 el.addEventListener(i, doHydrate, { once: true }); 4623 } 4624 }); 4625 return teardown; 4626 }; 4627 function forEachElement(node, cb) { 4628 if (isComment(node) && node.data === "[") { 4629 let depth = 1; 4630 let next = node.nextSibling; 4631 while (next) { 4632 if (next.nodeType === 1) { 4633 const result = cb(next); 4634 if (result === false) { 4635 break; 4636 } 4637 } else if (isComment(next)) { 4638 if (next.data === "]") { 4639 if (--depth === 0) break; 4640 } else if (next.data === "[") { 4641 depth++; 4642 } 4643 } 4644 next = next.nextSibling; 4645 } 4646 } else { 4647 cb(node); 4648 } 4649 } 4650 4651 const isAsyncWrapper = (i) => !!i.type.__asyncLoader; 4652 // @__NO_SIDE_EFFECTS__ 4653 function defineAsyncComponent(source) { 4654 if (isFunction(source)) { 4655 source = { loader: source }; 4656 } 4657 const { 4658 loader, 4659 loadingComponent, 4660 errorComponent,
vendor: 4,208 bytes, lines 4661-4789
4661 delay = 200, 4662 hydrate: hydrateStrategy, 4663 timeout, 4664 // undefined = never times out 4665 suspensible = true, 4666 onError: userOnError 4667 } = source; 4668 let pendingRequest = null; 4669 let resolvedComp; 4670 let retries = 0; 4671 const retry = () => { 4672 retries++; 4673 pendingRequest = null; 4674 return load(); 4675 }; 4676 const load = () => { 4677 let thisRequest; 4678 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => { 4679 err = err instanceof Error ? err : new Error(String(err)); 4680 if (userOnError) { 4681 return new Promise((resolve, reject) => { 4682 const userRetry = () => resolve(retry()); 4683 const userFail = () => reject(err); 4684 userOnError(err, userRetry, userFail, retries + 1); 4685 }); 4686 } else { 4687 throw err; 4688 } 4689 }).then((comp) => { 4690 if (thisRequest !== pendingRequest && pendingRequest) { 4691 return pendingRequest; 4692 } 4693 if (!comp) { 4694 warn$1( 4695 `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.` 4696 ); 4697 } 4698 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) { 4699 comp = comp.default; 4700 } 4701 if (comp && !isObject(comp) && !isFunction(comp)) { 4702 throw new Error(`Invalid async component load result: ${comp}`); 4703 } 4704 resolvedComp = comp; 4705 return comp; 4706 })); 4707 }; 4708 return defineComponent({ 4709 name: "AsyncComponentWrapper", 4710 __asyncLoader: load, 4711 __asyncHydrate(el, instance, hydrate) { 4712 let patched = false; 4713 (instance.bu || (instance.bu = [])).push(() => patched = true); 4714 const performHydrate = () => { 4715 if (patched) { 4716 { 4717 warn$1( 4718 `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.` 4719 ); 4720 } 4721 return; 4722 } 4723 hydrate(); 4724 }; 4725 const doHydrate = hydrateStrategy ? () => { 4726 const teardown = hydrateStrategy( 4727 performHydrate, 4728 (cb) => forEachElement(el, cb) 4729 ); 4730 if (teardown) { 4731 (instance.bum || (instance.bum = [])).push(teardown); 4732 } 4733 } : performHydrate; 4734 if (resolvedComp) { 4735 doHydrate(); 4736 } else { 4737 load().then(() => !instance.isUnmounted && doHydrate()); 4738 } 4739 }, 4740 get __asyncResolved() { 4741 return resolvedComp; 4742 }, 4743 setup() { 4744 const instance = currentInstance; 4745 markAsyncBoundary(instance); 4746 if (resolvedComp) { 4747 return () => createInnerComp(resolvedComp, instance); 4748 } 4749 const onError = (err) => { 4750 pendingRequest = null; 4751 handleError( 4752 err, 4753 instance, 4754 13, 4755 !errorComponent 4756 ); 4757 }; 4758 if (suspensible && instance.suspense || false) { 4759 return load().then((comp) => { 4760 return () => createInnerComp(comp, instance); 4761 }).catch((err) => { 4762 onError(err); 4763 return () => errorComponent ? createVNode(errorComponent, { 4764 error: err 4765 }) : null; 4766 }); 4767 } 4768 const loaded = ref(false); 4769 const error = ref(); 4770 const delayed = ref(!!delay); 4771 if (delay) { 4772 setTimeout(() => { 4773 delayed.value = false; 4774 }, delay); 4775 } 4776 if (timeout != null) { 4777 setTimeout(() => { 4778 if (!loaded.value && !error.value) { 4779 const err = new Error( 4780 `Async component timed out after ${timeout}ms.` 4781 ); 4782 onError(err); 4783 error.value = err; 4784 } 4785 }, timeout); 4786 } 4787 load().then(() => { 4788 loaded.value = true; 4789 if (instance.parent && isKeepAlive(instance.parent.vnode)) {
vendor: 34,860 bytes, lines 4790-5832
4790 instance.parent.update(); 4791 } 4792 }).catch((err) => { 4793 onError(err); 4794 error.value = err; 4795 }); 4796 return () => { 4797 if (loaded.value && resolvedComp) { 4798 return createInnerComp(resolvedComp, instance); 4799 } else if (error.value && errorComponent) { 4800 return createVNode(errorComponent, { 4801 error: error.value 4802 }); 4803 } else if (loadingComponent && !delayed.value) { 4804 return createVNode(loadingComponent); 4805 } 4806 }; 4807 } 4808 }); 4809 } 4810 function createInnerComp(comp, parent) { 4811 const { ref: ref2, props, children, ce } = parent.vnode; 4812 const vnode = createVNode(comp, props, children); 4813 vnode.ref = ref2; 4814 vnode.ce = ce; 4815 delete parent.vnode.ce; 4816 return vnode; 4817 } 4818 4819 const isKeepAlive = (vnode) => vnode.type.__isKeepAlive; 4820 const KeepAliveImpl = { 4821 name: `KeepAlive`, 4822 // Marker for special handling inside the renderer. We are not using a === 4823 // check directly on KeepAlive in the renderer, because importing it directly 4824 // would prevent it from being tree-shaken. 4825 __isKeepAlive: true, 4826 props: { 4827 include: [String, RegExp, Array], 4828 exclude: [String, RegExp, Array], 4829 max: [String, Number] 4830 }, 4831 setup(props, { slots }) { 4832 const instance = getCurrentInstance(); 4833 const sharedContext = instance.ctx; 4834 const cache = /* @__PURE__ */ new Map(); 4835 const keys = /* @__PURE__ */ new Set(); 4836 let current = null; 4837 { 4838 instance.__v_cache = cache; 4839 } 4840 const parentSuspense = instance.suspense; 4841 const { 4842 renderer: { 4843 p: patch, 4844 m: move, 4845 um: _unmount, 4846 o: { createElement } 4847 } 4848 } = sharedContext; 4849 const storageContainer = createElement("div"); 4850 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => { 4851 const instance2 = vnode.component; 4852 move(vnode, container, anchor, 0, parentSuspense); 4853 patch( 4854 instance2.vnode, 4855 vnode, 4856 container, 4857 anchor, 4858 instance2, 4859 parentSuspense, 4860 namespace, 4861 vnode.slotScopeIds, 4862 optimized 4863 ); 4864 queuePostRenderEffect(() => { 4865 instance2.isDeactivated = false; 4866 if (instance2.a) { 4867 invokeArrayFns(instance2.a); 4868 } 4869 const vnodeHook = vnode.props && vnode.props.onVnodeMounted; 4870 if (vnodeHook) { 4871 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 4872 } 4873 }, parentSuspense); 4874 { 4875 devtoolsComponentAdded(instance2); 4876 } 4877 }; 4878 sharedContext.deactivate = (vnode) => { 4879 const instance2 = vnode.component; 4880 invalidateMount(instance2.m); 4881 invalidateMount(instance2.a); 4882 move(vnode, storageContainer, null, 1, parentSuspense); 4883 queuePostRenderEffect(() => { 4884 if (instance2.da) { 4885 invokeArrayFns(instance2.da); 4886 } 4887 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted; 4888 if (vnodeHook) { 4889 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 4890 } 4891 instance2.isDeactivated = true; 4892 }, parentSuspense); 4893 { 4894 devtoolsComponentAdded(instance2); 4895 } 4896 { 4897 instance2.__keepAliveStorageContainer = storageContainer; 4898 } 4899 }; 4900 function unmount(vnode) { 4901 resetShapeFlag(vnode); 4902 _unmount(vnode, instance, parentSuspense, true); 4903 } 4904 function pruneCache(filter) { 4905 cache.forEach((vnode, key) => { 4906 const name = getComponentName(vnode.type); 4907 if (name && !filter(name)) { 4908 pruneCacheEntry(key); 4909 } 4910 }); 4911 } 4912 function pruneCacheEntry(key) { 4913 const cached = cache.get(key); 4914 if (cached && (!current || !isSameVNodeType(cached, current))) { 4915 unmount(cached); 4916 } else if (current) { 4917 resetShapeFlag(current); 4918 } 4919 cache.delete(key); 4920 keys.delete(key); 4921 } 4922 watch( 4923 () => [props.include, props.exclude], 4924 ([include, exclude]) => { 4925 include && pruneCache((name) => matches(include, name)); 4926 exclude && pruneCache((name) => !matches(exclude, name)); 4927 }, 4928 // prune post-render after `current` has been updated 4929 { flush: "post", deep: true } 4930 ); 4931 let pendingCacheKey = null; 4932 const cacheSubtree = () => { 4933 if (pendingCacheKey != null) { 4934 if (isSuspense(instance.subTree.type)) { 4935 queuePostRenderEffect(() => { 4936 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 4937 }, instance.subTree.suspense); 4938 } else { 4939 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 4940 } 4941 } 4942 }; 4943 onMounted(cacheSubtree); 4944 onUpdated(cacheSubtree); 4945 onBeforeUnmount(() => { 4946 cache.forEach((cached) => { 4947 const { subTree, suspense } = instance; 4948 const vnode = getInnerChild(subTree); 4949 if (cached.type === vnode.type && cached.key === vnode.key) { 4950 resetShapeFlag(vnode); 4951 const da = vnode.component.da; 4952 da && queuePostRenderEffect(da, suspense); 4953 return; 4954 } 4955 unmount(cached); 4956 }); 4957 }); 4958 return () => { 4959 pendingCacheKey = null; 4960 if (!slots.default) { 4961 return current = null; 4962 } 4963 const children = slots.default(); 4964 const rawVNode = children[0]; 4965 if (children.length > 1) { 4966 { 4967 warn$1(`KeepAlive should contain exactly one component child.`); 4968 } 4969 current = null; 4970 return children; 4971 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { 4972 current = null; 4973 return rawVNode; 4974 } 4975 let vnode = getInnerChild(rawVNode); 4976 if (vnode.type === Comment) { 4977 current = null; 4978 return vnode; 4979 } 4980 const comp = vnode.type; 4981 const name = getComponentName( 4982 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp 4983 ); 4984 const { include, exclude, max } = props; 4985 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { 4986 vnode.shapeFlag &= -257; 4987 current = vnode; 4988 return rawVNode; 4989 } 4990 const key = vnode.key == null ? comp : vnode.key; 4991 const cachedVNode = cache.get(key); 4992 if (vnode.el) { 4993 vnode = cloneVNode(vnode); 4994 if (rawVNode.shapeFlag & 128) { 4995 rawVNode.ssContent = vnode; 4996 } 4997 } 4998 pendingCacheKey = key; 4999 if (cachedVNode) { 5000 vnode.el = cachedVNode.el; 5001 vnode.component = cachedVNode.component; 5002 if (vnode.transition) { 5003 setTransitionHooks(vnode, vnode.transition); 5004 } 5005 vnode.shapeFlag |= 512; 5006 keys.delete(key); 5007 keys.add(key); 5008 } else { 5009 keys.add(key); 5010 if (max && keys.size > parseInt(max, 10)) { 5011 pruneCacheEntry(keys.values().next().value); 5012 } 5013 } 5014 vnode.shapeFlag |= 256; 5015 current = vnode; 5016 return isSuspense(rawVNode.type) ? rawVNode : vnode; 5017 }; 5018 } 5019 }; 5020 const KeepAlive = KeepAliveImpl; 5021 function matches(pattern, name) { 5022 if (isArray(pattern)) { 5023 return pattern.some((p) => matches(p, name)); 5024 } else if (isString(pattern)) { 5025 return pattern.split(",").includes(name); 5026 } else if (isRegExp(pattern)) { 5027 pattern.lastIndex = 0; 5028 return pattern.test(name); 5029 } 5030 return false; 5031 } 5032 function onActivated(hook, target) { 5033 registerKeepAliveHook(hook, "a", target); 5034 } 5035 function onDeactivated(hook, target) { 5036 registerKeepAliveHook(hook, "da", target); 5037 } 5038 function registerKeepAliveHook(hook, type, target = currentInstance) { 5039 const wrappedHook = hook.__wdc || (hook.__wdc = () => { 5040 let current = target; 5041 while (current) { 5042 if (current.isDeactivated) { 5043 return; 5044 } 5045 current = current.parent; 5046 } 5047 return hook(); 5048 }); 5049 injectHook(type, wrappedHook, target); 5050 if (target) { 5051 let current = target.parent; 5052 while (current && current.parent) { 5053 if (isKeepAlive(current.parent.vnode)) { 5054 injectToKeepAliveRoot(wrappedHook, type, target, current); 5055 } 5056 current = current.parent; 5057 } 5058 } 5059 } 5060 function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) { 5061 const injected = injectHook( 5062 type, 5063 hook, 5064 keepAliveRoot, 5065 true 5066 /* prepend */ 5067 ); 5068 onUnmounted(() => { 5069 remove(keepAliveRoot[type], injected); 5070 }, target); 5071 } 5072 function resetShapeFlag(vnode) { 5073 vnode.shapeFlag &= -257; 5074 vnode.shapeFlag &= -513; 5075 } 5076 function getInnerChild(vnode) { 5077 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; 5078 } 5079 5080 function injectHook(type, hook, target = currentInstance, prepend = false) { 5081 if (target) { 5082 const hooks = target[type] || (target[type] = []); 5083 const wrappedHook = hook.__weh || (hook.__weh = (...args) => { 5084 pauseTracking(); 5085 const reset = setCurrentInstance(target); 5086 const res = callWithAsyncErrorHandling(hook, target, type, args); 5087 reset(); 5088 resetTracking(); 5089 return res; 5090 }); 5091 if (prepend) { 5092 hooks.unshift(wrappedHook); 5093 } else { 5094 hooks.push(wrappedHook); 5095 } 5096 return wrappedHook; 5097 } else { 5098 const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, "")); 5099 warn$1( 5100 `${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.` ) 5101 ); 5102 } 5103 } 5104 const createHook = (lifecycle) => (hook, target = currentInstance) => { 5105 if (!isInSSRComponentSetup || lifecycle === "sp") { 5106 injectHook(lifecycle, (...args) => hook(...args), target); 5107 } 5108 }; 5109 const onBeforeMount = createHook("bm"); 5110 const onMounted = createHook("m"); 5111 const onBeforeUpdate = createHook( 5112 "bu" 5113 ); 5114 const onUpdated = createHook("u"); 5115 const onBeforeUnmount = createHook( 5116 "bum" 5117 ); 5118 const onUnmounted = createHook("um"); 5119 const onServerPrefetch = createHook( 5120 "sp" 5121 ); 5122 const onRenderTriggered = createHook("rtg"); 5123 const onRenderTracked = createHook("rtc"); 5124 function onErrorCaptured(hook, target = currentInstance) { 5125 injectHook("ec", hook, target); 5126 } 5127 5128 const COMPONENTS = "components"; 5129 const DIRECTIVES = "directives"; 5130 function resolveComponent(name, maybeSelfReference) { 5131 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; 5132 } 5133 const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); 5134 function resolveDynamicComponent(component) { 5135 if (isString(component)) { 5136 return resolveAsset(COMPONENTS, component, false) || component; 5137 } else { 5138 return component || NULL_DYNAMIC_COMPONENT; 5139 } 5140 } 5141 function resolveDirective(name) { 5142 return resolveAsset(DIRECTIVES, name); 5143 } 5144 function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) { 5145 const instance = currentRenderingInstance || currentInstance; 5146 if (instance) { 5147 const Component = instance.type; 5148 if (type === COMPONENTS) { 5149 const selfName = getComponentName( 5150 Component, 5151 false 5152 ); 5153 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) { 5154 return Component; 5155 } 5156 } 5157 const res = ( 5158 // local registration 5159 // check instance[type] first which is resolved for options API 5160 resolve(instance[type] || Component[type], name) || // global registration 5161 resolve(instance.appContext[type], name) 5162 ); 5163 if (!res && maybeSelfReference) { 5164 return Component; 5165 } 5166 if (warnMissing && !res) { 5167 const extra = type === COMPONENTS ? ` 5168If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``; 5169 warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`); 5170 } 5171 return res; 5172 } else { 5173 warn$1( 5174 `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().` 5175 ); 5176 } 5177 } 5178 function resolve(registry, name) { 5179 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]); 5180 } 5181 5182 function renderList(source, renderItem, cache, index) { 5183 let ret; 5184 const cached = cache && cache[index]; 5185 const sourceIsArray = isArray(source); 5186 if (sourceIsArray || isString(source)) { 5187 const sourceIsReactiveArray = sourceIsArray && isReactive(source); 5188 let needsWrap = false; 5189 let isReadonlySource = false; 5190 if (sourceIsReactiveArray) { 5191 needsWrap = !isShallow(source); 5192 isReadonlySource = isReadonly(source); 5193 source = shallowReadArray(source); 5194 } 5195 ret = new Array(source.length); 5196 for (let i = 0, l = source.length; i < l; i++) { 5197 ret[i] = renderItem( 5198 needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i], 5199 i, 5200 void 0, 5201 cached && cached[i] 5202 ); 5203 } 5204 } else if (typeof source === "number") { 5205 if (!Number.isInteger(source)) { 5206 warn$1(`The v-for range expect an integer value but got ${source}.`); 5207 } 5208 ret = new Array(source); 5209 for (let i = 0; i < source; i++) { 5210 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]); 5211 } 5212 } else if (isObject(source)) { 5213 if (source[Symbol.iterator]) { 5214 ret = Array.from( 5215 source, 5216 (item, i) => renderItem(item, i, void 0, cached && cached[i]) 5217 ); 5218 } else { 5219 const keys = Object.keys(source); 5220 ret = new Array(keys.length); 5221 for (let i = 0, l = keys.length; i < l; i++) { 5222 const key = keys[i]; 5223 ret[i] = renderItem(source[key], key, i, cached && cached[i]); 5224 } 5225 } 5226 } else { 5227 ret = []; 5228 } 5229 if (cache) { 5230 cache[index] = ret; 5231 } 5232 return ret; 5233 } 5234 5235 function createSlots(slots, dynamicSlots) { 5236 for (let i = 0; i < dynamicSlots.length; i++) { 5237 const slot = dynamicSlots[i]; 5238 if (isArray(slot)) { 5239 for (let j = 0; j < slot.length; j++) { 5240 slots[slot[j].name] = slot[j].fn; 5241 } 5242 } else if (slot) { 5243 slots[slot.name] = slot.key ? (...args) => { 5244 const res = slot.fn(...args); 5245 if (res) res.key = slot.key; 5246 return res; 5247 } : slot.fn; 5248 } 5249 } 5250 return slots; 5251 } 5252 5253 function renderSlot(slots, name, props = {}, fallback, noSlotted) { 5254 if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) { 5255 if (name !== "default") props.name = name; 5256 return openBlock(), createBlock( 5257 Fragment, 5258 null, 5259 [createVNode("slot", props, fallback && fallback())], 5260 64 5261 ); 5262 } 5263 let slot = slots[name]; 5264 if (slot && slot.length > 1) { 5265 warn$1( 5266 `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.` 5267 ); 5268 slot = () => []; 5269 } 5270 if (slot && slot._c) { 5271 slot._d = false; 5272 } 5273 openBlock(); 5274 const validSlotContent = slot && ensureValidVNode(slot(props)); 5275 const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch 5276 // key attached in the `createSlots` helper, respect that 5277 validSlotContent && validSlotContent.key; 5278 const rendered = createBlock( 5279 Fragment, 5280 { 5281 key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content 5282 (!validSlotContent && fallback ? "_fb" : "") 5283 }, 5284 validSlotContent || (fallback ? fallback() : []), 5285 validSlotContent && slots._ === 1 ? 64 : -2 5286 ); 5287 if (!noSlotted && rendered.scopeId) { 5288 rendered.slotScopeIds = [rendered.scopeId + "-s"]; 5289 } 5290 if (slot && slot._c) { 5291 slot._d = true; 5292 } 5293 return rendered; 5294 } 5295 function ensureValidVNode(vnodes) { 5296 return vnodes.some((child) => { 5297 if (!isVNode(child)) return true; 5298 if (child.type === Comment) return false; 5299 if (child.type === Fragment && !ensureValidVNode(child.children)) 5300 return false; 5301 return true; 5302 }) ? vnodes : null; 5303 } 5304 5305 function toHandlers(obj, preserveCaseIfNecessary) { 5306 const ret = {}; 5307 if (!isObject(obj)) { 5308 warn$1(`v-on with no argument expects an object value.`); 5309 return ret; 5310 } 5311 for (const key in obj) { 5312 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key]; 5313 } 5314 return ret; 5315 } 5316 5317 const getPublicInstance = (i) => { 5318 if (!i) return null; 5319 if (isStatefulComponent(i)) return getComponentPublicInstance(i); 5320 return getPublicInstance(i.parent); 5321 }; 5322 const publicPropertiesMap = ( 5323 // Move PURE marker to new line to workaround compiler discarding it 5324 // due to type annotation 5325 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), { 5326 $: (i) => i, 5327 $el: (i) => i.vnode.el, 5328 $data: (i) => i.data, 5329 $props: (i) => shallowReadonly(i.props) , 5330 $attrs: (i) => shallowReadonly(i.attrs) , 5331 $slots: (i) => shallowReadonly(i.slots) , 5332 $refs: (i) => shallowReadonly(i.refs) , 5333 $parent: (i) => getPublicInstance(i.parent), 5334 $root: (i) => getPublicInstance(i.root), 5335 $host: (i) => i.ce, 5336 $emit: (i) => i.emit, 5337 $options: (i) => resolveMergedOptions(i) , 5338 $forceUpdate: (i) => i.f || (i.f = () => { 5339 queueJob(i.update); 5340 }), 5341 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)), 5342 $watch: (i) => instanceWatch.bind(i) 5343 }) 5344 ); 5345 const isReservedPrefix = (key) => key === "_" || key === "$"; 5346 const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key); 5347 const PublicInstanceProxyHandlers = { 5348 get({ _: instance }, key) { 5349 if (key === "__v_skip") { 5350 return true; 5351 } 5352 const { ctx, setupState, data, props, accessCache, type, appContext } = instance; 5353 if (key === "__isVue") { 5354 return true; 5355 } 5356 let normalizedProps; 5357 if (key[0] !== "$") { 5358 const n = accessCache[key]; 5359 if (n !== void 0) { 5360 switch (n) { 5361 case 1 /* SETUP */: 5362 return setupState[key]; 5363 case 2 /* DATA */: 5364 return data[key]; 5365 case 4 /* CONTEXT */: 5366 return ctx[key]; 5367 case 3 /* PROPS */: 5368 return props[key]; 5369 } 5370 } else if (hasSetupBinding(setupState, key)) { 5371 accessCache[key] = 1 /* SETUP */; 5372 return setupState[key]; 5373 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 5374 accessCache[key] = 2 /* DATA */; 5375 return data[key]; 5376 } else if ( 5377 // only cache other properties when instance has declared (thus stable) 5378 // props 5379 (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key) 5380 ) { 5381 accessCache[key] = 3 /* PROPS */; 5382 return props[key]; 5383 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 5384 accessCache[key] = 4 /* CONTEXT */; 5385 return ctx[key]; 5386 } else if (shouldCacheAccess) { 5387 accessCache[key] = 0 /* OTHER */; 5388 } 5389 } 5390 const publicGetter = publicPropertiesMap[key]; 5391 let cssModule, globalProperties; 5392 if (publicGetter) { 5393 if (key === "$attrs") { 5394 track(instance.attrs, "get", ""); 5395 markAttrsAccessed(); 5396 } else if (key === "$slots") { 5397 track(instance, "get", key); 5398 } 5399 return publicGetter(instance); 5400 } else if ( 5401 // css module (injected by vue-loader) 5402 (cssModule = type.__cssModules) && (cssModule = cssModule[key]) 5403 ) { 5404 return cssModule; 5405 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 5406 accessCache[key] = 4 /* CONTEXT */; 5407 return ctx[key]; 5408 } else if ( 5409 // global properties 5410 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key) 5411 ) { 5412 { 5413 return globalProperties[key]; 5414 } 5415 } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading 5416 // to infinite warning loop 5417 key.indexOf("__v") !== 0)) { 5418 if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) { 5419 warn$1( 5420 `Property ${JSON.stringify( 5421 key 5422 )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.` 5423 ); 5424 } else if (instance === currentRenderingInstance) { 5425 warn$1( 5426 `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.` 5427 ); 5428 } 5429 } 5430 }, 5431 set({ _: instance }, key, value) { 5432 const { data, setupState, ctx } = instance; 5433 if (hasSetupBinding(setupState, key)) { 5434 setupState[key] = value; 5435 return true; 5436 } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) { 5437 warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`); 5438 return false; 5439 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 5440 data[key] = value; 5441 return true; 5442 } else if (hasOwn(instance.props, key)) { 5443 warn$1(`Attempting to mutate prop "${key}". Props are readonly.`); 5444 return false; 5445 } 5446 if (key[0] === "$" && key.slice(1) in instance) { 5447 warn$1( 5448 `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.` 5449 ); 5450 return false; 5451 } else { 5452 if (key in instance.appContext.config.globalProperties) { 5453 Object.defineProperty(ctx, key, { 5454 enumerable: true, 5455 configurable: true, 5456 value 5457 }); 5458 } else { 5459 ctx[key] = value; 5460 } 5461 } 5462 return true; 5463 }, 5464 has({ 5465 _: { data, setupState, accessCache, ctx, appContext, propsOptions, type } 5466 }, key) { 5467 let normalizedProps, cssModules; 5468 return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]); 5469 }, 5470 defineProperty(target, key, descriptor) { 5471 if (descriptor.get != null) { 5472 target._.accessCache[key] = 0; 5473 } else if (hasOwn(descriptor, "value")) { 5474 this.set(target, key, descriptor.value, null); 5475 } 5476 return Reflect.defineProperty(target, key, descriptor); 5477 } 5478 }; 5479 { 5480 PublicInstanceProxyHandlers.ownKeys = (target) => { 5481 warn$1( 5482 `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.` 5483 ); 5484 return Reflect.ownKeys(target); 5485 }; 5486 } 5487 const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, { 5488 get(target, key) { 5489 if (key === Symbol.unscopables) { 5490 return; 5491 } 5492 return PublicInstanceProxyHandlers.get(target, key, target); 5493 }, 5494 has(_, key) { 5495 const has = key[0] !== "_" && !isGloballyAllowed(key); 5496 if (!has && PublicInstanceProxyHandlers.has(_, key)) { 5497 warn$1( 5498 `Property ${JSON.stringify( 5499 key 5500 )} should not start with _ which is a reserved prefix for Vue internals.` 5501 ); 5502 } 5503 return has; 5504 } 5505 }); 5506 function createDevRenderContext(instance) { 5507 const target = {}; 5508 Object.defineProperty(target, `_`, { 5509 configurable: true, 5510 enumerable: false, 5511 get: () => instance 5512 }); 5513 Object.keys(publicPropertiesMap).forEach((key) => { 5514 Object.defineProperty(target, key, { 5515 configurable: true, 5516 enumerable: false, 5517 get: () => publicPropertiesMap[key](instance), 5518 // intercepted by the proxy so no need for implementation, 5519 // but needed to prevent set errors 5520 set: NOOP 5521 }); 5522 }); 5523 return target; 5524 } 5525 function exposePropsOnRenderContext(instance) { 5526 const { 5527 ctx, 5528 propsOptions: [propsOptions] 5529 } = instance; 5530 if (propsOptions) { 5531 Object.keys(propsOptions).forEach((key) => { 5532 Object.defineProperty(ctx, key, { 5533 enumerable: true, 5534 configurable: true, 5535 get: () => instance.props[key], 5536 set: NOOP 5537 }); 5538 }); 5539 } 5540 } 5541 function exposeSetupStateOnRenderContext(instance) { 5542 const { ctx, setupState } = instance; 5543 Object.keys(toRaw(setupState)).forEach((key) => { 5544 if (!setupState.__isScriptSetup) { 5545 if (isReservedPrefix(key[0])) { 5546 warn$1( 5547 `setup() return property ${JSON.stringify( 5548 key 5549 )} should not start with "$" or "_" which are reserved prefixes for Vue internals.` 5550 ); 5551 return; 5552 } 5553 Object.defineProperty(ctx, key, { 5554 enumerable: true, 5555 configurable: true, 5556 get: () => setupState[key], 5557 set: NOOP 5558 }); 5559 } 5560 }); 5561 } 5562 5563 const warnRuntimeUsage = (method) => warn$1( 5564 `${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.` 5565 ); 5566 function defineProps() { 5567 { 5568 warnRuntimeUsage(`defineProps`); 5569 } 5570 return null; 5571 } 5572 function defineEmits() { 5573 { 5574 warnRuntimeUsage(`defineEmits`); 5575 } 5576 return null; 5577 } 5578 function defineExpose(exposed) { 5579 { 5580 warnRuntimeUsage(`defineExpose`); 5581 } 5582 } 5583 function defineOptions(options) { 5584 { 5585 warnRuntimeUsage(`defineOptions`); 5586 } 5587 } 5588 function defineSlots() { 5589 { 5590 warnRuntimeUsage(`defineSlots`); 5591 } 5592 return null; 5593 } 5594 function defineModel() { 5595 { 5596 warnRuntimeUsage("defineModel"); 5597 } 5598 } 5599 function withDefaults(props, defaults) { 5600 { 5601 warnRuntimeUsage(`withDefaults`); 5602 } 5603 return null; 5604 } 5605 function useSlots() { 5606 return getContext("useSlots").slots; 5607 } 5608 function useAttrs() { 5609 return getContext("useAttrs").attrs; 5610 } 5611 function getContext(calledFunctionName) { 5612 const i = getCurrentInstance(); 5613 if (!i) { 5614 warn$1(`${calledFunctionName}() called without active instance.`); 5615 } 5616 return i.setupContext || (i.setupContext = createSetupContext(i)); 5617 } 5618 function normalizePropsOrEmits(props) { 5619 return isArray(props) ? props.reduce( 5620 (normalized, p) => (normalized[p] = null, normalized), 5621 {} 5622 ) : props; 5623 } 5624 function mergeDefaults(raw, defaults) { 5625 const props = normalizePropsOrEmits(raw); 5626 for (const key in defaults) { 5627 if (key.startsWith("__skip")) continue; 5628 let opt = props[key]; 5629 if (opt) { 5630 if (isArray(opt) || isFunction(opt)) { 5631 opt = props[key] = { type: opt, default: defaults[key] }; 5632 } else { 5633 opt.default = defaults[key]; 5634 } 5635 } else if (opt === null) { 5636 opt = props[key] = { default: defaults[key] }; 5637 } else { 5638 warn$1(`props default key "${key}" has no corresponding declaration.`); 5639 } 5640 if (opt && defaults[`__skip_${key}`]) { 5641 opt.skipFactory = true; 5642 } 5643 } 5644 return props; 5645 } 5646 function mergeModels(a, b) { 5647 if (!a || !b) return a || b; 5648 if (isArray(a) && isArray(b)) return a.concat(b); 5649 return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b)); 5650 } 5651 function createPropsRestProxy(props, excludedKeys) { 5652 const ret = {}; 5653 for (const key in props) { 5654 if (!excludedKeys.includes(key)) { 5655 Object.defineProperty(ret, key, { 5656 enumerable: true, 5657 get: () => props[key] 5658 }); 5659 } 5660 } 5661 return ret; 5662 } 5663 function withAsyncContext(getAwaitable) { 5664 const ctx = getCurrentInstance(); 5665 if (!ctx) { 5666 warn$1( 5667 `withAsyncContext called without active current instance. This is likely a bug.` 5668 ); 5669 } 5670 let awaitable = getAwaitable(); 5671 unsetCurrentInstance(); 5672 if (isPromise(awaitable)) { 5673 awaitable = awaitable.catch((e) => { 5674 setCurrentInstance(ctx); 5675 throw e; 5676 }); 5677 } 5678 return [awaitable, () => setCurrentInstance(ctx)]; 5679 } 5680 5681 function createDuplicateChecker() { 5682 const cache = /* @__PURE__ */ Object.create(null); 5683 return (type, key) => { 5684 if (cache[key]) { 5685 warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`); 5686 } else { 5687 cache[key] = type; 5688 } 5689 }; 5690 } 5691 let shouldCacheAccess = true; 5692 function applyOptions(instance) { 5693 const options = resolveMergedOptions(instance); 5694 const publicThis = instance.proxy; 5695 const ctx = instance.ctx; 5696 shouldCacheAccess = false; 5697 if (options.beforeCreate) { 5698 callHook$1(options.beforeCreate, instance, "bc"); 5699 } 5700 const { 5701 // state 5702 data: dataOptions, 5703 computed: computedOptions, 5704 methods, 5705 watch: watchOptions, 5706 provide: provideOptions, 5707 inject: injectOptions, 5708 // lifecycle 5709 created, 5710 beforeMount, 5711 mounted, 5712 beforeUpdate, 5713 updated, 5714 activated, 5715 deactivated, 5716 beforeDestroy, 5717 beforeUnmount, 5718 destroyed, 5719 unmounted, 5720 render, 5721 renderTracked, 5722 renderTriggered, 5723 errorCaptured, 5724 serverPrefetch, 5725 // public API 5726 expose, 5727 inheritAttrs, 5728 // assets 5729 components, 5730 directives, 5731 filters 5732 } = options; 5733 const checkDuplicateProperties = createDuplicateChecker() ; 5734 { 5735 const [propsOptions] = instance.propsOptions; 5736 if (propsOptions) { 5737 for (const key in propsOptions) { 5738 checkDuplicateProperties("Props" /* PROPS */, key); 5739 } 5740 } 5741 } 5742 if (injectOptions) { 5743 resolveInjections(injectOptions, ctx, checkDuplicateProperties); 5744 } 5745 if (methods) { 5746 for (const key in methods) { 5747 const methodHandler = methods[key]; 5748 if (isFunction(methodHandler)) { 5749 { 5750 Object.defineProperty(ctx, key, { 5751 value: methodHandler.bind(publicThis), 5752 configurable: true, 5753 enumerable: true, 5754 writable: true 5755 }); 5756 } 5757 { 5758 checkDuplicateProperties("Methods" /* METHODS */, key); 5759 } 5760 } else { 5761 warn$1( 5762 `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?` 5763 ); 5764 } 5765 } 5766 } 5767 if (dataOptions) { 5768 if (!isFunction(dataOptions)) { 5769 warn$1( 5770 `The data option must be a function. Plain object usage is no longer supported.` 5771 ); 5772 } 5773 const data = dataOptions.call(publicThis, publicThis); 5774 if (isPromise(data)) { 5775 warn$1( 5776 `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.` 5777 ); 5778 } 5779 if (!isObject(data)) { 5780 warn$1(`data() should return an object.`); 5781 } else { 5782 instance.data = reactive(data); 5783 { 5784 for (const key in data) { 5785 checkDuplicateProperties("Data" /* DATA */, key); 5786 if (!isReservedPrefix(key[0])) { 5787 Object.defineProperty(ctx, key, { 5788 configurable: true, 5789 enumerable: true, 5790 get: () => data[key], 5791 set: NOOP 5792 }); 5793 } 5794 } 5795 } 5796 } 5797 } 5798 shouldCacheAccess = true; 5799 if (computedOptions) { 5800 for (const key in computedOptions) { 5801 const opt = computedOptions[key]; 5802 const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; 5803 if (get === NOOP) { 5804 warn$1(`Computed property "${key}" has no getter.`); 5805 } 5806 const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => { 5807 warn$1( 5808 `Write operation failed: computed property "${key}" is readonly.` 5809 ); 5810 } ; 5811 const c = computed({ 5812 get, 5813 set 5814 }); 5815 Object.defineProperty(ctx, key, { 5816 enumerable: true, 5817 configurable: true, 5818 get: () => c.value, 5819 set: (v) => c.value = v 5820 }); 5821 { 5822 checkDuplicateProperties("Computed" /* COMPUTED */, key); 5823 } 5824 } 5825 } 5826 if (watchOptions) { 5827 for (const key in watchOptions) { 5828 createWatcher(watchOptions[key], ctx, publicThis, key); 5829 } 5830 } 5831 if (provideOptions) { 5832 const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
vendor: 4,307 bytes, lines 5833-5961
5833 Reflect.ownKeys(provides).forEach((key) => { 5834 provide(key, provides[key]); 5835 }); 5836 } 5837 if (created) { 5838 callHook$1(created, instance, "c"); 5839 } 5840 function registerLifecycleHook(register, hook) { 5841 if (isArray(hook)) { 5842 hook.forEach((_hook) => register(_hook.bind(publicThis))); 5843 } else if (hook) { 5844 register(hook.bind(publicThis)); 5845 } 5846 } 5847 registerLifecycleHook(onBeforeMount, beforeMount); 5848 registerLifecycleHook(onMounted, mounted); 5849 registerLifecycleHook(onBeforeUpdate, beforeUpdate); 5850 registerLifecycleHook(onUpdated, updated); 5851 registerLifecycleHook(onActivated, activated); 5852 registerLifecycleHook(onDeactivated, deactivated); 5853 registerLifecycleHook(onErrorCaptured, errorCaptured); 5854 registerLifecycleHook(onRenderTracked, renderTracked); 5855 registerLifecycleHook(onRenderTriggered, renderTriggered); 5856 registerLifecycleHook(onBeforeUnmount, beforeUnmount); 5857 registerLifecycleHook(onUnmounted, unmounted); 5858 registerLifecycleHook(onServerPrefetch, serverPrefetch); 5859 if (isArray(expose)) { 5860 if (expose.length) { 5861 const exposed = instance.exposed || (instance.exposed = {}); 5862 expose.forEach((key) => { 5863 Object.defineProperty(exposed, key, { 5864 get: () => publicThis[key], 5865 set: (val) => publicThis[key] = val, 5866 enumerable: true 5867 }); 5868 }); 5869 } else if (!instance.exposed) { 5870 instance.exposed = {}; 5871 } 5872 } 5873 if (render && instance.render === NOOP) { 5874 instance.render = render; 5875 } 5876 if (inheritAttrs != null) { 5877 instance.inheritAttrs = inheritAttrs; 5878 } 5879 if (components) instance.components = components; 5880 if (directives) instance.directives = directives; 5881 } 5882 function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) { 5883 if (isArray(injectOptions)) { 5884 injectOptions = normalizeInject(injectOptions); 5885 } 5886 for (const key in injectOptions) { 5887 const opt = injectOptions[key]; 5888 let injected; 5889 if (isObject(opt)) { 5890 if ("default" in opt) { 5891 injected = inject( 5892 opt.from || key, 5893 opt.default, 5894 true 5895 ); 5896 } else { 5897 injected = inject(opt.from || key); 5898 } 5899 } else { 5900 injected = inject(opt); 5901 } 5902 if (isRef(injected)) { 5903 Object.defineProperty(ctx, key, { 5904 enumerable: true, 5905 configurable: true, 5906 get: () => injected.value, 5907 set: (v) => injected.value = v 5908 }); 5909 } else { 5910 ctx[key] = injected; 5911 } 5912 { 5913 checkDuplicateProperties("Inject" /* INJECT */, key); 5914 } 5915 } 5916 } 5917 function callHook$1(hook, instance, type) { 5918 callWithAsyncErrorHandling( 5919 isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy), 5920 instance, 5921 type 5922 ); 5923 } 5924 function createWatcher(raw, ctx, publicThis, key) { 5925 let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; 5926 if (isString(raw)) { 5927 const handler = ctx[raw]; 5928 if (isFunction(handler)) { 5929 { 5930 watch(getter, handler); 5931 } 5932 } else { 5933 warn$1(`Invalid watch handler specified by key "${raw}"`, handler); 5934 } 5935 } else if (isFunction(raw)) { 5936 { 5937 watch(getter, raw.bind(publicThis)); 5938 } 5939 } else if (isObject(raw)) { 5940 if (isArray(raw)) { 5941 raw.forEach((r) => createWatcher(r, ctx, publicThis, key)); 5942 } else { 5943 const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; 5944 if (isFunction(handler)) { 5945 watch(getter, handler, raw); 5946 } else { 5947 warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler); 5948 } 5949 } 5950 } else { 5951 warn$1(`Invalid watch option: "${key}"`, raw); 5952 } 5953 } 5954 function resolveMergedOptions(instance) { 5955 const base = instance.type; 5956 const { mixins, extends: extendsOptions } = base; 5957 const { 5958 mixins: globalMixins, 5959 optionsCache: cache, 5960 config: { optionMergeStrategies } 5961 } = instance.appContext;
vendor: 63,428 bytes, lines 5962-7915
5962 const cached = cache.get(base); 5963 let resolved; 5964 if (cached) { 5965 resolved = cached; 5966 } else if (!globalMixins.length && !mixins && !extendsOptions) { 5967 { 5968 resolved = base; 5969 } 5970 } else { 5971 resolved = {}; 5972 if (globalMixins.length) { 5973 globalMixins.forEach( 5974 (m) => mergeOptions(resolved, m, optionMergeStrategies, true) 5975 ); 5976 } 5977 mergeOptions(resolved, base, optionMergeStrategies); 5978 } 5979 if (isObject(base)) { 5980 cache.set(base, resolved); 5981 } 5982 return resolved; 5983 } 5984 function mergeOptions(to, from, strats, asMixin = false) { 5985 const { mixins, extends: extendsOptions } = from; 5986 if (extendsOptions) { 5987 mergeOptions(to, extendsOptions, strats, true); 5988 } 5989 if (mixins) { 5990 mixins.forEach( 5991 (m) => mergeOptions(to, m, strats, true) 5992 ); 5993 } 5994 for (const key in from) { 5995 if (asMixin && key === "expose") { 5996 warn$1( 5997 `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.` 5998 ); 5999 } else { 6000 const strat = internalOptionMergeStrats[key] || strats && strats[key]; 6001 to[key] = strat ? strat(to[key], from[key]) : from[key]; 6002 } 6003 } 6004 return to; 6005 } 6006 const internalOptionMergeStrats = { 6007 data: mergeDataFn, 6008 props: mergeEmitsOrPropsOptions, 6009 emits: mergeEmitsOrPropsOptions, 6010 // objects 6011 methods: mergeObjectOptions, 6012 computed: mergeObjectOptions, 6013 // lifecycle 6014 beforeCreate: mergeAsArray$1, 6015 created: mergeAsArray$1, 6016 beforeMount: mergeAsArray$1, 6017 mounted: mergeAsArray$1, 6018 beforeUpdate: mergeAsArray$1, 6019 updated: mergeAsArray$1, 6020 beforeDestroy: mergeAsArray$1, 6021 beforeUnmount: mergeAsArray$1, 6022 destroyed: mergeAsArray$1, 6023 unmounted: mergeAsArray$1, 6024 activated: mergeAsArray$1, 6025 deactivated: mergeAsArray$1, 6026 errorCaptured: mergeAsArray$1, 6027 serverPrefetch: mergeAsArray$1, 6028 // assets 6029 components: mergeObjectOptions, 6030 directives: mergeObjectOptions, 6031 // watch 6032 watch: mergeWatchOptions, 6033 // provide / inject 6034 provide: mergeDataFn, 6035 inject: mergeInject 6036 }; 6037 function mergeDataFn(to, from) { 6038 if (!from) { 6039 return to; 6040 } 6041 if (!to) { 6042 return from; 6043 } 6044 return function mergedDataFn() { 6045 return (extend)( 6046 isFunction(to) ? to.call(this, this) : to, 6047 isFunction(from) ? from.call(this, this) : from 6048 ); 6049 }; 6050 } 6051 function mergeInject(to, from) { 6052 return mergeObjectOptions(normalizeInject(to), normalizeInject(from)); 6053 } 6054 function normalizeInject(raw) { 6055 if (isArray(raw)) { 6056 const res = {}; 6057 for (let i = 0; i < raw.length; i++) { 6058 res[raw[i]] = raw[i]; 6059 } 6060 return res; 6061 } 6062 return raw; 6063 } 6064 function mergeAsArray$1(to, from) { 6065 return to ? [...new Set([].concat(to, from))] : from; 6066 } 6067 function mergeObjectOptions(to, from) { 6068 return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from; 6069 } 6070 function mergeEmitsOrPropsOptions(to, from) { 6071 if (to) { 6072 if (isArray(to) && isArray(from)) { 6073 return [.../* @__PURE__ */ new Set([...to, ...from])]; 6074 } 6075 return extend( 6076 /* @__PURE__ */ Object.create(null), 6077 normalizePropsOrEmits(to), 6078 normalizePropsOrEmits(from != null ? from : {}) 6079 ); 6080 } else { 6081 return from; 6082 } 6083 } 6084 function mergeWatchOptions(to, from) { 6085 if (!to) return from; 6086 if (!from) return to; 6087 const merged = extend(/* @__PURE__ */ Object.create(null), to); 6088 for (const key in from) { 6089 merged[key] = mergeAsArray$1(to[key], from[key]); 6090 } 6091 return merged; 6092 } 6093 6094 function createAppContext() { 6095 return { 6096 app: null, 6097 config: { 6098 isNativeTag: NO, 6099 performance: false, 6100 globalProperties: {}, 6101 optionMergeStrategies: {}, 6102 errorHandler: void 0, 6103 warnHandler: void 0, 6104 compilerOptions: {} 6105 }, 6106 mixins: [], 6107 components: {}, 6108 directives: {}, 6109 provides: /* @__PURE__ */ Object.create(null), 6110 optionsCache: /* @__PURE__ */ new WeakMap(), 6111 propsCache: /* @__PURE__ */ new WeakMap(), 6112 emitsCache: /* @__PURE__ */ new WeakMap() 6113 }; 6114 } 6115 let uid$1 = 0; 6116 function createAppAPI(render, hydrate) { 6117 return function createApp(rootComponent, rootProps = null) { 6118 if (!isFunction(rootComponent)) { 6119 rootComponent = extend({}, rootComponent); 6120 } 6121 if (rootProps != null && !isObject(rootProps)) { 6122 warn$1(`root props passed to app.mount() must be an object.`); 6123 rootProps = null; 6124 } 6125 const context = createAppContext(); 6126 const installedPlugins = /* @__PURE__ */ new WeakSet(); 6127 const pluginCleanupFns = []; 6128 let isMounted = false; 6129 const app = context.app = { 6130 _uid: uid$1++, 6131 _component: rootComponent, 6132 _props: rootProps, 6133 _container: null, 6134 _context: context, 6135 _instance: null, 6136 version, 6137 get config() { 6138 return context.config; 6139 }, 6140 set config(v) { 6141 { 6142 warn$1( 6143 `app.config cannot be replaced. Modify individual options instead.` 6144 ); 6145 } 6146 }, 6147 use(plugin, ...options) { 6148 if (installedPlugins.has(plugin)) { 6149 warn$1(`Plugin has already been applied to target app.`); 6150 } else if (plugin && isFunction(plugin.install)) { 6151 installedPlugins.add(plugin); 6152 plugin.install(app, ...options); 6153 } else if (isFunction(plugin)) { 6154 installedPlugins.add(plugin); 6155 plugin(app, ...options); 6156 } else { 6157 warn$1( 6158 `A plugin must either be a function or an object with an "install" function.` 6159 ); 6160 } 6161 return app; 6162 }, 6163 mixin(mixin) { 6164 { 6165 if (!context.mixins.includes(mixin)) { 6166 context.mixins.push(mixin); 6167 } else { 6168 warn$1( 6169 "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "") 6170 ); 6171 } 6172 } 6173 return app; 6174 }, 6175 component(name, component) { 6176 { 6177 validateComponentName(name, context.config); 6178 } 6179 if (!component) { 6180 return context.components[name]; 6181 } 6182 if (context.components[name]) { 6183 warn$1(`Component "${name}" has already been registered in target app.`); 6184 } 6185 context.components[name] = component; 6186 return app; 6187 }, 6188 directive(name, directive) { 6189 { 6190 validateDirectiveName(name); 6191 } 6192 if (!directive) { 6193 return context.directives[name]; 6194 } 6195 if (context.directives[name]) { 6196 warn$1(`Directive "${name}" has already been registered in target app.`); 6197 } 6198 context.directives[name] = directive; 6199 return app; 6200 }, 6201 mount(rootContainer, isHydrate, namespace) { 6202 if (!isMounted) { 6203 if (rootContainer.__vue_app__) { 6204 warn$1( 6205 `There is already an app instance mounted on the host container. 6206 If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.` 6207 ); 6208 } 6209 const vnode = app._ceVNode || createVNode(rootComponent, rootProps); 6210 vnode.appContext = context; 6211 if (namespace === true) { 6212 namespace = "svg"; 6213 } else if (namespace === false) { 6214 namespace = void 0; 6215 } 6216 { 6217 context.reload = () => { 6218 const cloned = cloneVNode(vnode); 6219 cloned.el = null; 6220 render(cloned, rootContainer, namespace); 6221 }; 6222 } 6223 if (isHydrate && hydrate) { 6224 hydrate(vnode, rootContainer); 6225 } else { 6226 render(vnode, rootContainer, namespace); 6227 } 6228 isMounted = true; 6229 app._container = rootContainer; 6230 rootContainer.__vue_app__ = app; 6231 { 6232 app._instance = vnode.component; 6233 devtoolsInitApp(app, version); 6234 } 6235 return getComponentPublicInstance(vnode.component); 6236 } else { 6237 warn$1( 6238 `App has already been mounted. 6239If 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)\`` 6240 ); 6241 } 6242 }, 6243 onUnmount(cleanupFn) { 6244 if (typeof cleanupFn !== "function") { 6245 warn$1( 6246 `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}` 6247 ); 6248 } 6249 pluginCleanupFns.push(cleanupFn); 6250 }, 6251 unmount() { 6252 if (isMounted) { 6253 callWithAsyncErrorHandling( 6254 pluginCleanupFns, 6255 app._instance, 6256 16 6257 ); 6258 render(null, app._container); 6259 { 6260 app._instance = null; 6261 devtoolsUnmountApp(app); 6262 } 6263 delete app._container.__vue_app__; 6264 } else { 6265 warn$1(`Cannot unmount an app that is not mounted.`); 6266 } 6267 }, 6268 provide(key, value) { 6269 if (key in context.provides) { 6270 if (hasOwn(context.provides, key)) { 6271 warn$1( 6272 `App already provides property with key "${String(key)}". It will be overwritten with the new value.` 6273 ); 6274 } else { 6275 warn$1( 6276 `App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.` 6277 ); 6278 } 6279 } 6280 context.provides[key] = value; 6281 return app; 6282 }, 6283 runWithContext(fn) { 6284 const lastApp = currentApp; 6285 currentApp = app; 6286 try { 6287 return fn(); 6288 } finally { 6289 currentApp = lastApp; 6290 } 6291 } 6292 }; 6293 return app; 6294 }; 6295 } 6296 let currentApp = null; 6297 6298 function provide(key, value) { 6299 if (!currentInstance) { 6300 { 6301 warn$1(`provide() can only be used inside setup().`); 6302 } 6303 } else { 6304 let provides = currentInstance.provides; 6305 const parentProvides = currentInstance.parent && currentInstance.parent.provides; 6306 if (parentProvides === provides) { 6307 provides = currentInstance.provides = Object.create(parentProvides); 6308 } 6309 provides[key] = value; 6310 } 6311 } 6312 function inject(key, defaultValue, treatDefaultAsFactory = false) { 6313 const instance = getCurrentInstance(); 6314 if (instance || currentApp) { 6315 let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; 6316 if (provides && key in provides) { 6317 return provides[key]; 6318 } else if (arguments.length > 1) { 6319 return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; 6320 } else { 6321 warn$1(`injection "${String(key)}" not found.`); 6322 } 6323 } else { 6324 warn$1(`inject() can only be used inside setup() or functional components.`); 6325 } 6326 } 6327 function hasInjectionContext() { 6328 return !!(getCurrentInstance() || currentApp); 6329 } 6330 6331 const internalObjectProto = {}; 6332 const createInternalObject = () => Object.create(internalObjectProto); 6333 const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto; 6334 6335 function initProps(instance, rawProps, isStateful, isSSR = false) { 6336 const props = {}; 6337 const attrs = createInternalObject(); 6338 instance.propsDefaults = /* @__PURE__ */ Object.create(null); 6339 setFullProps(instance, rawProps, props, attrs); 6340 for (const key in instance.propsOptions[0]) { 6341 if (!(key in props)) { 6342 props[key] = void 0; 6343 } 6344 } 6345 { 6346 validateProps(rawProps || {}, props, instance); 6347 } 6348 if (isStateful) { 6349 instance.props = isSSR ? props : shallowReactive(props); 6350 } else { 6351 if (!instance.type.props) { 6352 instance.props = attrs; 6353 } else { 6354 instance.props = props; 6355 } 6356 } 6357 instance.attrs = attrs; 6358 } 6359 function isInHmrContext(instance) { 6360 while (instance) { 6361 if (instance.type.__hmrId) return true; 6362 instance = instance.parent; 6363 } 6364 } 6365 function updateProps(instance, rawProps, rawPrevProps, optimized) { 6366 const { 6367 props, 6368 attrs, 6369 vnode: { patchFlag } 6370 } = instance; 6371 const rawCurrentProps = toRaw(props); 6372 const [options] = instance.propsOptions; 6373 let hasAttrsChanged = false; 6374 if ( 6375 // always force full diff in dev 6376 // - #1942 if hmr is enabled with sfc component 6377 // - vite#872 non-sfc component used by sfc component 6378 !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16) 6379 ) { 6380 if (patchFlag & 8) { 6381 const propsToUpdate = instance.vnode.dynamicProps; 6382 for (let i = 0; i < propsToUpdate.length; i++) { 6383 let key = propsToUpdate[i]; 6384 if (isEmitListener(instance.emitsOptions, key)) { 6385 continue; 6386 } 6387 const value = rawProps[key]; 6388 if (options) { 6389 if (hasOwn(attrs, key)) { 6390 if (value !== attrs[key]) { 6391 attrs[key] = value; 6392 hasAttrsChanged = true; 6393 } 6394 } else { 6395 const camelizedKey = camelize(key); 6396 props[camelizedKey] = resolvePropValue( 6397 options, 6398 rawCurrentProps, 6399 camelizedKey, 6400 value, 6401 instance, 6402 false 6403 ); 6404 } 6405 } else { 6406 if (value !== attrs[key]) { 6407 attrs[key] = value; 6408 hasAttrsChanged = true; 6409 } 6410 } 6411 } 6412 } 6413 } else { 6414 if (setFullProps(instance, rawProps, props, attrs)) { 6415 hasAttrsChanged = true; 6416 } 6417 let kebabKey; 6418 for (const key in rawCurrentProps) { 6419 if (!rawProps || // for camelCase 6420 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case 6421 // and converted to camelCase (#955) 6422 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) { 6423 if (options) { 6424 if (rawPrevProps && // for camelCase 6425 (rawPrevProps[key] !== void 0 || // for kebab-case 6426 rawPrevProps[kebabKey] !== void 0)) { 6427 props[key] = resolvePropValue( 6428 options, 6429 rawCurrentProps, 6430 key, 6431 void 0, 6432 instance, 6433 true 6434 ); 6435 } 6436 } else { 6437 delete props[key]; 6438 } 6439 } 6440 } 6441 if (attrs !== rawCurrentProps) { 6442 for (const key in attrs) { 6443 if (!rawProps || !hasOwn(rawProps, key) && true) { 6444 delete attrs[key]; 6445 hasAttrsChanged = true; 6446 } 6447 } 6448 } 6449 } 6450 if (hasAttrsChanged) { 6451 trigger(instance.attrs, "set", ""); 6452 } 6453 { 6454 validateProps(rawProps || {}, props, instance); 6455 } 6456 } 6457 function setFullProps(instance, rawProps, props, attrs) { 6458 const [options, needCastKeys] = instance.propsOptions; 6459 let hasAttrsChanged = false; 6460 let rawCastValues; 6461 if (rawProps) { 6462 for (let key in rawProps) { 6463 if (isReservedProp(key)) { 6464 continue; 6465 } 6466 const value = rawProps[key]; 6467 let camelKey; 6468 if (options && hasOwn(options, camelKey = camelize(key))) { 6469 if (!needCastKeys || !needCastKeys.includes(camelKey)) { 6470 props[camelKey] = value; 6471 } else { 6472 (rawCastValues || (rawCastValues = {}))[camelKey] = value; 6473 } 6474 } else if (!isEmitListener(instance.emitsOptions, key)) { 6475 if (!(key in attrs) || value !== attrs[key]) { 6476 attrs[key] = value; 6477 hasAttrsChanged = true; 6478 } 6479 } 6480 } 6481 } 6482 if (needCastKeys) { 6483 const rawCurrentProps = toRaw(props); 6484 const castValues = rawCastValues || EMPTY_OBJ; 6485 for (let i = 0; i < needCastKeys.length; i++) { 6486 const key = needCastKeys[i]; 6487 props[key] = resolvePropValue( 6488 options, 6489 rawCurrentProps, 6490 key, 6491 castValues[key], 6492 instance, 6493 !hasOwn(castValues, key) 6494 ); 6495 } 6496 } 6497 return hasAttrsChanged; 6498 } 6499 function resolvePropValue(options, props, key, value, instance, isAbsent) { 6500 const opt = options[key]; 6501 if (opt != null) { 6502 const hasDefault = hasOwn(opt, "default"); 6503 if (hasDefault && value === void 0) { 6504 const defaultValue = opt.default; 6505 if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) { 6506 const { propsDefaults } = instance; 6507 if (key in propsDefaults) { 6508 value = propsDefaults[key]; 6509 } else { 6510 const reset = setCurrentInstance(instance); 6511 value = propsDefaults[key] = defaultValue.call( 6512 null, 6513 props 6514 ); 6515 reset(); 6516 } 6517 } else { 6518 value = defaultValue; 6519 } 6520 if (instance.ce) { 6521 instance.ce._setProp(key, value); 6522 } 6523 } 6524 if (opt[0 /* shouldCast */]) { 6525 if (isAbsent && !hasDefault) { 6526 value = false; 6527 } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) { 6528 value = true; 6529 } 6530 } 6531 } 6532 return value; 6533 } 6534 const mixinPropsCache = /* @__PURE__ */ new WeakMap(); 6535 function normalizePropsOptions(comp, appContext, asMixin = false) { 6536 const cache = asMixin ? mixinPropsCache : appContext.propsCache; 6537 const cached = cache.get(comp); 6538 if (cached) { 6539 return cached; 6540 } 6541 const raw = comp.props; 6542 const normalized = {}; 6543 const needCastKeys = []; 6544 let hasExtends = false; 6545 if (!isFunction(comp)) { 6546 const extendProps = (raw2) => { 6547 hasExtends = true; 6548 const [props, keys] = normalizePropsOptions(raw2, appContext, true); 6549 extend(normalized, props); 6550 if (keys) needCastKeys.push(...keys); 6551 }; 6552 if (!asMixin && appContext.mixins.length) { 6553 appContext.mixins.forEach(extendProps); 6554 } 6555 if (comp.extends) { 6556 extendProps(comp.extends); 6557 } 6558 if (comp.mixins) { 6559 comp.mixins.forEach(extendProps); 6560 } 6561 } 6562 if (!raw && !hasExtends) { 6563 if (isObject(comp)) { 6564 cache.set(comp, EMPTY_ARR); 6565 } 6566 return EMPTY_ARR; 6567 } 6568 if (isArray(raw)) { 6569 for (let i = 0; i < raw.length; i++) { 6570 if (!isString(raw[i])) { 6571 warn$1(`props must be strings when using array syntax.`, raw[i]); 6572 } 6573 const normalizedKey = camelize(raw[i]); 6574 if (validatePropName(normalizedKey)) { 6575 normalized[normalizedKey] = EMPTY_OBJ; 6576 } 6577 } 6578 } else if (raw) { 6579 if (!isObject(raw)) { 6580 warn$1(`invalid props options`, raw); 6581 } 6582 for (const key in raw) { 6583 const normalizedKey = camelize(key); 6584 if (validatePropName(normalizedKey)) { 6585 const opt = raw[key]; 6586 const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt); 6587 const propType = prop.type; 6588 let shouldCast = false; 6589 let shouldCastTrue = true; 6590 if (isArray(propType)) { 6591 for (let index = 0; index < propType.length; ++index) { 6592 const type = propType[index]; 6593 const typeName = isFunction(type) && type.name; 6594 if (typeName === "Boolean") { 6595 shouldCast = true; 6596 break; 6597 } else if (typeName === "String") { 6598 shouldCastTrue = false; 6599 } 6600 } 6601 } else { 6602 shouldCast = isFunction(propType) && propType.name === "Boolean"; 6603 } 6604 prop[0 /* shouldCast */] = shouldCast; 6605 prop[1 /* shouldCastTrue */] = shouldCastTrue; 6606 if (shouldCast || hasOwn(prop, "default")) { 6607 needCastKeys.push(normalizedKey); 6608 } 6609 } 6610 } 6611 } 6612 const res = [normalized, needCastKeys]; 6613 if (isObject(comp)) { 6614 cache.set(comp, res); 6615 } 6616 return res; 6617 } 6618 function validatePropName(key) { 6619 if (key[0] !== "$" && !isReservedProp(key)) { 6620 return true; 6621 } else { 6622 warn$1(`Invalid prop name: "${key}" is a reserved property.`); 6623 } 6624 return false; 6625 } 6626 function getType(ctor) { 6627 if (ctor === null) { 6628 return "null"; 6629 } 6630 if (typeof ctor === "function") { 6631 return ctor.name || ""; 6632 } else if (typeof ctor === "object") { 6633 const name = ctor.constructor && ctor.constructor.name; 6634 return name || ""; 6635 } 6636 return ""; 6637 } 6638 function validateProps(rawProps, props, instance) { 6639 const resolvedValues = toRaw(props); 6640 const options = instance.propsOptions[0]; 6641 const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key)); 6642 for (const key in options) { 6643 let opt = options[key]; 6644 if (opt == null) continue; 6645 validateProp( 6646 key, 6647 resolvedValues[key], 6648 opt, 6649 shallowReadonly(resolvedValues) , 6650 !camelizePropsKey.includes(key) 6651 ); 6652 } 6653 } 6654 function validateProp(name, value, prop, props, isAbsent) { 6655 const { type, required, validator, skipCheck } = prop; 6656 if (required && isAbsent) { 6657 warn$1('Missing required prop: "' + name + '"'); 6658 return; 6659 } 6660 if (value == null && !required) { 6661 return; 6662 } 6663 if (type != null && type !== true && !skipCheck) { 6664 let isValid = false; 6665 const types = isArray(type) ? type : [type]; 6666 const expectedTypes = []; 6667 for (let i = 0; i < types.length && !isValid; i++) { 6668 const { valid, expectedType } = assertType(value, types[i]); 6669 expectedTypes.push(expectedType || ""); 6670 isValid = valid; 6671 } 6672 if (!isValid) { 6673 warn$1(getInvalidTypeMessage(name, value, expectedTypes)); 6674 return; 6675 } 6676 } 6677 if (validator && !validator(value, props)) { 6678 warn$1('Invalid prop: custom validator check failed for prop "' + name + '".'); 6679 } 6680 } 6681 const isSimpleType = /* @__PURE__ */ makeMap( 6682 "String,Number,Boolean,Function,Symbol,BigInt" 6683 ); 6684 function assertType(value, type) { 6685 let valid; 6686 const expectedType = getType(type); 6687 if (expectedType === "null") { 6688 valid = value === null; 6689 } else if (isSimpleType(expectedType)) { 6690 const t = typeof value; 6691 valid = t === expectedType.toLowerCase(); 6692 if (!valid && t === "object") { 6693 valid = value instanceof type; 6694 } 6695 } else if (expectedType === "Object") { 6696 valid = isObject(value); 6697 } else if (expectedType === "Array") { 6698 valid = isArray(value); 6699 } else { 6700 valid = value instanceof type; 6701 } 6702 return { 6703 valid, 6704 expectedType 6705 }; 6706 } 6707 function getInvalidTypeMessage(name, value, expectedTypes) { 6708 if (expectedTypes.length === 0) { 6709 return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`; 6710 } 6711 let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`; 6712 const expectedType = expectedTypes[0]; 6713 const receivedType = toRawType(value); 6714 const expectedValue = styleValue(value, expectedType); 6715 const receivedValue = styleValue(value, receivedType); 6716 if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) { 6717 message += ` with value ${expectedValue}`; 6718 } 6719 message += `, got ${receivedType} `; 6720 if (isExplicable(receivedType)) { 6721 message += `with value ${receivedValue}.`; 6722 } 6723 return message; 6724 } 6725 function styleValue(value, type) { 6726 if (type === "String") { 6727 return `"${value}"`; 6728 } else if (type === "Number") { 6729 return `${Number(value)}`; 6730 } else { 6731 return `${value}`; 6732 } 6733 } 6734 function isExplicable(type) { 6735 const explicitTypes = ["string", "number", "boolean"]; 6736 return explicitTypes.some((elem) => type.toLowerCase() === elem); 6737 } 6738 function isBoolean(...args) { 6739 return args.some((elem) => elem.toLowerCase() === "boolean"); 6740 } 6741 6742 const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable"; 6743 const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; 6744 const normalizeSlot = (key, rawSlot, ctx) => { 6745 if (rawSlot._n) { 6746 return rawSlot; 6747 } 6748 const normalized = withCtx((...args) => { 6749 if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) { 6750 warn$1( 6751 `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.` 6752 ); 6753 } 6754 return normalizeSlotValue(rawSlot(...args)); 6755 }, ctx); 6756 normalized._c = false; 6757 return normalized; 6758 }; 6759 const normalizeObjectSlots = (rawSlots, slots, instance) => { 6760 const ctx = rawSlots._ctx; 6761 for (const key in rawSlots) { 6762 if (isInternalKey(key)) continue; 6763 const value = rawSlots[key]; 6764 if (isFunction(value)) { 6765 slots[key] = normalizeSlot(key, value, ctx); 6766 } else if (value != null) { 6767 { 6768 warn$1( 6769 `Non-function value encountered for slot "${key}". Prefer function slots for better performance.` 6770 ); 6771 } 6772 const normalized = normalizeSlotValue(value); 6773 slots[key] = () => normalized; 6774 } 6775 } 6776 }; 6777 const normalizeVNodeSlots = (instance, children) => { 6778 if (!isKeepAlive(instance.vnode) && true) { 6779 warn$1( 6780 `Non-function value encountered for default slot. Prefer function slots for better performance.` 6781 ); 6782 } 6783 const normalized = normalizeSlotValue(children); 6784 instance.slots.default = () => normalized; 6785 }; 6786 const assignSlots = (slots, children, optimized) => { 6787 for (const key in children) { 6788 if (optimized || !isInternalKey(key)) { 6789 slots[key] = children[key]; 6790 } 6791 } 6792 }; 6793 const initSlots = (instance, children, optimized) => { 6794 const slots = instance.slots = createInternalObject(); 6795 if (instance.vnode.shapeFlag & 32) { 6796 const type = children._; 6797 if (type) { 6798 assignSlots(slots, children, optimized); 6799 if (optimized) { 6800 def(slots, "_", type, true); 6801 } 6802 } else { 6803 normalizeObjectSlots(children, slots); 6804 } 6805 } else if (children) { 6806 normalizeVNodeSlots(instance, children); 6807 } 6808 }; 6809 const updateSlots = (instance, children, optimized) => { 6810 const { vnode, slots } = instance; 6811 let needDeletionCheck = true; 6812 let deletionComparisonTarget = EMPTY_OBJ; 6813 if (vnode.shapeFlag & 32) { 6814 const type = children._; 6815 if (type) { 6816 if (isHmrUpdating) { 6817 assignSlots(slots, children, optimized); 6818 trigger(instance, "set", "$slots"); 6819 } else if (optimized && type === 1) { 6820 needDeletionCheck = false; 6821 } else { 6822 assignSlots(slots, children, optimized); 6823 } 6824 } else { 6825 needDeletionCheck = !children.$stable; 6826 normalizeObjectSlots(children, slots); 6827 } 6828 deletionComparisonTarget = children; 6829 } else if (children) { 6830 normalizeVNodeSlots(instance, children); 6831 deletionComparisonTarget = { default: 1 }; 6832 } 6833 if (needDeletionCheck) { 6834 for (const key in slots) { 6835 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) { 6836 delete slots[key]; 6837 } 6838 } 6839 } 6840 }; 6841 6842 let supported; 6843 let perf; 6844 function startMeasure(instance, type) { 6845 if (instance.appContext.config.performance && isSupported()) { 6846 perf.mark(`vue-${type}-${instance.uid}`); 6847 } 6848 { 6849 devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now()); 6850 } 6851 } 6852 function endMeasure(instance, type) { 6853 if (instance.appContext.config.performance && isSupported()) { 6854 const startTag = `vue-${type}-${instance.uid}`; 6855 const endTag = startTag + `:end`; 6856 const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`; 6857 perf.mark(endTag); 6858 perf.measure(measureName, startTag, endTag); 6859 perf.clearMeasures(measureName); 6860 perf.clearMarks(startTag); 6861 perf.clearMarks(endTag); 6862 } 6863 { 6864 devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now()); 6865 } 6866 } 6867 function isSupported() { 6868 if (supported !== void 0) { 6869 return supported; 6870 } 6871 if (typeof window !== "undefined" && window.performance) { 6872 supported = true; 6873 perf = window.performance; 6874 } else { 6875 supported = false; 6876 } 6877 return supported; 6878 } 6879 6880 const queuePostRenderEffect = queueEffectWithSuspense ; 6881 function createRenderer(options) { 6882 return baseCreateRenderer(options); 6883 } 6884 function createHydrationRenderer(options) { 6885 return baseCreateRenderer(options, createHydrationFunctions); 6886 } 6887 function baseCreateRenderer(options, createHydrationFns) { 6888 const target = getGlobalThis(); 6889 target.__VUE__ = true; 6890 { 6891 setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target); 6892 } 6893 const { 6894 insert: hostInsert, 6895 remove: hostRemove, 6896 patchProp: hostPatchProp, 6897 createElement: hostCreateElement, 6898 createText: hostCreateText, 6899 createComment: hostCreateComment, 6900 setText: hostSetText, 6901 setElementText: hostSetElementText, 6902 parentNode: hostParentNode, 6903 nextSibling: hostNextSibling, 6904 setScopeId: hostSetScopeId = NOOP, 6905 insertStaticContent: hostInsertStaticContent 6906 } = options; 6907 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => { 6908 if (n1 === n2) { 6909 return; 6910 } 6911 if (n1 && !isSameVNodeType(n1, n2)) { 6912 anchor = getNextHostNode(n1); 6913 unmount(n1, parentComponent, parentSuspense, true); 6914 n1 = null; 6915 } 6916 if (n2.patchFlag === -2) { 6917 optimized = false; 6918 n2.dynamicChildren = null; 6919 } 6920 const { type, ref, shapeFlag } = n2; 6921 switch (type) { 6922 case Text: 6923 processText(n1, n2, container, anchor); 6924 break; 6925 case Comment: 6926 processCommentNode(n1, n2, container, anchor); 6927 break; 6928 case Static: 6929 if (n1 == null) { 6930 mountStaticNode(n2, container, anchor, namespace); 6931 } else { 6932 patchStaticNode(n1, n2, container, namespace); 6933 } 6934 break; 6935 case Fragment: 6936 processFragment( 6937 n1, 6938 n2, 6939 container, 6940 anchor, 6941 parentComponent, 6942 parentSuspense, 6943 namespace, 6944 slotScopeIds, 6945 optimized 6946 ); 6947 break; 6948 default: 6949 if (shapeFlag & 1) { 6950 processElement( 6951 n1, 6952 n2, 6953 container, 6954 anchor, 6955 parentComponent, 6956 parentSuspense, 6957 namespace, 6958 slotScopeIds, 6959 optimized 6960 ); 6961 } else if (shapeFlag & 6) { 6962 processComponent( 6963 n1, 6964 n2, 6965 container, 6966 anchor, 6967 parentComponent, 6968 parentSuspense, 6969 namespace, 6970 slotScopeIds, 6971 optimized 6972 ); 6973 } else if (shapeFlag & 64) { 6974 type.process( 6975 n1, 6976 n2, 6977 container, 6978 anchor, 6979 parentComponent, 6980 parentSuspense, 6981 namespace, 6982 slotScopeIds, 6983 optimized, 6984 internals 6985 ); 6986 } else if (shapeFlag & 128) { 6987 type.process( 6988 n1, 6989 n2, 6990 container, 6991 anchor, 6992 parentComponent, 6993 parentSuspense, 6994 namespace, 6995 slotScopeIds, 6996 optimized, 6997 internals 6998 ); 6999 } else { 7000 warn$1("Invalid VNode type:", type, `(${typeof type})`); 7001 } 7002 } 7003 if (ref != null && parentComponent) { 7004 setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); 7005 } else if (ref == null && n1 && n1.ref != null) { 7006 setRef(n1.ref, null, parentSuspense, n1, true); 7007 } 7008 }; 7009 const processText = (n1, n2, container, anchor) => { 7010 if (n1 == null) { 7011 hostInsert( 7012 n2.el = hostCreateText(n2.children), 7013 container, 7014 anchor 7015 ); 7016 } else { 7017 const el = n2.el = n1.el; 7018 if (n2.children !== n1.children) { 7019 hostSetText(el, n2.children); 7020 } 7021 } 7022 }; 7023 const processCommentNode = (n1, n2, container, anchor) => { 7024 if (n1 == null) { 7025 hostInsert( 7026 n2.el = hostCreateComment(n2.children || ""), 7027 container, 7028 anchor 7029 ); 7030 } else { 7031 n2.el = n1.el; 7032 } 7033 }; 7034 const mountStaticNode = (n2, container, anchor, namespace) => { 7035 [n2.el, n2.anchor] = hostInsertStaticContent( 7036 n2.children, 7037 container, 7038 anchor, 7039 namespace, 7040 n2.el, 7041 n2.anchor 7042 ); 7043 }; 7044 const patchStaticNode = (n1, n2, container, namespace) => { 7045 if (n2.children !== n1.children) { 7046 const anchor = hostNextSibling(n1.anchor); 7047 removeStaticNode(n1); 7048 [n2.el, n2.anchor] = hostInsertStaticContent( 7049 n2.children, 7050 container, 7051 anchor, 7052 namespace 7053 ); 7054 } else { 7055 n2.el = n1.el; 7056 n2.anchor = n1.anchor; 7057 } 7058 }; 7059 const moveStaticNode = ({ el, anchor }, container, nextSibling) => { 7060 let next; 7061 while (el && el !== anchor) { 7062 next = hostNextSibling(el); 7063 hostInsert(el, container, nextSibling); 7064 el = next; 7065 } 7066 hostInsert(anchor, container, nextSibling); 7067 }; 7068 const removeStaticNode = ({ el, anchor }) => { 7069 let next; 7070 while (el && el !== anchor) { 7071 next = hostNextSibling(el); 7072 hostRemove(el); 7073 el = next; 7074 } 7075 hostRemove(anchor); 7076 }; 7077 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7078 if (n2.type === "svg") { 7079 namespace = "svg"; 7080 } else if (n2.type === "math") { 7081 namespace = "mathml"; 7082 } 7083 if (n1 == null) { 7084 mountElement( 7085 n2, 7086 container, 7087 anchor, 7088 parentComponent, 7089 parentSuspense, 7090 namespace, 7091 slotScopeIds, 7092 optimized 7093 ); 7094 } else { 7095 patchElement( 7096 n1, 7097 n2, 7098 parentComponent, 7099 parentSuspense, 7100 namespace, 7101 slotScopeIds, 7102 optimized 7103 ); 7104 } 7105 }; 7106 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7107 let el; 7108 let vnodeHook; 7109 const { props, shapeFlag, transition, dirs } = vnode; 7110 el = vnode.el = hostCreateElement( 7111 vnode.type, 7112 namespace, 7113 props && props.is, 7114 props 7115 ); 7116 if (shapeFlag & 8) { 7117 hostSetElementText(el, vnode.children); 7118 } else if (shapeFlag & 16) { 7119 mountChildren( 7120 vnode.children, 7121 el, 7122 null, 7123 parentComponent, 7124 parentSuspense, 7125 resolveChildrenNamespace(vnode, namespace), 7126 slotScopeIds, 7127 optimized 7128 ); 7129 } 7130 if (dirs) { 7131 invokeDirectiveHook(vnode, null, parentComponent, "created"); 7132 } 7133 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent); 7134 if (props) { 7135 for (const key in props) { 7136 if (key !== "value" && !isReservedProp(key)) { 7137 hostPatchProp(el, key, null, props[key], namespace, parentComponent); 7138 } 7139 } 7140 if ("value" in props) { 7141 hostPatchProp(el, "value", null, props.value, namespace); 7142 } 7143 if (vnodeHook = props.onVnodeBeforeMount) { 7144 invokeVNodeHook(vnodeHook, parentComponent, vnode); 7145 } 7146 } 7147 { 7148 def(el, "__vnode", vnode, true); 7149 def(el, "__vueParentComponent", parentComponent, true); 7150 } 7151 if (dirs) { 7152 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 7153 } 7154 const needCallTransitionHooks = needTransition(parentSuspense, transition); 7155 if (needCallTransitionHooks) { 7156 transition.beforeEnter(el); 7157 } 7158 hostInsert(el, container, anchor); 7159 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) { 7160 queuePostRenderEffect(() => { 7161 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 7162 needCallTransitionHooks && transition.enter(el); 7163 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 7164 }, parentSuspense); 7165 } 7166 }; 7167 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => { 7168 if (scopeId) { 7169 hostSetScopeId(el, scopeId); 7170 } 7171 if (slotScopeIds) { 7172 for (let i = 0; i < slotScopeIds.length; i++) { 7173 hostSetScopeId(el, slotScopeIds[i]); 7174 } 7175 } 7176 if (parentComponent) { 7177 let subTree = parentComponent.subTree; 7178 if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) { 7179 subTree = filterSingleRoot(subTree.children) || subTree; 7180 } 7181 if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) { 7182 const parentVNode = parentComponent.vnode; 7183 setScopeId( 7184 el, 7185 parentVNode, 7186 parentVNode.scopeId, 7187 parentVNode.slotScopeIds, 7188 parentComponent.parent 7189 ); 7190 } 7191 } 7192 }; 7193 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => { 7194 for (let i = start; i < children.length; i++) { 7195 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]); 7196 patch( 7197 null, 7198 child, 7199 container, 7200 anchor, 7201 parentComponent, 7202 parentSuspense, 7203 namespace, 7204 slotScopeIds, 7205 optimized 7206 ); 7207 } 7208 }; 7209 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7210 const el = n2.el = n1.el; 7211 { 7212 el.__vnode = n2; 7213 } 7214 let { patchFlag, dynamicChildren, dirs } = n2; 7215 patchFlag |= n1.patchFlag & 16; 7216 const oldProps = n1.props || EMPTY_OBJ; 7217 const newProps = n2.props || EMPTY_OBJ; 7218 let vnodeHook; 7219 parentComponent && toggleRecurse(parentComponent, false); 7220 if (vnodeHook = newProps.onVnodeBeforeUpdate) { 7221 invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7222 } 7223 if (dirs) { 7224 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate"); 7225 } 7226 parentComponent && toggleRecurse(parentComponent, true); 7227 if (isHmrUpdating) { 7228 patchFlag = 0; 7229 optimized = false; 7230 dynamicChildren = null; 7231 } 7232 if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) { 7233 hostSetElementText(el, ""); 7234 } 7235 if (dynamicChildren) { 7236 patchBlockChildren( 7237 n1.dynamicChildren, 7238 dynamicChildren, 7239 el, 7240 parentComponent, 7241 parentSuspense, 7242 resolveChildrenNamespace(n2, namespace), 7243 slotScopeIds 7244 ); 7245 { 7246 traverseStaticChildren(n1, n2); 7247 } 7248 } else if (!optimized) { 7249 patchChildren( 7250 n1, 7251 n2, 7252 el, 7253 null, 7254 parentComponent, 7255 parentSuspense, 7256 resolveChildrenNamespace(n2, namespace), 7257 slotScopeIds, 7258 false 7259 ); 7260 } 7261 if (patchFlag > 0) { 7262 if (patchFlag & 16) { 7263 patchProps(el, oldProps, newProps, parentComponent, namespace); 7264 } else { 7265 if (patchFlag & 2) { 7266 if (oldProps.class !== newProps.class) { 7267 hostPatchProp(el, "class", null, newProps.class, namespace); 7268 } 7269 } 7270 if (patchFlag & 4) { 7271 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace); 7272 } 7273 if (patchFlag & 8) { 7274 const propsToUpdate = n2.dynamicProps; 7275 for (let i = 0; i < propsToUpdate.length; i++) { 7276 const key = propsToUpdate[i]; 7277 const prev = oldProps[key]; 7278 const next = newProps[key]; 7279 if (next !== prev || key === "value") { 7280 hostPatchProp(el, key, prev, next, namespace, parentComponent); 7281 } 7282 } 7283 } 7284 } 7285 if (patchFlag & 1) { 7286 if (n1.children !== n2.children) { 7287 hostSetElementText(el, n2.children); 7288 } 7289 } 7290 } else if (!optimized && dynamicChildren == null) { 7291 patchProps(el, oldProps, newProps, parentComponent, namespace); 7292 } 7293 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) { 7294 queuePostRenderEffect(() => { 7295 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7296 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated"); 7297 }, parentSuspense); 7298 } 7299 }; 7300 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => { 7301 for (let i = 0; i < newChildren.length; i++) { 7302 const oldVNode = oldChildren[i]; 7303 const newVNode = newChildren[i]; 7304 const container = ( 7305 // oldVNode may be an errored async setup() component inside Suspense 7306 // which will not have a mounted element 7307 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent 7308 // of the Fragment itself so it can move its children. 7309 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement 7310 // which also requires the correct parent container 7311 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. 7312 oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : ( 7313 // In other cases, the parent container is not actually used so we 7314 // just pass the block element here to avoid a DOM parentNode call. 7315 fallbackContainer 7316 ) 7317 ); 7318 patch( 7319 oldVNode, 7320 newVNode, 7321 container, 7322 null, 7323 parentComponent, 7324 parentSuspense, 7325 namespace, 7326 slotScopeIds, 7327 true 7328 ); 7329 } 7330 }; 7331 const patchProps = (el, oldProps, newProps, parentComponent, namespace) => { 7332 if (oldProps !== newProps) { 7333 if (oldProps !== EMPTY_OBJ) { 7334 for (const key in oldProps) { 7335 if (!isReservedProp(key) && !(key in newProps)) { 7336 hostPatchProp( 7337 el, 7338 key, 7339 oldProps[key], 7340 null, 7341 namespace, 7342 parentComponent 7343 ); 7344 } 7345 } 7346 } 7347 for (const key in newProps) { 7348 if (isReservedProp(key)) continue; 7349 const next = newProps[key]; 7350 const prev = oldProps[key]; 7351 if (next !== prev && key !== "value") { 7352 hostPatchProp(el, key, prev, next, namespace, parentComponent); 7353 } 7354 } 7355 if ("value" in newProps) { 7356 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace); 7357 } 7358 } 7359 }; 7360 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7361 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText(""); 7362 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText(""); 7363 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2; 7364 if ( 7365 // #5523 dev root fragment may inherit directives 7366 isHmrUpdating || patchFlag & 2048 7367 ) { 7368 patchFlag = 0; 7369 optimized = false; 7370 dynamicChildren = null; 7371 } 7372 if (fragmentSlotScopeIds) { 7373 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 7374 } 7375 if (n1 == null) { 7376 hostInsert(fragmentStartAnchor, container, anchor); 7377 hostInsert(fragmentEndAnchor, container, anchor); 7378 mountChildren( 7379 // #10007 7380 // such fragment like `<></>` will be compiled into 7381 // a fragment which doesn't have a children. 7382 // In this case fallback to an empty array 7383 n2.children || [], 7384 container, 7385 fragmentEndAnchor, 7386 parentComponent, 7387 parentSuspense, 7388 namespace, 7389 slotScopeIds, 7390 optimized 7391 ); 7392 } else { 7393 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result 7394 // of renderSlot() with no valid children 7395 n1.dynamicChildren) { 7396 patchBlockChildren( 7397 n1.dynamicChildren, 7398 dynamicChildren, 7399 container, 7400 parentComponent, 7401 parentSuspense, 7402 namespace, 7403 slotScopeIds 7404 ); 7405 { 7406 traverseStaticChildren(n1, n2); 7407 } 7408 } else { 7409 patchChildren( 7410 n1, 7411 n2, 7412 container, 7413 fragmentEndAnchor, 7414 parentComponent, 7415 parentSuspense, 7416 namespace, 7417 slotScopeIds, 7418 optimized 7419 ); 7420 } 7421 } 7422 }; 7423 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7424 n2.slotScopeIds = slotScopeIds; 7425 if (n1 == null) { 7426 if (n2.shapeFlag & 512) { 7427 parentComponent.ctx.activate( 7428 n2, 7429 container, 7430 anchor, 7431 namespace, 7432 optimized 7433 ); 7434 } else { 7435 mountComponent( 7436 n2, 7437 container, 7438 anchor, 7439 parentComponent, 7440 parentSuspense, 7441 namespace, 7442 optimized 7443 ); 7444 } 7445 } else { 7446 updateComponent(n1, n2, optimized); 7447 } 7448 }; 7449 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => { 7450 const instance = (initialVNode.component = createComponentInstance( 7451 initialVNode, 7452 parentComponent, 7453 parentSuspense 7454 )); 7455 if (instance.type.__hmrId) { 7456 registerHMR(instance); 7457 } 7458 { 7459 pushWarningContext(initialVNode); 7460 startMeasure(instance, `mount`); 7461 } 7462 if (isKeepAlive(initialVNode)) { 7463 instance.ctx.renderer = internals; 7464 } 7465 { 7466 { 7467 startMeasure(instance, `init`); 7468 } 7469 setupComponent(instance, false, optimized); 7470 { 7471 endMeasure(instance, `init`); 7472 } 7473 } 7474 if (isHmrUpdating) initialVNode.el = null; 7475 if (instance.asyncDep) { 7476 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); 7477 if (!initialVNode.el) { 7478 const placeholder = instance.subTree = createVNode(Comment); 7479 processCommentNode(null, placeholder, container, anchor); 7480 initialVNode.placeholder = placeholder.el; 7481 } 7482 } else { 7483 setupRenderEffect( 7484 instance, 7485 initialVNode, 7486 container, 7487 anchor, 7488 parentSuspense, 7489 namespace, 7490 optimized 7491 ); 7492 } 7493 { 7494 popWarningContext(); 7495 endMeasure(instance, `mount`); 7496 } 7497 }; 7498 const updateComponent = (n1, n2, optimized) => { 7499 const instance = n2.component = n1.component; 7500 if (shouldUpdateComponent(n1, n2, optimized)) { 7501 if (instance.asyncDep && !instance.asyncResolved) { 7502 { 7503 pushWarningContext(n2); 7504 } 7505 updateComponentPreRender(instance, n2, optimized); 7506 { 7507 popWarningContext(); 7508 } 7509 return; 7510 } else { 7511 instance.next = n2; 7512 instance.update(); 7513 } 7514 } else { 7515 n2.el = n1.el; 7516 instance.vnode = n2; 7517 } 7518 }; 7519 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => { 7520 const componentUpdateFn = () => { 7521 if (!instance.isMounted) { 7522 let vnodeHook; 7523 const { el, props } = initialVNode; 7524 const { bm, m, parent, root, type } = instance; 7525 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode); 7526 toggleRecurse(instance, false); 7527 if (bm) { 7528 invokeArrayFns(bm); 7529 } 7530 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) { 7531 invokeVNodeHook(vnodeHook, parent, initialVNode); 7532 } 7533 toggleRecurse(instance, true); 7534 if (el && hydrateNode) { 7535 const hydrateSubTree = () => { 7536 { 7537 startMeasure(instance, `render`); 7538 } 7539 instance.subTree = renderComponentRoot(instance); 7540 { 7541 endMeasure(instance, `render`); 7542 } 7543 { 7544 startMeasure(instance, `hydrate`); 7545 } 7546 hydrateNode( 7547 el, 7548 instance.subTree, 7549 instance, 7550 parentSuspense, 7551 null 7552 ); 7553 { 7554 endMeasure(instance, `hydrate`); 7555 } 7556 }; 7557 if (isAsyncWrapperVNode && type.__asyncHydrate) { 7558 type.__asyncHydrate( 7559 el, 7560 instance, 7561 hydrateSubTree 7562 ); 7563 } else { 7564 hydrateSubTree(); 7565 } 7566 } else { 7567 if (root.ce && // @ts-expect-error _def is private 7568 root.ce._def.shadowRoot !== false) { 7569 root.ce._injectChildStyle(type); 7570 } 7571 { 7572 startMeasure(instance, `render`); 7573 } 7574 const subTree = instance.subTree = renderComponentRoot(instance); 7575 { 7576 endMeasure(instance, `render`); 7577 } 7578 { 7579 startMeasure(instance, `patch`); 7580 } 7581 patch( 7582 null, 7583 subTree, 7584 container, 7585 anchor, 7586 instance, 7587 parentSuspense, 7588 namespace 7589 ); 7590 { 7591 endMeasure(instance, `patch`); 7592 } 7593 initialVNode.el = subTree.el; 7594 } 7595 if (m) { 7596 queuePostRenderEffect(m, parentSuspense); 7597 } 7598 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) { 7599 const scopedInitialVNode = initialVNode; 7600 queuePostRenderEffect( 7601 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), 7602 parentSuspense 7603 ); 7604 } 7605 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) { 7606 instance.a && queuePostRenderEffect(instance.a, parentSuspense); 7607 } 7608 instance.isMounted = true; 7609 { 7610 devtoolsComponentAdded(instance); 7611 } 7612 initialVNode = container = anchor = null; 7613 } else { 7614 let { next, bu, u, parent, vnode } = instance; 7615 { 7616 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance); 7617 if (nonHydratedAsyncRoot) { 7618 if (next) { 7619 next.el = vnode.el; 7620 updateComponentPreRender(instance, next, optimized); 7621 } 7622 nonHydratedAsyncRoot.asyncDep.then(() => { 7623 if (!instance.isUnmounted) { 7624 componentUpdateFn(); 7625 } 7626 }); 7627 return; 7628 } 7629 } 7630 let originNext = next; 7631 let vnodeHook; 7632 { 7633 pushWarningContext(next || instance.vnode); 7634 } 7635 toggleRecurse(instance, false); 7636 if (next) { 7637 next.el = vnode.el; 7638 updateComponentPreRender(instance, next, optimized); 7639 } else { 7640 next = vnode; 7641 } 7642 if (bu) { 7643 invokeArrayFns(bu); 7644 } 7645 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) { 7646 invokeVNodeHook(vnodeHook, parent, next, vnode); 7647 } 7648 toggleRecurse(instance, true); 7649 { 7650 startMeasure(instance, `render`); 7651 } 7652 const nextTree = renderComponentRoot(instance); 7653 { 7654 endMeasure(instance, `render`); 7655 } 7656 const prevTree = instance.subTree; 7657 instance.subTree = nextTree; 7658 { 7659 startMeasure(instance, `patch`); 7660 } 7661 patch( 7662 prevTree, 7663 nextTree, 7664 // parent may have changed if it's in a teleport 7665 hostParentNode(prevTree.el), 7666 // anchor may have changed if it's in a fragment 7667 getNextHostNode(prevTree), 7668 instance, 7669 parentSuspense, 7670 namespace 7671 ); 7672 { 7673 endMeasure(instance, `patch`); 7674 } 7675 next.el = nextTree.el; 7676 if (originNext === null) { 7677 updateHOCHostEl(instance, nextTree.el); 7678 } 7679 if (u) { 7680 queuePostRenderEffect(u, parentSuspense); 7681 } 7682 if (vnodeHook = next.props && next.props.onVnodeUpdated) { 7683 queuePostRenderEffect( 7684 () => invokeVNodeHook(vnodeHook, parent, next, vnode), 7685 parentSuspense 7686 ); 7687 } 7688 { 7689 devtoolsComponentUpdated(instance); 7690 } 7691 { 7692 popWarningContext(); 7693 } 7694 } 7695 }; 7696 instance.scope.on(); 7697 const effect = instance.effect = new ReactiveEffect(componentUpdateFn); 7698 instance.scope.off(); 7699 const update = instance.update = effect.run.bind(effect); 7700 const job = instance.job = effect.runIfDirty.bind(effect); 7701 job.i = instance; 7702 job.id = instance.uid; 7703 effect.scheduler = () => queueJob(job); 7704 toggleRecurse(instance, true); 7705 { 7706 effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0; 7707 effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0; 7708 } 7709 update(); 7710 }; 7711 const updateComponentPreRender = (instance, nextVNode, optimized) => { 7712 nextVNode.component = instance; 7713 const prevProps = instance.vnode.props; 7714 instance.vnode = nextVNode; 7715 instance.next = null; 7716 updateProps(instance, nextVNode.props, prevProps, optimized); 7717 updateSlots(instance, nextVNode.children, optimized); 7718 pauseTracking(); 7719 flushPreFlushCbs(instance); 7720 resetTracking(); 7721 }; 7722 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => { 7723 const c1 = n1 && n1.children; 7724 const prevShapeFlag = n1 ? n1.shapeFlag : 0; 7725 const c2 = n2.children; 7726 const { patchFlag, shapeFlag } = n2; 7727 if (patchFlag > 0) { 7728 if (patchFlag & 128) { 7729 patchKeyedChildren( 7730 c1, 7731 c2, 7732 container, 7733 anchor, 7734 parentComponent, 7735 parentSuspense, 7736 namespace, 7737 slotScopeIds, 7738 optimized 7739 ); 7740 return; 7741 } else if (patchFlag & 256) { 7742 patchUnkeyedChildren( 7743 c1, 7744 c2, 7745 container, 7746 anchor, 7747 parentComponent, 7748 parentSuspense, 7749 namespace, 7750 slotScopeIds, 7751 optimized 7752 ); 7753 return; 7754 } 7755 } 7756 if (shapeFlag & 8) { 7757 if (prevShapeFlag & 16) { 7758 unmountChildren(c1, parentComponent, parentSuspense); 7759 } 7760 if (c2 !== c1) { 7761 hostSetElementText(container, c2); 7762 } 7763 } else { 7764 if (prevShapeFlag & 16) { 7765 if (shapeFlag & 16) { 7766 patchKeyedChildren( 7767 c1, 7768 c2, 7769 container, 7770 anchor, 7771 parentComponent, 7772 parentSuspense, 7773 namespace, 7774 slotScopeIds, 7775 optimized 7776 ); 7777 } else { 7778 unmountChildren(c1, parentComponent, parentSuspense, true); 7779 } 7780 } else { 7781 if (prevShapeFlag & 8) { 7782 hostSetElementText(container, ""); 7783 } 7784 if (shapeFlag & 16) { 7785 mountChildren( 7786 c2, 7787 container, 7788 anchor, 7789 parentComponent, 7790 parentSuspense, 7791 namespace, 7792 slotScopeIds, 7793 optimized 7794 ); 7795 } 7796 } 7797 } 7798 }; 7799 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7800 c1 = c1 || EMPTY_ARR; 7801 c2 = c2 || EMPTY_ARR; 7802 const oldLength = c1.length; 7803 const newLength = c2.length; 7804 const commonLength = Math.min(oldLength, newLength); 7805 let i; 7806 for (i = 0; i < commonLength; i++) { 7807 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7808 patch( 7809 c1[i], 7810 nextChild, 7811 container, 7812 null, 7813 parentComponent, 7814 parentSuspense, 7815 namespace, 7816 slotScopeIds, 7817 optimized 7818 ); 7819 } 7820 if (oldLength > newLength) { 7821 unmountChildren( 7822 c1, 7823 parentComponent, 7824 parentSuspense, 7825 true, 7826 false, 7827 commonLength 7828 ); 7829 } else { 7830 mountChildren( 7831 c2, 7832 container, 7833 anchor, 7834 parentComponent, 7835 parentSuspense, 7836 namespace, 7837 slotScopeIds, 7838 optimized, 7839 commonLength 7840 ); 7841 } 7842 }; 7843 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7844 let i = 0; 7845 const l2 = c2.length; 7846 let e1 = c1.length - 1; 7847 let e2 = l2 - 1; 7848 while (i <= e1 && i <= e2) { 7849 const n1 = c1[i]; 7850 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7851 if (isSameVNodeType(n1, n2)) { 7852 patch( 7853 n1, 7854 n2, 7855 container, 7856 null, 7857 parentComponent, 7858 parentSuspense, 7859 namespace, 7860 slotScopeIds, 7861 optimized 7862 ); 7863 } else { 7864 break; 7865 } 7866 i++; 7867 } 7868 while (i <= e1 && i <= e2) { 7869 const n1 = c1[e1]; 7870 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]); 7871 if (isSameVNodeType(n1, n2)) { 7872 patch( 7873 n1, 7874 n2, 7875 container, 7876 null, 7877 parentComponent, 7878 parentSuspense, 7879 namespace, 7880 slotScopeIds, 7881 optimized 7882 ); 7883 } else { 7884 break; 7885 } 7886 e1--; 7887 e2--; 7888 } 7889 if (i > e1) { 7890 if (i <= e2) { 7891 const nextPos = e2 + 1; 7892 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor; 7893 while (i <= e2) { 7894 patch( 7895 null, 7896 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]), 7897 container, 7898 anchor, 7899 parentComponent, 7900 parentSuspense, 7901 namespace, 7902 slotScopeIds, 7903 optimized 7904 ); 7905 i++; 7906 } 7907 } 7908 } else if (i > e2) { 7909 while (i <= e1) { 7910 unmount(c1[i], parentComponent, parentSuspense, true); 7911 i++; 7912 } 7913 } else { 7914 const s1 = i; 7915 const s2 = i;
vendor: 8,362 bytes, lines 7916-8154
7916 const keyToNewIndexMap = /* @__PURE__ */ new Map(); 7917 for (i = s2; i <= e2; i++) { 7918 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7919 if (nextChild.key != null) { 7920 if (keyToNewIndexMap.has(nextChild.key)) { 7921 warn$1( 7922 `Duplicate keys found during update:`, 7923 JSON.stringify(nextChild.key), 7924 `Make sure keys are unique.` 7925 ); 7926 } 7927 keyToNewIndexMap.set(nextChild.key, i); 7928 } 7929 } 7930 let j; 7931 let patched = 0; 7932 const toBePatched = e2 - s2 + 1; 7933 let moved = false; 7934 let maxNewIndexSoFar = 0; 7935 const newIndexToOldIndexMap = new Array(toBePatched); 7936 for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0; 7937 for (i = s1; i <= e1; i++) { 7938 const prevChild = c1[i]; 7939 if (patched >= toBePatched) { 7940 unmount(prevChild, parentComponent, parentSuspense, true); 7941 continue; 7942 } 7943 let newIndex; 7944 if (prevChild.key != null) { 7945 newIndex = keyToNewIndexMap.get(prevChild.key); 7946 } else { 7947 for (j = s2; j <= e2; j++) { 7948 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) { 7949 newIndex = j; 7950 break; 7951 } 7952 } 7953 } 7954 if (newIndex === void 0) { 7955 unmount(prevChild, parentComponent, parentSuspense, true); 7956 } else { 7957 newIndexToOldIndexMap[newIndex - s2] = i + 1; 7958 if (newIndex >= maxNewIndexSoFar) { 7959 maxNewIndexSoFar = newIndex; 7960 } else { 7961 moved = true; 7962 } 7963 patch( 7964 prevChild, 7965 c2[newIndex], 7966 container, 7967 null, 7968 parentComponent, 7969 parentSuspense, 7970 namespace, 7971 slotScopeIds, 7972 optimized 7973 ); 7974 patched++; 7975 } 7976 } 7977 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR; 7978 j = increasingNewIndexSequence.length - 1; 7979 for (i = toBePatched - 1; i >= 0; i--) { 7980 const nextIndex = s2 + i; 7981 const nextChild = c2[nextIndex]; 7982 const anchorVNode = c2[nextIndex + 1]; 7983 const anchor = nextIndex + 1 < l2 ? ( 7984 // #13559, fallback to el placeholder for unresolved async component 7985 anchorVNode.el || anchorVNode.placeholder 7986 ) : parentAnchor; 7987 if (newIndexToOldIndexMap[i] === 0) { 7988 patch( 7989 null, 7990 nextChild, 7991 container, 7992 anchor, 7993 parentComponent, 7994 parentSuspense, 7995 namespace, 7996 slotScopeIds, 7997 optimized 7998 ); 7999 } else if (moved) { 8000 if (j < 0 || i !== increasingNewIndexSequence[j]) { 8001 move(nextChild, container, anchor, 2); 8002 } else { 8003 j--; 8004 } 8005 } 8006 } 8007 } 8008 }; 8009 const move = (vnode, container, anchor, moveType, parentSuspense = null) => { 8010 const { el, type, transition, children, shapeFlag } = vnode; 8011 if (shapeFlag & 6) { 8012 move(vnode.component.subTree, container, anchor, moveType); 8013 return; 8014 } 8015 if (shapeFlag & 128) { 8016 vnode.suspense.move(container, anchor, moveType); 8017 return; 8018 } 8019 if (shapeFlag & 64) { 8020 type.move(vnode, container, anchor, internals); 8021 return; 8022 } 8023 if (type === Fragment) { 8024 hostInsert(el, container, anchor); 8025 for (let i = 0; i < children.length; i++) { 8026 move(children[i], container, anchor, moveType); 8027 } 8028 hostInsert(vnode.anchor, container, anchor); 8029 return; 8030 } 8031 if (type === Static) { 8032 moveStaticNode(vnode, container, anchor); 8033 return; 8034 } 8035 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition; 8036 if (needTransition2) { 8037 if (moveType === 0) { 8038 transition.beforeEnter(el); 8039 hostInsert(el, container, anchor); 8040 queuePostRenderEffect(() => transition.enter(el), parentSuspense); 8041 } else { 8042 const { leave, delayLeave, afterLeave } = transition; 8043 const remove2 = () => { 8044 if (vnode.ctx.isUnmounted) { 8045 hostRemove(el); 8046 } else { 8047 hostInsert(el, container, anchor); 8048 } 8049 }; 8050 const performLeave = () => { 8051 if (el._isLeaving) { 8052 el[leaveCbKey]( 8053 true 8054 /* cancelled */ 8055 ); 8056 } 8057 leave(el, () => { 8058 remove2(); 8059 afterLeave && afterLeave(); 8060 }); 8061 }; 8062 if (delayLeave) { 8063 delayLeave(el, remove2, performLeave); 8064 } else { 8065 performLeave(); 8066 } 8067 } 8068 } else { 8069 hostInsert(el, container, anchor); 8070 } 8071 }; 8072 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => { 8073 const { 8074 type, 8075 props, 8076 ref, 8077 children, 8078 dynamicChildren, 8079 shapeFlag, 8080 patchFlag, 8081 dirs, 8082 cacheIndex 8083 } = vnode; 8084 if (patchFlag === -2) { 8085 optimized = false; 8086 } 8087 if (ref != null) { 8088 pauseTracking(); 8089 setRef(ref, null, parentSuspense, vnode, true); 8090 resetTracking(); 8091 } 8092 if (cacheIndex != null) { 8093 parentComponent.renderCache[cacheIndex] = void 0; 8094 } 8095 if (shapeFlag & 256) { 8096 parentComponent.ctx.deactivate(vnode); 8097 return; 8098 } 8099 const shouldInvokeDirs = shapeFlag & 1 && dirs; 8100 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode); 8101 let vnodeHook; 8102 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) { 8103 invokeVNodeHook(vnodeHook, parentComponent, vnode); 8104 } 8105 if (shapeFlag & 6) { 8106 unmountComponent(vnode.component, parentSuspense, doRemove); 8107 } else { 8108 if (shapeFlag & 128) { 8109 vnode.suspense.unmount(parentSuspense, doRemove); 8110 return; 8111 } 8112 if (shouldInvokeDirs) { 8113 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount"); 8114 } 8115 if (shapeFlag & 64) { 8116 vnode.type.remove( 8117 vnode, 8118 parentComponent, 8119 parentSuspense, 8120 internals, 8121 doRemove 8122 ); 8123 } else if (dynamicChildren && // #5154 8124 // when v-once is used inside a block, setBlockTracking(-1) marks the 8125 // parent block with hasOnce: true 8126 // so that it doesn't take the fast path during unmount - otherwise 8127 // components nested in v-once are never unmounted. 8128 !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments 8129 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) { 8130 unmountChildren( 8131 dynamicChildren, 8132 parentComponent, 8133 parentSuspense, 8134 false, 8135 true 8136 ); 8137 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) { 8138 unmountChildren(children, parentComponent, parentSuspense); 8139 } 8140 if (doRemove) { 8141 remove(vnode); 8142 } 8143 } 8144 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) { 8145 queuePostRenderEffect(() => { 8146 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 8147 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted"); 8148 }, parentSuspense); 8149 } 8150 }; 8151 const remove = (vnode) => { 8152 const { type, el, anchor, transition } = vnode; 8153 if (type === Fragment) { 8154 if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
vendor: 6,546 bytes, lines 8155-8381
8155 vnode.children.forEach((child) => { 8156 if (child.type === Comment) { 8157 hostRemove(child.el); 8158 } else { 8159 remove(child); 8160 } 8161 }); 8162 } else { 8163 removeFragment(el, anchor); 8164 } 8165 return; 8166 } 8167 if (type === Static) { 8168 removeStaticNode(vnode); 8169 return; 8170 } 8171 const performRemove = () => { 8172 hostRemove(el); 8173 if (transition && !transition.persisted && transition.afterLeave) { 8174 transition.afterLeave(); 8175 } 8176 }; 8177 if (vnode.shapeFlag & 1 && transition && !transition.persisted) { 8178 const { leave, delayLeave } = transition; 8179 const performLeave = () => leave(el, performRemove); 8180 if (delayLeave) { 8181 delayLeave(vnode.el, performRemove, performLeave); 8182 } else { 8183 performLeave(); 8184 } 8185 } else { 8186 performRemove(); 8187 } 8188 }; 8189 const removeFragment = (cur, end) => { 8190 let next; 8191 while (cur !== end) { 8192 next = hostNextSibling(cur); 8193 hostRemove(cur); 8194 cur = next; 8195 } 8196 hostRemove(end); 8197 }; 8198 const unmountComponent = (instance, parentSuspense, doRemove) => { 8199 if (instance.type.__hmrId) { 8200 unregisterHMR(instance); 8201 } 8202 const { bum, scope, job, subTree, um, m, a } = instance; 8203 invalidateMount(m); 8204 invalidateMount(a); 8205 if (bum) { 8206 invokeArrayFns(bum); 8207 } 8208 scope.stop(); 8209 if (job) { 8210 job.flags |= 8; 8211 unmount(subTree, instance, parentSuspense, doRemove); 8212 } 8213 if (um) { 8214 queuePostRenderEffect(um, parentSuspense); 8215 } 8216 queuePostRenderEffect(() => { 8217 instance.isUnmounted = true; 8218 }, parentSuspense); 8219 { 8220 devtoolsComponentRemoved(instance); 8221 } 8222 }; 8223 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => { 8224 for (let i = start; i < children.length; i++) { 8225 unmount(children[i], parentComponent, parentSuspense, doRemove, optimized); 8226 } 8227 }; 8228 const getNextHostNode = (vnode) => { 8229 if (vnode.shapeFlag & 6) { 8230 return getNextHostNode(vnode.component.subTree); 8231 } 8232 if (vnode.shapeFlag & 128) { 8233 return vnode.suspense.next(); 8234 } 8235 const el = hostNextSibling(vnode.anchor || vnode.el); 8236 const teleportEnd = el && el[TeleportEndKey]; 8237 return teleportEnd ? hostNextSibling(teleportEnd) : el; 8238 }; 8239 let isFlushing = false; 8240 const render = (vnode, container, namespace) => { 8241 if (vnode == null) { 8242 if (container._vnode) { 8243 unmount(container._vnode, null, null, true); 8244 } 8245 } else { 8246 patch( 8247 container._vnode || null, 8248 vnode, 8249 container, 8250 null, 8251 null, 8252 null, 8253 namespace 8254 ); 8255 } 8256 container._vnode = vnode; 8257 if (!isFlushing) { 8258 isFlushing = true; 8259 flushPreFlushCbs(); 8260 flushPostFlushCbs(); 8261 isFlushing = false; 8262 } 8263 }; 8264 const internals = { 8265 p: patch, 8266 um: unmount, 8267 m: move, 8268 r: remove, 8269 mt: mountComponent, 8270 mc: mountChildren, 8271 pc: patchChildren, 8272 pbc: patchBlockChildren, 8273 n: getNextHostNode, 8274 o: options 8275 }; 8276 let hydrate; 8277 let hydrateNode; 8278 if (createHydrationFns) { 8279 [hydrate, hydrateNode] = createHydrationFns( 8280 internals 8281 ); 8282 } 8283 return { 8284 render, 8285 hydrate, 8286 createApp: createAppAPI(render, hydrate) 8287 }; 8288 } 8289 function resolveChildrenNamespace({ type, props }, currentNamespace) { 8290 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace; 8291 } 8292 function toggleRecurse({ effect, job }, allowed) { 8293 if (allowed) { 8294 effect.flags |= 32; 8295 job.flags |= 4; 8296 } else { 8297 effect.flags &= -33; 8298 job.flags &= -5; 8299 } 8300 } 8301 function needTransition(parentSuspense, transition) { 8302 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted; 8303 } 8304 function traverseStaticChildren(n1, n2, shallow = false) { 8305 const ch1 = n1.children; 8306 const ch2 = n2.children; 8307 if (isArray(ch1) && isArray(ch2)) { 8308 for (let i = 0; i < ch1.length; i++) { 8309 const c1 = ch1[i]; 8310 let c2 = ch2[i]; 8311 if (c2.shapeFlag & 1 && !c2.dynamicChildren) { 8312 if (c2.patchFlag <= 0 || c2.patchFlag === 32) { 8313 c2 = ch2[i] = cloneIfMounted(ch2[i]); 8314 c2.el = c1.el; 8315 } 8316 if (!shallow && c2.patchFlag !== -2) 8317 traverseStaticChildren(c1, c2); 8318 } 8319 if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes 8320 c2.patchFlag !== -1) { 8321 c2.el = c1.el; 8322 } 8323 if (c2.type === Comment && !c2.el) { 8324 c2.el = c1.el; 8325 } 8326 { 8327 c2.el && (c2.el.__vnode = c2); 8328 } 8329 } 8330 } 8331 } 8332 function getSequence(arr) { 8333 const p = arr.slice(); 8334 const result = [0]; 8335 let i, j, u, v, c; 8336 const len = arr.length; 8337 for (i = 0; i < len; i++) { 8338 const arrI = arr[i]; 8339 if (arrI !== 0) { 8340 j = result[result.length - 1]; 8341 if (arr[j] < arrI) { 8342 p[i] = j; 8343 result.push(i); 8344 continue; 8345 } 8346 u = 0; 8347 v = result.length - 1; 8348 while (u < v) { 8349 c = u + v >> 1; 8350 if (arr[result[c]] < arrI) { 8351 u = c + 1; 8352 } else { 8353 v = c; 8354 } 8355 } 8356 if (arrI < arr[result[u]]) { 8357 if (u > 0) { 8358 p[i] = result[u - 1]; 8359 } 8360 result[u] = i; 8361 } 8362 } 8363 } 8364 u = result.length; 8365 v = result[u - 1]; 8366 while (u-- > 0) { 8367 result[u] = v; 8368 v = p[v]; 8369 } 8370 return result; 8371 } 8372 function locateNonHydratedAsyncRoot(instance) { 8373 const subComponent = instance.subTree.component; 8374 if (subComponent) { 8375 if (subComponent.asyncDep && !subComponent.asyncResolved) { 8376 return subComponent; 8377 } else { 8378 return locateNonHydratedAsyncRoot(subComponent); 8379 } 8380 } 8381 }
vendor: 5,493 bytes, lines 8382-8548
8382 function invalidateMount(hooks) { 8383 if (hooks) { 8384 for (let i = 0; i < hooks.length; i++) 8385 hooks[i].flags |= 8; 8386 } 8387 } 8388 8389 const ssrContextKey = Symbol.for("v-scx"); 8390 const useSSRContext = () => { 8391 { 8392 warn$1(`useSSRContext() is not supported in the global build.`); 8393 } 8394 }; 8395 8396 function watchEffect(effect, options) { 8397 return doWatch(effect, null, options); 8398 } 8399 function watchPostEffect(effect, options) { 8400 return doWatch( 8401 effect, 8402 null, 8403 extend({}, options, { flush: "post" }) 8404 ); 8405 } 8406 function watchSyncEffect(effect, options) { 8407 return doWatch( 8408 effect, 8409 null, 8410 extend({}, options, { flush: "sync" }) 8411 ); 8412 } 8413 function watch(source, cb, options) { 8414 if (!isFunction(cb)) { 8415 warn$1( 8416 `\`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.` 8417 ); 8418 } 8419 return doWatch(source, cb, options); 8420 } 8421 function doWatch(source, cb, options = EMPTY_OBJ) { 8422 const { immediate, deep, flush, once } = options; 8423 if (!cb) { 8424 if (immediate !== void 0) { 8425 warn$1( 8426 `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.` 8427 ); 8428 } 8429 if (deep !== void 0) { 8430 warn$1( 8431 `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.` 8432 ); 8433 } 8434 if (once !== void 0) { 8435 warn$1( 8436 `watch() "once" option is only respected when using the watch(source, callback, options?) signature.` 8437 ); 8438 } 8439 } 8440 const baseWatchOptions = extend({}, options); 8441 baseWatchOptions.onWarn = warn$1; 8442 const instance = currentInstance; 8443 baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args); 8444 let isPre = false; 8445 if (flush === "post") { 8446 baseWatchOptions.scheduler = (job) => { 8447 queuePostRenderEffect(job, instance && instance.suspense); 8448 }; 8449 } else if (flush !== "sync") { 8450 isPre = true; 8451 baseWatchOptions.scheduler = (job, isFirstRun) => { 8452 if (isFirstRun) { 8453 job(); 8454 } else { 8455 queueJob(job); 8456 } 8457 }; 8458 } 8459 baseWatchOptions.augmentJob = (job) => { 8460 if (cb) { 8461 job.flags |= 4; 8462 } 8463 if (isPre) { 8464 job.flags |= 2; 8465 if (instance) { 8466 job.id = instance.uid; 8467 job.i = instance; 8468 } 8469 } 8470 }; 8471 const watchHandle = watch$1(source, cb, baseWatchOptions); 8472 return watchHandle; 8473 } 8474 function instanceWatch(source, value, options) { 8475 const publicThis = this.proxy; 8476 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); 8477 let cb; 8478 if (isFunction(value)) { 8479 cb = value; 8480 } else { 8481 cb = value.handler; 8482 options = value; 8483 } 8484 const reset = setCurrentInstance(this); 8485 const res = doWatch(getter, cb.bind(publicThis), options); 8486 reset(); 8487 return res; 8488 } 8489 function createPathGetter(ctx, path) { 8490 const segments = path.split("."); 8491 return () => { 8492 let cur = ctx; 8493 for (let i = 0; i < segments.length && cur; i++) { 8494 cur = cur[segments[i]]; 8495 } 8496 return cur; 8497 }; 8498 } 8499 8500 function useModel(props, name, options = EMPTY_OBJ) { 8501 const i = getCurrentInstance(); 8502 if (!i) { 8503 warn$1(`useModel() called without active instance.`); 8504 return ref(); 8505 } 8506 const camelizedName = camelize(name); 8507 if (!i.propsOptions[0][camelizedName]) { 8508 warn$1(`useModel() called with prop "${name}" which is not declared.`); 8509 return ref(); 8510 } 8511 const hyphenatedName = hyphenate(name); 8512 const modifiers = getModelModifiers(props, camelizedName); 8513 const res = customRef((track, trigger) => { 8514 let localValue; 8515 let prevSetValue = EMPTY_OBJ; 8516 let prevEmittedValue; 8517 watchSyncEffect(() => { 8518 const propValue = props[camelizedName]; 8519 if (hasChanged(localValue, propValue)) { 8520 localValue = propValue; 8521 trigger(); 8522 } 8523 }); 8524 return { 8525 get() { 8526 track(); 8527 return options.get ? options.get(localValue) : localValue; 8528 }, 8529 set(value) { 8530 const emittedValue = options.set ? options.set(value) : value; 8531 if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) { 8532 return; 8533 } 8534 const rawProps = i.vnode.props; 8535 if (!(rawProps && // check if parent has passed v-model 8536 (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) { 8537 localValue = value; 8538 trigger(); 8539 } 8540 i.emit(`update:${name}`, emittedValue); 8541 if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) { 8542 trigger(); 8543 } 8544 prevSetValue = value; 8545 prevEmittedValue = emittedValue; 8546 } 8547 }; 8548 });
vendor: 16,940 bytes, lines 8549-9087
8549 res[Symbol.iterator] = () => { 8550 let i2 = 0; 8551 return { 8552 next() { 8553 if (i2 < 2) { 8554 return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false }; 8555 } else { 8556 return { done: true }; 8557 } 8558 } 8559 }; 8560 }; 8561 return res; 8562 } 8563 const getModelModifiers = (props, modelName) => { 8564 return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`]; 8565 }; 8566 8567 function emit(instance, event, ...rawArgs) { 8568 if (instance.isUnmounted) return; 8569 const props = instance.vnode.props || EMPTY_OBJ; 8570 { 8571 const { 8572 emitsOptions, 8573 propsOptions: [propsOptions] 8574 } = instance; 8575 if (emitsOptions) { 8576 if (!(event in emitsOptions) && true) { 8577 if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) { 8578 warn$1( 8579 `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.` 8580 ); 8581 } 8582 } else { 8583 const validator = emitsOptions[event]; 8584 if (isFunction(validator)) { 8585 const isValid = validator(...rawArgs); 8586 if (!isValid) { 8587 warn$1( 8588 `Invalid event arguments: event validation failed for event "${event}".` 8589 ); 8590 } 8591 } 8592 } 8593 } 8594 } 8595 let args = rawArgs; 8596 const isModelListener = event.startsWith("update:"); 8597 const modifiers = isModelListener && getModelModifiers(props, event.slice(7)); 8598 if (modifiers) { 8599 if (modifiers.trim) { 8600 args = rawArgs.map((a) => isString(a) ? a.trim() : a); 8601 } 8602 if (modifiers.number) { 8603 args = rawArgs.map(looseToNumber); 8604 } 8605 } 8606 { 8607 devtoolsComponentEmit(instance, event, args); 8608 } 8609 { 8610 const lowerCaseEvent = event.toLowerCase(); 8611 if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) { 8612 warn$1( 8613 `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName( 8614 instance, 8615 instance.type 8616 )} 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( 8617 event 8618 )}" instead of "${event}".` 8619 ); 8620 } 8621 } 8622 let handlerName; 8623 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249) 8624 props[handlerName = toHandlerKey(camelize(event))]; 8625 if (!handler && isModelListener) { 8626 handler = props[handlerName = toHandlerKey(hyphenate(event))]; 8627 } 8628 if (handler) { 8629 callWithAsyncErrorHandling( 8630 handler, 8631 instance, 8632 6, 8633 args 8634 ); 8635 } 8636 const onceHandler = props[handlerName + `Once`]; 8637 if (onceHandler) { 8638 if (!instance.emitted) { 8639 instance.emitted = {}; 8640 } else if (instance.emitted[handlerName]) { 8641 return; 8642 } 8643 instance.emitted[handlerName] = true; 8644 callWithAsyncErrorHandling( 8645 onceHandler, 8646 instance, 8647 6, 8648 args 8649 ); 8650 } 8651 } 8652 const mixinEmitsCache = /* @__PURE__ */ new WeakMap(); 8653 function normalizeEmitsOptions(comp, appContext, asMixin = false) { 8654 const cache = asMixin ? mixinEmitsCache : appContext.emitsCache; 8655 const cached = cache.get(comp); 8656 if (cached !== void 0) { 8657 return cached; 8658 } 8659 const raw = comp.emits; 8660 let normalized = {}; 8661 let hasExtends = false; 8662 if (!isFunction(comp)) { 8663 const extendEmits = (raw2) => { 8664 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); 8665 if (normalizedFromExtend) { 8666 hasExtends = true; 8667 extend(normalized, normalizedFromExtend); 8668 } 8669 }; 8670 if (!asMixin && appContext.mixins.length) { 8671 appContext.mixins.forEach(extendEmits); 8672 } 8673 if (comp.extends) { 8674 extendEmits(comp.extends); 8675 } 8676 if (comp.mixins) { 8677 comp.mixins.forEach(extendEmits); 8678 } 8679 } 8680 if (!raw && !hasExtends) { 8681 if (isObject(comp)) { 8682 cache.set(comp, null); 8683 } 8684 return null; 8685 } 8686 if (isArray(raw)) { 8687 raw.forEach((key) => normalized[key] = null); 8688 } else { 8689 extend(normalized, raw); 8690 } 8691 if (isObject(comp)) { 8692 cache.set(comp, normalized); 8693 } 8694 return normalized; 8695 } 8696 function isEmitListener(options, key) { 8697 if (!options || !isOn(key)) { 8698 return false; 8699 } 8700 key = key.slice(2).replace(/Once$/, ""); 8701 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); 8702 } 8703 8704 let accessedAttrs = false; 8705 function markAttrsAccessed() { 8706 accessedAttrs = true; 8707 } 8708 function renderComponentRoot(instance) { 8709 const { 8710 type: Component, 8711 vnode, 8712 proxy, 8713 withProxy, 8714 propsOptions: [propsOptions], 8715 slots, 8716 attrs, 8717 emit, 8718 render, 8719 renderCache, 8720 props, 8721 data, 8722 setupState, 8723 ctx, 8724 inheritAttrs 8725 } = instance; 8726 const prev = setCurrentRenderingInstance(instance); 8727 let result; 8728 let fallthroughAttrs; 8729 { 8730 accessedAttrs = false; 8731 } 8732 try { 8733 if (vnode.shapeFlag & 4) { 8734 const proxyToUse = withProxy || proxy; 8735 const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, { 8736 get(target, key, receiver) { 8737 warn$1( 8738 `Property '${String( 8739 key 8740 )}' was accessed via 'this'. Avoid using 'this' in templates.` 8741 ); 8742 return Reflect.get(target, key, receiver); 8743 } 8744 }) : proxyToUse; 8745 result = normalizeVNode( 8746 render.call( 8747 thisProxy, 8748 proxyToUse, 8749 renderCache, 8750 true ? shallowReadonly(props) : props, 8751 setupState, 8752 data, 8753 ctx 8754 ) 8755 ); 8756 fallthroughAttrs = attrs; 8757 } else { 8758 const render2 = Component; 8759 if (attrs === props) { 8760 markAttrsAccessed(); 8761 } 8762 result = normalizeVNode( 8763 render2.length > 1 ? render2( 8764 true ? shallowReadonly(props) : props, 8765 true ? { 8766 get attrs() { 8767 markAttrsAccessed(); 8768 return shallowReadonly(attrs); 8769 }, 8770 slots, 8771 emit 8772 } : { attrs, slots, emit } 8773 ) : render2( 8774 true ? shallowReadonly(props) : props, 8775 null 8776 ) 8777 ); 8778 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs); 8779 } 8780 } catch (err) { 8781 blockStack.length = 0; 8782 handleError(err, instance, 1); 8783 result = createVNode(Comment); 8784 } 8785 let root = result; 8786 let setRoot = void 0; 8787 if (result.patchFlag > 0 && result.patchFlag & 2048) { 8788 [root, setRoot] = getChildRoot(result); 8789 } 8790 if (fallthroughAttrs && inheritAttrs !== false) { 8791 const keys = Object.keys(fallthroughAttrs); 8792 const { shapeFlag } = root; 8793 if (keys.length) { 8794 if (shapeFlag & (1 | 6)) { 8795 if (propsOptions && keys.some(isModelListener)) { 8796 fallthroughAttrs = filterModelListeners( 8797 fallthroughAttrs, 8798 propsOptions 8799 ); 8800 } 8801 root = cloneVNode(root, fallthroughAttrs, false, true); 8802 } else if (!accessedAttrs && root.type !== Comment) { 8803 const allAttrs = Object.keys(attrs); 8804 const eventAttrs = []; 8805 const extraAttrs = []; 8806 for (let i = 0, l = allAttrs.length; i < l; i++) { 8807 const key = allAttrs[i]; 8808 if (isOn(key)) { 8809 if (!isModelListener(key)) { 8810 eventAttrs.push(key[2].toLowerCase() + key.slice(3)); 8811 } 8812 } else { 8813 extraAttrs.push(key); 8814 } 8815 } 8816 if (extraAttrs.length) { 8817 warn$1( 8818 `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.` 8819 ); 8820 } 8821 if (eventAttrs.length) { 8822 warn$1( 8823 `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.` 8824 ); 8825 } 8826 } 8827 } 8828 } 8829 if (vnode.dirs) { 8830 if (!isElementRoot(root)) { 8831 warn$1( 8832 `Runtime directive used on component with non-element root node. The directives will not function as intended.` 8833 ); 8834 } 8835 root = cloneVNode(root, null, false, true); 8836 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs; 8837 } 8838 if (vnode.transition) { 8839 if (!isElementRoot(root)) { 8840 warn$1( 8841 `Component inside <Transition> renders non-element root node that cannot be animated.` 8842 ); 8843 } 8844 setTransitionHooks(root, vnode.transition); 8845 } 8846 if (setRoot) { 8847 setRoot(root); 8848 } else { 8849 result = root; 8850 } 8851 setCurrentRenderingInstance(prev); 8852 return result; 8853 } 8854 const getChildRoot = (vnode) => { 8855 const rawChildren = vnode.children; 8856 const dynamicChildren = vnode.dynamicChildren; 8857 const childRoot = filterSingleRoot(rawChildren, false); 8858 if (!childRoot) { 8859 return [vnode, void 0]; 8860 } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) { 8861 return getChildRoot(childRoot); 8862 } 8863 const index = rawChildren.indexOf(childRoot); 8864 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1; 8865 const setRoot = (updatedRoot) => { 8866 rawChildren[index] = updatedRoot; 8867 if (dynamicChildren) { 8868 if (dynamicIndex > -1) { 8869 dynamicChildren[dynamicIndex] = updatedRoot; 8870 } else if (updatedRoot.patchFlag > 0) { 8871 vnode.dynamicChildren = [...dynamicChildren, updatedRoot]; 8872 } 8873 } 8874 }; 8875 return [normalizeVNode(childRoot), setRoot]; 8876 }; 8877 function filterSingleRoot(children, recurse = true) { 8878 let singleRoot; 8879 for (let i = 0; i < children.length; i++) { 8880 const child = children[i]; 8881 if (isVNode(child)) { 8882 if (child.type !== Comment || child.children === "v-if") { 8883 if (singleRoot) { 8884 return; 8885 } else { 8886 singleRoot = child; 8887 if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) { 8888 return filterSingleRoot(singleRoot.children); 8889 } 8890 } 8891 } 8892 } else { 8893 return; 8894 } 8895 } 8896 return singleRoot; 8897 } 8898 const getFunctionalFallthrough = (attrs) => { 8899 let res; 8900 for (const key in attrs) { 8901 if (key === "class" || key === "style" || isOn(key)) { 8902 (res || (res = {}))[key] = attrs[key]; 8903 } 8904 } 8905 return res; 8906 }; 8907 const filterModelListeners = (attrs, props) => { 8908 const res = {}; 8909 for (const key in attrs) { 8910 if (!isModelListener(key) || !(key.slice(9) in props)) { 8911 res[key] = attrs[key]; 8912 } 8913 } 8914 return res; 8915 }; 8916 const isElementRoot = (vnode) => { 8917 return vnode.shapeFlag & (6 | 1) || vnode.type === Comment; 8918 }; 8919 function shouldUpdateComponent(prevVNode, nextVNode, optimized) { 8920 const { props: prevProps, children: prevChildren, component } = prevVNode; 8921 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; 8922 const emits = component.emitsOptions; 8923 if ((prevChildren || nextChildren) && isHmrUpdating) { 8924 return true; 8925 } 8926 if (nextVNode.dirs || nextVNode.transition) { 8927 return true; 8928 } 8929 if (optimized && patchFlag >= 0) { 8930 if (patchFlag & 1024) { 8931 return true; 8932 } 8933 if (patchFlag & 16) { 8934 if (!prevProps) { 8935 return !!nextProps; 8936 } 8937 return hasPropsChanged(prevProps, nextProps, emits); 8938 } else if (patchFlag & 8) { 8939 const dynamicProps = nextVNode.dynamicProps; 8940 for (let i = 0; i < dynamicProps.length; i++) { 8941 const key = dynamicProps[i]; 8942 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) { 8943 return true; 8944 } 8945 } 8946 } 8947 } else { 8948 if (prevChildren || nextChildren) { 8949 if (!nextChildren || !nextChildren.$stable) { 8950 return true; 8951 } 8952 } 8953 if (prevProps === nextProps) { 8954 return false; 8955 } 8956 if (!prevProps) { 8957 return !!nextProps; 8958 } 8959 if (!nextProps) { 8960 return true; 8961 } 8962 return hasPropsChanged(prevProps, nextProps, emits); 8963 } 8964 return false; 8965 } 8966 function hasPropsChanged(prevProps, nextProps, emitsOptions) { 8967 const nextKeys = Object.keys(nextProps); 8968 if (nextKeys.length !== Object.keys(prevProps).length) { 8969 return true; 8970 } 8971 for (let i = 0; i < nextKeys.length; i++) { 8972 const key = nextKeys[i]; 8973 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { 8974 return true; 8975 } 8976 } 8977 return false; 8978 } 8979 function updateHOCHostEl({ vnode, parent }, el) { 8980 while (parent) { 8981 const root = parent.subTree; 8982 if (root.suspense && root.suspense.activeBranch === vnode) { 8983 root.el = vnode.el; 8984 } 8985 if (root === vnode) { 8986 (vnode = parent.vnode).el = el; 8987 parent = parent.parent; 8988 } else { 8989 break; 8990 } 8991 } 8992 } 8993 8994 const isSuspense = (type) => type.__isSuspense; 8995 let suspenseId = 0; 8996 const SuspenseImpl = { 8997 name: "Suspense", 8998 // In order to make Suspense tree-shakable, we need to avoid importing it 8999 // directly in the renderer. The renderer checks for the __isSuspense flag 9000 // on a vnode's type and calls the `process` method, passing in renderer 9001 // internals. 9002 __isSuspense: true, 9003 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 9004 if (n1 == null) { 9005 mountSuspense( 9006 n2, 9007 container, 9008 anchor, 9009 parentComponent, 9010 parentSuspense, 9011 namespace, 9012 slotScopeIds, 9013 optimized, 9014 rendererInternals 9015 ); 9016 } else { 9017 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) { 9018 n2.suspense = n1.suspense; 9019 n2.suspense.vnode = n2; 9020 n2.el = n1.el; 9021 return; 9022 } 9023 patchSuspense( 9024 n1, 9025 n2, 9026 container, 9027 anchor, 9028 parentComponent, 9029 namespace, 9030 slotScopeIds, 9031 optimized, 9032 rendererInternals 9033 ); 9034 } 9035 }, 9036 hydrate: hydrateSuspense, 9037 normalize: normalizeSuspenseChildren 9038 }; 9039 const Suspense = SuspenseImpl ; 9040 function triggerEvent(vnode, name) { 9041 const eventListener = vnode.props && vnode.props[name]; 9042 if (isFunction(eventListener)) { 9043 eventListener(); 9044 } 9045 } 9046 function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 9047 const { 9048 p: patch, 9049 o: { createElement } 9050 } = rendererInternals; 9051 const hiddenContainer = createElement("div"); 9052 const suspense = vnode.suspense = createSuspenseBoundary( 9053 vnode, 9054 parentSuspense, 9055 parentComponent, 9056 container, 9057 hiddenContainer, 9058 anchor, 9059 namespace, 9060 slotScopeIds, 9061 optimized, 9062 rendererInternals 9063 ); 9064 patch( 9065 null, 9066 suspense.pendingBranch = vnode.ssContent, 9067 hiddenContainer, 9068 null, 9069 parentComponent, 9070 suspense, 9071 namespace, 9072 slotScopeIds 9073 ); 9074 if (suspense.deps > 0) { 9075 triggerEvent(vnode, "onPending"); 9076 triggerEvent(vnode, "onFallback"); 9077 patch( 9078 null, 9079 vnode.ssFallback, 9080 container, 9081 anchor, 9082 parentComponent, 9083 null, 9084 // fallback tree will not have suspense context 9085 namespace, 9086 slotScopeIds 9087 );
9088 setActiveBranch(suspense, vnode.ssFallback); 9089 } else { 9090 suspense.resolve(false, true); 9091 } 9092 } 9093 function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) { 9094 const suspense = n2.suspense = n1.suspense; 9095 suspense.vnode = n2; 9096 n2.el = n1.el; 9097 const newBranch = n2.ssContent; 9098 const newFallback = n2.ssFallback; 9099 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense; 9100 if (pendingBranch) { 9101 suspense.pendingBranch = newBranch; 9102 if (isSameVNodeType(pendingBranch, newBranch)) { 9103 patch( 9104 pendingBranch, 9105 newBranch, 9106 suspense.hiddenContainer, 9107 null, 9108 parentComponent, 9109 suspense, 9110 namespace, 9111 slotScopeIds, 9112 optimized 9113 ); 9114 if (suspense.deps <= 0) { 9115 suspense.resolve(); 9116 } else if (isInFallback) { 9117 if (!isHydrating) { 9118 patch( 9119 activeBranch, 9120 newFallback, 9121 container, 9122 anchor, 9123 parentComponent, 9124 null, 9125 // fallback tree will not have suspense context 9126 namespace, 9127 slotScopeIds, 9128 optimized 9129 );
vendor: 6,492 bytes, lines 9130-9346
9130 setActiveBranch(suspense, newFallback); 9131 } 9132 } 9133 } else { 9134 suspense.pendingId = suspenseId++; 9135 if (isHydrating) { 9136 suspense.isHydrating = false; 9137 suspense.activeBranch = pendingBranch; 9138 } else { 9139 unmount(pendingBranch, parentComponent, suspense); 9140 } 9141 suspense.deps = 0; 9142 suspense.effects.length = 0; 9143 suspense.hiddenContainer = createElement("div"); 9144 if (isInFallback) { 9145 patch( 9146 null, 9147 newBranch, 9148 suspense.hiddenContainer, 9149 null, 9150 parentComponent, 9151 suspense, 9152 namespace, 9153 slotScopeIds, 9154 optimized 9155 ); 9156 if (suspense.deps <= 0) { 9157 suspense.resolve(); 9158 } else { 9159 patch( 9160 activeBranch, 9161 newFallback, 9162 container, 9163 anchor, 9164 parentComponent, 9165 null, 9166 // fallback tree will not have suspense context 9167 namespace, 9168 slotScopeIds, 9169 optimized 9170 ); 9171 setActiveBranch(suspense, newFallback); 9172 } 9173 } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) { 9174 patch( 9175 activeBranch, 9176 newBranch, 9177 container, 9178 anchor, 9179 parentComponent, 9180 suspense, 9181 namespace, 9182 slotScopeIds, 9183 optimized 9184 ); 9185 suspense.resolve(true); 9186 } else { 9187 patch( 9188 null, 9189 newBranch, 9190 suspense.hiddenContainer, 9191 null, 9192 parentComponent, 9193 suspense, 9194 namespace, 9195 slotScopeIds, 9196 optimized 9197 ); 9198 if (suspense.deps <= 0) { 9199 suspense.resolve(); 9200 } 9201 } 9202 } 9203 } else { 9204 if (activeBranch && isSameVNodeType(activeBranch, newBranch)) { 9205 patch( 9206 activeBranch, 9207 newBranch, 9208 container, 9209 anchor, 9210 parentComponent, 9211 suspense, 9212 namespace, 9213 slotScopeIds, 9214 optimized 9215 ); 9216 setActiveBranch(suspense, newBranch); 9217 } else { 9218 triggerEvent(n2, "onPending"); 9219 suspense.pendingBranch = newBranch; 9220 if (newBranch.shapeFlag & 512) { 9221 suspense.pendingId = newBranch.component.suspenseId; 9222 } else { 9223 suspense.pendingId = suspenseId++; 9224 } 9225 patch( 9226 null, 9227 newBranch, 9228 suspense.hiddenContainer, 9229 null, 9230 parentComponent, 9231 suspense, 9232 namespace, 9233 slotScopeIds, 9234 optimized 9235 ); 9236 if (suspense.deps <= 0) { 9237 suspense.resolve(); 9238 } else { 9239 const { timeout, pendingId } = suspense; 9240 if (timeout > 0) { 9241 setTimeout(() => { 9242 if (suspense.pendingId === pendingId) { 9243 suspense.fallback(newFallback); 9244 } 9245 }, timeout); 9246 } else if (timeout === 0) { 9247 suspense.fallback(newFallback); 9248 } 9249 } 9250 } 9251 } 9252 } 9253 let hasWarned = false; 9254 function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) { 9255 if (!hasWarned) { 9256 hasWarned = true; 9257 console[console.info ? "info" : "log"]( 9258 `<Suspense> is an experimental feature and its API will likely change.` 9259 ); 9260 } 9261 const { 9262 p: patch, 9263 m: move, 9264 um: unmount, 9265 n: next, 9266 o: { parentNode, remove } 9267 } = rendererInternals; 9268 let parentSuspenseId; 9269 const isSuspensible = isVNodeSuspensible(vnode); 9270 if (isSuspensible) { 9271 if (parentSuspense && parentSuspense.pendingBranch) { 9272 parentSuspenseId = parentSuspense.pendingId; 9273 parentSuspense.deps++; 9274 } 9275 } 9276 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; 9277 { 9278 assertNumber(timeout, `Suspense timeout`); 9279 } 9280 const initialAnchor = anchor; 9281 const suspense = { 9282 vnode, 9283 parent: parentSuspense, 9284 parentComponent, 9285 namespace, 9286 container, 9287 hiddenContainer, 9288 deps: 0, 9289 pendingId: suspenseId++, 9290 timeout: typeof timeout === "number" ? timeout : -1, 9291 activeBranch: null, 9292 pendingBranch: null, 9293 isInFallback: !isHydrating, 9294 isHydrating, 9295 isUnmounted: false, 9296 effects: [], 9297 resolve(resume = false, sync = false) { 9298 { 9299 if (!resume && !suspense.pendingBranch) { 9300 throw new Error( 9301 `suspense.resolve() is called without a pending branch.` 9302 ); 9303 } 9304 if (suspense.isUnmounted) { 9305 throw new Error( 9306 `suspense.resolve() is called on an already unmounted suspense boundary.` 9307 ); 9308 } 9309 } 9310 const { 9311 vnode: vnode2, 9312 activeBranch, 9313 pendingBranch, 9314 pendingId, 9315 effects, 9316 parentComponent: parentComponent2, 9317 container: container2 9318 } = suspense; 9319 let delayEnter = false; 9320 if (suspense.isHydrating) { 9321 suspense.isHydrating = false; 9322 } else if (!resume) { 9323 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in"; 9324 if (delayEnter) { 9325 activeBranch.transition.afterLeave = () => { 9326 if (pendingId === suspense.pendingId) { 9327 move( 9328 pendingBranch, 9329 container2, 9330 anchor === initialAnchor ? next(activeBranch) : anchor, 9331 0 9332 ); 9333 queuePostFlushCb(effects); 9334 } 9335 }; 9336 } 9337 if (activeBranch) { 9338 if (parentNode(activeBranch.el) === container2) { 9339 anchor = next(activeBranch); 9340 } 9341 unmount(activeBranch, parentComponent2, suspense, true); 9342 } 9343 if (!delayEnter) { 9344 move(pendingBranch, container2, anchor, 0); 9345 } 9346 }
9347 setActiveBranch(suspense, pendingBranch); 9348 suspense.pendingBranch = null; 9349 suspense.isInFallback = false; 9350 let parent = suspense.parent; 9351 let hasUnresolvedAncestor = false; 9352 while (parent) { 9353 if (parent.pendingBranch) { 9354 parent.effects.push(...effects); 9355 hasUnresolvedAncestor = true; 9356 break; 9357 } 9358 parent = parent.parent; 9359 } 9360 if (!hasUnresolvedAncestor && !delayEnter) { 9361 queuePostFlushCb(effects); 9362 } 9363 suspense.effects = []; 9364 if (isSuspensible) { 9365 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { 9366 parentSuspense.deps--; 9367 if (parentSuspense.deps === 0 && !sync) { 9368 parentSuspense.resolve(); 9369 } 9370 } 9371 } 9372 triggerEvent(vnode2, "onResolve"); 9373 }, 9374 fallback(fallbackVNode) { 9375 if (!suspense.pendingBranch) { 9376 return; 9377 } 9378 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense; 9379 triggerEvent(vnode2, "onFallback"); 9380 const anchor2 = next(activeBranch); 9381 const mountFallback = () => { 9382 if (!suspense.isInFallback) { 9383 return; 9384 } 9385 patch( 9386 null, 9387 fallbackVNode, 9388 container2, 9389 anchor2, 9390 parentComponent2, 9391 null, 9392 // fallback tree will not have suspense context 9393 namespace2, 9394 slotScopeIds, 9395 optimized 9396 );
vendor: 14,753 bytes, lines 9397-9832
9397 setActiveBranch(suspense, fallbackVNode); 9398 }; 9399 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in"; 9400 if (delayEnter) { 9401 activeBranch.transition.afterLeave = mountFallback; 9402 } 9403 suspense.isInFallback = true; 9404 unmount( 9405 activeBranch, 9406 parentComponent2, 9407 null, 9408 // no suspense so unmount hooks fire now 9409 true 9410 // shouldRemove 9411 ); 9412 if (!delayEnter) { 9413 mountFallback(); 9414 } 9415 }, 9416 move(container2, anchor2, type) { 9417 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type); 9418 suspense.container = container2; 9419 }, 9420 next() { 9421 return suspense.activeBranch && next(suspense.activeBranch); 9422 }, 9423 registerDep(instance, setupRenderEffect, optimized2) { 9424 const isInPendingSuspense = !!suspense.pendingBranch; 9425 if (isInPendingSuspense) { 9426 suspense.deps++; 9427 } 9428 const hydratedEl = instance.vnode.el; 9429 instance.asyncDep.catch((err) => { 9430 handleError(err, instance, 0); 9431 }).then((asyncSetupResult) => { 9432 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { 9433 return; 9434 } 9435 instance.asyncResolved = true; 9436 const { vnode: vnode2 } = instance; 9437 { 9438 pushWarningContext(vnode2); 9439 } 9440 handleSetupResult(instance, asyncSetupResult, false); 9441 if (hydratedEl) { 9442 vnode2.el = hydratedEl; 9443 } 9444 const placeholder = !hydratedEl && instance.subTree.el; 9445 setupRenderEffect( 9446 instance, 9447 vnode2, 9448 // component may have been moved before resolve. 9449 // if this is not a hydration, instance.subTree will be the comment 9450 // placeholder. 9451 parentNode(hydratedEl || instance.subTree.el), 9452 // anchor will not be used if this is hydration, so only need to 9453 // consider the comment placeholder case. 9454 hydratedEl ? null : next(instance.subTree), 9455 suspense, 9456 namespace, 9457 optimized2 9458 ); 9459 if (placeholder) { 9460 remove(placeholder); 9461 } 9462 updateHOCHostEl(instance, vnode2.el); 9463 { 9464 popWarningContext(); 9465 } 9466 if (isInPendingSuspense && --suspense.deps === 0) { 9467 suspense.resolve(); 9468 } 9469 }); 9470 }, 9471 unmount(parentSuspense2, doRemove) { 9472 suspense.isUnmounted = true; 9473 if (suspense.activeBranch) { 9474 unmount( 9475 suspense.activeBranch, 9476 parentComponent, 9477 parentSuspense2, 9478 doRemove 9479 ); 9480 } 9481 if (suspense.pendingBranch) { 9482 unmount( 9483 suspense.pendingBranch, 9484 parentComponent, 9485 parentSuspense2, 9486 doRemove 9487 ); 9488 } 9489 } 9490 }; 9491 return suspense; 9492 } 9493 function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) { 9494 const suspense = vnode.suspense = createSuspenseBoundary( 9495 vnode, 9496 parentSuspense, 9497 parentComponent, 9498 node.parentNode, 9499 // eslint-disable-next-line no-restricted-globals 9500 document.createElement("div"), 9501 null, 9502 namespace, 9503 slotScopeIds, 9504 optimized, 9505 rendererInternals, 9506 true 9507 ); 9508 const result = hydrateNode( 9509 node, 9510 suspense.pendingBranch = vnode.ssContent, 9511 parentComponent, 9512 suspense, 9513 slotScopeIds, 9514 optimized 9515 ); 9516 if (suspense.deps === 0) { 9517 suspense.resolve(false, true); 9518 } 9519 return result; 9520 } 9521 function normalizeSuspenseChildren(vnode) { 9522 const { shapeFlag, children } = vnode; 9523 const isSlotChildren = shapeFlag & 32; 9524 vnode.ssContent = normalizeSuspenseSlot( 9525 isSlotChildren ? children.default : children 9526 ); 9527 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); 9528 } 9529 function normalizeSuspenseSlot(s) { 9530 let block; 9531 if (isFunction(s)) { 9532 const trackBlock = isBlockTreeEnabled && s._c; 9533 if (trackBlock) { 9534 s._d = false; 9535 openBlock(); 9536 } 9537 s = s(); 9538 if (trackBlock) { 9539 s._d = true; 9540 block = currentBlock; 9541 closeBlock(); 9542 } 9543 } 9544 if (isArray(s)) { 9545 const singleChild = filterSingleRoot(s); 9546 if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) { 9547 warn$1(`<Suspense> slots expect a single root node.`); 9548 } 9549 s = singleChild; 9550 } 9551 s = normalizeVNode(s); 9552 if (block && !s.dynamicChildren) { 9553 s.dynamicChildren = block.filter((c) => c !== s); 9554 } 9555 return s; 9556 } 9557 function queueEffectWithSuspense(fn, suspense) { 9558 if (suspense && suspense.pendingBranch) { 9559 if (isArray(fn)) { 9560 suspense.effects.push(...fn); 9561 } else { 9562 suspense.effects.push(fn); 9563 } 9564 } else { 9565 queuePostFlushCb(fn); 9566 } 9567 } 9568 function setActiveBranch(suspense, branch) { 9569 suspense.activeBranch = branch; 9570 const { vnode, parentComponent } = suspense; 9571 let el = branch.el; 9572 while (!el && branch.component) { 9573 branch = branch.component.subTree; 9574 el = branch.el; 9575 } 9576 vnode.el = el; 9577 if (parentComponent && parentComponent.subTree === vnode) { 9578 parentComponent.vnode.el = el; 9579 updateHOCHostEl(parentComponent, el); 9580 } 9581 } 9582 function isVNodeSuspensible(vnode) { 9583 const suspensible = vnode.props && vnode.props.suspensible; 9584 return suspensible != null && suspensible !== false; 9585 } 9586 9587 const Fragment = Symbol.for("v-fgt"); 9588 const Text = Symbol.for("v-txt"); 9589 const Comment = Symbol.for("v-cmt"); 9590 const Static = Symbol.for("v-stc"); 9591 const blockStack = []; 9592 let currentBlock = null; 9593 function openBlock(disableTracking = false) { 9594 blockStack.push(currentBlock = disableTracking ? null : []); 9595 } 9596 function closeBlock() { 9597 blockStack.pop(); 9598 currentBlock = blockStack[blockStack.length - 1] || null; 9599 } 9600 let isBlockTreeEnabled = 1; 9601 function setBlockTracking(value, inVOnce = false) { 9602 isBlockTreeEnabled += value; 9603 if (value < 0 && currentBlock && inVOnce) { 9604 currentBlock.hasOnce = true; 9605 } 9606 } 9607 function setupBlock(vnode) { 9608 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null; 9609 closeBlock(); 9610 if (isBlockTreeEnabled > 0 && currentBlock) { 9611 currentBlock.push(vnode); 9612 } 9613 return vnode; 9614 } 9615 function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) { 9616 return setupBlock( 9617 createBaseVNode( 9618 type, 9619 props, 9620 children, 9621 patchFlag, 9622 dynamicProps, 9623 shapeFlag, 9624 true 9625 ) 9626 ); 9627 } 9628 function createBlock(type, props, children, patchFlag, dynamicProps) { 9629 return setupBlock( 9630 createVNode( 9631 type, 9632 props, 9633 children, 9634 patchFlag, 9635 dynamicProps, 9636 true 9637 ) 9638 ); 9639 } 9640 function isVNode(value) { 9641 return value ? value.__v_isVNode === true : false; 9642 } 9643 function isSameVNodeType(n1, n2) { 9644 if (n2.shapeFlag & 6 && n1.component) { 9645 const dirtyInstances = hmrDirtyComponents.get(n2.type); 9646 if (dirtyInstances && dirtyInstances.has(n1.component)) { 9647 n1.shapeFlag &= -257; 9648 n2.shapeFlag &= -513; 9649 return false; 9650 } 9651 } 9652 return n1.type === n2.type && n1.key === n2.key; 9653 } 9654 let vnodeArgsTransformer; 9655 function transformVNodeArgs(transformer) { 9656 vnodeArgsTransformer = transformer; 9657 } 9658 const createVNodeWithArgsTransform = (...args) => { 9659 return _createVNode( 9660 ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args 9661 ); 9662 }; 9663 const normalizeKey = ({ key }) => key != null ? key : null; 9664 const normalizeRef = ({ 9665 ref, 9666 ref_key, 9667 ref_for 9668 }) => { 9669 if (typeof ref === "number") { 9670 ref = "" + ref; 9671 } 9672 return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null; 9673 }; 9674 function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) { 9675 const vnode = { 9676 __v_isVNode: true, 9677 __v_skip: true, 9678 type, 9679 props, 9680 key: props && normalizeKey(props), 9681 ref: props && normalizeRef(props), 9682 scopeId: currentScopeId, 9683 slotScopeIds: null, 9684 children, 9685 component: null, 9686 suspense: null, 9687 ssContent: null, 9688 ssFallback: null, 9689 dirs: null, 9690 transition: null, 9691 el: null, 9692 anchor: null, 9693 target: null, 9694 targetStart: null, 9695 targetAnchor: null, 9696 staticCount: 0, 9697 shapeFlag, 9698 patchFlag, 9699 dynamicProps, 9700 dynamicChildren: null, 9701 appContext: null, 9702 ctx: currentRenderingInstance 9703 }; 9704 if (needFullChildrenNormalization) { 9705 normalizeChildren(vnode, children); 9706 if (shapeFlag & 128) { 9707 type.normalize(vnode); 9708 } 9709 } else if (children) { 9710 vnode.shapeFlag |= isString(children) ? 8 : 16; 9711 } 9712 if (vnode.key !== vnode.key) { 9713 warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type); 9714 } 9715 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself 9716 !isBlockNode && // has current parent block 9717 currentBlock && // presence of a patch flag indicates this node needs patching on updates. 9718 // component nodes also should always be patched, because even if the 9719 // component doesn't need to update, it needs to persist the instance on to 9720 // the next vnode so that it can be properly unmounted later. 9721 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the 9722 // vnode should not be considered dynamic due to handler caching. 9723 vnode.patchFlag !== 32) { 9724 currentBlock.push(vnode); 9725 } 9726 return vnode; 9727 } 9728 const createVNode = createVNodeWithArgsTransform ; 9729 function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) { 9730 if (!type || type === NULL_DYNAMIC_COMPONENT) { 9731 if (!type) { 9732 warn$1(`Invalid vnode type when creating vnode: ${type}.`); 9733 } 9734 type = Comment; 9735 } 9736 if (isVNode(type)) { 9737 const cloned = cloneVNode( 9738 type, 9739 props, 9740 true 9741 /* mergeRef: true */ 9742 ); 9743 if (children) { 9744 normalizeChildren(cloned, children); 9745 } 9746 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) { 9747 if (cloned.shapeFlag & 6) { 9748 currentBlock[currentBlock.indexOf(type)] = cloned; 9749 } else { 9750 currentBlock.push(cloned); 9751 } 9752 } 9753 cloned.patchFlag = -2; 9754 return cloned; 9755 } 9756 if (isClassComponent(type)) { 9757 type = type.__vccOpts; 9758 } 9759 if (props) { 9760 props = guardReactiveProps(props); 9761 let { class: klass, style } = props; 9762 if (klass && !isString(klass)) { 9763 props.class = normalizeClass(klass); 9764 } 9765 if (isObject(style)) { 9766 if (isProxy(style) && !isArray(style)) { 9767 style = extend({}, style); 9768 } 9769 props.style = normalizeStyle(style); 9770 } 9771 } 9772 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0; 9773 if (shapeFlag & 4 && isProxy(type)) { 9774 type = toRaw(type); 9775 warn$1( 9776 `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\`.`, 9777 ` 9778Component that was made reactive: `, 9779 type 9780 ); 9781 } 9782 return createBaseVNode( 9783 type, 9784 props, 9785 children, 9786 patchFlag, 9787 dynamicProps, 9788 shapeFlag, 9789 isBlockNode, 9790 true 9791 ); 9792 } 9793 function guardReactiveProps(props) { 9794 if (!props) return null; 9795 return isProxy(props) || isInternalObject(props) ? extend({}, props) : props; 9796 } 9797 function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) { 9798 const { props, ref, patchFlag, children, transition } = vnode; 9799 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props; 9800 const cloned = { 9801 __v_isVNode: true, 9802 __v_skip: true, 9803 type: vnode.type, 9804 props: mergedProps, 9805 key: mergedProps && normalizeKey(mergedProps), 9806 ref: extraProps && extraProps.ref ? ( 9807 // #2078 in the case of <component :is="vnode" ref="extra"/> 9808 // if the vnode itself already has a ref, cloneVNode will need to merge 9809 // the refs so the single vnode can be set on multiple refs 9810 mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) 9811 ) : ref, 9812 scopeId: vnode.scopeId, 9813 slotScopeIds: vnode.slotScopeIds, 9814 children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children, 9815 target: vnode.target, 9816 targetStart: vnode.targetStart, 9817 targetAnchor: vnode.targetAnchor, 9818 staticCount: vnode.staticCount, 9819 shapeFlag: vnode.shapeFlag, 9820 // if the vnode is cloned with extra props, we can no longer assume its 9821 // existing patch flag to be reliable and need to add the FULL_PROPS flag. 9822 // note: preserve flag for fragments since they use the flag for children 9823 // fast paths only. 9824 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag, 9825 dynamicProps: vnode.dynamicProps, 9826 dynamicChildren: vnode.dynamicChildren, 9827 appContext: vnode.appContext, 9828 dirs: vnode.dirs, 9829 transition, 9830 // These should technically only be non-null on mounted VNodes. However, 9831 // they *should* be copied for kept-alive vnodes. So we just always copy 9832 // them since them being non-null during a mount doesn't affect the logic as
vendor: 4,111 bytes, lines 9833-9958
9833 // they will simply be overwritten. 9834 component: vnode.component, 9835 suspense: vnode.suspense, 9836 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent), 9837 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback), 9838 placeholder: vnode.placeholder, 9839 el: vnode.el, 9840 anchor: vnode.anchor, 9841 ctx: vnode.ctx, 9842 ce: vnode.ce 9843 }; 9844 if (transition && cloneTransition) { 9845 setTransitionHooks( 9846 cloned, 9847 transition.clone(cloned) 9848 ); 9849 } 9850 return cloned; 9851 } 9852 function deepCloneVNode(vnode) { 9853 const cloned = cloneVNode(vnode); 9854 if (isArray(vnode.children)) { 9855 cloned.children = vnode.children.map(deepCloneVNode); 9856 } 9857 return cloned; 9858 } 9859 function createTextVNode(text = " ", flag = 0) { 9860 return createVNode(Text, null, text, flag); 9861 } 9862 function createStaticVNode(content, numberOfNodes) { 9863 const vnode = createVNode(Static, null, content); 9864 vnode.staticCount = numberOfNodes; 9865 return vnode; 9866 } 9867 function createCommentVNode(text = "", asBlock = false) { 9868 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text); 9869 } 9870 function normalizeVNode(child) { 9871 if (child == null || typeof child === "boolean") { 9872 return createVNode(Comment); 9873 } else if (isArray(child)) { 9874 return createVNode( 9875 Fragment, 9876 null, 9877 // #3666, avoid reference pollution when reusing vnode 9878 child.slice() 9879 ); 9880 } else if (isVNode(child)) { 9881 return cloneIfMounted(child); 9882 } else { 9883 return createVNode(Text, null, String(child)); 9884 } 9885 } 9886 function cloneIfMounted(child) { 9887 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child); 9888 } 9889 function normalizeChildren(vnode, children) { 9890 let type = 0; 9891 const { shapeFlag } = vnode; 9892 if (children == null) { 9893 children = null; 9894 } else if (isArray(children)) { 9895 type = 16; 9896 } else if (typeof children === "object") { 9897 if (shapeFlag & (1 | 64)) { 9898 const slot = children.default; 9899 if (slot) { 9900 slot._c && (slot._d = false); 9901 normalizeChildren(vnode, slot()); 9902 slot._c && (slot._d = true); 9903 } 9904 return; 9905 } else { 9906 type = 32; 9907 const slotFlag = children._; 9908 if (!slotFlag && !isInternalObject(children)) { 9909 children._ctx = currentRenderingInstance; 9910 } else if (slotFlag === 3 && currentRenderingInstance) { 9911 if (currentRenderingInstance.slots._ === 1) { 9912 children._ = 1; 9913 } else { 9914 children._ = 2; 9915 vnode.patchFlag |= 1024; 9916 } 9917 } 9918 } 9919 } else if (isFunction(children)) { 9920 children = { default: children, _ctx: currentRenderingInstance }; 9921 type = 32; 9922 } else { 9923 children = String(children); 9924 if (shapeFlag & 64) { 9925 type = 16; 9926 children = [createTextVNode(children)]; 9927 } else { 9928 type = 8; 9929 } 9930 } 9931 vnode.children = children; 9932 vnode.shapeFlag |= type; 9933 } 9934 function mergeProps(...args) { 9935 const ret = {}; 9936 for (let i = 0; i < args.length; i++) { 9937 const toMerge = args[i]; 9938 for (const key in toMerge) { 9939 if (key === "class") { 9940 if (ret.class !== toMerge.class) { 9941 ret.class = normalizeClass([ret.class, toMerge.class]); 9942 } 9943 } else if (key === "style") { 9944 ret.style = normalizeStyle([ret.style, toMerge.style]); 9945 } else if (isOn(key)) { 9946 const existing = ret[key]; 9947 const incoming = toMerge[key]; 9948 if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) { 9949 ret[key] = existing ? [].concat(existing, incoming) : incoming; 9950 } 9951 } else if (key !== "") { 9952 ret[key] = toMerge[key]; 9953 } 9954 } 9955 } 9956 return ret; 9957 } 9958 function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
vendor: 9,330 bytes, lines 9959-10247
9959 callWithAsyncErrorHandling(hook, instance, 7, [ 9960 vnode, 9961 prevVNode 9962 ]); 9963 } 9964 9965 const emptyAppContext = createAppContext(); 9966 let uid = 0; 9967 function createComponentInstance(vnode, parent, suspense) { 9968 const type = vnode.type; 9969 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext; 9970 const instance = { 9971 uid: uid++, 9972 vnode, 9973 type, 9974 parent, 9975 appContext, 9976 root: null, 9977 // to be immediately set 9978 next: null, 9979 subTree: null, 9980 // will be set synchronously right after creation 9981 effect: null, 9982 update: null, 9983 // will be set synchronously right after creation 9984 job: null, 9985 scope: new EffectScope( 9986 true 9987 /* detached */ 9988 ), 9989 render: null, 9990 proxy: null, 9991 exposed: null, 9992 exposeProxy: null, 9993 withProxy: null, 9994 provides: parent ? parent.provides : Object.create(appContext.provides), 9995 ids: parent ? parent.ids : ["", 0, 0], 9996 accessCache: null, 9997 renderCache: [], 9998 // local resolved assets 9999 components: null, 10000 directives: null, 10001 // resolved props and emits options 10002 propsOptions: normalizePropsOptions(type, appContext), 10003 emitsOptions: normalizeEmitsOptions(type, appContext), 10004 // emit 10005 emit: null, 10006 // to be set immediately 10007 emitted: null, 10008 // props default value 10009 propsDefaults: EMPTY_OBJ, 10010 // inheritAttrs 10011 inheritAttrs: type.inheritAttrs, 10012 // state 10013 ctx: EMPTY_OBJ, 10014 data: EMPTY_OBJ, 10015 props: EMPTY_OBJ, 10016 attrs: EMPTY_OBJ, 10017 slots: EMPTY_OBJ, 10018 refs: EMPTY_OBJ, 10019 setupState: EMPTY_OBJ, 10020 setupContext: null, 10021 // suspense related 10022 suspense, 10023 suspenseId: suspense ? suspense.pendingId : 0, 10024 asyncDep: null, 10025 asyncResolved: false, 10026 // lifecycle hooks 10027 // not using enums here because it results in computed properties 10028 isMounted: false, 10029 isUnmounted: false, 10030 isDeactivated: false, 10031 bc: null, 10032 c: null, 10033 bm: null, 10034 m: null, 10035 bu: null, 10036 u: null, 10037 um: null, 10038 bum: null, 10039 da: null, 10040 a: null, 10041 rtg: null, 10042 rtc: null, 10043 ec: null, 10044 sp: null 10045 }; 10046 { 10047 instance.ctx = createDevRenderContext(instance); 10048 } 10049 instance.root = parent ? parent.root : instance; 10050 instance.emit = emit.bind(null, instance); 10051 if (vnode.ce) { 10052 vnode.ce(instance); 10053 } 10054 return instance; 10055 } 10056 let currentInstance = null; 10057 const getCurrentInstance = () => currentInstance || currentRenderingInstance; 10058 let internalSetCurrentInstance; 10059 let setInSSRSetupState; 10060 { 10061 internalSetCurrentInstance = (i) => { 10062 currentInstance = i; 10063 }; 10064 setInSSRSetupState = (v) => { 10065 isInSSRComponentSetup = v; 10066 }; 10067 } 10068 const setCurrentInstance = (instance) => { 10069 const prev = currentInstance; 10070 internalSetCurrentInstance(instance); 10071 instance.scope.on(); 10072 return () => { 10073 instance.scope.off(); 10074 internalSetCurrentInstance(prev); 10075 }; 10076 }; 10077 const unsetCurrentInstance = () => { 10078 currentInstance && currentInstance.scope.off(); 10079 internalSetCurrentInstance(null); 10080 }; 10081 const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component"); 10082 function validateComponentName(name, { isNativeTag }) { 10083 if (isBuiltInTag(name) || isNativeTag(name)) { 10084 warn$1( 10085 "Do not use built-in or reserved HTML elements as component id: " + name 10086 ); 10087 } 10088 } 10089 function isStatefulComponent(instance) { 10090 return instance.vnode.shapeFlag & 4; 10091 } 10092 let isInSSRComponentSetup = false; 10093 function setupComponent(instance, isSSR = false, optimized = false) { 10094 isSSR && setInSSRSetupState(isSSR); 10095 const { props, children } = instance.vnode; 10096 const isStateful = isStatefulComponent(instance); 10097 initProps(instance, props, isStateful, isSSR); 10098 initSlots(instance, children, optimized || isSSR); 10099 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; 10100 isSSR && setInSSRSetupState(false); 10101 return setupResult; 10102 } 10103 function setupStatefulComponent(instance, isSSR) { 10104 var _a; 10105 const Component = instance.type; 10106 { 10107 if (Component.name) { 10108 validateComponentName(Component.name, instance.appContext.config); 10109 } 10110 if (Component.components) { 10111 const names = Object.keys(Component.components); 10112 for (let i = 0; i < names.length; i++) { 10113 validateComponentName(names[i], instance.appContext.config); 10114 } 10115 } 10116 if (Component.directives) { 10117 const names = Object.keys(Component.directives); 10118 for (let i = 0; i < names.length; i++) { 10119 validateDirectiveName(names[i]); 10120 } 10121 } 10122 if (Component.compilerOptions && isRuntimeOnly()) { 10123 warn$1( 10124 `"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.` 10125 ); 10126 } 10127 } 10128 instance.accessCache = /* @__PURE__ */ Object.create(null); 10129 instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers); 10130 { 10131 exposePropsOnRenderContext(instance); 10132 } 10133 const { setup } = Component; 10134 if (setup) { 10135 pauseTracking(); 10136 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null; 10137 const reset = setCurrentInstance(instance); 10138 const setupResult = callWithErrorHandling( 10139 setup, 10140 instance, 10141 0, 10142 [ 10143 shallowReadonly(instance.props) , 10144 setupContext 10145 ] 10146 ); 10147 const isAsyncSetup = isPromise(setupResult); 10148 resetTracking(); 10149 reset(); 10150 if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) { 10151 markAsyncBoundary(instance); 10152 } 10153 if (isAsyncSetup) { 10154 setupResult.then(unsetCurrentInstance, unsetCurrentInstance); 10155 if (isSSR) { 10156 return setupResult.then((resolvedResult) => { 10157 handleSetupResult(instance, resolvedResult, isSSR); 10158 }).catch((e) => { 10159 handleError(e, instance, 0); 10160 }); 10161 } else { 10162 instance.asyncDep = setupResult; 10163 if (!instance.suspense) { 10164 const name = (_a = Component.name) != null ? _a : "Anonymous"; 10165 warn$1( 10166 `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.` 10167 ); 10168 } 10169 } 10170 } else { 10171 handleSetupResult(instance, setupResult, isSSR); 10172 } 10173 } else { 10174 finishComponentSetup(instance, isSSR); 10175 } 10176 } 10177 function handleSetupResult(instance, setupResult, isSSR) { 10178 if (isFunction(setupResult)) { 10179 { 10180 instance.render = setupResult; 10181 } 10182 } else if (isObject(setupResult)) { 10183 if (isVNode(setupResult)) { 10184 warn$1( 10185 `setup() should not return VNodes directly - return a render function instead.` 10186 ); 10187 } 10188 { 10189 instance.devtoolsRawSetupState = setupResult; 10190 } 10191 instance.setupState = proxyRefs(setupResult); 10192 { 10193 exposeSetupStateOnRenderContext(instance); 10194 } 10195 } else if (setupResult !== void 0) { 10196 warn$1( 10197 `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}` 10198 ); 10199 } 10200 finishComponentSetup(instance, isSSR); 10201 } 10202 let compile$1; 10203 let installWithProxy; 10204 function registerRuntimeCompiler(_compile) { 10205 compile$1 = _compile; 10206 installWithProxy = (i) => { 10207 if (i.render._rc) { 10208 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers); 10209 } 10210 }; 10211 } 10212 const isRuntimeOnly = () => !compile$1; 10213 function finishComponentSetup(instance, isSSR, skipOptions) { 10214 const Component = instance.type; 10215 if (!instance.render) { 10216 if (!isSSR && compile$1 && !Component.render) { 10217 const template = Component.template || resolveMergedOptions(instance).template; 10218 if (template) { 10219 { 10220 startMeasure(instance, `compile`); 10221 } 10222 const { isCustomElement, compilerOptions } = instance.appContext.config; 10223 const { delimiters, compilerOptions: componentCompilerOptions } = Component; 10224 const finalCompilerOptions = extend( 10225 extend( 10226 { 10227 isCustomElement, 10228 delimiters 10229 }, 10230 compilerOptions 10231 ), 10232 componentCompilerOptions 10233 ); 10234 Component.render = compile$1(template, finalCompilerOptions); 10235 { 10236 endMeasure(instance, `compile`); 10237 } 10238 } 10239 } 10240 instance.render = Component.render || NOOP; 10241 if (installWithProxy) { 10242 installWithProxy(instance); 10243 } 10244 } 10245 { 10246 const reset = setCurrentInstance(instance); 10247 pauseTracking();
vendor: 2,156 bytes, lines 10248-10321
10248 try { 10249 applyOptions(instance); 10250 } finally { 10251 resetTracking(); 10252 reset(); 10253 } 10254 } 10255 if (!Component.render && instance.render === NOOP && !isSSR) { 10256 if (!compile$1 && Component.template) { 10257 warn$1( 10258 `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` ) 10259 ); 10260 } else { 10261 warn$1(`Component is missing template or render function: `, Component); 10262 } 10263 } 10264 } 10265 const attrsProxyHandlers = { 10266 get(target, key) { 10267 markAttrsAccessed(); 10268 track(target, "get", ""); 10269 return target[key]; 10270 }, 10271 set() { 10272 warn$1(`setupContext.attrs is readonly.`); 10273 return false; 10274 }, 10275 deleteProperty() { 10276 warn$1(`setupContext.attrs is readonly.`); 10277 return false; 10278 } 10279 } ; 10280 function getSlotsProxy(instance) { 10281 return new Proxy(instance.slots, { 10282 get(target, key) { 10283 track(instance, "get", "$slots"); 10284 return target[key]; 10285 } 10286 }); 10287 } 10288 function createSetupContext(instance) { 10289 const expose = (exposed) => { 10290 { 10291 if (instance.exposed) { 10292 warn$1(`expose() should be called only once per setup().`); 10293 } 10294 if (exposed != null) { 10295 let exposedType = typeof exposed; 10296 if (exposedType === "object") { 10297 if (isArray(exposed)) { 10298 exposedType = "array"; 10299 } else if (isRef(exposed)) { 10300 exposedType = "ref"; 10301 } 10302 } 10303 if (exposedType !== "object") { 10304 warn$1( 10305 `expose() should be passed a plain object, received ${exposedType}.` 10306 ); 10307 } 10308 } 10309 } 10310 instance.exposed = exposed || {}; 10311 }; 10312 { 10313 let attrsProxy; 10314 let slotsProxy; 10315 return Object.freeze({ 10316 get attrs() { 10317 return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers)); 10318 }, 10319 get slots() { 10320 return slotsProxy || (slotsProxy = getSlotsProxy(instance)); 10321 },
vendor: 8,317 bytes, lines 10322-10598
10322 get emit() { 10323 return (event, ...args) => instance.emit(event, ...args); 10324 }, 10325 expose 10326 }); 10327 } 10328 } 10329 function getComponentPublicInstance(instance) { 10330 if (instance.exposed) { 10331 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), { 10332 get(target, key) { 10333 if (key in target) { 10334 return target[key]; 10335 } else if (key in publicPropertiesMap) { 10336 return publicPropertiesMap[key](instance); 10337 } 10338 }, 10339 has(target, key) { 10340 return key in target || key in publicPropertiesMap; 10341 } 10342 })); 10343 } else { 10344 return instance.proxy; 10345 } 10346 } 10347 const classifyRE = /(?:^|[-_])\w/g; 10348 const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, ""); 10349 function getComponentName(Component, includeInferred = true) { 10350 return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; 10351 } 10352 function formatComponentName(instance, Component, isRoot = false) { 10353 let name = getComponentName(Component); 10354 if (!name && Component.__file) { 10355 const match = Component.__file.match(/([^/\\]+)\.\w+$/); 10356 if (match) { 10357 name = match[1]; 10358 } 10359 } 10360 if (!name && instance && instance.parent) { 10361 const inferFromRegistry = (registry) => { 10362 for (const key in registry) { 10363 if (registry[key] === Component) { 10364 return key; 10365 } 10366 } 10367 }; 10368 name = inferFromRegistry( 10369 instance.components || instance.parent.type.components 10370 ) || inferFromRegistry(instance.appContext.components); 10371 } 10372 return name ? classify(name) : isRoot ? `App` : `Anonymous`; 10373 } 10374 function isClassComponent(value) { 10375 return isFunction(value) && "__vccOpts" in value; 10376 } 10377 10378 const computed = (getterOrOptions, debugOptions) => { 10379 const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); 10380 { 10381 const i = getCurrentInstance(); 10382 if (i && i.appContext.config.warnRecursiveComputed) { 10383 c._warnRecursive = true; 10384 } 10385 } 10386 return c; 10387 }; 10388 10389 function h(type, propsOrChildren, children) { 10390 const doCreateVNode = (type2, props, children2) => { 10391 setBlockTracking(-1); 10392 try { 10393 return createVNode(type2, props, children2); 10394 } finally { 10395 setBlockTracking(1); 10396 } 10397 }; 10398 const l = arguments.length; 10399 if (l === 2) { 10400 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) { 10401 if (isVNode(propsOrChildren)) { 10402 return doCreateVNode(type, null, [propsOrChildren]); 10403 } 10404 return doCreateVNode(type, propsOrChildren); 10405 } else { 10406 return doCreateVNode(type, null, propsOrChildren); 10407 } 10408 } else { 10409 if (l > 3) { 10410 children = Array.prototype.slice.call(arguments, 2); 10411 } else if (l === 3 && isVNode(children)) { 10412 children = [children]; 10413 } 10414 return doCreateVNode(type, propsOrChildren, children); 10415 } 10416 } 10417 10418 function initCustomFormatter() { 10419 if (typeof window === "undefined") { 10420 return; 10421 } 10422 const vueStyle = { style: "color:#3ba776" }; 10423 const numberStyle = { style: "color:#1677ff" }; 10424 const stringStyle = { style: "color:#f5222d" }; 10425 const keywordStyle = { style: "color:#eb2f96" }; 10426 const formatter = { 10427 __vue_custom_formatter: true, 10428 header(obj) { 10429 if (!isObject(obj)) { 10430 return null; 10431 } 10432 if (obj.__isVue) { 10433 return ["div", vueStyle, `VueInstance`]; 10434 } else if (isRef(obj)) { 10435 pauseTracking(); 10436 const value = obj.value; 10437 resetTracking(); 10438 return [ 10439 "div", 10440 {}, 10441 ["span", vueStyle, genRefFlag(obj)], 10442 "<", 10443 formatValue(value), 10444 `>` 10445 ]; 10446 } else if (isReactive(obj)) { 10447 return [ 10448 "div", 10449 {}, 10450 ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"], 10451 "<", 10452 formatValue(obj), 10453 `>${isReadonly(obj) ? ` (readonly)` : ``}` 10454 ]; 10455 } else if (isReadonly(obj)) { 10456 return [ 10457 "div", 10458 {}, 10459 ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"], 10460 "<", 10461 formatValue(obj), 10462 ">" 10463 ]; 10464 } 10465 return null; 10466 }, 10467 hasBody(obj) { 10468 return obj && obj.__isVue; 10469 }, 10470 body(obj) { 10471 if (obj && obj.__isVue) { 10472 return [ 10473 "div", 10474 {}, 10475 ...formatInstance(obj.$) 10476 ]; 10477 } 10478 } 10479 }; 10480 function formatInstance(instance) { 10481 const blocks = []; 10482 if (instance.type.props && instance.props) { 10483 blocks.push(createInstanceBlock("props", toRaw(instance.props))); 10484 } 10485 if (instance.setupState !== EMPTY_OBJ) { 10486 blocks.push(createInstanceBlock("setup", instance.setupState)); 10487 } 10488 if (instance.data !== EMPTY_OBJ) { 10489 blocks.push(createInstanceBlock("data", toRaw(instance.data))); 10490 } 10491 const computed = extractKeys(instance, "computed"); 10492 if (computed) { 10493 blocks.push(createInstanceBlock("computed", computed)); 10494 } 10495 const injected = extractKeys(instance, "inject"); 10496 if (injected) { 10497 blocks.push(createInstanceBlock("injected", injected)); 10498 } 10499 blocks.push([ 10500 "div", 10501 {}, 10502 [ 10503 "span", 10504 { 10505 style: keywordStyle.style + ";opacity:0.66" 10506 }, 10507 "$ (internal): " 10508 ], 10509 ["object", { object: instance }] 10510 ]); 10511 return blocks; 10512 } 10513 function createInstanceBlock(type, target) { 10514 target = extend({}, target); 10515 if (!Object.keys(target).length) { 10516 return ["span", {}]; 10517 } 10518 return [ 10519 "div", 10520 { style: "line-height:1.25em;margin-bottom:0.6em" }, 10521 [ 10522 "div", 10523 { 10524 style: "color:#476582" 10525 }, 10526 type 10527 ], 10528 [ 10529 "div", 10530 { 10531 style: "padding-left:1.25em" 10532 }, 10533 ...Object.keys(target).map((key) => { 10534 return [ 10535 "div", 10536 {}, 10537 ["span", keywordStyle, key + ": "], 10538 formatValue(target[key], false) 10539 ]; 10540 }) 10541 ] 10542 ]; 10543 } 10544 function formatValue(v, asRaw = true) { 10545 if (typeof v === "number") { 10546 return ["span", numberStyle, v]; 10547 } else if (typeof v === "string") { 10548 return ["span", stringStyle, JSON.stringify(v)]; 10549 } else if (typeof v === "boolean") { 10550 return ["span", keywordStyle, v]; 10551 } else if (isObject(v)) { 10552 return ["object", { object: asRaw ? toRaw(v) : v }]; 10553 } else { 10554 return ["span", stringStyle, String(v)]; 10555 } 10556 } 10557 function extractKeys(instance, type) { 10558 const Comp = instance.type; 10559 if (isFunction(Comp)) { 10560 return; 10561 } 10562 const extracted = {}; 10563 for (const key in instance.ctx) { 10564 if (isKeyOfType(Comp, key, type)) { 10565 extracted[key] = instance.ctx[key]; 10566 } 10567 } 10568 return extracted; 10569 } 10570 function isKeyOfType(Comp, key, type) { 10571 const opts = Comp[type]; 10572 if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) { 10573 return true; 10574 } 10575 if (Comp.extends && isKeyOfType(Comp.extends, key, type)) { 10576 return true; 10577 } 10578 if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) { 10579 return true; 10580 } 10581 } 10582 function genRefFlag(v) { 10583 if (isShallow(v)) { 10584 return `ShallowRef`; 10585 } 10586 if (v.effect) { 10587 return `ComputedRef`; 10588 } 10589 return `Ref`; 10590 } 10591 if (window.devtoolsFormatters) { 10592 window.devtoolsFormatters.push(formatter); 10593 } else { 10594 window.devtoolsFormatters = [formatter]; 10595 } 10596 } 10597 10598 function withMemo(memo, render, cache, index) {
vendor: 1,485 bytes, lines 10599-10648
10599 const cached = cache[index]; 10600 if (cached && isMemoSame(cached, memo)) { 10601 return cached; 10602 } 10603 const ret = render(); 10604 ret.memo = memo.slice(); 10605 ret.cacheIndex = index; 10606 return cache[index] = ret; 10607 } 10608 function isMemoSame(cached, memo) { 10609 const prev = cached.memo; 10610 if (prev.length != memo.length) { 10611 return false; 10612 } 10613 for (let i = 0; i < prev.length; i++) { 10614 if (hasChanged(prev[i], memo[i])) { 10615 return false; 10616 } 10617 } 10618 if (isBlockTreeEnabled > 0 && currentBlock) { 10619 currentBlock.push(cached); 10620 } 10621 return true; 10622 } 10623 10624 const version = "3.5.21"; 10625 const warn = warn$1 ; 10626 const ErrorTypeStrings = ErrorTypeStrings$1 ; 10627 const devtools = devtools$1 ; 10628 const setDevtoolsHook = setDevtoolsHook$1 ; 10629 const ssrUtils = null; 10630 const resolveFilter = null; 10631 const compatUtils = null; 10632 const DeprecationTypes = null; 10633 10634 let policy = void 0; 10635 const tt = typeof window !== "undefined" && window.trustedTypes; 10636 if (tt) { 10637 try { 10638 policy = /* @__PURE__ */ tt.createPolicy("vue", { 10639 createHTML: (val) => val 10640 }); 10641 } catch (e) { 10642 warn(`Error creating trusted types policy: ${e}`); 10643 } 10644 } 10645 const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val; 10646 const svgNS = "http://www.w3.org/2000/svg"; 10647 const mathmlNS = "http://www.w3.org/1998/Math/MathML"; 10648 const doc = typeof document !== "undefined" ? document : null;
vendor: 12,179 bytes, lines 10649-11009
10649 const templateContainer = doc && /* @__PURE__ */ doc.createElement("template"); 10650 const nodeOps = { 10651 insert: (child, parent, anchor) => { 10652 parent.insertBefore(child, anchor || null); 10653 }, 10654 remove: (child) => { 10655 const parent = child.parentNode; 10656 if (parent) { 10657 parent.removeChild(child); 10658 } 10659 }, 10660 createElement: (tag, namespace, is, props) => { 10661 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag); 10662 if (tag === "select" && props && props.multiple != null) { 10663 el.setAttribute("multiple", props.multiple); 10664 } 10665 return el; 10666 }, 10667 createText: (text) => doc.createTextNode(text), 10668 createComment: (text) => doc.createComment(text), 10669 setText: (node, text) => { 10670 node.nodeValue = text; 10671 }, 10672 setElementText: (el, text) => { 10673 el.textContent = text; 10674 }, 10675 parentNode: (node) => node.parentNode, 10676 nextSibling: (node) => node.nextSibling, 10677 querySelector: (selector) => doc.querySelector(selector), 10678 setScopeId(el, id) { 10679 el.setAttribute(id, ""); 10680 }, 10681 // __UNSAFE__ 10682 // Reason: innerHTML. 10683 // Static content here can only come from compiled templates. 10684 // As long as the user only uses trusted templates, this is safe. 10685 insertStaticContent(content, parent, anchor, namespace, start, end) { 10686 const before = anchor ? anchor.previousSibling : parent.lastChild; 10687 if (start && (start === end || start.nextSibling)) { 10688 while (true) { 10689 parent.insertBefore(start.cloneNode(true), anchor); 10690 if (start === end || !(start = start.nextSibling)) break; 10691 } 10692 } else { 10693 templateContainer.innerHTML = unsafeToTrustedHTML( 10694 namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content 10695 ); 10696 const template = templateContainer.content; 10697 if (namespace === "svg" || namespace === "mathml") { 10698 const wrapper = template.firstChild; 10699 while (wrapper.firstChild) { 10700 template.appendChild(wrapper.firstChild); 10701 } 10702 template.removeChild(wrapper); 10703 } 10704 parent.insertBefore(template, anchor); 10705 } 10706 return [ 10707 // first 10708 before ? before.nextSibling : parent.firstChild, 10709 // last 10710 anchor ? anchor.previousSibling : parent.lastChild 10711 ]; 10712 } 10713 }; 10714 10715 const TRANSITION$1 = "transition"; 10716 const ANIMATION = "animation"; 10717 const vtcKey = Symbol("_vtc"); 10718 const DOMTransitionPropsValidators = { 10719 name: String, 10720 type: String, 10721 css: { 10722 type: Boolean, 10723 default: true 10724 }, 10725 duration: [String, Number, Object], 10726 enterFromClass: String, 10727 enterActiveClass: String, 10728 enterToClass: String, 10729 appearFromClass: String, 10730 appearActiveClass: String, 10731 appearToClass: String, 10732 leaveFromClass: String, 10733 leaveActiveClass: String, 10734 leaveToClass: String 10735 }; 10736 const TransitionPropsValidators = /* @__PURE__ */ extend( 10737 {}, 10738 BaseTransitionPropsValidators, 10739 DOMTransitionPropsValidators 10740 ); 10741 const decorate$1 = (t) => { 10742 t.displayName = "Transition"; 10743 t.props = TransitionPropsValidators; 10744 return t; 10745 }; 10746 const Transition = /* @__PURE__ */ decorate$1( 10747 (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots) 10748 ); 10749 const callHook = (hook, args = []) => { 10750 if (isArray(hook)) { 10751 hook.forEach((h2) => h2(...args)); 10752 } else if (hook) { 10753 hook(...args); 10754 } 10755 }; 10756 const hasExplicitCallback = (hook) => { 10757 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; 10758 }; 10759 function resolveTransitionProps(rawProps) { 10760 const baseProps = {}; 10761 for (const key in rawProps) { 10762 if (!(key in DOMTransitionPropsValidators)) { 10763 baseProps[key] = rawProps[key]; 10764 } 10765 } 10766 if (rawProps.css === false) { 10767 return baseProps; 10768 } 10769 const { 10770 name = "v", 10771 type, 10772 duration, 10773 enterFromClass = `${name}-enter-from`, 10774 enterActiveClass = `${name}-enter-active`, 10775 enterToClass = `${name}-enter-to`, 10776 appearFromClass = enterFromClass, 10777 appearActiveClass = enterActiveClass, 10778 appearToClass = enterToClass, 10779 leaveFromClass = `${name}-leave-from`, 10780 leaveActiveClass = `${name}-leave-active`, 10781 leaveToClass = `${name}-leave-to` 10782 } = rawProps; 10783 const durations = normalizeDuration(duration); 10784 const enterDuration = durations && durations[0]; 10785 const leaveDuration = durations && durations[1]; 10786 const { 10787 onBeforeEnter, 10788 onEnter, 10789 onEnterCancelled, 10790 onLeave, 10791 onLeaveCancelled, 10792 onBeforeAppear = onBeforeEnter, 10793 onAppear = onEnter, 10794 onAppearCancelled = onEnterCancelled 10795 } = baseProps; 10796 const finishEnter = (el, isAppear, done, isCancelled) => { 10797 el._enterCancelled = isCancelled; 10798 removeTransitionClass(el, isAppear ? appearToClass : enterToClass); 10799 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass); 10800 done && done(); 10801 }; 10802 const finishLeave = (el, done) => { 10803 el._isLeaving = false; 10804 removeTransitionClass(el, leaveFromClass); 10805 removeTransitionClass(el, leaveToClass); 10806 removeTransitionClass(el, leaveActiveClass); 10807 done && done(); 10808 }; 10809 const makeEnterHook = (isAppear) => { 10810 return (el, done) => { 10811 const hook = isAppear ? onAppear : onEnter; 10812 const resolve = () => finishEnter(el, isAppear, done); 10813 callHook(hook, [el, resolve]); 10814 nextFrame(() => { 10815 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass); 10816 addTransitionClass(el, isAppear ? appearToClass : enterToClass); 10817 if (!hasExplicitCallback(hook)) { 10818 whenTransitionEnds(el, type, enterDuration, resolve); 10819 } 10820 }); 10821 }; 10822 }; 10823 return extend(baseProps, { 10824 onBeforeEnter(el) { 10825 callHook(onBeforeEnter, [el]); 10826 addTransitionClass(el, enterFromClass); 10827 addTransitionClass(el, enterActiveClass); 10828 }, 10829 onBeforeAppear(el) { 10830 callHook(onBeforeAppear, [el]); 10831 addTransitionClass(el, appearFromClass); 10832 addTransitionClass(el, appearActiveClass); 10833 }, 10834 onEnter: makeEnterHook(false), 10835 onAppear: makeEnterHook(true), 10836 onLeave(el, done) { 10837 el._isLeaving = true; 10838 const resolve = () => finishLeave(el, done); 10839 addTransitionClass(el, leaveFromClass); 10840 if (!el._enterCancelled) { 10841 forceReflow(); 10842 addTransitionClass(el, leaveActiveClass); 10843 } else { 10844 addTransitionClass(el, leaveActiveClass); 10845 forceReflow(); 10846 } 10847 nextFrame(() => { 10848 if (!el._isLeaving) { 10849 return; 10850 } 10851 removeTransitionClass(el, leaveFromClass); 10852 addTransitionClass(el, leaveToClass); 10853 if (!hasExplicitCallback(onLeave)) { 10854 whenTransitionEnds(el, type, leaveDuration, resolve); 10855 } 10856 }); 10857 callHook(onLeave, [el, resolve]); 10858 }, 10859 onEnterCancelled(el) { 10860 finishEnter(el, false, void 0, true); 10861 callHook(onEnterCancelled, [el]); 10862 }, 10863 onAppearCancelled(el) { 10864 finishEnter(el, true, void 0, true); 10865 callHook(onAppearCancelled, [el]); 10866 }, 10867 onLeaveCancelled(el) { 10868 finishLeave(el); 10869 callHook(onLeaveCancelled, [el]); 10870 } 10871 }); 10872 } 10873 function normalizeDuration(duration) { 10874 if (duration == null) { 10875 return null; 10876 } else if (isObject(duration)) { 10877 return [NumberOf(duration.enter), NumberOf(duration.leave)]; 10878 } else { 10879 const n = NumberOf(duration); 10880 return [n, n]; 10881 } 10882 } 10883 function NumberOf(val) { 10884 const res = toNumber(val); 10885 { 10886 assertNumber(res, "<transition> explicit duration"); 10887 } 10888 return res; 10889 } 10890 function addTransitionClass(el, cls) { 10891 cls.split(/\s+/).forEach((c) => c && el.classList.add(c)); 10892 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls); 10893 } 10894 function removeTransitionClass(el, cls) { 10895 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c)); 10896 const _vtc = el[vtcKey]; 10897 if (_vtc) { 10898 _vtc.delete(cls); 10899 if (!_vtc.size) { 10900 el[vtcKey] = void 0; 10901 } 10902 } 10903 } 10904 function nextFrame(cb) { 10905 requestAnimationFrame(() => { 10906 requestAnimationFrame(cb); 10907 }); 10908 } 10909 let endId = 0; 10910 function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) { 10911 const id = el._endId = ++endId; 10912 const resolveIfNotStale = () => { 10913 if (id === el._endId) { 10914 resolve(); 10915 } 10916 }; 10917 if (explicitTimeout != null) { 10918 return setTimeout(resolveIfNotStale, explicitTimeout); 10919 } 10920 const { type, timeout, propCount } = getTransitionInfo(el, expectedType); 10921 if (!type) { 10922 return resolve(); 10923 } 10924 const endEvent = type + "end"; 10925 let ended = 0; 10926 const end = () => { 10927 el.removeEventListener(endEvent, onEnd); 10928 resolveIfNotStale(); 10929 }; 10930 const onEnd = (e) => { 10931 if (e.target === el && ++ended >= propCount) { 10932 end(); 10933 } 10934 }; 10935 setTimeout(() => { 10936 if (ended < propCount) { 10937 end(); 10938 } 10939 }, timeout + 1); 10940 el.addEventListener(endEvent, onEnd); 10941 } 10942 function getTransitionInfo(el, expectedType) { 10943 const styles = window.getComputedStyle(el); 10944 const getStyleProperties = (key) => (styles[key] || "").split(", "); 10945 const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`); 10946 const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`); 10947 const transitionTimeout = getTimeout(transitionDelays, transitionDurations); 10948 const animationDelays = getStyleProperties(`${ANIMATION}Delay`); 10949 const animationDurations = getStyleProperties(`${ANIMATION}Duration`); 10950 const animationTimeout = getTimeout(animationDelays, animationDurations); 10951 let type = null; 10952 let timeout = 0; 10953 let propCount = 0; 10954 if (expectedType === TRANSITION$1) { 10955 if (transitionTimeout > 0) { 10956 type = TRANSITION$1; 10957 timeout = transitionTimeout; 10958 propCount = transitionDurations.length; 10959 } 10960 } else if (expectedType === ANIMATION) { 10961 if (animationTimeout > 0) { 10962 type = ANIMATION; 10963 timeout = animationTimeout; 10964 propCount = animationDurations.length; 10965 } 10966 } else { 10967 timeout = Math.max(transitionTimeout, animationTimeout); 10968 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null; 10969 propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0; 10970 } 10971 const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test( 10972 getStyleProperties(`${TRANSITION$1}Property`).toString() 10973 ); 10974 return { 10975 type, 10976 timeout, 10977 propCount, 10978 hasTransform 10979 }; 10980 } 10981 function getTimeout(delays, durations) { 10982 while (delays.length < durations.length) { 10983 delays = delays.concat(delays); 10984 } 10985 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i]))); 10986 } 10987 function toMs(s) { 10988 if (s === "auto") return 0; 10989 return Number(s.slice(0, -1).replace(",", ".")) * 1e3; 10990 } 10991 function forceReflow() { 10992 return document.body.offsetHeight; 10993 } 10994 10995 function patchClass(el, value, isSVG) { 10996 const transitionClasses = el[vtcKey]; 10997 if (transitionClasses) { 10998 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" "); 10999 } 11000 if (value == null) { 11001 el.removeAttribute("class"); 11002 } else if (isSVG) { 11003 el.setAttribute("class", value); 11004 } else { 11005 el.className = value; 11006 } 11007 } 11008 11009 const vShowOriginalDisplay = Symbol("_vod");
vendor: 4,989 bytes, lines 11010-11174
11010 const vShowHidden = Symbol("_vsh"); 11011 const vShow = { 11012 // used for prop mismatch check during hydration 11013 name: "show", 11014 beforeMount(el, { value }, { transition }) { 11015 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display; 11016 if (transition && value) { 11017 transition.beforeEnter(el); 11018 } else { 11019 setDisplay(el, value); 11020 } 11021 }, 11022 mounted(el, { value }, { transition }) { 11023 if (transition && value) { 11024 transition.enter(el); 11025 } 11026 }, 11027 updated(el, { value, oldValue }, { transition }) { 11028 if (!value === !oldValue) return; 11029 if (transition) { 11030 if (value) { 11031 transition.beforeEnter(el); 11032 setDisplay(el, true); 11033 transition.enter(el); 11034 } else { 11035 transition.leave(el, () => { 11036 setDisplay(el, false); 11037 }); 11038 } 11039 } else { 11040 setDisplay(el, value); 11041 } 11042 }, 11043 beforeUnmount(el, { value }) { 11044 setDisplay(el, value); 11045 } 11046 }; 11047 function setDisplay(el, value) { 11048 el.style.display = value ? el[vShowOriginalDisplay] : "none"; 11049 el[vShowHidden] = !value; 11050 } 11051 11052 const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" ); 11053 function useCssVars(getter) { 11054 const instance = getCurrentInstance(); 11055 if (!instance) { 11056 warn(`useCssVars is called without current active component instance.`); 11057 return; 11058 } 11059 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => { 11060 Array.from( 11061 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`) 11062 ).forEach((node) => setVarsOnNode(node, vars)); 11063 }; 11064 { 11065 instance.getCssVars = () => getter(instance.proxy); 11066 } 11067 const setVars = () => { 11068 const vars = getter(instance.proxy); 11069 if (instance.ce) { 11070 setVarsOnNode(instance.ce, vars); 11071 } else { 11072 setVarsOnVNode(instance.subTree, vars); 11073 } 11074 updateTeleports(vars); 11075 }; 11076 onBeforeUpdate(() => { 11077 queuePostFlushCb(setVars); 11078 }); 11079 onMounted(() => { 11080 watch(setVars, NOOP, { flush: "post" }); 11081 const ob = new MutationObserver(setVars); 11082 ob.observe(instance.subTree.el.parentNode, { childList: true }); 11083 onUnmounted(() => ob.disconnect()); 11084 }); 11085 } 11086 function setVarsOnVNode(vnode, vars) { 11087 if (vnode.shapeFlag & 128) { 11088 const suspense = vnode.suspense; 11089 vnode = suspense.activeBranch; 11090 if (suspense.pendingBranch && !suspense.isHydrating) { 11091 suspense.effects.push(() => { 11092 setVarsOnVNode(suspense.activeBranch, vars); 11093 }); 11094 } 11095 } 11096 while (vnode.component) { 11097 vnode = vnode.component.subTree; 11098 } 11099 if (vnode.shapeFlag & 1 && vnode.el) { 11100 setVarsOnNode(vnode.el, vars); 11101 } else if (vnode.type === Fragment) { 11102 vnode.children.forEach((c) => setVarsOnVNode(c, vars)); 11103 } else if (vnode.type === Static) { 11104 let { el, anchor } = vnode; 11105 while (el) { 11106 setVarsOnNode(el, vars); 11107 if (el === anchor) break; 11108 el = el.nextSibling; 11109 } 11110 } 11111 } 11112 function setVarsOnNode(el, vars) { 11113 if (el.nodeType === 1) { 11114 const style = el.style; 11115 let cssText = ""; 11116 for (const key in vars) { 11117 const value = normalizeCssVarValue(vars[key]); 11118 style.setProperty(`--${key}`, value); 11119 cssText += `--${key}: ${value};`; 11120 } 11121 style[CSS_VAR_TEXT] = cssText; 11122 } 11123 } 11124 11125 const displayRE = /(?:^|;)\s*display\s*:/; 11126 function patchStyle(el, prev, next) { 11127 const style = el.style; 11128 const isCssString = isString(next); 11129 let hasControlledDisplay = false; 11130 if (next && !isCssString) { 11131 if (prev) { 11132 if (!isString(prev)) { 11133 for (const key in prev) { 11134 if (next[key] == null) { 11135 setStyle(style, key, ""); 11136 } 11137 } 11138 } else { 11139 for (const prevStyle of prev.split(";")) { 11140 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim(); 11141 if (next[key] == null) { 11142 setStyle(style, key, ""); 11143 } 11144 } 11145 } 11146 } 11147 for (const key in next) { 11148 if (key === "display") { 11149 hasControlledDisplay = true; 11150 } 11151 setStyle(style, key, next[key]); 11152 } 11153 } else { 11154 if (isCssString) { 11155 if (prev !== next) { 11156 const cssVarText = style[CSS_VAR_TEXT]; 11157 if (cssVarText) { 11158 next += ";" + cssVarText; 11159 } 11160 style.cssText = next; 11161 hasControlledDisplay = displayRE.test(next); 11162 } 11163 } else if (prev) { 11164 el.removeAttribute("style"); 11165 } 11166 } 11167 if (vShowOriginalDisplay in el) { 11168 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : ""; 11169 if (el[vShowHidden]) { 11170 style.display = "none"; 11171 } 11172 } 11173 } 11174 const semicolonRE = /[^\\];\s*$/;
vendor: 4,132 bytes, lines 11175-11305
11175 const importantRE = /\s*!important$/; 11176 function setStyle(style, name, val) { 11177 if (isArray(val)) { 11178 val.forEach((v) => setStyle(style, name, v)); 11179 } else { 11180 if (val == null) val = ""; 11181 { 11182 if (semicolonRE.test(val)) { 11183 warn( 11184 `Unexpected semicolon at the end of '${name}' style value: '${val}'` 11185 ); 11186 } 11187 } 11188 if (name.startsWith("--")) { 11189 style.setProperty(name, val); 11190 } else { 11191 const prefixed = autoPrefix(style, name); 11192 if (importantRE.test(val)) { 11193 style.setProperty( 11194 hyphenate(prefixed), 11195 val.replace(importantRE, ""), 11196 "important" 11197 ); 11198 } else { 11199 style[prefixed] = val; 11200 } 11201 } 11202 } 11203 } 11204 const prefixes = ["Webkit", "Moz", "ms"]; 11205 const prefixCache = {}; 11206 function autoPrefix(style, rawName) { 11207 const cached = prefixCache[rawName]; 11208 if (cached) { 11209 return cached; 11210 } 11211 let name = camelize(rawName); 11212 if (name !== "filter" && name in style) { 11213 return prefixCache[rawName] = name; 11214 } 11215 name = capitalize(name); 11216 for (let i = 0; i < prefixes.length; i++) { 11217 const prefixed = prefixes[i] + name; 11218 if (prefixed in style) { 11219 return prefixCache[rawName] = prefixed; 11220 } 11221 } 11222 return rawName; 11223 } 11224 11225 const xlinkNS = "http://www.w3.org/1999/xlink"; 11226 function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) { 11227 if (isSVG && key.startsWith("xlink:")) { 11228 if (value == null) { 11229 el.removeAttributeNS(xlinkNS, key.slice(6, key.length)); 11230 } else { 11231 el.setAttributeNS(xlinkNS, key, value); 11232 } 11233 } else { 11234 if (value == null || isBoolean && !includeBooleanAttr(value)) { 11235 el.removeAttribute(key); 11236 } else { 11237 el.setAttribute( 11238 key, 11239 isBoolean ? "" : isSymbol(value) ? String(value) : value 11240 ); 11241 } 11242 } 11243 } 11244 11245 function patchDOMProp(el, key, value, parentComponent, attrName) { 11246 if (key === "innerHTML" || key === "textContent") { 11247 if (value != null) { 11248 el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value; 11249 } 11250 return; 11251 } 11252 const tag = el.tagName; 11253 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally 11254 !tag.includes("-")) { 11255 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value; 11256 const newValue = value == null ? ( 11257 // #11647: value should be set as empty string for null and undefined, 11258 // but <input type="checkbox"> should be set as 'on'. 11259 el.type === "checkbox" ? "on" : "" 11260 ) : String(value); 11261 if (oldValue !== newValue || !("_value" in el)) { 11262 el.value = newValue; 11263 } 11264 if (value == null) { 11265 el.removeAttribute(key); 11266 } 11267 el._value = value; 11268 return; 11269 } 11270 let needRemove = false; 11271 if (value === "" || value == null) { 11272 const type = typeof el[key]; 11273 if (type === "boolean") { 11274 value = includeBooleanAttr(value); 11275 } else if (value == null && type === "string") { 11276 value = ""; 11277 needRemove = true; 11278 } else if (type === "number") { 11279 value = 0; 11280 needRemove = true; 11281 } 11282 } 11283 try { 11284 el[key] = value; 11285 } catch (e) { 11286 if (!needRemove) { 11287 warn( 11288 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`, 11289 e 11290 ); 11291 } 11292 } 11293 needRemove && el.removeAttribute(attrName || key); 11294 } 11295 11296 function addEventListener(el, event, handler, options) { 11297 el.addEventListener(event, handler, options); 11298 } 11299 function removeEventListener(el, event, handler, options) { 11300 el.removeEventListener(event, handler, options); 11301 } 11302 const veiKey = Symbol("_vei"); 11303 function patchEvent(el, rawName, prevValue, nextValue, instance = null) { 11304 const invokers = el[veiKey] || (el[veiKey] = {}); 11305 const existingInvoker = invokers[rawName];
vendor: 2,412 bytes, lines 11306-11382
11306 if (nextValue && existingInvoker) { 11307 existingInvoker.value = sanitizeEventValue(nextValue, rawName) ; 11308 } else { 11309 const [name, options] = parseName(rawName); 11310 if (nextValue) { 11311 const invoker = invokers[rawName] = createInvoker( 11312 sanitizeEventValue(nextValue, rawName) , 11313 instance 11314 ); 11315 addEventListener(el, name, invoker, options); 11316 } else if (existingInvoker) { 11317 removeEventListener(el, name, existingInvoker, options); 11318 invokers[rawName] = void 0; 11319 } 11320 } 11321 } 11322 const optionsModifierRE = /(?:Once|Passive|Capture)$/; 11323 function parseName(name) { 11324 let options; 11325 if (optionsModifierRE.test(name)) { 11326 options = {}; 11327 let m; 11328 while (m = name.match(optionsModifierRE)) { 11329 name = name.slice(0, name.length - m[0].length); 11330 options[m[0].toLowerCase()] = true; 11331 } 11332 } 11333 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)); 11334 return [event, options]; 11335 } 11336 let cachedNow = 0; 11337 const p = /* @__PURE__ */ Promise.resolve(); 11338 const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now()); 11339 function createInvoker(initialValue, instance) { 11340 const invoker = (e) => { 11341 if (!e._vts) { 11342 e._vts = Date.now(); 11343 } else if (e._vts <= invoker.attached) { 11344 return; 11345 } 11346 callWithAsyncErrorHandling( 11347 patchStopImmediatePropagation(e, invoker.value), 11348 instance, 11349 5, 11350 [e] 11351 ); 11352 }; 11353 invoker.value = initialValue; 11354 invoker.attached = getNow(); 11355 return invoker; 11356 } 11357 function sanitizeEventValue(value, propName) { 11358 if (isFunction(value) || isArray(value)) { 11359 return value; 11360 } 11361 warn( 11362 `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop? 11363Expected function or array of functions, received type ${typeof value}.` 11364 ); 11365 return NOOP; 11366 } 11367 function patchStopImmediatePropagation(e, value) { 11368 if (isArray(value)) { 11369 const originalStop = e.stopImmediatePropagation; 11370 e.stopImmediatePropagation = () => { 11371 originalStop.call(e); 11372 e._stopped = true; 11373 }; 11374 return value.map( 11375 (fn) => (e2) => !e2._stopped && fn && fn(e2) 11376 ); 11377 } else { 11378 return value; 11379 } 11380 } 11381 11382 const isNativeOn = (key) =>
vendor: 12,488 bytes, lines 11382-11761
11382 key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter 11383 key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; 11384 const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => { 11385 const isSVG = namespace === "svg"; 11386 if (key === "class") { 11387 patchClass(el, nextValue, isSVG); 11388 } else if (key === "style") { 11389 patchStyle(el, prevValue, nextValue); 11390 } else if (isOn(key)) { 11391 if (!isModelListener(key)) { 11392 patchEvent(el, key, prevValue, nextValue, parentComponent); 11393 } 11394 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) { 11395 patchDOMProp(el, key, nextValue); 11396 if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) { 11397 patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value"); 11398 } 11399 } else if ( 11400 // #11081 force set props for possible async custom element 11401 el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue)) 11402 ) { 11403 patchDOMProp(el, camelize(key), nextValue, parentComponent, key); 11404 } else { 11405 if (key === "true-value") { 11406 el._trueValue = nextValue; 11407 } else if (key === "false-value") { 11408 el._falseValue = nextValue; 11409 } 11410 patchAttr(el, key, nextValue, isSVG); 11411 } 11412 }; 11413 function shouldSetAsProp(el, key, value, isSVG) { 11414 if (isSVG) { 11415 if (key === "innerHTML" || key === "textContent") { 11416 return true; 11417 } 11418 if (key in el && isNativeOn(key) && isFunction(value)) { 11419 return true; 11420 } 11421 return false; 11422 } 11423 if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") { 11424 return false; 11425 } 11426 if (key === "form") { 11427 return false; 11428 } 11429 if (key === "list" && el.tagName === "INPUT") { 11430 return false; 11431 } 11432 if (key === "type" && el.tagName === "TEXTAREA") { 11433 return false; 11434 } 11435 if (key === "width" || key === "height") { 11436 const tag = el.tagName; 11437 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") { 11438 return false; 11439 } 11440 } 11441 if (isNativeOn(key) && isString(value)) { 11442 return false; 11443 } 11444 return key in el; 11445 } 11446 11447 const REMOVAL = {}; 11448 // @__NO_SIDE_EFFECTS__ 11449 function defineCustomElement(options, extraOptions, _createApp) { 11450 let Comp = defineComponent(options, extraOptions); 11451 if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions); 11452 class VueCustomElement extends VueElement { 11453 constructor(initialProps) { 11454 super(Comp, initialProps, _createApp); 11455 } 11456 } 11457 VueCustomElement.def = Comp; 11458 return VueCustomElement; 11459 } 11460 const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => { 11461 return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp); 11462 }); 11463 const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class { 11464 }; 11465 class VueElement extends BaseClass { 11466 constructor(_def, _props = {}, _createApp = createApp) { 11467 super(); 11468 this._def = _def; 11469 this._props = _props; 11470 this._createApp = _createApp; 11471 this._isVueCE = true; 11472 /** 11473 * @internal 11474 */ 11475 this._instance = null; 11476 /** 11477 * @internal 11478 */ 11479 this._app = null; 11480 /** 11481 * @internal 11482 */ 11483 this._nonce = this._def.nonce; 11484 this._connected = false; 11485 this._resolved = false; 11486 this._numberProps = null; 11487 this._styleChildren = /* @__PURE__ */ new WeakSet(); 11488 this._ob = null; 11489 if (this.shadowRoot && _createApp !== createApp) { 11490 this._root = this.shadowRoot; 11491 } else { 11492 if (this.shadowRoot) { 11493 warn( 11494 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.` 11495 ); 11496 } 11497 if (_def.shadowRoot !== false) { 11498 this.attachShadow({ mode: "open" }); 11499 this._root = this.shadowRoot; 11500 } else { 11501 this._root = this; 11502 } 11503 } 11504 } 11505 connectedCallback() { 11506 if (!this.isConnected) return; 11507 if (!this.shadowRoot && !this._resolved) { 11508 this._parseSlots(); 11509 } 11510 this._connected = true; 11511 let parent = this; 11512 while (parent = parent && (parent.parentNode || parent.host)) { 11513 if (parent instanceof VueElement) { 11514 this._parent = parent; 11515 break; 11516 } 11517 } 11518 if (!this._instance) { 11519 if (this._resolved) { 11520 this._mount(this._def); 11521 } else { 11522 if (parent && parent._pendingResolve) { 11523 this._pendingResolve = parent._pendingResolve.then(() => { 11524 this._pendingResolve = void 0; 11525 this._resolveDef(); 11526 }); 11527 } else { 11528 this._resolveDef(); 11529 } 11530 } 11531 } 11532 } 11533 _setParent(parent = this._parent) { 11534 if (parent) { 11535 this._instance.parent = parent._instance; 11536 this._inheritParentContext(parent); 11537 } 11538 } 11539 _inheritParentContext(parent = this._parent) { 11540 if (parent && this._app) { 11541 Object.setPrototypeOf( 11542 this._app._context.provides, 11543 parent._instance.provides 11544 ); 11545 } 11546 } 11547 disconnectedCallback() { 11548 this._connected = false; 11549 nextTick(() => { 11550 if (!this._connected) { 11551 if (this._ob) { 11552 this._ob.disconnect(); 11553 this._ob = null; 11554 } 11555 this._app && this._app.unmount(); 11556 if (this._instance) this._instance.ce = void 0; 11557 this._app = this._instance = null; 11558 } 11559 }); 11560 } 11561 /** 11562 * resolve inner component definition (handle possible async component) 11563 */ 11564 _resolveDef() { 11565 if (this._pendingResolve) { 11566 return; 11567 } 11568 for (let i = 0; i < this.attributes.length; i++) { 11569 this._setAttr(this.attributes[i].name); 11570 } 11571 this._ob = new MutationObserver((mutations) => { 11572 for (const m of mutations) { 11573 this._setAttr(m.attributeName); 11574 } 11575 }); 11576 this._ob.observe(this, { attributes: true }); 11577 const resolve = (def, isAsync = false) => { 11578 this._resolved = true; 11579 this._pendingResolve = void 0; 11580 const { props, styles } = def; 11581 let numberProps; 11582 if (props && !isArray(props)) { 11583 for (const key in props) { 11584 const opt = props[key]; 11585 if (opt === Number || opt && opt.type === Number) { 11586 if (key in this._props) { 11587 this._props[key] = toNumber(this._props[key]); 11588 } 11589 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true; 11590 } 11591 } 11592 } 11593 this._numberProps = numberProps; 11594 this._resolveProps(def); 11595 if (this.shadowRoot) { 11596 this._applyStyles(styles); 11597 } else if (styles) { 11598 warn( 11599 "Custom element style injection is not supported when using shadowRoot: false" 11600 ); 11601 } 11602 this._mount(def); 11603 }; 11604 const asyncDef = this._def.__asyncLoader; 11605 if (asyncDef) { 11606 this._pendingResolve = asyncDef().then((def) => { 11607 def.configureApp = this._def.configureApp; 11608 resolve(this._def = def, true); 11609 }); 11610 } else { 11611 resolve(this._def); 11612 } 11613 } 11614 _mount(def) { 11615 if (!def.name) { 11616 def.name = "VueElement"; 11617 } 11618 this._app = this._createApp(def); 11619 this._inheritParentContext(); 11620 if (def.configureApp) { 11621 def.configureApp(this._app); 11622 } 11623 this._app._ceVNode = this._createVNode(); 11624 this._app.mount(this._root); 11625 const exposed = this._instance && this._instance.exposed; 11626 if (!exposed) return; 11627 for (const key in exposed) { 11628 if (!hasOwn(this, key)) { 11629 Object.defineProperty(this, key, { 11630 // unwrap ref to be consistent with public instance behavior 11631 get: () => unref(exposed[key]) 11632 }); 11633 } else { 11634 warn(`Exposed property "${key}" already exists on custom element.`); 11635 } 11636 } 11637 } 11638 _resolveProps(def) { 11639 const { props } = def; 11640 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {}); 11641 for (const key of Object.keys(this)) { 11642 if (key[0] !== "_" && declaredPropKeys.includes(key)) { 11643 this._setProp(key, this[key]); 11644 } 11645 } 11646 for (const key of declaredPropKeys.map(camelize)) { 11647 Object.defineProperty(this, key, { 11648 get() { 11649 return this._getProp(key); 11650 }, 11651 set(val) { 11652 this._setProp(key, val, true, true); 11653 } 11654 }); 11655 } 11656 } 11657 _setAttr(key) { 11658 if (key.startsWith("data-v-")) return; 11659 const has = this.hasAttribute(key); 11660 let value = has ? this.getAttribute(key) : REMOVAL; 11661 const camelKey = camelize(key); 11662 if (has && this._numberProps && this._numberProps[camelKey]) { 11663 value = toNumber(value); 11664 } 11665 this._setProp(camelKey, value, false, true); 11666 } 11667 /** 11668 * @internal 11669 */ 11670 _getProp(key) { 11671 return this._props[key]; 11672 } 11673 /** 11674 * @internal 11675 */ 11676 _setProp(key, val, shouldReflect = true, shouldUpdate = false) { 11677 if (val !== this._props[key]) { 11678 if (val === REMOVAL) { 11679 delete this._props[key]; 11680 } else { 11681 this._props[key] = val; 11682 if (key === "key" && this._app) { 11683 this._app._ceVNode.key = val; 11684 } 11685 } 11686 if (shouldUpdate && this._instance) { 11687 this._update(); 11688 } 11689 if (shouldReflect) { 11690 const ob = this._ob; 11691 ob && ob.disconnect(); 11692 if (val === true) { 11693 this.setAttribute(hyphenate(key), ""); 11694 } else if (typeof val === "string" || typeof val === "number") { 11695 this.setAttribute(hyphenate(key), val + ""); 11696 } else if (!val) { 11697 this.removeAttribute(hyphenate(key)); 11698 } 11699 ob && ob.observe(this, { attributes: true }); 11700 } 11701 } 11702 } 11703 _update() { 11704 const vnode = this._createVNode(); 11705 if (this._app) vnode.appContext = this._app._context; 11706 render(vnode, this._root); 11707 } 11708 _createVNode() { 11709 const baseProps = {}; 11710 if (!this.shadowRoot) { 11711 baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this); 11712 } 11713 const vnode = createVNode(this._def, extend(baseProps, this._props)); 11714 if (!this._instance) { 11715 vnode.ce = (instance) => { 11716 this._instance = instance; 11717 instance.ce = this; 11718 instance.isCE = true; 11719 { 11720 instance.ceReload = (newStyles) => { 11721 if (this._styles) { 11722 this._styles.forEach((s) => this._root.removeChild(s)); 11723 this._styles.length = 0; 11724 } 11725 this._applyStyles(newStyles); 11726 this._instance = null; 11727 this._update(); 11728 }; 11729 } 11730 const dispatch = (event, args) => { 11731 this.dispatchEvent( 11732 new CustomEvent( 11733 event, 11734 isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args } 11735 ) 11736 ); 11737 }; 11738 instance.emit = (event, ...args) => { 11739 dispatch(event, args); 11740 if (hyphenate(event) !== event) { 11741 dispatch(hyphenate(event), args); 11742 } 11743 }; 11744 this._setParent(); 11745 }; 11746 } 11747 return vnode; 11748 } 11749 _applyStyles(styles, owner) { 11750 if (!styles) return; 11751 if (owner) { 11752 if (owner === this._def || this._styleChildren.has(owner)) { 11753 return; 11754 } 11755 this._styleChildren.add(owner); 11756 } 11757 const nonce = this._nonce; 11758 for (let i = styles.length - 1; i >= 0; i--) { 11759 const s = document.createElement("style"); 11760 if (nonce) s.setAttribute("nonce", nonce); 11761 s.textContent = styles[i];
vendor: 4,252 bytes, lines 11762-11906
11762 this.shadowRoot.prepend(s); 11763 { 11764 if (owner) { 11765 if (owner.__hmrId) { 11766 if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map(); 11767 let entry = this._childStyles.get(owner.__hmrId); 11768 if (!entry) { 11769 this._childStyles.set(owner.__hmrId, entry = []); 11770 } 11771 entry.push(s); 11772 } 11773 } else { 11774 (this._styles || (this._styles = [])).push(s); 11775 } 11776 } 11777 } 11778 } 11779 /** 11780 * Only called when shadowRoot is false 11781 */ 11782 _parseSlots() { 11783 const slots = this._slots = {}; 11784 let n; 11785 while (n = this.firstChild) { 11786 const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default"; 11787 (slots[slotName] || (slots[slotName] = [])).push(n); 11788 this.removeChild(n); 11789 } 11790 } 11791 /** 11792 * Only called when shadowRoot is false 11793 */ 11794 _renderSlots() { 11795 const outlets = (this._teleportTarget || this).querySelectorAll("slot"); 11796 const scopeId = this._instance.type.__scopeId; 11797 for (let i = 0; i < outlets.length; i++) { 11798 const o = outlets[i]; 11799 const slotName = o.getAttribute("name") || "default"; 11800 const content = this._slots[slotName]; 11801 const parent = o.parentNode; 11802 if (content) { 11803 for (const n of content) { 11804 if (scopeId && n.nodeType === 1) { 11805 const id = scopeId + "-s"; 11806 const walker = document.createTreeWalker(n, 1); 11807 n.setAttribute(id, ""); 11808 let child; 11809 while (child = walker.nextNode()) { 11810 child.setAttribute(id, ""); 11811 } 11812 } 11813 parent.insertBefore(n, o); 11814 } 11815 } else { 11816 while (o.firstChild) parent.insertBefore(o.firstChild, o); 11817 } 11818 parent.removeChild(o); 11819 } 11820 } 11821 /** 11822 * @internal 11823 */ 11824 _injectChildStyle(comp) { 11825 this._applyStyles(comp.styles, comp); 11826 } 11827 /** 11828 * @internal 11829 */ 11830 _removeChildStyle(comp) { 11831 { 11832 this._styleChildren.delete(comp); 11833 if (this._childStyles && comp.__hmrId) { 11834 const oldStyles = this._childStyles.get(comp.__hmrId); 11835 if (oldStyles) { 11836 oldStyles.forEach((s) => this._root.removeChild(s)); 11837 oldStyles.length = 0; 11838 } 11839 } 11840 } 11841 } 11842 } 11843 function useHost(caller) { 11844 const instance = getCurrentInstance(); 11845 const el = instance && instance.ce; 11846 if (el) { 11847 return el; 11848 } else { 11849 if (!instance) { 11850 warn( 11851 `${caller || "useHost"} called without an active component instance.` 11852 ); 11853 } else { 11854 warn( 11855 `${caller || "useHost"} can only be used in components defined via defineCustomElement.` 11856 ); 11857 } 11858 } 11859 return null; 11860 } 11861 function useShadowRoot() { 11862 const el = useHost("useShadowRoot") ; 11863 return el && el.shadowRoot; 11864 } 11865 11866 function useCssModule(name = "$style") { 11867 { 11868 { 11869 warn(`useCssModule() is not supported in the global build.`); 11870 } 11871 return EMPTY_OBJ; 11872 } 11873 } 11874 11875 const positionMap = /* @__PURE__ */ new WeakMap(); 11876 const newPositionMap = /* @__PURE__ */ new WeakMap(); 11877 const moveCbKey = Symbol("_moveCb"); 11878 const enterCbKey = Symbol("_enterCb"); 11879 const decorate = (t) => { 11880 delete t.props.mode; 11881 return t; 11882 }; 11883 const TransitionGroupImpl = /* @__PURE__ */ decorate({ 11884 name: "TransitionGroup", 11885 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, { 11886 tag: String, 11887 moveClass: String 11888 }), 11889 setup(props, { slots }) { 11890 const instance = getCurrentInstance(); 11891 const state = useTransitionState(); 11892 let prevChildren; 11893 let children; 11894 onUpdated(() => { 11895 if (!prevChildren.length) { 11896 return; 11897 } 11898 const moveClass = props.moveClass || `${props.name || "v"}-move`; 11899 if (!hasCSSTransform( 11900 prevChildren[0].el, 11901 instance.vnode.el, 11902 moveClass 11903 )) { 11904 prevChildren = []; 11905 return; 11906 }
vendor: 7,305 bytes, lines 11907-12119
11907 prevChildren.forEach(callPendingCbs); 11908 prevChildren.forEach(recordPosition); 11909 const movedChildren = prevChildren.filter(applyTranslation); 11910 forceReflow(); 11911 movedChildren.forEach((c) => { 11912 const el = c.el; 11913 const style = el.style; 11914 addTransitionClass(el, moveClass); 11915 style.transform = style.webkitTransform = style.transitionDuration = ""; 11916 const cb = el[moveCbKey] = (e) => { 11917 if (e && e.target !== el) { 11918 return; 11919 } 11920 if (!e || e.propertyName.endsWith("transform")) { 11921 el.removeEventListener("transitionend", cb); 11922 el[moveCbKey] = null; 11923 removeTransitionClass(el, moveClass); 11924 } 11925 }; 11926 el.addEventListener("transitionend", cb); 11927 }); 11928 prevChildren = []; 11929 }); 11930 return () => { 11931 const rawProps = toRaw(props); 11932 const cssTransitionProps = resolveTransitionProps(rawProps); 11933 let tag = rawProps.tag || Fragment; 11934 prevChildren = []; 11935 if (children) { 11936 for (let i = 0; i < children.length; i++) { 11937 const child = children[i]; 11938 if (child.el && child.el instanceof Element) { 11939 prevChildren.push(child); 11940 setTransitionHooks( 11941 child, 11942 resolveTransitionHooks( 11943 child, 11944 cssTransitionProps, 11945 state, 11946 instance 11947 ) 11948 ); 11949 positionMap.set( 11950 child, 11951 child.el.getBoundingClientRect() 11952 ); 11953 } 11954 } 11955 } 11956 children = slots.default ? getTransitionRawChildren(slots.default()) : []; 11957 for (let i = 0; i < children.length; i++) { 11958 const child = children[i]; 11959 if (child.key != null) { 11960 setTransitionHooks( 11961 child, 11962 resolveTransitionHooks(child, cssTransitionProps, state, instance) 11963 ); 11964 } else if (child.type !== Text) { 11965 warn(`<TransitionGroup> children must be keyed.`); 11966 } 11967 } 11968 return createVNode(tag, null, children); 11969 }; 11970 } 11971 }); 11972 const TransitionGroup = TransitionGroupImpl; 11973 function callPendingCbs(c) { 11974 const el = c.el; 11975 if (el[moveCbKey]) { 11976 el[moveCbKey](); 11977 } 11978 if (el[enterCbKey]) { 11979 el[enterCbKey](); 11980 } 11981 } 11982 function recordPosition(c) { 11983 newPositionMap.set(c, c.el.getBoundingClientRect()); 11984 } 11985 function applyTranslation(c) { 11986 const oldPos = positionMap.get(c); 11987 const newPos = newPositionMap.get(c); 11988 const dx = oldPos.left - newPos.left; 11989 const dy = oldPos.top - newPos.top; 11990 if (dx || dy) { 11991 const s = c.el.style; 11992 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`; 11993 s.transitionDuration = "0s"; 11994 return c; 11995 } 11996 } 11997 function hasCSSTransform(el, root, moveClass) { 11998 const clone = el.cloneNode(); 11999 const _vtc = el[vtcKey]; 12000 if (_vtc) { 12001 _vtc.forEach((cls) => { 12002 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c)); 12003 }); 12004 } 12005 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c)); 12006 clone.style.display = "none"; 12007 const container = root.nodeType === 1 ? root : root.parentNode; 12008 container.appendChild(clone); 12009 const { hasTransform } = getTransitionInfo(clone); 12010 container.removeChild(clone); 12011 return hasTransform; 12012 } 12013 12014 const getModelAssigner = (vnode) => { 12015 const fn = vnode.props["onUpdate:modelValue"] || false; 12016 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn; 12017 }; 12018 function onCompositionStart(e) { 12019 e.target.composing = true; 12020 } 12021 function onCompositionEnd(e) { 12022 const target = e.target; 12023 if (target.composing) { 12024 target.composing = false; 12025 target.dispatchEvent(new Event("input")); 12026 } 12027 } 12028 const assignKey = Symbol("_assign"); 12029 const vModelText = { 12030 created(el, { modifiers: { lazy, trim, number } }, vnode) { 12031 el[assignKey] = getModelAssigner(vnode); 12032 const castToNumber = number || vnode.props && vnode.props.type === "number"; 12033 addEventListener(el, lazy ? "change" : "input", (e) => { 12034 if (e.target.composing) return; 12035 let domValue = el.value; 12036 if (trim) { 12037 domValue = domValue.trim(); 12038 } 12039 if (castToNumber) { 12040 domValue = looseToNumber(domValue); 12041 } 12042 el[assignKey](domValue); 12043 }); 12044 if (trim) { 12045 addEventListener(el, "change", () => { 12046 el.value = el.value.trim(); 12047 }); 12048 } 12049 if (!lazy) { 12050 addEventListener(el, "compositionstart", onCompositionStart); 12051 addEventListener(el, "compositionend", onCompositionEnd); 12052 addEventListener(el, "change", onCompositionEnd); 12053 } 12054 }, 12055 // set value on mounted so it's after min/max for type="range" 12056 mounted(el, { value }) { 12057 el.value = value == null ? "" : value; 12058 }, 12059 beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) { 12060 el[assignKey] = getModelAssigner(vnode); 12061 if (el.composing) return; 12062 const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value; 12063 const newValue = value == null ? "" : value; 12064 if (elValue === newValue) { 12065 return; 12066 } 12067 if (document.activeElement === el && el.type !== "range") { 12068 if (lazy && value === oldValue) { 12069 return; 12070 } 12071 if (trim && el.value.trim() === newValue) { 12072 return; 12073 } 12074 } 12075 el.value = newValue; 12076 } 12077 }; 12078 const vModelCheckbox = { 12079 // #4096 array checkboxes need to be deep traversed 12080 deep: true, 12081 created(el, _, vnode) { 12082 el[assignKey] = getModelAssigner(vnode); 12083 addEventListener(el, "change", () => { 12084 const modelValue = el._modelValue; 12085 const elementValue = getValue(el); 12086 const checked = el.checked; 12087 const assign = el[assignKey]; 12088 if (isArray(modelValue)) { 12089 const index = looseIndexOf(modelValue, elementValue); 12090 const found = index !== -1; 12091 if (checked && !found) { 12092 assign(modelValue.concat(elementValue)); 12093 } else if (!checked && found) { 12094 const filtered = [...modelValue]; 12095 filtered.splice(index, 1); 12096 assign(filtered); 12097 } 12098 } else if (isSet(modelValue)) { 12099 const cloned = new Set(modelValue); 12100 if (checked) { 12101 cloned.add(elementValue); 12102 } else { 12103 cloned.delete(elementValue); 12104 } 12105 assign(cloned); 12106 } else { 12107 assign(getCheckboxValue(el, checked)); 12108 } 12109 }); 12110 }, 12111 // set initial checked on mount to wait for true-value/false-value 12112 mounted: setChecked, 12113 beforeUpdate(el, binding, vnode) { 12114 el[assignKey] = getModelAssigner(vnode); 12115 setChecked(el, binding, vnode); 12116 } 12117 }; 12118 function setChecked(el, { value, oldValue }, vnode) { 12119 el._modelValue = value;
vendor: 11,086 bytes, lines 12120-12448
12120 let checked; 12121 if (isArray(value)) { 12122 checked = looseIndexOf(value, vnode.props.value) > -1; 12123 } else if (isSet(value)) { 12124 checked = value.has(vnode.props.value); 12125 } else { 12126 if (value === oldValue) return; 12127 checked = looseEqual(value, getCheckboxValue(el, true)); 12128 } 12129 if (el.checked !== checked) { 12130 el.checked = checked; 12131 } 12132 } 12133 const vModelRadio = { 12134 created(el, { value }, vnode) { 12135 el.checked = looseEqual(value, vnode.props.value); 12136 el[assignKey] = getModelAssigner(vnode); 12137 addEventListener(el, "change", () => { 12138 el[assignKey](getValue(el)); 12139 }); 12140 }, 12141 beforeUpdate(el, { value, oldValue }, vnode) { 12142 el[assignKey] = getModelAssigner(vnode); 12143 if (value !== oldValue) { 12144 el.checked = looseEqual(value, vnode.props.value); 12145 } 12146 } 12147 }; 12148 const vModelSelect = { 12149 // <select multiple> value need to be deep traversed 12150 deep: true, 12151 created(el, { value, modifiers: { number } }, vnode) { 12152 const isSetModel = isSet(value); 12153 addEventListener(el, "change", () => { 12154 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map( 12155 (o) => number ? looseToNumber(getValue(o)) : getValue(o) 12156 ); 12157 el[assignKey]( 12158 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0] 12159 ); 12160 el._assigning = true; 12161 nextTick(() => { 12162 el._assigning = false; 12163 }); 12164 }); 12165 el[assignKey] = getModelAssigner(vnode); 12166 }, 12167 // set value in mounted & updated because <select> relies on its children 12168 // <option>s. 12169 mounted(el, { value }) { 12170 setSelected(el, value); 12171 }, 12172 beforeUpdate(el, _binding, vnode) { 12173 el[assignKey] = getModelAssigner(vnode); 12174 }, 12175 updated(el, { value }) { 12176 if (!el._assigning) { 12177 setSelected(el, value); 12178 } 12179 } 12180 }; 12181 function setSelected(el, value) { 12182 const isMultiple = el.multiple; 12183 const isArrayValue = isArray(value); 12184 if (isMultiple && !isArrayValue && !isSet(value)) { 12185 warn( 12186 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.` 12187 ); 12188 return; 12189 } 12190 for (let i = 0, l = el.options.length; i < l; i++) { 12191 const option = el.options[i]; 12192 const optionValue = getValue(option); 12193 if (isMultiple) { 12194 if (isArrayValue) { 12195 const optionType = typeof optionValue; 12196 if (optionType === "string" || optionType === "number") { 12197 option.selected = value.some((v) => String(v) === String(optionValue)); 12198 } else { 12199 option.selected = looseIndexOf(value, optionValue) > -1; 12200 } 12201 } else { 12202 option.selected = value.has(optionValue); 12203 } 12204 } else if (looseEqual(getValue(option), value)) { 12205 if (el.selectedIndex !== i) el.selectedIndex = i; 12206 return; 12207 } 12208 } 12209 if (!isMultiple && el.selectedIndex !== -1) { 12210 el.selectedIndex = -1; 12211 } 12212 } 12213 function getValue(el) { 12214 return "_value" in el ? el._value : el.value; 12215 } 12216 function getCheckboxValue(el, checked) { 12217 const key = checked ? "_trueValue" : "_falseValue"; 12218 return key in el ? el[key] : checked; 12219 } 12220 const vModelDynamic = { 12221 created(el, binding, vnode) { 12222 callModelHook(el, binding, vnode, null, "created"); 12223 }, 12224 mounted(el, binding, vnode) { 12225 callModelHook(el, binding, vnode, null, "mounted"); 12226 }, 12227 beforeUpdate(el, binding, vnode, prevVNode) { 12228 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate"); 12229 }, 12230 updated(el, binding, vnode, prevVNode) { 12231 callModelHook(el, binding, vnode, prevVNode, "updated"); 12232 } 12233 }; 12234 function resolveDynamicModel(tagName, type) { 12235 switch (tagName) { 12236 case "SELECT": 12237 return vModelSelect; 12238 case "TEXTAREA": 12239 return vModelText; 12240 default: 12241 switch (type) { 12242 case "checkbox": 12243 return vModelCheckbox; 12244 case "radio": 12245 return vModelRadio; 12246 default: 12247 return vModelText; 12248 } 12249 } 12250 } 12251 function callModelHook(el, binding, vnode, prevVNode, hook) { 12252 const modelToUse = resolveDynamicModel( 12253 el.tagName, 12254 vnode.props && vnode.props.type 12255 ); 12256 const fn = modelToUse[hook]; 12257 fn && fn(el, binding, vnode, prevVNode); 12258 } 12259 12260 const systemModifiers = ["ctrl", "shift", "alt", "meta"]; 12261 const modifierGuards = { 12262 stop: (e) => e.stopPropagation(), 12263 prevent: (e) => e.preventDefault(), 12264 self: (e) => e.target !== e.currentTarget, 12265 ctrl: (e) => !e.ctrlKey, 12266 shift: (e) => !e.shiftKey, 12267 alt: (e) => !e.altKey, 12268 meta: (e) => !e.metaKey, 12269 left: (e) => "button" in e && e.button !== 0, 12270 middle: (e) => "button" in e && e.button !== 1, 12271 right: (e) => "button" in e && e.button !== 2, 12272 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m)) 12273 }; 12274 const withModifiers = (fn, modifiers) => { 12275 const cache = fn._withMods || (fn._withMods = {}); 12276 const cacheKey = modifiers.join("."); 12277 return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => { 12278 for (let i = 0; i < modifiers.length; i++) { 12279 const guard = modifierGuards[modifiers[i]]; 12280 if (guard && guard(event, modifiers)) return; 12281 } 12282 return fn(event, ...args); 12283 })); 12284 }; 12285 const keyNames = { 12286 esc: "escape", 12287 space: " ", 12288 up: "arrow-up", 12289 left: "arrow-left", 12290 right: "arrow-right", 12291 down: "arrow-down", 12292 delete: "backspace" 12293 }; 12294 const withKeys = (fn, modifiers) => { 12295 const cache = fn._withKeys || (fn._withKeys = {}); 12296 const cacheKey = modifiers.join("."); 12297 return cache[cacheKey] || (cache[cacheKey] = ((event) => { 12298 if (!("key" in event)) { 12299 return; 12300 } 12301 const eventKey = hyphenate(event.key); 12302 if (modifiers.some( 12303 (k) => k === eventKey || keyNames[k] === eventKey 12304 )) { 12305 return fn(event); 12306 } 12307 })); 12308 }; 12309 12310 const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps); 12311 let renderer; 12312 let enabledHydration = false; 12313 function ensureRenderer() { 12314 return renderer || (renderer = createRenderer(rendererOptions)); 12315 } 12316 function ensureHydrationRenderer() { 12317 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions); 12318 enabledHydration = true; 12319 return renderer; 12320 } 12321 const render = ((...args) => { 12322 ensureRenderer().render(...args); 12323 }); 12324 const hydrate = ((...args) => { 12325 ensureHydrationRenderer().hydrate(...args); 12326 }); 12327 const createApp = ((...args) => { 12328 const app = ensureRenderer().createApp(...args); 12329 { 12330 injectNativeTagCheck(app); 12331 injectCompilerOptionsCheck(app); 12332 } 12333 const { mount } = app; 12334 app.mount = (containerOrSelector) => { 12335 const container = normalizeContainer(containerOrSelector); 12336 if (!container) return; 12337 const component = app._component; 12338 if (!isFunction(component) && !component.render && !component.template) { 12339 component.template = container.innerHTML; 12340 } 12341 if (container.nodeType === 1) { 12342 container.textContent = ""; 12343 } 12344 const proxy = mount(container, false, resolveRootNamespace(container)); 12345 if (container instanceof Element) { 12346 container.removeAttribute("v-cloak"); 12347 container.setAttribute("data-v-app", ""); 12348 } 12349 return proxy; 12350 }; 12351 return app; 12352 }); 12353 const createSSRApp = ((...args) => { 12354 const app = ensureHydrationRenderer().createApp(...args); 12355 { 12356 injectNativeTagCheck(app); 12357 injectCompilerOptionsCheck(app); 12358 } 12359 const { mount } = app; 12360 app.mount = (containerOrSelector) => { 12361 const container = normalizeContainer(containerOrSelector); 12362 if (container) { 12363 return mount(container, true, resolveRootNamespace(container)); 12364 } 12365 }; 12366 return app; 12367 }); 12368 function resolveRootNamespace(container) { 12369 if (container instanceof SVGElement) { 12370 return "svg"; 12371 } 12372 if (typeof MathMLElement === "function" && container instanceof MathMLElement) { 12373 return "mathml"; 12374 } 12375 } 12376 function injectNativeTagCheck(app) { 12377 Object.defineProperty(app.config, "isNativeTag", { 12378 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 12379 writable: false 12380 }); 12381 } 12382 function injectCompilerOptionsCheck(app) { 12383 if (isRuntimeOnly()) { 12384 const isCustomElement = app.config.isCustomElement; 12385 Object.defineProperty(app.config, "isCustomElement", { 12386 get() { 12387 return isCustomElement; 12388 }, 12389 set() { 12390 warn( 12391 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.` 12392 ); 12393 } 12394 }); 12395 const compilerOptions = app.config.compilerOptions; 12396 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. 12397- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option. 12398- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader 12399- 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`; 12400 Object.defineProperty(app.config, "compilerOptions", { 12401 get() { 12402 warn(msg); 12403 return compilerOptions; 12404 }, 12405 set() { 12406 warn(msg); 12407 } 12408 }); 12409 } 12410 } 12411 function normalizeContainer(container) { 12412 if (isString(container)) { 12413 const res = document.querySelector(container); 12414 if (!res) { 12415 warn( 12416 `Failed to mount app: mount target selector "${container}" returned null.` 12417 ); 12418 } 12419 return res; 12420 } 12421 if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") { 12422 warn( 12423 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs` 12424 ); 12425 } 12426 return container; 12427 } 12428 const initDirectivesForSSR = NOOP; 12429 12430 function initDev() { 12431 { 12432 { 12433 console.info( 12434 `You are running a development build of Vue. 12435Make sure to use the production build (*.prod.js) when deploying for production.` 12436 ); 12437 } 12438 initCustomFormatter(); 12439 } 12440 } 12441 12442 const FRAGMENT = Symbol(`Fragment` ); 12443 const TELEPORT = Symbol(`Teleport` ); 12444 const SUSPENSE = Symbol(`Suspense` ); 12445 const KEEP_ALIVE = Symbol(`KeepAlive` ); 12446 const BASE_TRANSITION = Symbol( 12447 `BaseTransition` 12448 );
12449 const OPEN_BLOCK = Symbol(`openBlock` ); 12450 const CREATE_BLOCK = Symbol(`createBlock` ); 12451 const CREATE_ELEMENT_BLOCK = Symbol( 12452 `createElementBlock` 12453 ); 12454 const CREATE_VNODE = Symbol(`createVNode` ); 12455 const CREATE_ELEMENT_VNODE = Symbol( 12456 `createElementVNode` 12457 ); 12458 const CREATE_COMMENT = Symbol( 12459 `createCommentVNode` 12460 ); 12461 const CREATE_TEXT = Symbol( 12462 `createTextVNode` 12463 ); 12464 const CREATE_STATIC = Symbol( 12465 `createStaticVNode` 12466 ); 12467 const RESOLVE_COMPONENT = Symbol( 12468 `resolveComponent` 12469 ); 12470 const RESOLVE_DYNAMIC_COMPONENT = Symbol( 12471 `resolveDynamicComponent` 12472 ); 12473 const RESOLVE_DIRECTIVE = Symbol( 12474 `resolveDirective` 12475 ); 12476 const RESOLVE_FILTER = Symbol( 12477 `resolveFilter` 12478 ); 12479 const WITH_DIRECTIVES = Symbol( 12480 `withDirectives` 12481 ); 12482 const RENDER_LIST = Symbol(`renderList` ); 12483 const RENDER_SLOT = Symbol(`renderSlot` ); 12484 const CREATE_SLOTS = Symbol(`createSlots` ); 12485 const TO_DISPLAY_STRING = Symbol( 12486 `toDisplayString` 12487 ); 12488 const MERGE_PROPS = Symbol(`mergeProps` ); 12489 const NORMALIZE_CLASS = Symbol( 12490 `normalizeClass` 12491 );
vendor: 39,615 bytes, lines 12492-13731
12492 const NORMALIZE_STYLE = Symbol( 12493 `normalizeStyle` 12494 ); 12495 const NORMALIZE_PROPS = Symbol( 12496 `normalizeProps` 12497 ); 12498 const GUARD_REACTIVE_PROPS = Symbol( 12499 `guardReactiveProps` 12500 ); 12501 const TO_HANDLERS = Symbol(`toHandlers` ); 12502 const CAMELIZE = Symbol(`camelize` ); 12503 const CAPITALIZE = Symbol(`capitalize` ); 12504 const TO_HANDLER_KEY = Symbol( 12505 `toHandlerKey` 12506 ); 12507 const SET_BLOCK_TRACKING = Symbol( 12508 `setBlockTracking` 12509 ); 12510 const PUSH_SCOPE_ID = Symbol(`pushScopeId` ); 12511 const POP_SCOPE_ID = Symbol(`popScopeId` ); 12512 const WITH_CTX = Symbol(`withCtx` ); 12513 const UNREF = Symbol(`unref` ); 12514 const IS_REF = Symbol(`isRef` ); 12515 const WITH_MEMO = Symbol(`withMemo` ); 12516 const IS_MEMO_SAME = Symbol(`isMemoSame` ); 12517 const helperNameMap = { 12518 [FRAGMENT]: `Fragment`, 12519 [TELEPORT]: `Teleport`, 12520 [SUSPENSE]: `Suspense`, 12521 [KEEP_ALIVE]: `KeepAlive`, 12522 [BASE_TRANSITION]: `BaseTransition`, 12523 [OPEN_BLOCK]: `openBlock`, 12524 [CREATE_BLOCK]: `createBlock`, 12525 [CREATE_ELEMENT_BLOCK]: `createElementBlock`, 12526 [CREATE_VNODE]: `createVNode`, 12527 [CREATE_ELEMENT_VNODE]: `createElementVNode`, 12528 [CREATE_COMMENT]: `createCommentVNode`, 12529 [CREATE_TEXT]: `createTextVNode`, 12530 [CREATE_STATIC]: `createStaticVNode`, 12531 [RESOLVE_COMPONENT]: `resolveComponent`, 12532 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`, 12533 [RESOLVE_DIRECTIVE]: `resolveDirective`, 12534 [RESOLVE_FILTER]: `resolveFilter`, 12535 [WITH_DIRECTIVES]: `withDirectives`, 12536 [RENDER_LIST]: `renderList`, 12537 [RENDER_SLOT]: `renderSlot`, 12538 [CREATE_SLOTS]: `createSlots`, 12539 [TO_DISPLAY_STRING]: `toDisplayString`, 12540 [MERGE_PROPS]: `mergeProps`, 12541 [NORMALIZE_CLASS]: `normalizeClass`, 12542 [NORMALIZE_STYLE]: `normalizeStyle`, 12543 [NORMALIZE_PROPS]: `normalizeProps`, 12544 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`, 12545 [TO_HANDLERS]: `toHandlers`, 12546 [CAMELIZE]: `camelize`, 12547 [CAPITALIZE]: `capitalize`, 12548 [TO_HANDLER_KEY]: `toHandlerKey`, 12549 [SET_BLOCK_TRACKING]: `setBlockTracking`, 12550 [PUSH_SCOPE_ID]: `pushScopeId`, 12551 [POP_SCOPE_ID]: `popScopeId`, 12552 [WITH_CTX]: `withCtx`, 12553 [UNREF]: `unref`, 12554 [IS_REF]: `isRef`, 12555 [WITH_MEMO]: `withMemo`, 12556 [IS_MEMO_SAME]: `isMemoSame` 12557 }; 12558 function registerRuntimeHelpers(helpers) { 12559 Object.getOwnPropertySymbols(helpers).forEach((s) => { 12560 helperNameMap[s] = helpers[s]; 12561 }); 12562 } 12563 12564 const locStub = { 12565 start: { line: 1, column: 1, offset: 0 }, 12566 end: { line: 1, column: 1, offset: 0 }, 12567 source: "" 12568 }; 12569 function createRoot(children, source = "") { 12570 return { 12571 type: 0, 12572 source, 12573 children, 12574 helpers: /* @__PURE__ */ new Set(), 12575 components: [], 12576 directives: [], 12577 hoists: [], 12578 imports: [], 12579 cached: [], 12580 temps: 0, 12581 codegenNode: void 0, 12582 loc: locStub 12583 }; 12584 } 12585 function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) { 12586 if (context) { 12587 if (isBlock) { 12588 context.helper(OPEN_BLOCK); 12589 context.helper(getVNodeBlockHelper(context.inSSR, isComponent)); 12590 } else { 12591 context.helper(getVNodeHelper(context.inSSR, isComponent)); 12592 } 12593 if (directives) { 12594 context.helper(WITH_DIRECTIVES); 12595 } 12596 } 12597 return { 12598 type: 13, 12599 tag, 12600 props, 12601 children, 12602 patchFlag, 12603 dynamicProps, 12604 directives, 12605 isBlock, 12606 disableTracking, 12607 isComponent, 12608 loc 12609 }; 12610 } 12611 function createArrayExpression(elements, loc = locStub) { 12612 return { 12613 type: 17, 12614 loc, 12615 elements 12616 }; 12617 } 12618 function createObjectExpression(properties, loc = locStub) { 12619 return { 12620 type: 15, 12621 loc, 12622 properties 12623 }; 12624 } 12625 function createObjectProperty(key, value) { 12626 return { 12627 type: 16, 12628 loc: locStub, 12629 key: isString(key) ? createSimpleExpression(key, true) : key, 12630 value 12631 }; 12632 } 12633 function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) { 12634 return { 12635 type: 4, 12636 loc, 12637 content, 12638 isStatic, 12639 constType: isStatic ? 3 : constType 12640 }; 12641 } 12642 function createCompoundExpression(children, loc = locStub) { 12643 return { 12644 type: 8, 12645 loc, 12646 children 12647 }; 12648 } 12649 function createCallExpression(callee, args = [], loc = locStub) { 12650 return { 12651 type: 14, 12652 loc, 12653 callee, 12654 arguments: args 12655 }; 12656 } 12657 function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) { 12658 return { 12659 type: 18, 12660 params, 12661 returns, 12662 newline, 12663 isSlot, 12664 loc 12665 }; 12666 } 12667 function createConditionalExpression(test, consequent, alternate, newline = true) { 12668 return { 12669 type: 19, 12670 test, 12671 consequent, 12672 alternate, 12673 newline, 12674 loc: locStub 12675 }; 12676 } 12677 function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) { 12678 return { 12679 type: 20, 12680 index, 12681 value, 12682 needPauseTracking, 12683 inVOnce, 12684 needArraySpread: false, 12685 loc: locStub 12686 }; 12687 } 12688 function createBlockStatement(body) { 12689 return { 12690 type: 21, 12691 body, 12692 loc: locStub 12693 }; 12694 } 12695 function getVNodeHelper(ssr, isComponent) { 12696 return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE; 12697 } 12698 function getVNodeBlockHelper(ssr, isComponent) { 12699 return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK; 12700 } 12701 function convertToBlock(node, { helper, removeHelper, inSSR }) { 12702 if (!node.isBlock) { 12703 node.isBlock = true; 12704 removeHelper(getVNodeHelper(inSSR, node.isComponent)); 12705 helper(OPEN_BLOCK); 12706 helper(getVNodeBlockHelper(inSSR, node.isComponent)); 12707 } 12708 } 12709 12710 const defaultDelimitersOpen = new Uint8Array([123, 123]); 12711 const defaultDelimitersClose = new Uint8Array([125, 125]); 12712 function isTagStartChar(c) { 12713 return c >= 97 && c <= 122 || c >= 65 && c <= 90; 12714 } 12715 function isWhitespace(c) { 12716 return c === 32 || c === 10 || c === 9 || c === 12 || c === 13; 12717 } 12718 function isEndOfTagSection(c) { 12719 return c === 47 || c === 62 || isWhitespace(c); 12720 } 12721 function toCharCodes(str) { 12722 const ret = new Uint8Array(str.length); 12723 for (let i = 0; i < str.length; i++) { 12724 ret[i] = str.charCodeAt(i); 12725 } 12726 return ret; 12727 } 12728 const Sequences = { 12729 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]), 12730 // CDATA[ 12731 CdataEnd: new Uint8Array([93, 93, 62]), 12732 // ]]> 12733 CommentEnd: new Uint8Array([45, 45, 62]), 12734 // `-->` 12735 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]), 12736 // `<\/script` 12737 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]), 12738 // `</style` 12739 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]), 12740 // `</title` 12741 TextareaEnd: new Uint8Array([ 12742 60, 12743 47, 12744 116, 12745 101, 12746 120, 12747 116, 12748 97, 12749 114, 12750 101, 12751 97 12752 ]) 12753 // `</textarea 12754 }; 12755 class Tokenizer { 12756 constructor(stack, cbs) { 12757 this.stack = stack; 12758 this.cbs = cbs; 12759 /** The current state the tokenizer is in. */ 12760 this.state = 1; 12761 /** The read buffer. */ 12762 this.buffer = ""; 12763 /** The beginning of the section that is currently being read. */ 12764 this.sectionStart = 0; 12765 /** The index within the buffer that we are currently looking at. */ 12766 this.index = 0; 12767 /** The start of the last entity. */ 12768 this.entityStart = 0; 12769 /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */ 12770 this.baseState = 1; 12771 /** For special parsing behavior inside of script and style tags. */ 12772 this.inRCDATA = false; 12773 /** For disabling RCDATA tags handling */ 12774 this.inXML = false; 12775 /** For disabling interpolation parsing in v-pre */ 12776 this.inVPre = false; 12777 /** Record newline positions for fast line / column calculation */ 12778 this.newlines = []; 12779 this.mode = 0; 12780 this.delimiterOpen = defaultDelimitersOpen; 12781 this.delimiterClose = defaultDelimitersClose; 12782 this.delimiterIndex = -1; 12783 this.currentSequence = void 0; 12784 this.sequenceIndex = 0; 12785 } 12786 get inSFCRoot() { 12787 return this.mode === 2 && this.stack.length === 0; 12788 } 12789 reset() { 12790 this.state = 1; 12791 this.mode = 0; 12792 this.buffer = ""; 12793 this.sectionStart = 0; 12794 this.index = 0; 12795 this.baseState = 1; 12796 this.inRCDATA = false; 12797 this.currentSequence = void 0; 12798 this.newlines.length = 0; 12799 this.delimiterOpen = defaultDelimitersOpen; 12800 this.delimiterClose = defaultDelimitersClose; 12801 } 12802 /** 12803 * Generate Position object with line / column information using recorded 12804 * newline positions. We know the index is always going to be an already 12805 * processed index, so all the newlines up to this index should have been 12806 * recorded. 12807 */ 12808 getPos(index) { 12809 let line = 1; 12810 let column = index + 1; 12811 for (let i = this.newlines.length - 1; i >= 0; i--) { 12812 const newlineIndex = this.newlines[i]; 12813 if (index > newlineIndex) { 12814 line = i + 2; 12815 column = index - newlineIndex; 12816 break; 12817 } 12818 } 12819 return { 12820 column, 12821 line, 12822 offset: index 12823 }; 12824 } 12825 peek() { 12826 return this.buffer.charCodeAt(this.index + 1); 12827 } 12828 stateText(c) { 12829 if (c === 60) { 12830 if (this.index > this.sectionStart) { 12831 this.cbs.ontext(this.sectionStart, this.index); 12832 } 12833 this.state = 5; 12834 this.sectionStart = this.index; 12835 } else if (!this.inVPre && c === this.delimiterOpen[0]) { 12836 this.state = 2; 12837 this.delimiterIndex = 0; 12838 this.stateInterpolationOpen(c); 12839 } 12840 } 12841 stateInterpolationOpen(c) { 12842 if (c === this.delimiterOpen[this.delimiterIndex]) { 12843 if (this.delimiterIndex === this.delimiterOpen.length - 1) { 12844 const start = this.index + 1 - this.delimiterOpen.length; 12845 if (start > this.sectionStart) { 12846 this.cbs.ontext(this.sectionStart, start); 12847 } 12848 this.state = 3; 12849 this.sectionStart = start; 12850 } else { 12851 this.delimiterIndex++; 12852 } 12853 } else if (this.inRCDATA) { 12854 this.state = 32; 12855 this.stateInRCDATA(c); 12856 } else { 12857 this.state = 1; 12858 this.stateText(c); 12859 } 12860 } 12861 stateInterpolation(c) { 12862 if (c === this.delimiterClose[0]) { 12863 this.state = 4; 12864 this.delimiterIndex = 0; 12865 this.stateInterpolationClose(c); 12866 } 12867 } 12868 stateInterpolationClose(c) { 12869 if (c === this.delimiterClose[this.delimiterIndex]) { 12870 if (this.delimiterIndex === this.delimiterClose.length - 1) { 12871 this.cbs.oninterpolation(this.sectionStart, this.index + 1); 12872 if (this.inRCDATA) { 12873 this.state = 32; 12874 } else { 12875 this.state = 1; 12876 } 12877 this.sectionStart = this.index + 1; 12878 } else { 12879 this.delimiterIndex++; 12880 } 12881 } else { 12882 this.state = 3; 12883 this.stateInterpolation(c); 12884 } 12885 } 12886 stateSpecialStartSequence(c) { 12887 const isEnd = this.sequenceIndex === this.currentSequence.length; 12888 const isMatch = isEnd ? ( 12889 // If we are at the end of the sequence, make sure the tag name has ended 12890 isEndOfTagSection(c) 12891 ) : ( 12892 // Otherwise, do a case-insensitive comparison 12893 (c | 32) === this.currentSequence[this.sequenceIndex] 12894 ); 12895 if (!isMatch) { 12896 this.inRCDATA = false; 12897 } else if (!isEnd) { 12898 this.sequenceIndex++; 12899 return; 12900 } 12901 this.sequenceIndex = 0; 12902 this.state = 6; 12903 this.stateInTagName(c); 12904 } 12905 /** Look for an end tag. For <title> and <textarea>, also decode entities. */ 12906 stateInRCDATA(c) { 12907 if (this.sequenceIndex === this.currentSequence.length) { 12908 if (c === 62 || isWhitespace(c)) { 12909 const endOfText = this.index - this.currentSequence.length; 12910 if (this.sectionStart < endOfText) { 12911 const actualIndex = this.index; 12912 this.index = endOfText; 12913 this.cbs.ontext(this.sectionStart, endOfText); 12914 this.index = actualIndex; 12915 } 12916 this.sectionStart = endOfText + 2; 12917 this.stateInClosingTagName(c); 12918 this.inRCDATA = false; 12919 return; 12920 } 12921 this.sequenceIndex = 0; 12922 } 12923 if ((c | 32) === this.currentSequence[this.sequenceIndex]) { 12924 this.sequenceIndex += 1; 12925 } else if (this.sequenceIndex === 0) { 12926 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) { 12927 if (!this.inVPre && c === this.delimiterOpen[0]) { 12928 this.state = 2; 12929 this.delimiterIndex = 0; 12930 this.stateInterpolationOpen(c); 12931 } 12932 } else if (this.fastForwardTo(60)) { 12933 this.sequenceIndex = 1; 12934 } 12935 } else { 12936 this.sequenceIndex = Number(c === 60); 12937 } 12938 } 12939 stateCDATASequence(c) { 12940 if (c === Sequences.Cdata[this.sequenceIndex]) { 12941 if (++this.sequenceIndex === Sequences.Cdata.length) { 12942 this.state = 28; 12943 this.currentSequence = Sequences.CdataEnd; 12944 this.sequenceIndex = 0; 12945 this.sectionStart = this.index + 1; 12946 } 12947 } else { 12948 this.sequenceIndex = 0; 12949 this.state = 23; 12950 this.stateInDeclaration(c); 12951 } 12952 } 12953 /** 12954 * When we wait for one specific character, we can speed things up 12955 * by skipping through the buffer until we find it. 12956 * 12957 * @returns Whether the character was found. 12958 */ 12959 fastForwardTo(c) { 12960 while (++this.index < this.buffer.length) { 12961 const cc = this.buffer.charCodeAt(this.index); 12962 if (cc === 10) { 12963 this.newlines.push(this.index); 12964 } 12965 if (cc === c) { 12966 return true; 12967 } 12968 } 12969 this.index = this.buffer.length - 1; 12970 return false; 12971 } 12972 /** 12973 * Comments and CDATA end with `-->` and `]]>`. 12974 * 12975 * Their common qualities are: 12976 * - Their end sequences have a distinct character they start with. 12977 * - That character is then repeated, so we have to check multiple repeats. 12978 * - All characters but the start character of the sequence can be skipped. 12979 */ 12980 stateInCommentLike(c) { 12981 if (c === this.currentSequence[this.sequenceIndex]) { 12982 if (++this.sequenceIndex === this.currentSequence.length) { 12983 if (this.currentSequence === Sequences.CdataEnd) { 12984 this.cbs.oncdata(this.sectionStart, this.index - 2); 12985 } else { 12986 this.cbs.oncomment(this.sectionStart, this.index - 2); 12987 } 12988 this.sequenceIndex = 0; 12989 this.sectionStart = this.index + 1; 12990 this.state = 1; 12991 } 12992 } else if (this.sequenceIndex === 0) { 12993 if (this.fastForwardTo(this.currentSequence[0])) { 12994 this.sequenceIndex = 1; 12995 } 12996 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) { 12997 this.sequenceIndex = 0; 12998 } 12999 } 13000 startSpecial(sequence, offset) { 13001 this.enterRCDATA(sequence, offset); 13002 this.state = 31; 13003 } 13004 enterRCDATA(sequence, offset) { 13005 this.inRCDATA = true; 13006 this.currentSequence = sequence; 13007 this.sequenceIndex = offset; 13008 } 13009 stateBeforeTagName(c) { 13010 if (c === 33) { 13011 this.state = 22; 13012 this.sectionStart = this.index + 1; 13013 } else if (c === 63) { 13014 this.state = 24; 13015 this.sectionStart = this.index + 1; 13016 } else if (isTagStartChar(c)) { 13017 this.sectionStart = this.index; 13018 if (this.mode === 0) { 13019 this.state = 6; 13020 } else if (this.inSFCRoot) { 13021 this.state = 34; 13022 } else if (!this.inXML) { 13023 if (c === 116) { 13024 this.state = 30; 13025 } else { 13026 this.state = c === 115 ? 29 : 6; 13027 } 13028 } else { 13029 this.state = 6; 13030 } 13031 } else if (c === 47) { 13032 this.state = 8; 13033 } else { 13034 this.state = 1; 13035 this.stateText(c); 13036 } 13037 } 13038 stateInTagName(c) { 13039 if (isEndOfTagSection(c)) { 13040 this.handleTagName(c); 13041 } 13042 } 13043 stateInSFCRootTagName(c) { 13044 if (isEndOfTagSection(c)) { 13045 const tag = this.buffer.slice(this.sectionStart, this.index); 13046 if (tag !== "template") { 13047 this.enterRCDATA(toCharCodes(`</` + tag), 0); 13048 } 13049 this.handleTagName(c); 13050 } 13051 } 13052 handleTagName(c) { 13053 this.cbs.onopentagname(this.sectionStart, this.index); 13054 this.sectionStart = -1; 13055 this.state = 11; 13056 this.stateBeforeAttrName(c); 13057 } 13058 stateBeforeClosingTagName(c) { 13059 if (isWhitespace(c)) ; else if (c === 62) { 13060 { 13061 this.cbs.onerr(14, this.index); 13062 } 13063 this.state = 1; 13064 this.sectionStart = this.index + 1; 13065 } else { 13066 this.state = isTagStartChar(c) ? 9 : 27; 13067 this.sectionStart = this.index; 13068 } 13069 } 13070 stateInClosingTagName(c) { 13071 if (c === 62 || isWhitespace(c)) { 13072 this.cbs.onclosetag(this.sectionStart, this.index); 13073 this.sectionStart = -1; 13074 this.state = 10; 13075 this.stateAfterClosingTagName(c); 13076 } 13077 } 13078 stateAfterClosingTagName(c) { 13079 if (c === 62) { 13080 this.state = 1; 13081 this.sectionStart = this.index + 1; 13082 } 13083 } 13084 stateBeforeAttrName(c) { 13085 if (c === 62) { 13086 this.cbs.onopentagend(this.index); 13087 if (this.inRCDATA) { 13088 this.state = 32; 13089 } else { 13090 this.state = 1; 13091 } 13092 this.sectionStart = this.index + 1; 13093 } else if (c === 47) { 13094 this.state = 7; 13095 if (this.peek() !== 62) { 13096 this.cbs.onerr(22, this.index); 13097 } 13098 } else if (c === 60 && this.peek() === 47) { 13099 this.cbs.onopentagend(this.index); 13100 this.state = 5; 13101 this.sectionStart = this.index; 13102 } else if (!isWhitespace(c)) { 13103 if (c === 61) { 13104 this.cbs.onerr( 13105 19, 13106 this.index 13107 ); 13108 } 13109 this.handleAttrStart(c); 13110 } 13111 } 13112 handleAttrStart(c) { 13113 if (c === 118 && this.peek() === 45) { 13114 this.state = 13; 13115 this.sectionStart = this.index; 13116 } else if (c === 46 || c === 58 || c === 64 || c === 35) { 13117 this.cbs.ondirname(this.index, this.index + 1); 13118 this.state = 14; 13119 this.sectionStart = this.index + 1; 13120 } else { 13121 this.state = 12; 13122 this.sectionStart = this.index; 13123 } 13124 } 13125 stateInSelfClosingTag(c) { 13126 if (c === 62) { 13127 this.cbs.onselfclosingtag(this.index); 13128 this.state = 1; 13129 this.sectionStart = this.index + 1; 13130 this.inRCDATA = false; 13131 } else if (!isWhitespace(c)) { 13132 this.state = 11; 13133 this.stateBeforeAttrName(c); 13134 } 13135 } 13136 stateInAttrName(c) { 13137 if (c === 61 || isEndOfTagSection(c)) { 13138 this.cbs.onattribname(this.sectionStart, this.index); 13139 this.handleAttrNameEnd(c); 13140 } else if (c === 34 || c === 39 || c === 60) { 13141 this.cbs.onerr( 13142 17, 13143 this.index 13144 ); 13145 } 13146 } 13147 stateInDirName(c) { 13148 if (c === 61 || isEndOfTagSection(c)) { 13149 this.cbs.ondirname(this.sectionStart, this.index); 13150 this.handleAttrNameEnd(c); 13151 } else if (c === 58) { 13152 this.cbs.ondirname(this.sectionStart, this.index); 13153 this.state = 14; 13154 this.sectionStart = this.index + 1; 13155 } else if (c === 46) { 13156 this.cbs.ondirname(this.sectionStart, this.index); 13157 this.state = 16; 13158 this.sectionStart = this.index + 1; 13159 } 13160 } 13161 stateInDirArg(c) { 13162 if (c === 61 || isEndOfTagSection(c)) { 13163 this.cbs.ondirarg(this.sectionStart, this.index); 13164 this.handleAttrNameEnd(c); 13165 } else if (c === 91) { 13166 this.state = 15; 13167 } else if (c === 46) { 13168 this.cbs.ondirarg(this.sectionStart, this.index); 13169 this.state = 16; 13170 this.sectionStart = this.index + 1; 13171 } 13172 } 13173 stateInDynamicDirArg(c) { 13174 if (c === 93) { 13175 this.state = 14; 13176 } else if (c === 61 || isEndOfTagSection(c)) { 13177 this.cbs.ondirarg(this.sectionStart, this.index + 1); 13178 this.handleAttrNameEnd(c); 13179 { 13180 this.cbs.onerr( 13181 27, 13182 this.index 13183 ); 13184 } 13185 } 13186 } 13187 stateInDirModifier(c) { 13188 if (c === 61 || isEndOfTagSection(c)) { 13189 this.cbs.ondirmodifier(this.sectionStart, this.index); 13190 this.handleAttrNameEnd(c); 13191 } else if (c === 46) { 13192 this.cbs.ondirmodifier(this.sectionStart, this.index); 13193 this.sectionStart = this.index + 1; 13194 } 13195 } 13196 handleAttrNameEnd(c) { 13197 this.sectionStart = this.index; 13198 this.state = 17; 13199 this.cbs.onattribnameend(this.index); 13200 this.stateAfterAttrName(c); 13201 } 13202 stateAfterAttrName(c) { 13203 if (c === 61) { 13204 this.state = 18; 13205 } else if (c === 47 || c === 62) { 13206 this.cbs.onattribend(0, this.sectionStart); 13207 this.sectionStart = -1; 13208 this.state = 11; 13209 this.stateBeforeAttrName(c); 13210 } else if (!isWhitespace(c)) { 13211 this.cbs.onattribend(0, this.sectionStart); 13212 this.handleAttrStart(c); 13213 } 13214 } 13215 stateBeforeAttrValue(c) { 13216 if (c === 34) { 13217 this.state = 19; 13218 this.sectionStart = this.index + 1; 13219 } else if (c === 39) { 13220 this.state = 20; 13221 this.sectionStart = this.index + 1; 13222 } else if (!isWhitespace(c)) { 13223 this.sectionStart = this.index; 13224 this.state = 21; 13225 this.stateInAttrValueNoQuotes(c); 13226 } 13227 } 13228 handleInAttrValue(c, quote) { 13229 if (c === quote || this.fastForwardTo(quote)) { 13230 this.cbs.onattribdata(this.sectionStart, this.index); 13231 this.sectionStart = -1; 13232 this.cbs.onattribend( 13233 quote === 34 ? 3 : 2, 13234 this.index + 1 13235 ); 13236 this.state = 11; 13237 } 13238 } 13239 stateInAttrValueDoubleQuotes(c) { 13240 this.handleInAttrValue(c, 34); 13241 } 13242 stateInAttrValueSingleQuotes(c) { 13243 this.handleInAttrValue(c, 39); 13244 } 13245 stateInAttrValueNoQuotes(c) { 13246 if (isWhitespace(c) || c === 62) { 13247 this.cbs.onattribdata(this.sectionStart, this.index); 13248 this.sectionStart = -1; 13249 this.cbs.onattribend(1, this.index); 13250 this.state = 11; 13251 this.stateBeforeAttrName(c); 13252 } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) { 13253 this.cbs.onerr( 13254 18, 13255 this.index 13256 ); 13257 } else ; 13258 } 13259 stateBeforeDeclaration(c) { 13260 if (c === 91) { 13261 this.state = 26; 13262 this.sequenceIndex = 0; 13263 } else { 13264 this.state = c === 45 ? 25 : 23; 13265 } 13266 } 13267 stateInDeclaration(c) { 13268 if (c === 62 || this.fastForwardTo(62)) { 13269 this.state = 1; 13270 this.sectionStart = this.index + 1; 13271 } 13272 } 13273 stateInProcessingInstruction(c) { 13274 if (c === 62 || this.fastForwardTo(62)) { 13275 this.cbs.onprocessinginstruction(this.sectionStart, this.index); 13276 this.state = 1; 13277 this.sectionStart = this.index + 1; 13278 } 13279 } 13280 stateBeforeComment(c) { 13281 if (c === 45) { 13282 this.state = 28; 13283 this.currentSequence = Sequences.CommentEnd; 13284 this.sequenceIndex = 2; 13285 this.sectionStart = this.index + 1; 13286 } else { 13287 this.state = 23; 13288 } 13289 } 13290 stateInSpecialComment(c) { 13291 if (c === 62 || this.fastForwardTo(62)) { 13292 this.cbs.oncomment(this.sectionStart, this.index); 13293 this.state = 1; 13294 this.sectionStart = this.index + 1; 13295 } 13296 } 13297 stateBeforeSpecialS(c) { 13298 if (c === Sequences.ScriptEnd[3]) { 13299 this.startSpecial(Sequences.ScriptEnd, 4); 13300 } else if (c === Sequences.StyleEnd[3]) { 13301 this.startSpecial(Sequences.StyleEnd, 4); 13302 } else { 13303 this.state = 6; 13304 this.stateInTagName(c); 13305 } 13306 } 13307 stateBeforeSpecialT(c) { 13308 if (c === Sequences.TitleEnd[3]) { 13309 this.startSpecial(Sequences.TitleEnd, 4); 13310 } else if (c === Sequences.TextareaEnd[3]) { 13311 this.startSpecial(Sequences.TextareaEnd, 4); 13312 } else { 13313 this.state = 6; 13314 this.stateInTagName(c); 13315 } 13316 } 13317 startEntity() { 13318 } 13319 stateInEntity() { 13320 } 13321 /** 13322 * Iterates through the buffer, calling the function corresponding to the current state. 13323 * 13324 * States that are more likely to be hit are higher up, as a performance improvement. 13325 */ 13326 parse(input) { 13327 this.buffer = input; 13328 while (this.index < this.buffer.length) { 13329 const c = this.buffer.charCodeAt(this.index); 13330 if (c === 10 && this.state !== 33) { 13331 this.newlines.push(this.index); 13332 } 13333 switch (this.state) { 13334 case 1: { 13335 this.stateText(c); 13336 break; 13337 } 13338 case 2: { 13339 this.stateInterpolationOpen(c); 13340 break; 13341 } 13342 case 3: { 13343 this.stateInterpolation(c); 13344 break; 13345 } 13346 case 4: { 13347 this.stateInterpolationClose(c); 13348 break; 13349 } 13350 case 31: { 13351 this.stateSpecialStartSequence(c); 13352 break; 13353 } 13354 case 32: { 13355 this.stateInRCDATA(c); 13356 break; 13357 } 13358 case 26: { 13359 this.stateCDATASequence(c); 13360 break; 13361 } 13362 case 19: { 13363 this.stateInAttrValueDoubleQuotes(c); 13364 break; 13365 } 13366 case 12: { 13367 this.stateInAttrName(c); 13368 break; 13369 } 13370 case 13: { 13371 this.stateInDirName(c); 13372 break; 13373 } 13374 case 14: { 13375 this.stateInDirArg(c); 13376 break; 13377 } 13378 case 15: { 13379 this.stateInDynamicDirArg(c); 13380 break; 13381 } 13382 case 16: { 13383 this.stateInDirModifier(c); 13384 break; 13385 } 13386 case 28: { 13387 this.stateInCommentLike(c); 13388 break; 13389 } 13390 case 27: { 13391 this.stateInSpecialComment(c); 13392 break; 13393 } 13394 case 11: { 13395 this.stateBeforeAttrName(c); 13396 break; 13397 } 13398 case 6: { 13399 this.stateInTagName(c); 13400 break; 13401 } 13402 case 34: { 13403 this.stateInSFCRootTagName(c); 13404 break; 13405 } 13406 case 9: { 13407 this.stateInClosingTagName(c); 13408 break; 13409 } 13410 case 5: { 13411 this.stateBeforeTagName(c); 13412 break; 13413 } 13414 case 17: { 13415 this.stateAfterAttrName(c); 13416 break; 13417 } 13418 case 20: { 13419 this.stateInAttrValueSingleQuotes(c); 13420 break; 13421 } 13422 case 18: { 13423 this.stateBeforeAttrValue(c); 13424 break; 13425 } 13426 case 8: { 13427 this.stateBeforeClosingTagName(c); 13428 break; 13429 } 13430 case 10: { 13431 this.stateAfterClosingTagName(c); 13432 break; 13433 } 13434 case 29: { 13435 this.stateBeforeSpecialS(c); 13436 break; 13437 } 13438 case 30: { 13439 this.stateBeforeSpecialT(c); 13440 break; 13441 } 13442 case 21: { 13443 this.stateInAttrValueNoQuotes(c); 13444 break; 13445 } 13446 case 7: { 13447 this.stateInSelfClosingTag(c); 13448 break; 13449 } 13450 case 23: { 13451 this.stateInDeclaration(c); 13452 break; 13453 } 13454 case 22: { 13455 this.stateBeforeDeclaration(c); 13456 break; 13457 } 13458 case 25: { 13459 this.stateBeforeComment(c); 13460 break; 13461 } 13462 case 24: { 13463 this.stateInProcessingInstruction(c); 13464 break; 13465 } 13466 case 33: { 13467 this.stateInEntity(); 13468 break; 13469 } 13470 } 13471 this.index++; 13472 } 13473 this.cleanup(); 13474 this.finish(); 13475 } 13476 /** 13477 * Remove data that has already been consumed from the buffer. 13478 */ 13479 cleanup() { 13480 if (this.sectionStart !== this.index) { 13481 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) { 13482 this.cbs.ontext(this.sectionStart, this.index); 13483 this.sectionStart = this.index; 13484 } else if (this.state === 19 || this.state === 20 || this.state === 21) { 13485 this.cbs.onattribdata(this.sectionStart, this.index); 13486 this.sectionStart = this.index; 13487 } 13488 } 13489 } 13490 finish() { 13491 this.handleTrailingData(); 13492 this.cbs.onend(); 13493 } 13494 /** Handle any trailing data. */ 13495 handleTrailingData() { 13496 const endIndex = this.buffer.length; 13497 if (this.sectionStart >= endIndex) { 13498 return; 13499 } 13500 if (this.state === 28) { 13501 if (this.currentSequence === Sequences.CdataEnd) { 13502 this.cbs.oncdata(this.sectionStart, endIndex); 13503 } else { 13504 this.cbs.oncomment(this.sectionStart, endIndex); 13505 } 13506 } 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 { 13507 this.cbs.ontext(this.sectionStart, endIndex); 13508 } 13509 } 13510 emitCodePoint(cp, consumed) { 13511 } 13512 } 13513 13514 function defaultOnError(error) { 13515 throw error; 13516 } 13517 function defaultOnWarn(msg) { 13518 console.warn(`[Vue warn] ${msg.message}`); 13519 } 13520 function createCompilerError(code, loc, messages, additionalMessage) { 13521 const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ; 13522 const error = new SyntaxError(String(msg)); 13523 error.code = code; 13524 error.loc = loc; 13525 return error; 13526 } 13527 const errorMessages = { 13528 // parse errors 13529 [0]: "Illegal comment.", 13530 [1]: "CDATA section is allowed only in XML context.", 13531 [2]: "Duplicate attribute.", 13532 [3]: "End tag cannot have attributes.", 13533 [4]: "Illegal '/' in tags.", 13534 [5]: "Unexpected EOF in tag.", 13535 [6]: "Unexpected EOF in CDATA section.", 13536 [7]: "Unexpected EOF in comment.", 13537 [8]: "Unexpected EOF in script.", 13538 [9]: "Unexpected EOF in tag.", 13539 [10]: "Incorrectly closed comment.", 13540 [11]: "Incorrectly opened comment.", 13541 [12]: "Illegal tag name. Use '<' to print '<'.", 13542 [13]: "Attribute value was expected.", 13543 [14]: "End tag name was expected.", 13544 [15]: "Whitespace was expected.", 13545 [16]: "Unexpected '<!--' in comment.", 13546 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`, 13547 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).", 13548 [19]: "Attribute name cannot start with '='.", 13549 [21]: "'<?' is allowed only in XML context.", 13550 [20]: `Unexpected null character.`, 13551 [22]: "Illegal '/' in tags.", 13552 // Vue-specific parse errors 13553 [23]: "Invalid end tag.", 13554 [24]: "Element is missing end tag.", 13555 [25]: "Interpolation end sign was not found.", 13556 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.", 13557 [26]: "Legal directive name was expected.", 13558 // transform errors 13559 [28]: `v-if/v-else-if is missing expression.`, 13560 [29]: `v-if/else branches must use unique keys.`, 13561 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`, 13562 [31]: `v-for is missing expression.`, 13563 [32]: `v-for has invalid expression.`, 13564 [33]: `<template v-for> key should be placed on the <template> tag.`, 13565 [34]: `v-bind is missing expression.`, 13566 [52]: `v-bind with same-name shorthand only allows static argument.`, 13567 [35]: `v-on is missing expression.`, 13568 [36]: `Unexpected custom directive on <slot> outlet.`, 13569 [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.`, 13570 [38]: `Duplicate slot names found. `, 13571 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`, 13572 [40]: `v-slot can only be used on components or <template> tags.`, 13573 [41]: `v-model is missing expression.`, 13574 [42]: `v-model value must be a valid JavaScript member expression.`, 13575 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`, 13576 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable. 13577Use a v-bind binding combined with a v-on listener that emits update:x event instead.`, 13578 [45]: `Error parsing JavaScript expression: `, 13579 [46]: `<KeepAlive> expects exactly one child component.`, 13580 [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`, 13581 // generic errors 13582 [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`, 13583 [48]: `ES module mode is not supported in this build of compiler.`, 13584 [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`, 13585 [50]: `"scopeId" option is only supported in module mode.`, 13586 // just to fulfill types 13587 [53]: `` 13588 }; 13589 13590 const isStaticExp = (p) => p.type === 4 && p.isStatic; 13591 function isCoreComponent(tag) { 13592 switch (tag) { 13593 case "Teleport": 13594 case "teleport": 13595 return TELEPORT; 13596 case "Suspense": 13597 case "suspense": 13598 return SUSPENSE; 13599 case "KeepAlive": 13600 case "keep-alive": 13601 return KEEP_ALIVE; 13602 case "BaseTransition": 13603 case "base-transition": 13604 return BASE_TRANSITION; 13605 } 13606 } 13607 const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/; 13608 const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name); 13609 const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/; 13610 const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/; 13611 const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g; 13612 const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source; 13613 const isMemberExpressionBrowser = (exp) => { 13614 const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim()); 13615 let state = 0 /* inMemberExp */; 13616 let stateStack = []; 13617 let currentOpenBracketCount = 0; 13618 let currentOpenParensCount = 0; 13619 let currentStringType = null; 13620 for (let i = 0; i < path.length; i++) { 13621 const char = path.charAt(i); 13622 switch (state) { 13623 case 0 /* inMemberExp */: 13624 if (char === "[") { 13625 stateStack.push(state); 13626 state = 1 /* inBrackets */; 13627 currentOpenBracketCount++; 13628 } else if (char === "(") { 13629 stateStack.push(state); 13630 state = 2 /* inParens */; 13631 currentOpenParensCount++; 13632 } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) { 13633 return false; 13634 } 13635 break; 13636 case 1 /* inBrackets */: 13637 if (char === `'` || char === `"` || char === "`") { 13638 stateStack.push(state); 13639 state = 3 /* inString */; 13640 currentStringType = char; 13641 } else if (char === `[`) { 13642 currentOpenBracketCount++; 13643 } else if (char === `]`) { 13644 if (!--currentOpenBracketCount) { 13645 state = stateStack.pop(); 13646 } 13647 } 13648 break; 13649 case 2 /* inParens */: 13650 if (char === `'` || char === `"` || char === "`") { 13651 stateStack.push(state); 13652 state = 3 /* inString */; 13653 currentStringType = char; 13654 } else if (char === `(`) { 13655 currentOpenParensCount++; 13656 } else if (char === `)`) { 13657 if (i === path.length - 1) { 13658 return false; 13659 } 13660 if (!--currentOpenParensCount) { 13661 state = stateStack.pop(); 13662 } 13663 } 13664 break; 13665 case 3 /* inString */: 13666 if (char === currentStringType) { 13667 state = stateStack.pop(); 13668 currentStringType = null; 13669 } 13670 break; 13671 } 13672 } 13673 return !currentOpenBracketCount && !currentOpenParensCount; 13674 }; 13675 const isMemberExpression = isMemberExpressionBrowser ; 13676 const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/; 13677 const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp)); 13678 const isFnExpression = isFnExpressionBrowser ; 13679 function assert(condition, msg) { 13680 if (!condition) { 13681 throw new Error(msg || `unexpected compiler condition`); 13682 } 13683 } 13684 function findDir(node, name, allowEmpty = false) { 13685 for (let i = 0; i < node.props.length; i++) { 13686 const p = node.props[i]; 13687 if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) { 13688 return p; 13689 } 13690 } 13691 } 13692 function findProp(node, name, dynamicOnly = false, allowEmpty = false) { 13693 for (let i = 0; i < node.props.length; i++) { 13694 const p = node.props[i]; 13695 if (p.type === 6) { 13696 if (dynamicOnly) continue; 13697 if (p.name === name && (p.value || allowEmpty)) { 13698 return p; 13699 } 13700 } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) { 13701 return p; 13702 } 13703 } 13704 } 13705 function isStaticArgOf(arg, name) { 13706 return !!(arg && isStaticExp(arg) && arg.content === name); 13707 } 13708 function hasDynamicKeyVBind(node) { 13709 return node.props.some( 13710 (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj" 13711 p.arg.type !== 4 || // v-bind:[_ctx.foo] 13712 !p.arg.isStatic) 13713 // v-bind:[foo] 13714 ); 13715 } 13716 function isText$1(node) { 13717 return node.type === 5 || node.type === 2; 13718 } 13719 function isVPre(p) { 13720 return p.type === 7 && p.name === "pre"; 13721 } 13722 function isVSlot(p) { 13723 return p.type === 7 && p.name === "slot"; 13724 } 13725 function isTemplateNode(node) { 13726 return node.type === 1 && node.tagType === 3; 13727 } 13728 function isSlotOutlet(node) { 13729 return node.type === 1 && node.tagType === 2; 13730 } 13731 const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROP
vendor: 5,195 bytes, lines 13731-13898
13731S]); 13732 function getUnnormalizedProps(props, callPath = []) { 13733 if (props && !isString(props) && props.type === 14) { 13734 const callee = props.callee; 13735 if (!isString(callee) && propsHelperSet.has(callee)) { 13736 return getUnnormalizedProps( 13737 props.arguments[0], 13738 callPath.concat(props) 13739 ); 13740 } 13741 } 13742 return [props, callPath]; 13743 } 13744 function injectProp(node, prop, context) { 13745 let propsWithInjection; 13746 let props = node.type === 13 ? node.props : node.arguments[2]; 13747 let callPath = []; 13748 let parentCall; 13749 if (props && !isString(props) && props.type === 14) { 13750 const ret = getUnnormalizedProps(props); 13751 props = ret[0]; 13752 callPath = ret[1]; 13753 parentCall = callPath[callPath.length - 1]; 13754 } 13755 if (props == null || isString(props)) { 13756 propsWithInjection = createObjectExpression([prop]); 13757 } else if (props.type === 14) { 13758 const first = props.arguments[0]; 13759 if (!isString(first) && first.type === 15) { 13760 if (!hasProp(prop, first)) { 13761 first.properties.unshift(prop); 13762 } 13763 } else { 13764 if (props.callee === TO_HANDLERS) { 13765 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 13766 createObjectExpression([prop]), 13767 props 13768 ]); 13769 } else { 13770 props.arguments.unshift(createObjectExpression([prop])); 13771 } 13772 } 13773 !propsWithInjection && (propsWithInjection = props); 13774 } else if (props.type === 15) { 13775 if (!hasProp(prop, props)) { 13776 props.properties.unshift(prop); 13777 } 13778 propsWithInjection = props; 13779 } else { 13780 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 13781 createObjectExpression([prop]), 13782 props 13783 ]); 13784 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) { 13785 parentCall = callPath[callPath.length - 2]; 13786 } 13787 } 13788 if (node.type === 13) { 13789 if (parentCall) { 13790 parentCall.arguments[0] = propsWithInjection; 13791 } else { 13792 node.props = propsWithInjection; 13793 } 13794 } else { 13795 if (parentCall) { 13796 parentCall.arguments[0] = propsWithInjection; 13797 } else { 13798 node.arguments[2] = propsWithInjection; 13799 } 13800 } 13801 } 13802 function hasProp(prop, props) { 13803 let result = false; 13804 if (prop.key.type === 4) { 13805 const propKeyName = prop.key.content; 13806 result = props.properties.some( 13807 (p) => p.key.type === 4 && p.key.content === propKeyName 13808 ); 13809 } 13810 return result; 13811 } 13812 function toValidAssetId(name, type) { 13813 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => { 13814 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString(); 13815 })}`; 13816 } 13817 function getMemoedVNodeCall(node) { 13818 if (node.type === 14 && node.callee === WITH_MEMO) { 13819 return node.arguments[1].returns; 13820 } else { 13821 return node; 13822 } 13823 } 13824 const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/; 13825 13826 const defaultParserOptions = { 13827 parseMode: "base", 13828 ns: 0, 13829 delimiters: [`{{`, `}}`], 13830 getNamespace: () => 0, 13831 isVoidTag: NO, 13832 isPreTag: NO, 13833 isIgnoreNewlineTag: NO, 13834 isCustomElement: NO, 13835 onError: defaultOnError, 13836 onWarn: defaultOnWarn, 13837 comments: true, 13838 prefixIdentifiers: false 13839 }; 13840 let currentOptions = defaultParserOptions; 13841 let currentRoot = null; 13842 let currentInput = ""; 13843 let currentOpenTag = null; 13844 let currentProp = null; 13845 let currentAttrValue = ""; 13846 let currentAttrStartIndex = -1; 13847 let currentAttrEndIndex = -1; 13848 let inPre = 0; 13849 let inVPre = false; 13850 let currentVPreBoundary = null; 13851 const stack = []; 13852 const tokenizer = new Tokenizer(stack, { 13853 onerr: emitError, 13854 ontext(start, end) { 13855 onText(getSlice(start, end), start, end); 13856 }, 13857 ontextentity(char, start, end) { 13858 onText(char, start, end); 13859 }, 13860 oninterpolation(start, end) { 13861 if (inVPre) { 13862 return onText(getSlice(start, end), start, end); 13863 } 13864 let innerStart = start + tokenizer.delimiterOpen.length; 13865 let innerEnd = end - tokenizer.delimiterClose.length; 13866 while (isWhitespace(currentInput.charCodeAt(innerStart))) { 13867 innerStart++; 13868 } 13869 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) { 13870 innerEnd--; 13871 } 13872 let exp = getSlice(innerStart, innerEnd); 13873 if (exp.includes("&")) { 13874 { 13875 exp = currentOptions.decodeEntities(exp, false); 13876 } 13877 } 13878 addNode({ 13879 type: 5, 13880 content: createExp(exp, false, getLoc(innerStart, innerEnd)), 13881 loc: getLoc(start, end) 13882 }); 13883 }, 13884 onopentagname(start, end) { 13885 const name = getSlice(start, end); 13886 currentOpenTag = { 13887 type: 1, 13888 tag: name, 13889 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns), 13890 tagType: 0, 13891 // will be refined on tag close 13892 props: [], 13893 children: [], 13894 loc: getLoc(start - 1, end), 13895 codegenNode: void 0 13896 }; 13897 }, 13898 onopentagend(end) {
vendor: 58,012 bytes, lines 13899-15798
13899 endOpenTag(end); 13900 }, 13901 onclosetag(start, end) { 13902 const name = getSlice(start, end); 13903 if (!currentOptions.isVoidTag(name)) { 13904 let found = false; 13905 for (let i = 0; i < stack.length; i++) { 13906 const e = stack[i]; 13907 if (e.tag.toLowerCase() === name.toLowerCase()) { 13908 found = true; 13909 if (i > 0) { 13910 emitError(24, stack[0].loc.start.offset); 13911 } 13912 for (let j = 0; j <= i; j++) { 13913 const el = stack.shift(); 13914 onCloseTag(el, end, j < i); 13915 } 13916 break; 13917 } 13918 } 13919 if (!found) { 13920 emitError(23, backTrack(start, 60)); 13921 } 13922 } 13923 }, 13924 onselfclosingtag(end) { 13925 const name = currentOpenTag.tag; 13926 currentOpenTag.isSelfClosing = true; 13927 endOpenTag(end); 13928 if (stack[0] && stack[0].tag === name) { 13929 onCloseTag(stack.shift(), end); 13930 } 13931 }, 13932 onattribname(start, end) { 13933 currentProp = { 13934 type: 6, 13935 name: getSlice(start, end), 13936 nameLoc: getLoc(start, end), 13937 value: void 0, 13938 loc: getLoc(start) 13939 }; 13940 }, 13941 ondirname(start, end) { 13942 const raw = getSlice(start, end); 13943 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2); 13944 if (!inVPre && name === "") { 13945 emitError(26, start); 13946 } 13947 if (inVPre || name === "") { 13948 currentProp = { 13949 type: 6, 13950 name: raw, 13951 nameLoc: getLoc(start, end), 13952 value: void 0, 13953 loc: getLoc(start) 13954 }; 13955 } else { 13956 currentProp = { 13957 type: 7, 13958 name, 13959 rawName: raw, 13960 exp: void 0, 13961 arg: void 0, 13962 modifiers: raw === "." ? [createSimpleExpression("prop")] : [], 13963 loc: getLoc(start) 13964 }; 13965 if (name === "pre") { 13966 inVPre = tokenizer.inVPre = true; 13967 currentVPreBoundary = currentOpenTag; 13968 const props = currentOpenTag.props; 13969 for (let i = 0; i < props.length; i++) { 13970 if (props[i].type === 7) { 13971 props[i] = dirToAttr(props[i]); 13972 } 13973 } 13974 } 13975 } 13976 }, 13977 ondirarg(start, end) { 13978 if (start === end) return; 13979 const arg = getSlice(start, end); 13980 if (inVPre && !isVPre(currentProp)) { 13981 currentProp.name += arg; 13982 setLocEnd(currentProp.nameLoc, end); 13983 } else { 13984 const isStatic = arg[0] !== `[`; 13985 currentProp.arg = createExp( 13986 isStatic ? arg : arg.slice(1, -1), 13987 isStatic, 13988 getLoc(start, end), 13989 isStatic ? 3 : 0 13990 ); 13991 } 13992 }, 13993 ondirmodifier(start, end) { 13994 const mod = getSlice(start, end); 13995 if (inVPre && !isVPre(currentProp)) { 13996 currentProp.name += "." + mod; 13997 setLocEnd(currentProp.nameLoc, end); 13998 } else if (currentProp.name === "slot") { 13999 const arg = currentProp.arg; 14000 if (arg) { 14001 arg.content += "." + mod; 14002 setLocEnd(arg.loc, end); 14003 } 14004 } else { 14005 const exp = createSimpleExpression(mod, true, getLoc(start, end)); 14006 currentProp.modifiers.push(exp); 14007 } 14008 }, 14009 onattribdata(start, end) { 14010 currentAttrValue += getSlice(start, end); 14011 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 14012 currentAttrEndIndex = end; 14013 }, 14014 onattribentity(char, start, end) { 14015 currentAttrValue += char; 14016 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 14017 currentAttrEndIndex = end; 14018 }, 14019 onattribnameend(end) { 14020 const start = currentProp.loc.start.offset; 14021 const name = getSlice(start, end); 14022 if (currentProp.type === 7) { 14023 currentProp.rawName = name; 14024 } 14025 if (currentOpenTag.props.some( 14026 (p) => (p.type === 7 ? p.rawName : p.name) === name 14027 )) { 14028 emitError(2, start); 14029 } 14030 }, 14031 onattribend(quote, end) { 14032 if (currentOpenTag && currentProp) { 14033 setLocEnd(currentProp.loc, end); 14034 if (quote !== 0) { 14035 if (currentAttrValue.includes("&")) { 14036 currentAttrValue = currentOptions.decodeEntities( 14037 currentAttrValue, 14038 true 14039 ); 14040 } 14041 if (currentProp.type === 6) { 14042 if (currentProp.name === "class") { 14043 currentAttrValue = condense(currentAttrValue).trim(); 14044 } 14045 if (quote === 1 && !currentAttrValue) { 14046 emitError(13, end); 14047 } 14048 currentProp.value = { 14049 type: 2, 14050 content: currentAttrValue, 14051 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1) 14052 }; 14053 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") { 14054 tokenizer.enterRCDATA(toCharCodes(`</template`), 0); 14055 } 14056 } else { 14057 let expParseMode = 0 /* Normal */; 14058 currentProp.exp = createExp( 14059 currentAttrValue, 14060 false, 14061 getLoc(currentAttrStartIndex, currentAttrEndIndex), 14062 0, 14063 expParseMode 14064 ); 14065 if (currentProp.name === "for") { 14066 currentProp.forParseResult = parseForExpression(currentProp.exp); 14067 } 14068 } 14069 } 14070 if (currentProp.type !== 7 || currentProp.name !== "pre") { 14071 currentOpenTag.props.push(currentProp); 14072 } 14073 } 14074 currentAttrValue = ""; 14075 currentAttrStartIndex = currentAttrEndIndex = -1; 14076 }, 14077 oncomment(start, end) { 14078 if (currentOptions.comments) { 14079 addNode({ 14080 type: 3, 14081 content: getSlice(start, end), 14082 loc: getLoc(start - 4, end + 3) 14083 }); 14084 } 14085 }, 14086 onend() { 14087 const end = currentInput.length; 14088 if (tokenizer.state !== 1) { 14089 switch (tokenizer.state) { 14090 case 5: 14091 case 8: 14092 emitError(5, end); 14093 break; 14094 case 3: 14095 case 4: 14096 emitError( 14097 25, 14098 tokenizer.sectionStart 14099 ); 14100 break; 14101 case 28: 14102 if (tokenizer.currentSequence === Sequences.CdataEnd) { 14103 emitError(6, end); 14104 } else { 14105 emitError(7, end); 14106 } 14107 break; 14108 case 6: 14109 case 7: 14110 case 9: 14111 case 11: 14112 case 12: 14113 case 13: 14114 case 14: 14115 case 15: 14116 case 16: 14117 case 17: 14118 case 18: 14119 case 19: 14120 // " 14121 case 20: 14122 // ' 14123 case 21: 14124 emitError(9, end); 14125 break; 14126 } 14127 } 14128 for (let index = 0; index < stack.length; index++) { 14129 onCloseTag(stack[index], end - 1); 14130 emitError(24, stack[index].loc.start.offset); 14131 } 14132 }, 14133 oncdata(start, end) { 14134 if (stack[0].ns !== 0) { 14135 onText(getSlice(start, end), start, end); 14136 } else { 14137 emitError(1, start - 9); 14138 } 14139 }, 14140 onprocessinginstruction(start) { 14141 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 14142 emitError( 14143 21, 14144 start - 1 14145 ); 14146 } 14147 } 14148 }); 14149 const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 14150 const stripParensRE = /^\(|\)$/g; 14151 function parseForExpression(input) { 14152 const loc = input.loc; 14153 const exp = input.content; 14154 const inMatch = exp.match(forAliasRE); 14155 if (!inMatch) return; 14156 const [, LHS, RHS] = inMatch; 14157 const createAliasExpression = (content, offset, asParam = false) => { 14158 const start = loc.start.offset + offset; 14159 const end = start + content.length; 14160 return createExp( 14161 content, 14162 false, 14163 getLoc(start, end), 14164 0, 14165 asParam ? 1 /* Params */ : 0 /* Normal */ 14166 ); 14167 }; 14168 const result = { 14169 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)), 14170 value: void 0, 14171 key: void 0, 14172 index: void 0, 14173 finalized: false 14174 }; 14175 let valueContent = LHS.trim().replace(stripParensRE, "").trim(); 14176 const trimmedOffset = LHS.indexOf(valueContent); 14177 const iteratorMatch = valueContent.match(forIteratorRE); 14178 if (iteratorMatch) { 14179 valueContent = valueContent.replace(forIteratorRE, "").trim(); 14180 const keyContent = iteratorMatch[1].trim(); 14181 let keyOffset; 14182 if (keyContent) { 14183 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length); 14184 result.key = createAliasExpression(keyContent, keyOffset, true); 14185 } 14186 if (iteratorMatch[2]) { 14187 const indexContent = iteratorMatch[2].trim(); 14188 if (indexContent) { 14189 result.index = createAliasExpression( 14190 indexContent, 14191 exp.indexOf( 14192 indexContent, 14193 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length 14194 ), 14195 true 14196 ); 14197 } 14198 } 14199 } 14200 if (valueContent) { 14201 result.value = createAliasExpression(valueContent, trimmedOffset, true); 14202 } 14203 return result; 14204 } 14205 function getSlice(start, end) { 14206 return currentInput.slice(start, end); 14207 } 14208 function endOpenTag(end) { 14209 if (tokenizer.inSFCRoot) { 14210 currentOpenTag.innerLoc = getLoc(end + 1, end + 1); 14211 } 14212 addNode(currentOpenTag); 14213 const { tag, ns } = currentOpenTag; 14214 if (ns === 0 && currentOptions.isPreTag(tag)) { 14215 inPre++; 14216 } 14217 if (currentOptions.isVoidTag(tag)) { 14218 onCloseTag(currentOpenTag, end); 14219 } else { 14220 stack.unshift(currentOpenTag); 14221 if (ns === 1 || ns === 2) { 14222 tokenizer.inXML = true; 14223 } 14224 } 14225 currentOpenTag = null; 14226 } 14227 function onText(content, start, end) { 14228 { 14229 const tag = stack[0] && stack[0].tag; 14230 if (tag !== "script" && tag !== "style" && content.includes("&")) { 14231 content = currentOptions.decodeEntities(content, false); 14232 } 14233 } 14234 const parent = stack[0] || currentRoot; 14235 const lastNode = parent.children[parent.children.length - 1]; 14236 if (lastNode && lastNode.type === 2) { 14237 lastNode.content += content; 14238 setLocEnd(lastNode.loc, end); 14239 } else { 14240 parent.children.push({ 14241 type: 2, 14242 content, 14243 loc: getLoc(start, end) 14244 }); 14245 } 14246 } 14247 function onCloseTag(el, end, isImplied = false) { 14248 if (isImplied) { 14249 setLocEnd(el.loc, backTrack(end, 60)); 14250 } else { 14251 setLocEnd(el.loc, lookAhead(end, 62) + 1); 14252 } 14253 if (tokenizer.inSFCRoot) { 14254 if (el.children.length) { 14255 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end); 14256 } else { 14257 el.innerLoc.end = extend({}, el.innerLoc.start); 14258 } 14259 el.innerLoc.source = getSlice( 14260 el.innerLoc.start.offset, 14261 el.innerLoc.end.offset 14262 ); 14263 } 14264 const { tag, ns, children } = el; 14265 if (!inVPre) { 14266 if (tag === "slot") { 14267 el.tagType = 2; 14268 } else if (isFragmentTemplate(el)) { 14269 el.tagType = 3; 14270 } else if (isComponent(el)) { 14271 el.tagType = 1; 14272 } 14273 } 14274 if (!tokenizer.inRCDATA) { 14275 el.children = condenseWhitespace(children); 14276 } 14277 if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) { 14278 const first = children[0]; 14279 if (first && first.type === 2) { 14280 first.content = first.content.replace(/^\r?\n/, ""); 14281 } 14282 } 14283 if (ns === 0 && currentOptions.isPreTag(tag)) { 14284 inPre--; 14285 } 14286 if (currentVPreBoundary === el) { 14287 inVPre = tokenizer.inVPre = false; 14288 currentVPreBoundary = null; 14289 } 14290 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 14291 tokenizer.inXML = false; 14292 } 14293 } 14294 function lookAhead(index, c) { 14295 let i = index; 14296 while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++; 14297 return i; 14298 } 14299 function backTrack(index, c) { 14300 let i = index; 14301 while (currentInput.charCodeAt(i) !== c && i >= 0) i--; 14302 return i; 14303 } 14304 const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]); 14305 function isFragmentTemplate({ tag, props }) { 14306 if (tag === "template") { 14307 for (let i = 0; i < props.length; i++) { 14308 if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) { 14309 return true; 14310 } 14311 } 14312 } 14313 return false; 14314 } 14315 function isComponent({ tag, props }) { 14316 if (currentOptions.isCustomElement(tag)) { 14317 return false; 14318 } 14319 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) { 14320 return true; 14321 } 14322 for (let i = 0; i < props.length; i++) { 14323 const p = props[i]; 14324 if (p.type === 6) { 14325 if (p.name === "is" && p.value) { 14326 if (p.value.content.startsWith("vue:")) { 14327 return true; 14328 } 14329 } 14330 } 14331 } 14332 return false; 14333 } 14334 function isUpperCase(c) { 14335 return c > 64 && c < 91; 14336 } 14337 const windowsNewlineRE = /\r\n/g; 14338 function condenseWhitespace(nodes) { 14339 const shouldCondense = currentOptions.whitespace !== "preserve"; 14340 let removedWhitespace = false; 14341 for (let i = 0; i < nodes.length; i++) { 14342 const node = nodes[i]; 14343 if (node.type === 2) { 14344 if (!inPre) { 14345 if (isAllWhitespace(node.content)) { 14346 const prev = nodes[i - 1] && nodes[i - 1].type; 14347 const next = nodes[i + 1] && nodes[i + 1].type; 14348 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) { 14349 removedWhitespace = true; 14350 nodes[i] = null; 14351 } else { 14352 node.content = " "; 14353 } 14354 } else if (shouldCondense) { 14355 node.content = condense(node.content); 14356 } 14357 } else { 14358 node.content = node.content.replace(windowsNewlineRE, "\n"); 14359 } 14360 } 14361 } 14362 return removedWhitespace ? nodes.filter(Boolean) : nodes; 14363 } 14364 function isAllWhitespace(str) { 14365 for (let i = 0; i < str.length; i++) { 14366 if (!isWhitespace(str.charCodeAt(i))) { 14367 return false; 14368 } 14369 } 14370 return true; 14371 } 14372 function hasNewlineChar(str) { 14373 for (let i = 0; i < str.length; i++) { 14374 const c = str.charCodeAt(i); 14375 if (c === 10 || c === 13) { 14376 return true; 14377 } 14378 } 14379 return false; 14380 } 14381 function condense(str) { 14382 let ret = ""; 14383 let prevCharIsWhitespace = false; 14384 for (let i = 0; i < str.length; i++) { 14385 if (isWhitespace(str.charCodeAt(i))) { 14386 if (!prevCharIsWhitespace) { 14387 ret += " "; 14388 prevCharIsWhitespace = true; 14389 } 14390 } else { 14391 ret += str[i]; 14392 prevCharIsWhitespace = false; 14393 } 14394 } 14395 return ret; 14396 } 14397 function addNode(node) { 14398 (stack[0] || currentRoot).children.push(node); 14399 } 14400 function getLoc(start, end) { 14401 return { 14402 start: tokenizer.getPos(start), 14403 // @ts-expect-error allow late attachment 14404 end: end == null ? end : tokenizer.getPos(end), 14405 // @ts-expect-error allow late attachment 14406 source: end == null ? end : getSlice(start, end) 14407 }; 14408 } 14409 function cloneLoc(loc) { 14410 return getLoc(loc.start.offset, loc.end.offset); 14411 } 14412 function setLocEnd(loc, end) { 14413 loc.end = tokenizer.getPos(end); 14414 loc.source = getSlice(loc.start.offset, end); 14415 } 14416 function dirToAttr(dir) { 14417 const attr = { 14418 type: 6, 14419 name: dir.rawName, 14420 nameLoc: getLoc( 14421 dir.loc.start.offset, 14422 dir.loc.start.offset + dir.rawName.length 14423 ), 14424 value: void 0, 14425 loc: dir.loc 14426 }; 14427 if (dir.exp) { 14428 const loc = dir.exp.loc; 14429 if (loc.end.offset < dir.loc.end.offset) { 14430 loc.start.offset--; 14431 loc.start.column--; 14432 loc.end.offset++; 14433 loc.end.column++; 14434 } 14435 attr.value = { 14436 type: 2, 14437 content: dir.exp.content, 14438 loc 14439 }; 14440 } 14441 return attr; 14442 } 14443 function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) { 14444 const exp = createSimpleExpression(content, isStatic, loc, constType); 14445 return exp; 14446 } 14447 function emitError(code, index, message) { 14448 currentOptions.onError( 14449 createCompilerError(code, getLoc(index, index), void 0, message) 14450 ); 14451 } 14452 function reset() { 14453 tokenizer.reset(); 14454 currentOpenTag = null; 14455 currentProp = null; 14456 currentAttrValue = ""; 14457 currentAttrStartIndex = -1; 14458 currentAttrEndIndex = -1; 14459 stack.length = 0; 14460 } 14461 function baseParse(input, options) { 14462 reset(); 14463 currentInput = input; 14464 currentOptions = extend({}, defaultParserOptions); 14465 if (options) { 14466 let key; 14467 for (key in options) { 14468 if (options[key] != null) { 14469 currentOptions[key] = options[key]; 14470 } 14471 } 14472 } 14473 { 14474 if (!currentOptions.decodeEntities) { 14475 throw new Error( 14476 `[@vue/compiler-core] decodeEntities option is required in browser builds.` 14477 ); 14478 } 14479 } 14480 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0; 14481 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2; 14482 const delimiters = options && options.delimiters; 14483 if (delimiters) { 14484 tokenizer.delimiterOpen = toCharCodes(delimiters[0]); 14485 tokenizer.delimiterClose = toCharCodes(delimiters[1]); 14486 } 14487 const root = currentRoot = createRoot([], input); 14488 tokenizer.parse(currentInput); 14489 root.loc = getLoc(0, input.length); 14490 root.children = condenseWhitespace(root.children); 14491 currentRoot = null; 14492 return root; 14493 } 14494 14495 function cacheStatic(root, context) { 14496 walk( 14497 root, 14498 void 0, 14499 context, 14500 // Root node is unfortunately non-hoistable due to potential parent 14501 // fallthrough attributes. 14502 !!getSingleElementRoot(root) 14503 ); 14504 } 14505 function getSingleElementRoot(root) { 14506 const children = root.children.filter((x) => x.type !== 3); 14507 return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null; 14508 } 14509 function walk(node, parent, context, doNotHoistNode = false, inFor = false) { 14510 const { children } = node; 14511 const toCache = []; 14512 for (let i = 0; i < children.length; i++) { 14513 const child = children[i]; 14514 if (child.type === 1 && child.tagType === 0) { 14515 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 14516 if (constantType > 0) { 14517 if (constantType >= 2) { 14518 child.codegenNode.patchFlag = -1; 14519 toCache.push(child); 14520 continue; 14521 } 14522 } else { 14523 const codegenNode = child.codegenNode; 14524 if (codegenNode.type === 13) { 14525 const flag = codegenNode.patchFlag; 14526 if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) { 14527 const props = getNodeProps(child); 14528 if (props) { 14529 codegenNode.props = context.hoist(props); 14530 } 14531 } 14532 if (codegenNode.dynamicProps) { 14533 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps); 14534 } 14535 } 14536 } 14537 } else if (child.type === 12) { 14538 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 14539 if (constantType >= 2) { 14540 if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) { 14541 child.codegenNode.arguments.push( 14542 -1 + (` /* ${PatchFlagNames[-1]} */` ) 14543 ); 14544 } 14545 toCache.push(child); 14546 continue; 14547 } 14548 } 14549 if (child.type === 1) { 14550 const isComponent = child.tagType === 1; 14551 if (isComponent) { 14552 context.scopes.vSlot++; 14553 } 14554 walk(child, node, context, false, inFor); 14555 if (isComponent) { 14556 context.scopes.vSlot--; 14557 } 14558 } else if (child.type === 11) { 14559 walk(child, node, context, child.children.length === 1, true); 14560 } else if (child.type === 9) { 14561 for (let i2 = 0; i2 < child.branches.length; i2++) { 14562 walk( 14563 child.branches[i2], 14564 node, 14565 context, 14566 child.branches[i2].children.length === 1, 14567 inFor 14568 ); 14569 } 14570 } 14571 } 14572 let cachedAsArray = false; 14573 if (toCache.length === children.length && node.type === 1) { 14574 if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) { 14575 node.codegenNode.children = getCacheExpression( 14576 createArrayExpression(node.codegenNode.children) 14577 ); 14578 cachedAsArray = true; 14579 } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) { 14580 const slot = getSlotNode(node.codegenNode, "default"); 14581 if (slot) { 14582 slot.returns = getCacheExpression( 14583 createArrayExpression(slot.returns) 14584 ); 14585 cachedAsArray = true; 14586 } 14587 } 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) { 14588 const slotName = findDir(node, "slot", true); 14589 const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); 14590 if (slot) { 14591 slot.returns = getCacheExpression( 14592 createArrayExpression(slot.returns) 14593 ); 14594 cachedAsArray = true; 14595 } 14596 } 14597 } 14598 if (!cachedAsArray) { 14599 for (const child of toCache) { 14600 child.codegenNode = context.cache(child.codegenNode); 14601 } 14602 } 14603 function getCacheExpression(value) { 14604 const exp = context.cache(value); 14605 exp.needArraySpread = true; 14606 return exp; 14607 } 14608 function getSlotNode(node2, name) { 14609 if (node2.children && !isArray(node2.children) && node2.children.type === 15) { 14610 const slot = node2.children.properties.find( 14611 (p) => p.key === name || p.key.content === name 14612 ); 14613 return slot && slot.value; 14614 } 14615 } 14616 if (toCache.length && context.transformHoist) { 14617 context.transformHoist(children, context, node); 14618 } 14619 } 14620 function getConstantType(node, context) { 14621 const { constantCache } = context; 14622 switch (node.type) { 14623 case 1: 14624 if (node.tagType !== 0) { 14625 return 0; 14626 } 14627 const cached = constantCache.get(node); 14628 if (cached !== void 0) { 14629 return cached; 14630 } 14631 const codegenNode = node.codegenNode; 14632 if (codegenNode.type !== 13) { 14633 return 0; 14634 } 14635 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") { 14636 return 0; 14637 } 14638 if (codegenNode.patchFlag === void 0) { 14639 let returnType2 = 3; 14640 const generatedPropsType = getGeneratedPropsConstantType(node, context); 14641 if (generatedPropsType === 0) { 14642 constantCache.set(node, 0); 14643 return 0; 14644 } 14645 if (generatedPropsType < returnType2) { 14646 returnType2 = generatedPropsType; 14647 } 14648 for (let i = 0; i < node.children.length; i++) { 14649 const childType = getConstantType(node.children[i], context); 14650 if (childType === 0) { 14651 constantCache.set(node, 0); 14652 return 0; 14653 } 14654 if (childType < returnType2) { 14655 returnType2 = childType; 14656 } 14657 } 14658 if (returnType2 > 1) { 14659 for (let i = 0; i < node.props.length; i++) { 14660 const p = node.props[i]; 14661 if (p.type === 7 && p.name === "bind" && p.exp) { 14662 const expType = getConstantType(p.exp, context); 14663 if (expType === 0) { 14664 constantCache.set(node, 0); 14665 return 0; 14666 } 14667 if (expType < returnType2) { 14668 returnType2 = expType; 14669 } 14670 } 14671 } 14672 } 14673 if (codegenNode.isBlock) { 14674 for (let i = 0; i < node.props.length; i++) { 14675 const p = node.props[i]; 14676 if (p.type === 7) { 14677 constantCache.set(node, 0); 14678 return 0; 14679 } 14680 } 14681 context.removeHelper(OPEN_BLOCK); 14682 context.removeHelper( 14683 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent) 14684 ); 14685 codegenNode.isBlock = false; 14686 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent)); 14687 } 14688 constantCache.set(node, returnType2); 14689 return returnType2; 14690 } else { 14691 constantCache.set(node, 0); 14692 return 0; 14693 } 14694 case 2: 14695 case 3: 14696 return 3; 14697 case 9: 14698 case 11: 14699 case 10: 14700 return 0; 14701 case 5: 14702 case 12: 14703 return getConstantType(node.content, context); 14704 case 4: 14705 return node.constType; 14706 case 8: 14707 let returnType = 3; 14708 for (let i = 0; i < node.children.length; i++) { 14709 const child = node.children[i]; 14710 if (isString(child) || isSymbol(child)) { 14711 continue; 14712 } 14713 const childType = getConstantType(child, context); 14714 if (childType === 0) { 14715 return 0; 14716 } else if (childType < returnType) { 14717 returnType = childType; 14718 } 14719 } 14720 return returnType; 14721 case 20: 14722 return 2; 14723 default: 14724 return 0; 14725 } 14726 } 14727 const allowHoistedHelperSet = /* @__PURE__ */ new Set([ 14728 NORMALIZE_CLASS, 14729 NORMALIZE_STYLE, 14730 NORMALIZE_PROPS, 14731 GUARD_REACTIVE_PROPS 14732 ]); 14733 function getConstantTypeOfHelperCall(value, context) { 14734 if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) { 14735 const arg = value.arguments[0]; 14736 if (arg.type === 4) { 14737 return getConstantType(arg, context); 14738 } else if (arg.type === 14) { 14739 return getConstantTypeOfHelperCall(arg, context); 14740 } 14741 } 14742 return 0; 14743 } 14744 function getGeneratedPropsConstantType(node, context) { 14745 let returnType = 3; 14746 const props = getNodeProps(node); 14747 if (props && props.type === 15) { 14748 const { properties } = props; 14749 for (let i = 0; i < properties.length; i++) { 14750 const { key, value } = properties[i]; 14751 const keyType = getConstantType(key, context); 14752 if (keyType === 0) { 14753 return keyType; 14754 } 14755 if (keyType < returnType) { 14756 returnType = keyType; 14757 } 14758 let valueType; 14759 if (value.type === 4) { 14760 valueType = getConstantType(value, context); 14761 } else if (value.type === 14) { 14762 valueType = getConstantTypeOfHelperCall(value, context); 14763 } else { 14764 valueType = 0; 14765 } 14766 if (valueType === 0) { 14767 return valueType; 14768 } 14769 if (valueType < returnType) { 14770 returnType = valueType; 14771 } 14772 } 14773 } 14774 return returnType; 14775 } 14776 function getNodeProps(node) { 14777 const codegenNode = node.codegenNode; 14778 if (codegenNode.type === 13) { 14779 return codegenNode.props; 14780 } 14781 } 14782 14783 function createTransformContext(root, { 14784 filename = "", 14785 prefixIdentifiers = false, 14786 hoistStatic = false, 14787 hmr = false, 14788 cacheHandlers = false, 14789 nodeTransforms = [], 14790 directiveTransforms = {}, 14791 transformHoist = null, 14792 isBuiltInComponent = NOOP, 14793 isCustomElement = NOOP, 14794 expressionPlugins = [], 14795 scopeId = null, 14796 slotted = true, 14797 ssr = false, 14798 inSSR = false, 14799 ssrCssVars = ``, 14800 bindingMetadata = EMPTY_OBJ, 14801 inline = false, 14802 isTS = false, 14803 onError = defaultOnError, 14804 onWarn = defaultOnWarn, 14805 compatConfig 14806 }) { 14807 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/); 14808 const context = { 14809 // options 14810 filename, 14811 selfName: nameMatch && capitalize(camelize(nameMatch[1])), 14812 prefixIdentifiers, 14813 hoistStatic, 14814 hmr, 14815 cacheHandlers, 14816 nodeTransforms, 14817 directiveTransforms, 14818 transformHoist, 14819 isBuiltInComponent, 14820 isCustomElement, 14821 expressionPlugins, 14822 scopeId, 14823 slotted, 14824 ssr, 14825 inSSR, 14826 ssrCssVars, 14827 bindingMetadata, 14828 inline, 14829 isTS, 14830 onError, 14831 onWarn, 14832 compatConfig, 14833 // state 14834 root, 14835 helpers: /* @__PURE__ */ new Map(), 14836 components: /* @__PURE__ */ new Set(), 14837 directives: /* @__PURE__ */ new Set(), 14838 hoists: [], 14839 imports: [], 14840 cached: [], 14841 constantCache: /* @__PURE__ */ new WeakMap(), 14842 temps: 0, 14843 identifiers: /* @__PURE__ */ Object.create(null), 14844 scopes: { 14845 vFor: 0, 14846 vSlot: 0, 14847 vPre: 0, 14848 vOnce: 0 14849 }, 14850 parent: null, 14851 grandParent: null, 14852 currentNode: root, 14853 childIndex: 0, 14854 inVOnce: false, 14855 // methods 14856 helper(name) { 14857 const count = context.helpers.get(name) || 0; 14858 context.helpers.set(name, count + 1); 14859 return name; 14860 }, 14861 removeHelper(name) { 14862 const count = context.helpers.get(name); 14863 if (count) { 14864 const currentCount = count - 1; 14865 if (!currentCount) { 14866 context.helpers.delete(name); 14867 } else { 14868 context.helpers.set(name, currentCount); 14869 } 14870 } 14871 }, 14872 helperString(name) { 14873 return `_${helperNameMap[context.helper(name)]}`; 14874 }, 14875 replaceNode(node) { 14876 { 14877 if (!context.currentNode) { 14878 throw new Error(`Node being replaced is already removed.`); 14879 } 14880 if (!context.parent) { 14881 throw new Error(`Cannot replace root node.`); 14882 } 14883 } 14884 context.parent.children[context.childIndex] = context.currentNode = node; 14885 }, 14886 removeNode(node) { 14887 if (!context.parent) { 14888 throw new Error(`Cannot remove root node.`); 14889 } 14890 const list = context.parent.children; 14891 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1; 14892 if (removalIndex < 0) { 14893 throw new Error(`node being removed is not a child of current parent`); 14894 } 14895 if (!node || node === context.currentNode) { 14896 context.currentNode = null; 14897 context.onNodeRemoved(); 14898 } else { 14899 if (context.childIndex > removalIndex) { 14900 context.childIndex--; 14901 context.onNodeRemoved(); 14902 } 14903 } 14904 context.parent.children.splice(removalIndex, 1); 14905 }, 14906 onNodeRemoved: NOOP, 14907 addIdentifiers(exp) { 14908 }, 14909 removeIdentifiers(exp) { 14910 }, 14911 hoist(exp) { 14912 if (isString(exp)) exp = createSimpleExpression(exp); 14913 context.hoists.push(exp); 14914 const identifier = createSimpleExpression( 14915 `_hoisted_${context.hoists.length}`, 14916 false, 14917 exp.loc, 14918 2 14919 ); 14920 identifier.hoisted = exp; 14921 return identifier; 14922 }, 14923 cache(exp, isVNode = false, inVOnce = false) { 14924 const cacheExp = createCacheExpression( 14925 context.cached.length, 14926 exp, 14927 isVNode, 14928 inVOnce 14929 ); 14930 context.cached.push(cacheExp); 14931 return cacheExp; 14932 } 14933 }; 14934 return context; 14935 } 14936 function transform(root, options) { 14937 const context = createTransformContext(root, options); 14938 traverseNode(root, context); 14939 if (options.hoistStatic) { 14940 cacheStatic(root, context); 14941 } 14942 if (!options.ssr) { 14943 createRootCodegen(root, context); 14944 } 14945 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]); 14946 root.components = [...context.components]; 14947 root.directives = [...context.directives]; 14948 root.imports = context.imports; 14949 root.hoists = context.hoists; 14950 root.temps = context.temps; 14951 root.cached = context.cached; 14952 root.transformed = true; 14953 } 14954 function createRootCodegen(root, context) { 14955 const { helper } = context; 14956 const { children } = root; 14957 if (children.length === 1) { 14958 const singleElementRootChild = getSingleElementRoot(root); 14959 if (singleElementRootChild && singleElementRootChild.codegenNode) { 14960 const codegenNode = singleElementRootChild.codegenNode; 14961 if (codegenNode.type === 13) { 14962 convertToBlock(codegenNode, context); 14963 } 14964 root.codegenNode = codegenNode; 14965 } else { 14966 root.codegenNode = children[0]; 14967 } 14968 } else if (children.length > 1) { 14969 let patchFlag = 64; 14970 if (children.filter((c) => c.type !== 3).length === 1) { 14971 patchFlag |= 2048; 14972 } 14973 root.codegenNode = createVNodeCall( 14974 context, 14975 helper(FRAGMENT), 14976 void 0, 14977 root.children, 14978 patchFlag, 14979 void 0, 14980 void 0, 14981 true, 14982 void 0, 14983 false 14984 ); 14985 } else ; 14986 } 14987 function traverseChildren(parent, context) { 14988 let i = 0; 14989 const nodeRemoved = () => { 14990 i--; 14991 }; 14992 for (; i < parent.children.length; i++) { 14993 const child = parent.children[i]; 14994 if (isString(child)) continue; 14995 context.grandParent = context.parent; 14996 context.parent = parent; 14997 context.childIndex = i; 14998 context.onNodeRemoved = nodeRemoved; 14999 traverseNode(child, context); 15000 } 15001 } 15002 function traverseNode(node, context) { 15003 context.currentNode = node; 15004 const { nodeTransforms } = context; 15005 const exitFns = []; 15006 for (let i2 = 0; i2 < nodeTransforms.length; i2++) { 15007 const onExit = nodeTransforms[i2](node, context); 15008 if (onExit) { 15009 if (isArray(onExit)) { 15010 exitFns.push(...onExit); 15011 } else { 15012 exitFns.push(onExit); 15013 } 15014 } 15015 if (!context.currentNode) { 15016 return; 15017 } else { 15018 node = context.currentNode; 15019 } 15020 } 15021 switch (node.type) { 15022 case 3: 15023 if (!context.ssr) { 15024 context.helper(CREATE_COMMENT); 15025 } 15026 break; 15027 case 5: 15028 if (!context.ssr) { 15029 context.helper(TO_DISPLAY_STRING); 15030 } 15031 break; 15032 // for container types, further traverse downwards 15033 case 9: 15034 for (let i2 = 0; i2 < node.branches.length; i2++) { 15035 traverseNode(node.branches[i2], context); 15036 } 15037 break; 15038 case 10: 15039 case 11: 15040 case 1: 15041 case 0: 15042 traverseChildren(node, context); 15043 break; 15044 } 15045 context.currentNode = node; 15046 let i = exitFns.length; 15047 while (i--) { 15048 exitFns[i](); 15049 } 15050 } 15051 function createStructuralDirectiveTransform(name, fn) { 15052 const matches = isString(name) ? (n) => n === name : (n) => name.test(n); 15053 return (node, context) => { 15054 if (node.type === 1) { 15055 const { props } = node; 15056 if (node.tagType === 3 && props.some(isVSlot)) { 15057 return; 15058 } 15059 const exitFns = []; 15060 for (let i = 0; i < props.length; i++) { 15061 const prop = props[i]; 15062 if (prop.type === 7 && matches(prop.name)) { 15063 props.splice(i, 1); 15064 i--; 15065 const onExit = fn(node, prop, context); 15066 if (onExit) exitFns.push(onExit); 15067 } 15068 } 15069 return exitFns; 15070 } 15071 }; 15072 } 15073 15074 const PURE_ANNOTATION = `/*@__PURE__*/`; 15075 const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`; 15076 function createCodegenContext(ast, { 15077 mode = "function", 15078 prefixIdentifiers = mode === "module", 15079 sourceMap = false, 15080 filename = `template.vue.html`, 15081 scopeId = null, 15082 optimizeImports = false, 15083 runtimeGlobalName = `Vue`, 15084 runtimeModuleName = `vue`, 15085 ssrRuntimeModuleName = "vue/server-renderer", 15086 ssr = false, 15087 isTS = false, 15088 inSSR = false 15089 }) { 15090 const context = { 15091 mode, 15092 prefixIdentifiers, 15093 sourceMap, 15094 filename, 15095 scopeId, 15096 optimizeImports, 15097 runtimeGlobalName, 15098 runtimeModuleName, 15099 ssrRuntimeModuleName, 15100 ssr, 15101 isTS, 15102 inSSR, 15103 source: ast.source, 15104 code: ``, 15105 column: 1, 15106 line: 1, 15107 offset: 0, 15108 indentLevel: 0, 15109 pure: false, 15110 map: void 0, 15111 helper(key) { 15112 return `_${helperNameMap[key]}`; 15113 }, 15114 push(code, newlineIndex = -2 /* None */, node) { 15115 context.code += code; 15116 }, 15117 indent() { 15118 newline(++context.indentLevel); 15119 }, 15120 deindent(withoutNewLine = false) { 15121 if (withoutNewLine) { 15122 --context.indentLevel; 15123 } else { 15124 newline(--context.indentLevel); 15125 } 15126 }, 15127 newline() { 15128 newline(context.indentLevel); 15129 } 15130 }; 15131 function newline(n) { 15132 context.push("\n" + ` `.repeat(n), 0 /* Start */); 15133 } 15134 return context; 15135 } 15136 function generate(ast, options = {}) { 15137 const context = createCodegenContext(ast, options); 15138 if (options.onContextCreated) options.onContextCreated(context); 15139 const { 15140 mode, 15141 push, 15142 prefixIdentifiers, 15143 indent, 15144 deindent, 15145 newline, 15146 scopeId, 15147 ssr 15148 } = context; 15149 const helpers = Array.from(ast.helpers); 15150 const hasHelpers = helpers.length > 0; 15151 const useWithBlock = !prefixIdentifiers && mode !== "module"; 15152 const preambleContext = context; 15153 { 15154 genFunctionPreamble(ast, preambleContext); 15155 } 15156 const functionName = ssr ? `ssrRender` : `render`; 15157 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"]; 15158 const signature = args.join(", "); 15159 { 15160 push(`function ${functionName}(${signature}) {`); 15161 } 15162 indent(); 15163 if (useWithBlock) { 15164 push(`with (_ctx) {`); 15165 indent(); 15166 if (hasHelpers) { 15167 push( 15168 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue 15169`, 15170 -1 /* End */ 15171 ); 15172 newline(); 15173 } 15174 } 15175 if (ast.components.length) { 15176 genAssets(ast.components, "component", context); 15177 if (ast.directives.length || ast.temps > 0) { 15178 newline(); 15179 } 15180 } 15181 if (ast.directives.length) { 15182 genAssets(ast.directives, "directive", context); 15183 if (ast.temps > 0) { 15184 newline(); 15185 } 15186 } 15187 if (ast.temps > 0) { 15188 push(`let `); 15189 for (let i = 0; i < ast.temps; i++) { 15190 push(`${i > 0 ? `, ` : ``}_temp${i}`); 15191 } 15192 } 15193 if (ast.components.length || ast.directives.length || ast.temps) { 15194 push(` 15195`, 0 /* Start */); 15196 newline(); 15197 } 15198 if (!ssr) { 15199 push(`return `); 15200 } 15201 if (ast.codegenNode) { 15202 genNode(ast.codegenNode, context); 15203 } else { 15204 push(`null`); 15205 } 15206 if (useWithBlock) { 15207 deindent(); 15208 push(`}`); 15209 } 15210 deindent(); 15211 push(`}`); 15212 return { 15213 ast, 15214 code: context.code, 15215 preamble: ``, 15216 map: context.map ? context.map.toJSON() : void 0 15217 }; 15218 } 15219 function genFunctionPreamble(ast, context) { 15220 const { 15221 ssr, 15222 prefixIdentifiers, 15223 push, 15224 newline, 15225 runtimeModuleName, 15226 runtimeGlobalName, 15227 ssrRuntimeModuleName 15228 } = context; 15229 const VueBinding = runtimeGlobalName; 15230 const helpers = Array.from(ast.helpers); 15231 if (helpers.length > 0) { 15232 { 15233 push(`const _Vue = ${VueBinding} 15234`, -1 /* End */); 15235 if (ast.hoists.length) { 15236 const staticHelpers = [ 15237 CREATE_VNODE, 15238 CREATE_ELEMENT_VNODE, 15239 CREATE_COMMENT, 15240 CREATE_TEXT, 15241 CREATE_STATIC 15242 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", "); 15243 push(`const { ${staticHelpers} } = _Vue 15244`, -1 /* End */); 15245 } 15246 } 15247 } 15248 genHoists(ast.hoists, context); 15249 newline(); 15250 push(`return `); 15251 } 15252 function genAssets(assets, type, { helper, push, newline, isTS }) { 15253 const resolver = helper( 15254 type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE 15255 ); 15256 for (let i = 0; i < assets.length; i++) { 15257 let id = assets[i]; 15258 const maybeSelfReference = id.endsWith("__self"); 15259 if (maybeSelfReference) { 15260 id = id.slice(0, -6); 15261 } 15262 push( 15263 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}` 15264 ); 15265 if (i < assets.length - 1) { 15266 newline(); 15267 } 15268 } 15269 } 15270 function genHoists(hoists, context) { 15271 if (!hoists.length) { 15272 return; 15273 } 15274 context.pure = true; 15275 const { push, newline } = context; 15276 newline(); 15277 for (let i = 0; i < hoists.length; i++) { 15278 const exp = hoists[i]; 15279 if (exp) { 15280 push(`const _hoisted_${i + 1} = `); 15281 genNode(exp, context); 15282 newline(); 15283 } 15284 } 15285 context.pure = false; 15286 } 15287 function isText(n) { 15288 return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8; 15289 } 15290 function genNodeListAsArray(nodes, context) { 15291 const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n)); 15292 context.push(`[`); 15293 multilines && context.indent(); 15294 genNodeList(nodes, context, multilines); 15295 multilines && context.deindent(); 15296 context.push(`]`); 15297 } 15298 function genNodeList(nodes, context, multilines = false, comma = true) { 15299 const { push, newline } = context; 15300 for (let i = 0; i < nodes.length; i++) { 15301 const node = nodes[i]; 15302 if (isString(node)) { 15303 push(node, -3 /* Unknown */); 15304 } else if (isArray(node)) { 15305 genNodeListAsArray(node, context); 15306 } else { 15307 genNode(node, context); 15308 } 15309 if (i < nodes.length - 1) { 15310 if (multilines) { 15311 comma && push(","); 15312 newline(); 15313 } else { 15314 comma && push(", "); 15315 } 15316 } 15317 } 15318 } 15319 function genNode(node, context) { 15320 if (isString(node)) { 15321 context.push(node, -3 /* Unknown */); 15322 return; 15323 } 15324 if (isSymbol(node)) { 15325 context.push(context.helper(node)); 15326 return; 15327 } 15328 switch (node.type) { 15329 case 1: 15330 case 9: 15331 case 11: 15332 assert( 15333 node.codegenNode != null, 15334 `Codegen node is missing for element/if/for node. Apply appropriate transforms first.` 15335 ); 15336 genNode(node.codegenNode, context); 15337 break; 15338 case 2: 15339 genText(node, context); 15340 break; 15341 case 4: 15342 genExpression(node, context); 15343 break; 15344 case 5: 15345 genInterpolation(node, context); 15346 break; 15347 case 12: 15348 genNode(node.codegenNode, context); 15349 break; 15350 case 8: 15351 genCompoundExpression(node, context); 15352 break; 15353 case 3: 15354 genComment(node, context); 15355 break; 15356 case 13: 15357 genVNodeCall(node, context); 15358 break; 15359 case 14: 15360 genCallExpression(node, context); 15361 break; 15362 case 15: 15363 genObjectExpression(node, context); 15364 break; 15365 case 17: 15366 genArrayExpression(node, context); 15367 break; 15368 case 18: 15369 genFunctionExpression(node, context); 15370 break; 15371 case 19: 15372 genConditionalExpression(node, context); 15373 break; 15374 case 20: 15375 genCacheExpression(node, context); 15376 break; 15377 case 21: 15378 genNodeList(node.body, context, true, false); 15379 break; 15380 // SSR only types 15381 case 22: 15382 break; 15383 case 23: 15384 break; 15385 case 24: 15386 break; 15387 case 25: 15388 break; 15389 case 26: 15390 break; 15391 /* v8 ignore start */ 15392 case 10: 15393 break; 15394 default: 15395 { 15396 assert(false, `unhandled codegen node type: ${node.type}`); 15397 const exhaustiveCheck = node; 15398 return exhaustiveCheck; 15399 } 15400 } 15401 } 15402 function genText(node, context) { 15403 context.push(JSON.stringify(node.content), -3 /* Unknown */, node); 15404 } 15405 function genExpression(node, context) { 15406 const { content, isStatic } = node; 15407 context.push( 15408 isStatic ? JSON.stringify(content) : content, 15409 -3 /* Unknown */, 15410 node 15411 ); 15412 } 15413 function genInterpolation(node, context) { 15414 const { push, helper, pure } = context; 15415 if (pure) push(PURE_ANNOTATION); 15416 push(`${helper(TO_DISPLAY_STRING)}(`); 15417 genNode(node.content, context); 15418 push(`)`); 15419 } 15420 function genCompoundExpression(node, context) { 15421 for (let i = 0; i < node.children.length; i++) { 15422 const child = node.children[i]; 15423 if (isString(child)) { 15424 context.push(child, -3 /* Unknown */); 15425 } else { 15426 genNode(child, context); 15427 } 15428 } 15429 } 15430 function genExpressionAsPropertyKey(node, context) { 15431 const { push } = context; 15432 if (node.type === 8) { 15433 push(`[`); 15434 genCompoundExpression(node, context); 15435 push(`]`); 15436 } else if (node.isStatic) { 15437 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content); 15438 push(text, -2 /* None */, node); 15439 } else { 15440 push(`[${node.content}]`, -3 /* Unknown */, node); 15441 } 15442 } 15443 function genComment(node, context) { 15444 const { push, helper, pure } = context; 15445 if (pure) { 15446 push(PURE_ANNOTATION); 15447 } 15448 push( 15449 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, 15450 -3 /* Unknown */, 15451 node 15452 ); 15453 } 15454 function genVNodeCall(node, context) { 15455 const { push, helper, pure } = context; 15456 const { 15457 tag, 15458 props, 15459 children, 15460 patchFlag, 15461 dynamicProps, 15462 directives, 15463 isBlock, 15464 disableTracking, 15465 isComponent 15466 } = node; 15467 let patchFlagString; 15468 if (patchFlag) { 15469 { 15470 if (patchFlag < 0) { 15471 patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`; 15472 } else { 15473 const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `); 15474 patchFlagString = patchFlag + ` /* ${flagNames} */`; 15475 } 15476 } 15477 } 15478 if (directives) { 15479 push(helper(WITH_DIRECTIVES) + `(`); 15480 } 15481 if (isBlock) { 15482 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `); 15483 } 15484 if (pure) { 15485 push(PURE_ANNOTATION); 15486 } 15487 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent); 15488 push(helper(callHelper) + `(`, -2 /* None */, node); 15489 genNodeList( 15490 genNullableArgs([tag, props, children, patchFlagString, dynamicProps]), 15491 context 15492 ); 15493 push(`)`); 15494 if (isBlock) { 15495 push(`)`); 15496 } 15497 if (directives) { 15498 push(`, `); 15499 genNode(directives, context); 15500 push(`)`); 15501 } 15502 } 15503 function genNullableArgs(args) { 15504 let i = args.length; 15505 while (i--) { 15506 if (args[i] != null) break; 15507 } 15508 return args.slice(0, i + 1).map((arg) => arg || `null`); 15509 } 15510 function genCallExpression(node, context) { 15511 const { push, helper, pure } = context; 15512 const callee = isString(node.callee) ? node.callee : helper(node.callee); 15513 if (pure) { 15514 push(PURE_ANNOTATION); 15515 } 15516 push(callee + `(`, -2 /* None */, node); 15517 genNodeList(node.arguments, context); 15518 push(`)`); 15519 } 15520 function genObjectExpression(node, context) { 15521 const { push, indent, deindent, newline } = context; 15522 const { properties } = node; 15523 if (!properties.length) { 15524 push(`{}`, -2 /* None */, node); 15525 return; 15526 } 15527 const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4); 15528 push(multilines ? `{` : `{ `); 15529 multilines && indent(); 15530 for (let i = 0; i < properties.length; i++) { 15531 const { key, value } = properties[i]; 15532 genExpressionAsPropertyKey(key, context); 15533 push(`: `); 15534 genNode(value, context); 15535 if (i < properties.length - 1) { 15536 push(`,`); 15537 newline(); 15538 } 15539 } 15540 multilines && deindent(); 15541 push(multilines ? `}` : ` }`); 15542 } 15543 function genArrayExpression(node, context) { 15544 genNodeListAsArray(node.elements, context); 15545 } 15546 function genFunctionExpression(node, context) { 15547 const { push, indent, deindent } = context; 15548 const { params, returns, body, newline, isSlot } = node; 15549 if (isSlot) { 15550 push(`_${helperNameMap[WITH_CTX]}(`); 15551 } 15552 push(`(`, -2 /* None */, node); 15553 if (isArray(params)) { 15554 genNodeList(params, context); 15555 } else if (params) { 15556 genNode(params, context); 15557 } 15558 push(`) => `); 15559 if (newline || body) { 15560 push(`{`); 15561 indent(); 15562 } 15563 if (returns) { 15564 if (newline) { 15565 push(`return `); 15566 } 15567 if (isArray(returns)) { 15568 genNodeListAsArray(returns, context); 15569 } else { 15570 genNode(returns, context); 15571 } 15572 } else if (body) { 15573 genNode(body, context); 15574 } 15575 if (newline || body) { 15576 deindent(); 15577 push(`}`); 15578 } 15579 if (isSlot) { 15580 push(`)`); 15581 } 15582 } 15583 function genConditionalExpression(node, context) { 15584 const { test, consequent, alternate, newline: needNewline } = node; 15585 const { push, indent, deindent, newline } = context; 15586 if (test.type === 4) { 15587 const needsParens = !isSimpleIdentifier(test.content); 15588 needsParens && push(`(`); 15589 genExpression(test, context); 15590 needsParens && push(`)`); 15591 } else { 15592 push(`(`); 15593 genNode(test, context); 15594 push(`)`); 15595 } 15596 needNewline && indent(); 15597 context.indentLevel++; 15598 needNewline || push(` `); 15599 push(`? `); 15600 genNode(consequent, context); 15601 context.indentLevel--; 15602 needNewline && newline(); 15603 needNewline || push(` `); 15604 push(`: `); 15605 const isNested = alternate.type === 19; 15606 if (!isNested) { 15607 context.indentLevel++; 15608 } 15609 genNode(alternate, context); 15610 if (!isNested) { 15611 context.indentLevel--; 15612 } 15613 needNewline && deindent( 15614 true 15615 /* without newline */ 15616 ); 15617 } 15618 function genCacheExpression(node, context) { 15619 const { push, helper, indent, deindent, newline } = context; 15620 const { needPauseTracking, needArraySpread } = node; 15621 if (needArraySpread) { 15622 push(`[...(`); 15623 } 15624 push(`_cache[${node.index}] || (`); 15625 if (needPauseTracking) { 15626 indent(); 15627 push(`${helper(SET_BLOCK_TRACKING)}(-1`); 15628 if (node.inVOnce) push(`, true`); 15629 push(`),`); 15630 newline(); 15631 push(`(`); 15632 } 15633 push(`_cache[${node.index}] = `); 15634 genNode(node.value, context); 15635 if (needPauseTracking) { 15636 push(`).cacheIndex = ${node.index},`); 15637 newline(); 15638 push(`${helper(SET_BLOCK_TRACKING)}(1),`); 15639 newline(); 15640 push(`_cache[${node.index}]`); 15641 deindent(); 15642 } 15643 push(`)`); 15644 if (needArraySpread) { 15645 push(`)]`); 15646 } 15647 } 15648 15649 const prohibitedKeywordRE = new RegExp( 15650 "\\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" 15651 ); 15652 const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; 15653 function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) { 15654 const exp = node.content; 15655 if (!exp.trim()) { 15656 return; 15657 } 15658 try { 15659 new Function( 15660 asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}` 15661 ); 15662 } catch (e) { 15663 let message = e.message; 15664 const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE); 15665 if (keywordMatch) { 15666 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`; 15667 } 15668 context.onError( 15669 createCompilerError( 15670 45, 15671 node.loc, 15672 void 0, 15673 message 15674 ) 15675 ); 15676 } 15677 } 15678 15679 const transformExpression = (node, context) => { 15680 if (node.type === 5) { 15681 node.content = processExpression( 15682 node.content, 15683 context 15684 ); 15685 } else if (node.type === 1) { 15686 const memo = findDir(node, "memo"); 15687 for (let i = 0; i < node.props.length; i++) { 15688 const dir = node.props[i]; 15689 if (dir.type === 7 && dir.name !== "for") { 15690 const exp = dir.exp; 15691 const arg = dir.arg; 15692 if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor) 15693 !(memo && arg && arg.type === 4 && arg.content === "key")) { 15694 dir.exp = processExpression( 15695 exp, 15696 context, 15697 // slot args must be processed as function params 15698 dir.name === "slot" 15699 ); 15700 } 15701 if (arg && arg.type === 4 && !arg.isStatic) { 15702 dir.arg = processExpression(arg, context); 15703 } 15704 } 15705 } 15706 } 15707 }; 15708 function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) { 15709 { 15710 { 15711 validateBrowserExpression(node, context, asParams, asRawStatements); 15712 } 15713 return node; 15714 } 15715 } 15716 15717 const transformIf = createStructuralDirectiveTransform( 15718 /^(?:if|else|else-if)$/, 15719 (node, dir, context) => { 15720 return processIf(node, dir, context, (ifNode, branch, isRoot) => { 15721 const siblings = context.parent.children; 15722 let i = siblings.indexOf(ifNode); 15723 let key = 0; 15724 while (i-- >= 0) { 15725 const sibling = siblings[i]; 15726 if (sibling && sibling.type === 9) { 15727 key += sibling.branches.length; 15728 } 15729 } 15730 return () => { 15731 if (isRoot) { 15732 ifNode.codegenNode = createCodegenNodeForBranch( 15733 branch, 15734 key, 15735 context 15736 ); 15737 } else { 15738 const parentCondition = getParentCondition(ifNode.codegenNode); 15739 parentCondition.alternate = createCodegenNodeForBranch( 15740 branch, 15741 key + ifNode.branches.length - 1, 15742 context 15743 ); 15744 } 15745 }; 15746 }); 15747 } 15748 ); 15749 function processIf(node, dir, context, processCodegen) { 15750 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) { 15751 const loc = dir.exp ? dir.exp.loc : node.loc; 15752 context.onError( 15753 createCompilerError(28, dir.loc) 15754 ); 15755 dir.exp = createSimpleExpression(`true`, false, loc); 15756 } 15757 if (dir.exp) { 15758 validateBrowserExpression(dir.exp, context); 15759 } 15760 if (dir.name === "if") { 15761 const branch = createIfBranch(node, dir); 15762 const ifNode = { 15763 type: 9, 15764 loc: cloneLoc(node.loc), 15765 branches: [branch] 15766 }; 15767 context.replaceNode(ifNode); 15768 if (processCodegen) { 15769 return processCodegen(ifNode, branch, true); 15770 } 15771 } else { 15772 const siblings = context.parent.children; 15773 const comments = []; 15774 let i = siblings.indexOf(node); 15775 while (i-- >= -1) { 15776 const sibling = siblings[i]; 15777 if (sibling && sibling.type === 3) { 15778 context.removeNode(sibling); 15779 comments.unshift(sibling); 15780 continue; 15781 } 15782 if (sibling && sibling.type === 2 && !sibling.content.trim().length) { 15783 context.removeNode(sibling); 15784 continue; 15785 } 15786 if (sibling && sibling.type === 9) { 15787 if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) { 15788 context.onError( 15789 createCompilerError(30, node.loc) 15790 ); 15791 } 15792 context.removeNode(); 15793 const branch = createIfBranch(node, dir); 15794 if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition> 15795 !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) { 15796 branch.children = [...comments, ...branch.children]; 15797 } 15798 {
vendor: 6,237 bytes, lines 15799-16013
15799 const key = branch.userKey; 15800 if (key) { 15801 sibling.branches.forEach(({ userKey }) => { 15802 if (isSameKey(userKey, key)) { 15803 context.onError( 15804 createCompilerError( 15805 29, 15806 branch.userKey.loc 15807 ) 15808 ); 15809 } 15810 }); 15811 } 15812 } 15813 sibling.branches.push(branch); 15814 const onExit = processCodegen && processCodegen(sibling, branch, false); 15815 traverseNode(branch, context); 15816 if (onExit) onExit(); 15817 context.currentNode = null; 15818 } else { 15819 context.onError( 15820 createCompilerError(30, node.loc) 15821 ); 15822 } 15823 break; 15824 } 15825 } 15826 } 15827 function createIfBranch(node, dir) { 15828 const isTemplateIf = node.tagType === 3; 15829 return { 15830 type: 10, 15831 loc: node.loc, 15832 condition: dir.name === "else" ? void 0 : dir.exp, 15833 children: isTemplateIf && !findDir(node, "for") ? node.children : [node], 15834 userKey: findProp(node, `key`), 15835 isTemplateIf 15836 }; 15837 } 15838 function createCodegenNodeForBranch(branch, keyIndex, context) { 15839 if (branch.condition) { 15840 return createConditionalExpression( 15841 branch.condition, 15842 createChildrenCodegenNode(branch, keyIndex, context), 15843 // make sure to pass in asBlock: true so that the comment node call 15844 // closes the current block. 15845 createCallExpression(context.helper(CREATE_COMMENT), [ 15846 '"v-if"' , 15847 "true" 15848 ]) 15849 ); 15850 } else { 15851 return createChildrenCodegenNode(branch, keyIndex, context); 15852 } 15853 } 15854 function createChildrenCodegenNode(branch, keyIndex, context) { 15855 const { helper } = context; 15856 const keyProperty = createObjectProperty( 15857 `key`, 15858 createSimpleExpression( 15859 `${keyIndex}`, 15860 false, 15861 locStub, 15862 2 15863 ) 15864 ); 15865 const { children } = branch; 15866 const firstChild = children[0]; 15867 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1; 15868 if (needFragmentWrapper) { 15869 if (children.length === 1 && firstChild.type === 11) { 15870 const vnodeCall = firstChild.codegenNode; 15871 injectProp(vnodeCall, keyProperty, context); 15872 return vnodeCall; 15873 } else { 15874 let patchFlag = 64; 15875 if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) { 15876 patchFlag |= 2048; 15877 } 15878 return createVNodeCall( 15879 context, 15880 helper(FRAGMENT), 15881 createObjectExpression([keyProperty]), 15882 children, 15883 patchFlag, 15884 void 0, 15885 void 0, 15886 true, 15887 false, 15888 false, 15889 branch.loc 15890 ); 15891 } 15892 } else { 15893 const ret = firstChild.codegenNode; 15894 const vnodeCall = getMemoedVNodeCall(ret); 15895 if (vnodeCall.type === 13) { 15896 convertToBlock(vnodeCall, context); 15897 } 15898 injectProp(vnodeCall, keyProperty, context); 15899 return ret; 15900 } 15901 } 15902 function isSameKey(a, b) { 15903 if (!a || a.type !== b.type) { 15904 return false; 15905 } 15906 if (a.type === 6) { 15907 if (a.value.content !== b.value.content) { 15908 return false; 15909 } 15910 } else { 15911 const exp = a.exp; 15912 const branchExp = b.exp; 15913 if (exp.type !== branchExp.type) { 15914 return false; 15915 } 15916 if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) { 15917 return false; 15918 } 15919 } 15920 return true; 15921 } 15922 function getParentCondition(node) { 15923 while (true) { 15924 if (node.type === 19) { 15925 if (node.alternate.type === 19) { 15926 node = node.alternate; 15927 } else { 15928 return node; 15929 } 15930 } else if (node.type === 20) { 15931 node = node.value; 15932 } 15933 } 15934 } 15935 15936 const transformBind = (dir, _node, context) => { 15937 const { modifiers, loc } = dir; 15938 const arg = dir.arg; 15939 let { exp } = dir; 15940 if (exp && exp.type === 4 && !exp.content.trim()) { 15941 { 15942 exp = void 0; 15943 } 15944 } 15945 if (!exp) { 15946 if (arg.type !== 4 || !arg.isStatic) { 15947 context.onError( 15948 createCompilerError( 15949 52, 15950 arg.loc 15951 ) 15952 ); 15953 return { 15954 props: [ 15955 createObjectProperty(arg, createSimpleExpression("", true, loc)) 15956 ] 15957 }; 15958 } 15959 transformBindShorthand(dir); 15960 exp = dir.exp; 15961 } 15962 if (arg.type !== 4) { 15963 arg.children.unshift(`(`); 15964 arg.children.push(`) || ""`); 15965 } else if (!arg.isStatic) { 15966 arg.content = arg.content ? `${arg.content} || ""` : `""`; 15967 } 15968 if (modifiers.some((mod) => mod.content === "camel")) { 15969 if (arg.type === 4) { 15970 if (arg.isStatic) { 15971 arg.content = camelize(arg.content); 15972 } else { 15973 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`; 15974 } 15975 } else { 15976 arg.children.unshift(`${context.helperString(CAMELIZE)}(`); 15977 arg.children.push(`)`); 15978 } 15979 } 15980 if (!context.inSSR) { 15981 if (modifiers.some((mod) => mod.content === "prop")) { 15982 injectPrefix(arg, "."); 15983 } 15984 if (modifiers.some((mod) => mod.content === "attr")) { 15985 injectPrefix(arg, "^"); 15986 } 15987 } 15988 return { 15989 props: [createObjectProperty(arg, exp)] 15990 }; 15991 }; 15992 const transformBindShorthand = (dir, context) => { 15993 const arg = dir.arg; 15994 const propName = camelize(arg.content); 15995 dir.exp = createSimpleExpression(propName, false, arg.loc); 15996 }; 15997 const injectPrefix = (arg, prefix) => { 15998 if (arg.type === 4) { 15999 if (arg.isStatic) { 16000 arg.content = prefix + arg.content; 16001 } else { 16002 arg.content = `\`${prefix}\${${arg.content}}\``; 16003 } 16004 } else { 16005 arg.children.unshift(`'${prefix}' + (`); 16006 arg.children.push(`)`); 16007 } 16008 }; 16009 16010 const transformFor = createStructuralDirectiveTransform( 16011 "for", 16012 (node, dir, context) => { 16013 const { helper, removeHelper } = context;
vendor: 4,933 bytes, lines 16014-16143
16014 return processFor(node, dir, context, (forNode) => { 16015 const renderExp = createCallExpression(helper(RENDER_LIST), [ 16016 forNode.source 16017 ]); 16018 const isTemplate = isTemplateNode(node); 16019 const memo = findDir(node, "memo"); 16020 const keyProp = findProp(node, `key`, false, true); 16021 const isDirKey = keyProp && keyProp.type === 7; 16022 if (isDirKey && !keyProp.exp) { 16023 transformBindShorthand(keyProp); 16024 } 16025 let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp); 16026 const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null; 16027 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0; 16028 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256; 16029 forNode.codegenNode = createVNodeCall( 16030 context, 16031 helper(FRAGMENT), 16032 void 0, 16033 renderExp, 16034 fragmentFlag, 16035 void 0, 16036 void 0, 16037 true, 16038 !isStableFragment, 16039 false, 16040 node.loc 16041 ); 16042 return () => { 16043 let childBlock; 16044 const { children } = forNode; 16045 if (isTemplate) { 16046 node.children.some((c) => { 16047 if (c.type === 1) { 16048 const key = findProp(c, "key"); 16049 if (key) { 16050 context.onError( 16051 createCompilerError( 16052 33, 16053 key.loc 16054 ) 16055 ); 16056 return true; 16057 } 16058 } 16059 }); 16060 } 16061 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1; 16062 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null; 16063 if (slotOutlet) { 16064 childBlock = slotOutlet.codegenNode; 16065 if (isTemplate && keyProperty) { 16066 injectProp(childBlock, keyProperty, context); 16067 } 16068 } else if (needFragmentWrapper) { 16069 childBlock = createVNodeCall( 16070 context, 16071 helper(FRAGMENT), 16072 keyProperty ? createObjectExpression([keyProperty]) : void 0, 16073 node.children, 16074 64, 16075 void 0, 16076 void 0, 16077 true, 16078 void 0, 16079 false 16080 ); 16081 } else { 16082 childBlock = children[0].codegenNode; 16083 if (isTemplate && keyProperty) { 16084 injectProp(childBlock, keyProperty, context); 16085 } 16086 if (childBlock.isBlock !== !isStableFragment) { 16087 if (childBlock.isBlock) { 16088 removeHelper(OPEN_BLOCK); 16089 removeHelper( 16090 getVNodeBlockHelper(context.inSSR, childBlock.isComponent) 16091 ); 16092 } else { 16093 removeHelper( 16094 getVNodeHelper(context.inSSR, childBlock.isComponent) 16095 ); 16096 } 16097 } 16098 childBlock.isBlock = !isStableFragment; 16099 if (childBlock.isBlock) { 16100 helper(OPEN_BLOCK); 16101 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent)); 16102 } else { 16103 helper(getVNodeHelper(context.inSSR, childBlock.isComponent)); 16104 } 16105 } 16106 if (memo) { 16107 const loop = createFunctionExpression( 16108 createForLoopParams(forNode.parseResult, [ 16109 createSimpleExpression(`_cached`) 16110 ]) 16111 ); 16112 loop.body = createBlockStatement([ 16113 createCompoundExpression([`const _memo = (`, memo.exp, `)`]), 16114 createCompoundExpression([ 16115 `if (_cached`, 16116 ...keyExp ? [` && _cached.key === `, keyExp] : [], 16117 ` && ${context.helperString( 16118 IS_MEMO_SAME 16119 )}(_cached, _memo)) return _cached` 16120 ]), 16121 createCompoundExpression([`const _item = `, childBlock]), 16122 createSimpleExpression(`_item.memo = _memo`), 16123 createSimpleExpression(`return _item`) 16124 ]); 16125 renderExp.arguments.push( 16126 loop, 16127 createSimpleExpression(`_cache`), 16128 createSimpleExpression(String(context.cached.length)) 16129 ); 16130 context.cached.push(null); 16131 } else { 16132 renderExp.arguments.push( 16133 createFunctionExpression( 16134 createForLoopParams(forNode.parseResult), 16135 childBlock, 16136 true 16137 ) 16138 ); 16139 } 16140 }; 16141 }); 16142 } 16143 );
vendor: 40,503 bytes, lines 16144-17382
16144 function processFor(node, dir, context, processCodegen) { 16145 if (!dir.exp) { 16146 context.onError( 16147 createCompilerError(31, dir.loc) 16148 ); 16149 return; 16150 } 16151 const parseResult = dir.forParseResult; 16152 if (!parseResult) { 16153 context.onError( 16154 createCompilerError(32, dir.loc) 16155 ); 16156 return; 16157 } 16158 finalizeForParseResult(parseResult, context); 16159 const { addIdentifiers, removeIdentifiers, scopes } = context; 16160 const { source, value, key, index } = parseResult; 16161 const forNode = { 16162 type: 11, 16163 loc: dir.loc, 16164 source, 16165 valueAlias: value, 16166 keyAlias: key, 16167 objectIndexAlias: index, 16168 parseResult, 16169 children: isTemplateNode(node) ? node.children : [node] 16170 }; 16171 context.replaceNode(forNode); 16172 scopes.vFor++; 16173 const onExit = processCodegen && processCodegen(forNode); 16174 return () => { 16175 scopes.vFor--; 16176 if (onExit) onExit(); 16177 }; 16178 } 16179 function finalizeForParseResult(result, context) { 16180 if (result.finalized) return; 16181 { 16182 validateBrowserExpression(result.source, context); 16183 if (result.key) { 16184 validateBrowserExpression( 16185 result.key, 16186 context, 16187 true 16188 ); 16189 } 16190 if (result.index) { 16191 validateBrowserExpression( 16192 result.index, 16193 context, 16194 true 16195 ); 16196 } 16197 if (result.value) { 16198 validateBrowserExpression( 16199 result.value, 16200 context, 16201 true 16202 ); 16203 } 16204 } 16205 result.finalized = true; 16206 } 16207 function createForLoopParams({ value, key, index }, memoArgs = []) { 16208 return createParamsList([value, key, index, ...memoArgs]); 16209 } 16210 function createParamsList(args) { 16211 let i = args.length; 16212 while (i--) { 16213 if (args[i]) break; 16214 } 16215 return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false)); 16216 } 16217 16218 const defaultFallback = createSimpleExpression(`undefined`, false); 16219 const trackSlotScopes = (node, context) => { 16220 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) { 16221 const vSlot = findDir(node, "slot"); 16222 if (vSlot) { 16223 vSlot.exp; 16224 context.scopes.vSlot++; 16225 return () => { 16226 context.scopes.vSlot--; 16227 }; 16228 } 16229 } 16230 }; 16231 const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression( 16232 props, 16233 children, 16234 false, 16235 true, 16236 children.length ? children[0].loc : loc 16237 ); 16238 function buildSlots(node, context, buildSlotFn = buildClientSlotFn) { 16239 context.helper(WITH_CTX); 16240 const { children, loc } = node; 16241 const slotsProperties = []; 16242 const dynamicSlots = []; 16243 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0; 16244 const onComponentSlot = findDir(node, "slot", true); 16245 if (onComponentSlot) { 16246 const { arg, exp } = onComponentSlot; 16247 if (arg && !isStaticExp(arg)) { 16248 hasDynamicSlots = true; 16249 } 16250 slotsProperties.push( 16251 createObjectProperty( 16252 arg || createSimpleExpression("default", true), 16253 buildSlotFn(exp, void 0, children, loc) 16254 ) 16255 ); 16256 } 16257 let hasTemplateSlots = false; 16258 let hasNamedDefaultSlot = false; 16259 const implicitDefaultChildren = []; 16260 const seenSlotNames = /* @__PURE__ */ new Set(); 16261 let conditionalBranchIndex = 0; 16262 for (let i = 0; i < children.length; i++) { 16263 const slotElement = children[i]; 16264 let slotDir; 16265 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) { 16266 if (slotElement.type !== 3) { 16267 implicitDefaultChildren.push(slotElement); 16268 } 16269 continue; 16270 } 16271 if (onComponentSlot) { 16272 context.onError( 16273 createCompilerError(37, slotDir.loc) 16274 ); 16275 break; 16276 } 16277 hasTemplateSlots = true; 16278 const { children: slotChildren, loc: slotLoc } = slotElement; 16279 const { 16280 arg: slotName = createSimpleExpression(`default`, true), 16281 exp: slotProps, 16282 loc: dirLoc 16283 } = slotDir; 16284 let staticSlotName; 16285 if (isStaticExp(slotName)) { 16286 staticSlotName = slotName ? slotName.content : `default`; 16287 } else { 16288 hasDynamicSlots = true; 16289 } 16290 const vFor = findDir(slotElement, "for"); 16291 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc); 16292 let vIf; 16293 let vElse; 16294 if (vIf = findDir(slotElement, "if")) { 16295 hasDynamicSlots = true; 16296 dynamicSlots.push( 16297 createConditionalExpression( 16298 vIf.exp, 16299 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), 16300 defaultFallback 16301 ) 16302 ); 16303 } else if (vElse = findDir( 16304 slotElement, 16305 /^else(?:-if)?$/, 16306 true 16307 /* allowEmpty */ 16308 )) { 16309 let j = i; 16310 let prev; 16311 while (j--) { 16312 prev = children[j]; 16313 if (prev.type !== 3 && isNonWhitespaceContent(prev)) { 16314 break; 16315 } 16316 } 16317 if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) { 16318 let conditional = dynamicSlots[dynamicSlots.length - 1]; 16319 while (conditional.alternate.type === 19) { 16320 conditional = conditional.alternate; 16321 } 16322 conditional.alternate = vElse.exp ? createConditionalExpression( 16323 vElse.exp, 16324 buildDynamicSlot( 16325 slotName, 16326 slotFunction, 16327 conditionalBranchIndex++ 16328 ), 16329 defaultFallback 16330 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++); 16331 } else { 16332 context.onError( 16333 createCompilerError(30, vElse.loc) 16334 ); 16335 } 16336 } else if (vFor) { 16337 hasDynamicSlots = true; 16338 const parseResult = vFor.forParseResult; 16339 if (parseResult) { 16340 finalizeForParseResult(parseResult, context); 16341 dynamicSlots.push( 16342 createCallExpression(context.helper(RENDER_LIST), [ 16343 parseResult.source, 16344 createFunctionExpression( 16345 createForLoopParams(parseResult), 16346 buildDynamicSlot(slotName, slotFunction), 16347 true 16348 ) 16349 ]) 16350 ); 16351 } else { 16352 context.onError( 16353 createCompilerError( 16354 32, 16355 vFor.loc 16356 ) 16357 ); 16358 } 16359 } else { 16360 if (staticSlotName) { 16361 if (seenSlotNames.has(staticSlotName)) { 16362 context.onError( 16363 createCompilerError( 16364 38, 16365 dirLoc 16366 ) 16367 ); 16368 continue; 16369 } 16370 seenSlotNames.add(staticSlotName); 16371 if (staticSlotName === "default") { 16372 hasNamedDefaultSlot = true; 16373 } 16374 } 16375 slotsProperties.push(createObjectProperty(slotName, slotFunction)); 16376 } 16377 } 16378 if (!onComponentSlot) { 16379 const buildDefaultSlotProperty = (props, children2) => { 16380 const fn = buildSlotFn(props, void 0, children2, loc); 16381 return createObjectProperty(`default`, fn); 16382 }; 16383 if (!hasTemplateSlots) { 16384 slotsProperties.push(buildDefaultSlotProperty(void 0, children)); 16385 } else if (implicitDefaultChildren.length && // #3766 16386 // with whitespace: 'preserve', whitespaces between slots will end up in 16387 // implicitDefaultChildren. Ignore if all implicit children are whitespaces. 16388 implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) { 16389 if (hasNamedDefaultSlot) { 16390 context.onError( 16391 createCompilerError( 16392 39, 16393 implicitDefaultChildren[0].loc 16394 ) 16395 ); 16396 } else { 16397 slotsProperties.push( 16398 buildDefaultSlotProperty(void 0, implicitDefaultChildren) 16399 ); 16400 } 16401 } 16402 } 16403 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1; 16404 let slots = createObjectExpression( 16405 slotsProperties.concat( 16406 createObjectProperty( 16407 `_`, 16408 // 2 = compiled but dynamic = can skip normalization, but must run diff 16409 // 1 = compiled and static = can skip normalization AND diff as optimized 16410 createSimpleExpression( 16411 slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ), 16412 false 16413 ) 16414 ) 16415 ), 16416 loc 16417 ); 16418 if (dynamicSlots.length) { 16419 slots = createCallExpression(context.helper(CREATE_SLOTS), [ 16420 slots, 16421 createArrayExpression(dynamicSlots) 16422 ]); 16423 } 16424 return { 16425 slots, 16426 hasDynamicSlots 16427 }; 16428 } 16429 function buildDynamicSlot(name, fn, index) { 16430 const props = [ 16431 createObjectProperty(`name`, name), 16432 createObjectProperty(`fn`, fn) 16433 ]; 16434 if (index != null) { 16435 props.push( 16436 createObjectProperty(`key`, createSimpleExpression(String(index), true)) 16437 ); 16438 } 16439 return createObjectExpression(props); 16440 } 16441 function hasForwardedSlots(children) { 16442 for (let i = 0; i < children.length; i++) { 16443 const child = children[i]; 16444 switch (child.type) { 16445 case 1: 16446 if (child.tagType === 2 || hasForwardedSlots(child.children)) { 16447 return true; 16448 } 16449 break; 16450 case 9: 16451 if (hasForwardedSlots(child.branches)) return true; 16452 break; 16453 case 10: 16454 case 11: 16455 if (hasForwardedSlots(child.children)) return true; 16456 break; 16457 } 16458 } 16459 return false; 16460 } 16461 function isNonWhitespaceContent(node) { 16462 if (node.type !== 2 && node.type !== 12) 16463 return true; 16464 return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content); 16465 } 16466 16467 const directiveImportMap = /* @__PURE__ */ new WeakMap(); 16468 const transformElement = (node, context) => { 16469 return function postTransformElement() { 16470 node = context.currentNode; 16471 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) { 16472 return; 16473 } 16474 const { tag, props } = node; 16475 const isComponent = node.tagType === 1; 16476 let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`; 16477 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT; 16478 let vnodeProps; 16479 let vnodeChildren; 16480 let patchFlag = 0; 16481 let vnodeDynamicProps; 16482 let dynamicPropNames; 16483 let vnodeDirectives; 16484 let shouldUseBlock = ( 16485 // dynamic component may resolve to plain elements 16486 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block 16487 // updates inside get proper isSVG flag at runtime. (#639, #643) 16488 // This is technically web-specific, but splitting the logic out of core 16489 // leads to too much unnecessary complexity. 16490 (tag === "svg" || tag === "foreignObject" || tag === "math") 16491 ); 16492 if (props.length > 0) { 16493 const propsBuildResult = buildProps( 16494 node, 16495 context, 16496 void 0, 16497 isComponent, 16498 isDynamicComponent 16499 ); 16500 vnodeProps = propsBuildResult.props; 16501 patchFlag = propsBuildResult.patchFlag; 16502 dynamicPropNames = propsBuildResult.dynamicPropNames; 16503 const directives = propsBuildResult.directives; 16504 vnodeDirectives = directives && directives.length ? createArrayExpression( 16505 directives.map((dir) => buildDirectiveArgs(dir, context)) 16506 ) : void 0; 16507 if (propsBuildResult.shouldUseBlock) { 16508 shouldUseBlock = true; 16509 } 16510 } 16511 if (node.children.length > 0) { 16512 if (vnodeTag === KEEP_ALIVE) { 16513 shouldUseBlock = true; 16514 patchFlag |= 1024; 16515 if (node.children.length > 1) { 16516 context.onError( 16517 createCompilerError(46, { 16518 start: node.children[0].loc.start, 16519 end: node.children[node.children.length - 1].loc.end, 16520 source: "" 16521 }) 16522 ); 16523 } 16524 } 16525 const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling 16526 vnodeTag !== TELEPORT && // explained above. 16527 vnodeTag !== KEEP_ALIVE; 16528 if (shouldBuildAsSlots) { 16529 const { slots, hasDynamicSlots } = buildSlots(node, context); 16530 vnodeChildren = slots; 16531 if (hasDynamicSlots) { 16532 patchFlag |= 1024; 16533 } 16534 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) { 16535 const child = node.children[0]; 16536 const type = child.type; 16537 const hasDynamicTextChild = type === 5 || type === 8; 16538 if (hasDynamicTextChild && getConstantType(child, context) === 0) { 16539 patchFlag |= 1; 16540 } 16541 if (hasDynamicTextChild || type === 2) { 16542 vnodeChildren = child; 16543 } else { 16544 vnodeChildren = node.children; 16545 } 16546 } else { 16547 vnodeChildren = node.children; 16548 } 16549 } 16550 if (dynamicPropNames && dynamicPropNames.length) { 16551 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames); 16552 } 16553 node.codegenNode = createVNodeCall( 16554 context, 16555 vnodeTag, 16556 vnodeProps, 16557 vnodeChildren, 16558 patchFlag === 0 ? void 0 : patchFlag, 16559 vnodeDynamicProps, 16560 vnodeDirectives, 16561 !!shouldUseBlock, 16562 false, 16563 isComponent, 16564 node.loc 16565 ); 16566 }; 16567 }; 16568 function resolveComponentType(node, context, ssr = false) { 16569 let { tag } = node; 16570 const isExplicitDynamic = isComponentTag(tag); 16571 const isProp = findProp( 16572 node, 16573 "is", 16574 false, 16575 true 16576 /* allow empty */ 16577 ); 16578 if (isProp) { 16579 if (isExplicitDynamic || false) { 16580 let exp; 16581 if (isProp.type === 6) { 16582 exp = isProp.value && createSimpleExpression(isProp.value.content, true); 16583 } else { 16584 exp = isProp.exp; 16585 if (!exp) { 16586 exp = createSimpleExpression(`is`, false, isProp.arg.loc); 16587 } 16588 } 16589 if (exp) { 16590 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [ 16591 exp 16592 ]); 16593 } 16594 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) { 16595 tag = isProp.value.content.slice(4); 16596 } 16597 } 16598 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag); 16599 if (builtIn) { 16600 if (!ssr) context.helper(builtIn); 16601 return builtIn; 16602 } 16603 context.helper(RESOLVE_COMPONENT); 16604 context.components.add(tag); 16605 return toValidAssetId(tag, `component`); 16606 } 16607 function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) { 16608 const { tag, loc: elementLoc, children } = node; 16609 let properties = []; 16610 const mergeArgs = []; 16611 const runtimeDirectives = []; 16612 const hasChildren = children.length > 0; 16613 let shouldUseBlock = false; 16614 let patchFlag = 0; 16615 let hasRef = false; 16616 let hasClassBinding = false; 16617 let hasStyleBinding = false; 16618 let hasHydrationEventBinding = false; 16619 let hasDynamicKeys = false; 16620 let hasVnodeHook = false; 16621 const dynamicPropNames = []; 16622 const pushMergeArg = (arg) => { 16623 if (properties.length) { 16624 mergeArgs.push( 16625 createObjectExpression(dedupeProperties(properties), elementLoc) 16626 ); 16627 properties = []; 16628 } 16629 if (arg) mergeArgs.push(arg); 16630 }; 16631 const pushRefVForMarker = () => { 16632 if (context.scopes.vFor > 0) { 16633 properties.push( 16634 createObjectProperty( 16635 createSimpleExpression("ref_for", true), 16636 createSimpleExpression("true") 16637 ) 16638 ); 16639 } 16640 }; 16641 const analyzePatchFlag = ({ key, value }) => { 16642 if (isStaticExp(key)) { 16643 const name = key.content; 16644 const isEventHandler = isOn(name); 16645 if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click 16646 // dedicated fast path. 16647 name.toLowerCase() !== "onclick" && // omit v-model handlers 16648 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks 16649 !isReservedProp(name)) { 16650 hasHydrationEventBinding = true; 16651 } 16652 if (isEventHandler && isReservedProp(name)) { 16653 hasVnodeHook = true; 16654 } 16655 if (isEventHandler && value.type === 14) { 16656 value = value.arguments[0]; 16657 } 16658 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) { 16659 return; 16660 } 16661 if (name === "ref") { 16662 hasRef = true; 16663 } else if (name === "class") { 16664 hasClassBinding = true; 16665 } else if (name === "style") { 16666 hasStyleBinding = true; 16667 } else if (name !== "key" && !dynamicPropNames.includes(name)) { 16668 dynamicPropNames.push(name); 16669 } 16670 if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) { 16671 dynamicPropNames.push(name); 16672 } 16673 } else { 16674 hasDynamicKeys = true; 16675 } 16676 }; 16677 for (let i = 0; i < props.length; i++) { 16678 const prop = props[i]; 16679 if (prop.type === 6) { 16680 const { loc, name, nameLoc, value } = prop; 16681 let isStatic = true; 16682 if (name === "ref") { 16683 hasRef = true; 16684 pushRefVForMarker(); 16685 } 16686 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) { 16687 continue; 16688 } 16689 properties.push( 16690 createObjectProperty( 16691 createSimpleExpression(name, true, nameLoc), 16692 createSimpleExpression( 16693 value ? value.content : "", 16694 isStatic, 16695 value ? value.loc : loc 16696 ) 16697 ) 16698 ); 16699 } else { 16700 const { name, arg, exp, loc, modifiers } = prop; 16701 const isVBind = name === "bind"; 16702 const isVOn = name === "on"; 16703 if (name === "slot") { 16704 if (!isComponent) { 16705 context.onError( 16706 createCompilerError(40, loc) 16707 ); 16708 } 16709 continue; 16710 } 16711 if (name === "once" || name === "memo") { 16712 continue; 16713 } 16714 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) { 16715 continue; 16716 } 16717 if (isVOn && ssr) { 16718 continue; 16719 } 16720 if ( 16721 // #938: elements with dynamic keys should be forced into blocks 16722 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked 16723 // before children 16724 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update") 16725 ) { 16726 shouldUseBlock = true; 16727 } 16728 if (isVBind && isStaticArgOf(arg, "ref")) { 16729 pushRefVForMarker(); 16730 } 16731 if (!arg && (isVBind || isVOn)) { 16732 hasDynamicKeys = true; 16733 if (exp) { 16734 if (isVBind) { 16735 pushRefVForMarker(); 16736 pushMergeArg(); 16737 mergeArgs.push(exp); 16738 } else { 16739 pushMergeArg({ 16740 type: 14, 16741 loc, 16742 callee: context.helper(TO_HANDLERS), 16743 arguments: isComponent ? [exp] : [exp, `true`] 16744 }); 16745 } 16746 } else { 16747 context.onError( 16748 createCompilerError( 16749 isVBind ? 34 : 35, 16750 loc 16751 ) 16752 ); 16753 } 16754 continue; 16755 } 16756 if (isVBind && modifiers.some((mod) => mod.content === "prop")) { 16757 patchFlag |= 32; 16758 } 16759 const directiveTransform = context.directiveTransforms[name]; 16760 if (directiveTransform) { 16761 const { props: props2, needRuntime } = directiveTransform(prop, node, context); 16762 !ssr && props2.forEach(analyzePatchFlag); 16763 if (isVOn && arg && !isStaticExp(arg)) { 16764 pushMergeArg(createObjectExpression(props2, elementLoc)); 16765 } else { 16766 properties.push(...props2); 16767 } 16768 if (needRuntime) { 16769 runtimeDirectives.push(prop); 16770 if (isSymbol(needRuntime)) { 16771 directiveImportMap.set(prop, needRuntime); 16772 } 16773 } 16774 } else if (!isBuiltInDirective(name)) { 16775 runtimeDirectives.push(prop); 16776 if (hasChildren) { 16777 shouldUseBlock = true; 16778 } 16779 } 16780 } 16781 } 16782 let propsExpression = void 0; 16783 if (mergeArgs.length) { 16784 pushMergeArg(); 16785 if (mergeArgs.length > 1) { 16786 propsExpression = createCallExpression( 16787 context.helper(MERGE_PROPS), 16788 mergeArgs, 16789 elementLoc 16790 ); 16791 } else { 16792 propsExpression = mergeArgs[0]; 16793 } 16794 } else if (properties.length) { 16795 propsExpression = createObjectExpression( 16796 dedupeProperties(properties), 16797 elementLoc 16798 ); 16799 } 16800 if (hasDynamicKeys) { 16801 patchFlag |= 16; 16802 } else { 16803 if (hasClassBinding && !isComponent) { 16804 patchFlag |= 2; 16805 } 16806 if (hasStyleBinding && !isComponent) { 16807 patchFlag |= 4; 16808 } 16809 if (dynamicPropNames.length) { 16810 patchFlag |= 8; 16811 } 16812 if (hasHydrationEventBinding) { 16813 patchFlag |= 32; 16814 } 16815 } 16816 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) { 16817 patchFlag |= 512; 16818 } 16819 if (!context.inSSR && propsExpression) { 16820 switch (propsExpression.type) { 16821 case 15: 16822 let classKeyIndex = -1; 16823 let styleKeyIndex = -1; 16824 let hasDynamicKey = false; 16825 for (let i = 0; i < propsExpression.properties.length; i++) { 16826 const key = propsExpression.properties[i].key; 16827 if (isStaticExp(key)) { 16828 if (key.content === "class") { 16829 classKeyIndex = i; 16830 } else if (key.content === "style") { 16831 styleKeyIndex = i; 16832 } 16833 } else if (!key.isHandlerKey) { 16834 hasDynamicKey = true; 16835 } 16836 } 16837 const classProp = propsExpression.properties[classKeyIndex]; 16838 const styleProp = propsExpression.properties[styleKeyIndex]; 16839 if (!hasDynamicKey) { 16840 if (classProp && !isStaticExp(classProp.value)) { 16841 classProp.value = createCallExpression( 16842 context.helper(NORMALIZE_CLASS), 16843 [classProp.value] 16844 ); 16845 } 16846 if (styleProp && // the static style is compiled into an object, 16847 // so use `hasStyleBinding` to ensure that it is a dynamic style binding 16848 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist, 16849 // v-bind:style with static literal object 16850 styleProp.value.type === 17)) { 16851 styleProp.value = createCallExpression( 16852 context.helper(NORMALIZE_STYLE), 16853 [styleProp.value] 16854 ); 16855 } 16856 } else { 16857 propsExpression = createCallExpression( 16858 context.helper(NORMALIZE_PROPS), 16859 [propsExpression] 16860 ); 16861 } 16862 break; 16863 case 14: 16864 break; 16865 default: 16866 propsExpression = createCallExpression( 16867 context.helper(NORMALIZE_PROPS), 16868 [ 16869 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [ 16870 propsExpression 16871 ]) 16872 ] 16873 ); 16874 break; 16875 } 16876 } 16877 return { 16878 props: propsExpression, 16879 directives: runtimeDirectives, 16880 patchFlag, 16881 dynamicPropNames, 16882 shouldUseBlock 16883 }; 16884 } 16885 function dedupeProperties(properties) { 16886 const knownProps = /* @__PURE__ */ new Map(); 16887 const deduped = []; 16888 for (let i = 0; i < properties.length; i++) { 16889 const prop = properties[i]; 16890 if (prop.key.type === 8 || !prop.key.isStatic) { 16891 deduped.push(prop); 16892 continue; 16893 } 16894 const name = prop.key.content; 16895 const existing = knownProps.get(name); 16896 if (existing) { 16897 if (name === "style" || name === "class" || isOn(name)) { 16898 mergeAsArray(existing, prop); 16899 } 16900 } else { 16901 knownProps.set(name, prop); 16902 deduped.push(prop); 16903 } 16904 } 16905 return deduped; 16906 } 16907 function mergeAsArray(existing, incoming) { 16908 if (existing.value.type === 17) { 16909 existing.value.elements.push(incoming.value); 16910 } else { 16911 existing.value = createArrayExpression( 16912 [existing.value, incoming.value], 16913 existing.loc 16914 ); 16915 } 16916 } 16917 function buildDirectiveArgs(dir, context) { 16918 const dirArgs = []; 16919 const runtime = directiveImportMap.get(dir); 16920 if (runtime) { 16921 dirArgs.push(context.helperString(runtime)); 16922 } else { 16923 { 16924 context.helper(RESOLVE_DIRECTIVE); 16925 context.directives.add(dir.name); 16926 dirArgs.push(toValidAssetId(dir.name, `directive`)); 16927 } 16928 } 16929 const { loc } = dir; 16930 if (dir.exp) dirArgs.push(dir.exp); 16931 if (dir.arg) { 16932 if (!dir.exp) { 16933 dirArgs.push(`void 0`); 16934 } 16935 dirArgs.push(dir.arg); 16936 } 16937 if (Object.keys(dir.modifiers).length) { 16938 if (!dir.arg) { 16939 if (!dir.exp) { 16940 dirArgs.push(`void 0`); 16941 } 16942 dirArgs.push(`void 0`); 16943 } 16944 const trueExpression = createSimpleExpression(`true`, false, loc); 16945 dirArgs.push( 16946 createObjectExpression( 16947 dir.modifiers.map( 16948 (modifier) => createObjectProperty(modifier, trueExpression) 16949 ), 16950 loc 16951 ) 16952 ); 16953 } 16954 return createArrayExpression(dirArgs, dir.loc); 16955 } 16956 function stringifyDynamicPropNames(props) { 16957 let propsNamesString = `[`; 16958 for (let i = 0, l = props.length; i < l; i++) { 16959 propsNamesString += JSON.stringify(props[i]); 16960 if (i < l - 1) propsNamesString += ", "; 16961 } 16962 return propsNamesString + `]`; 16963 } 16964 function isComponentTag(tag) { 16965 return tag === "component" || tag === "Component"; 16966 } 16967 16968 const transformSlotOutlet = (node, context) => { 16969 if (isSlotOutlet(node)) { 16970 const { children, loc } = node; 16971 const { slotName, slotProps } = processSlotOutlet(node, context); 16972 const slotArgs = [ 16973 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`, 16974 slotName, 16975 "{}", 16976 "undefined", 16977 "true" 16978 ]; 16979 let expectedLen = 2; 16980 if (slotProps) { 16981 slotArgs[2] = slotProps; 16982 expectedLen = 3; 16983 } 16984 if (children.length) { 16985 slotArgs[3] = createFunctionExpression([], children, false, false, loc); 16986 expectedLen = 4; 16987 } 16988 if (context.scopeId && !context.slotted) { 16989 expectedLen = 5; 16990 } 16991 slotArgs.splice(expectedLen); 16992 node.codegenNode = createCallExpression( 16993 context.helper(RENDER_SLOT), 16994 slotArgs, 16995 loc 16996 ); 16997 } 16998 }; 16999 function processSlotOutlet(node, context) { 17000 let slotName = `"default"`; 17001 let slotProps = void 0; 17002 const nonNameProps = []; 17003 for (let i = 0; i < node.props.length; i++) { 17004 const p = node.props[i]; 17005 if (p.type === 6) { 17006 if (p.value) { 17007 if (p.name === "name") { 17008 slotName = JSON.stringify(p.value.content); 17009 } else { 17010 p.name = camelize(p.name); 17011 nonNameProps.push(p); 17012 } 17013 } 17014 } else { 17015 if (p.name === "bind" && isStaticArgOf(p.arg, "name")) { 17016 if (p.exp) { 17017 slotName = p.exp; 17018 } else if (p.arg && p.arg.type === 4) { 17019 const name = camelize(p.arg.content); 17020 slotName = p.exp = createSimpleExpression(name, false, p.arg.loc); 17021 } 17022 } else { 17023 if (p.name === "bind" && p.arg && isStaticExp(p.arg)) { 17024 p.arg.content = camelize(p.arg.content); 17025 } 17026 nonNameProps.push(p); 17027 } 17028 } 17029 } 17030 if (nonNameProps.length > 0) { 17031 const { props, directives } = buildProps( 17032 node, 17033 context, 17034 nonNameProps, 17035 false, 17036 false 17037 ); 17038 slotProps = props; 17039 if (directives.length) { 17040 context.onError( 17041 createCompilerError( 17042 36, 17043 directives[0].loc 17044 ) 17045 ); 17046 } 17047 } 17048 return { 17049 slotName, 17050 slotProps 17051 }; 17052 } 17053 17054 const transformOn$1 = (dir, node, context, augmentor) => { 17055 const { loc, modifiers, arg } = dir; 17056 if (!dir.exp && !modifiers.length) { 17057 context.onError(createCompilerError(35, loc)); 17058 } 17059 let eventName; 17060 if (arg.type === 4) { 17061 if (arg.isStatic) { 17062 let rawName = arg.content; 17063 if (rawName.startsWith("vnode")) { 17064 context.onError(createCompilerError(51, arg.loc)); 17065 } 17066 if (rawName.startsWith("vue:")) { 17067 rawName = `vnode-${rawName.slice(4)}`; 17068 } 17069 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? ( 17070 // for non-element and vnode lifecycle event listeners, auto convert 17071 // it to camelCase. See issue #2249 17072 toHandlerKey(camelize(rawName)) 17073 ) : ( 17074 // preserve case for plain element listeners that have uppercase 17075 // letters, as these may be custom elements' custom events 17076 `on:${rawName}` 17077 ); 17078 eventName = createSimpleExpression(eventString, true, arg.loc); 17079 } else { 17080 eventName = createCompoundExpression([ 17081 `${context.helperString(TO_HANDLER_KEY)}(`, 17082 arg, 17083 `)` 17084 ]); 17085 } 17086 } else { 17087 eventName = arg; 17088 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`); 17089 eventName.children.push(`)`); 17090 } 17091 let exp = dir.exp; 17092 if (exp && !exp.content.trim()) { 17093 exp = void 0; 17094 } 17095 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce; 17096 if (exp) { 17097 const isMemberExp = isMemberExpression(exp); 17098 const isInlineStatement = !(isMemberExp || isFnExpression(exp)); 17099 const hasMultipleStatements = exp.content.includes(`;`); 17100 { 17101 validateBrowserExpression( 17102 exp, 17103 context, 17104 false, 17105 hasMultipleStatements 17106 ); 17107 } 17108 if (isInlineStatement || shouldCache && isMemberExp) { 17109 exp = createCompoundExpression([ 17110 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`, 17111 exp, 17112 hasMultipleStatements ? `}` : `)` 17113 ]); 17114 } 17115 } 17116 let ret = { 17117 props: [ 17118 createObjectProperty( 17119 eventName, 17120 exp || createSimpleExpression(`() => {}`, false, loc) 17121 ) 17122 ] 17123 }; 17124 if (augmentor) { 17125 ret = augmentor(ret); 17126 } 17127 if (shouldCache) { 17128 ret.props[0].value = context.cache(ret.props[0].value); 17129 } 17130 ret.props.forEach((p) => p.key.isHandlerKey = true); 17131 return ret; 17132 }; 17133 17134 const transformText = (node, context) => { 17135 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) { 17136 return () => { 17137 const children = node.children; 17138 let currentContainer = void 0; 17139 let hasText = false; 17140 for (let i = 0; i < children.length; i++) { 17141 const child = children[i]; 17142 if (isText$1(child)) { 17143 hasText = true; 17144 for (let j = i + 1; j < children.length; j++) { 17145 const next = children[j]; 17146 if (isText$1(next)) { 17147 if (!currentContainer) { 17148 currentContainer = children[i] = createCompoundExpression( 17149 [child], 17150 child.loc 17151 ); 17152 } 17153 currentContainer.children.push(` + `, next); 17154 children.splice(j, 1); 17155 j--; 17156 } else { 17157 currentContainer = void 0; 17158 break; 17159 } 17160 } 17161 } 17162 } 17163 if (!hasText || // if this is a plain element with a single text child, leave it 17164 // as-is since the runtime has dedicated fast path for this by directly 17165 // setting textContent of the element. 17166 // for component root it's always normalized anyway. 17167 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756 17168 // custom directives can potentially add DOM elements arbitrarily, 17169 // we need to avoid setting textContent of the element at runtime 17170 // to avoid accidentally overwriting the DOM elements added 17171 // by the user through custom directives. 17172 !node.props.find( 17173 (p) => p.type === 7 && !context.directiveTransforms[p.name] 17174 ) && // in compat mode, <template> tags with no special directives 17175 // will be rendered as a fragment so its children must be 17176 // converted into vnodes. 17177 true)) { 17178 return; 17179 } 17180 for (let i = 0; i < children.length; i++) { 17181 const child = children[i]; 17182 if (isText$1(child) || child.type === 8) { 17183 const callArgs = []; 17184 if (child.type !== 2 || child.content !== " ") { 17185 callArgs.push(child); 17186 } 17187 if (!context.ssr && getConstantType(child, context) === 0) { 17188 callArgs.push( 17189 1 + (` /* ${PatchFlagNames[1]} */` ) 17190 ); 17191 } 17192 children[i] = { 17193 type: 12, 17194 content: child, 17195 loc: child.loc, 17196 codegenNode: createCallExpression( 17197 context.helper(CREATE_TEXT), 17198 callArgs 17199 ) 17200 }; 17201 } 17202 } 17203 }; 17204 } 17205 }; 17206 17207 const seen$1 = /* @__PURE__ */ new WeakSet(); 17208 const transformOnce = (node, context) => { 17209 if (node.type === 1 && findDir(node, "once", true)) { 17210 if (seen$1.has(node) || context.inVOnce || context.inSSR) { 17211 return; 17212 } 17213 seen$1.add(node); 17214 context.inVOnce = true; 17215 context.helper(SET_BLOCK_TRACKING); 17216 return () => { 17217 context.inVOnce = false; 17218 const cur = context.currentNode; 17219 if (cur.codegenNode) { 17220 cur.codegenNode = context.cache( 17221 cur.codegenNode, 17222 true, 17223 true 17224 ); 17225 } 17226 }; 17227 } 17228 }; 17229 17230 const transformModel$1 = (dir, node, context) => { 17231 const { exp, arg } = dir; 17232 if (!exp) { 17233 context.onError( 17234 createCompilerError(41, dir.loc) 17235 ); 17236 return createTransformProps(); 17237 } 17238 const rawExp = exp.loc.source.trim(); 17239 const expString = exp.type === 4 ? exp.content : rawExp; 17240 const bindingType = context.bindingMetadata[rawExp]; 17241 if (bindingType === "props" || bindingType === "props-aliased") { 17242 context.onError(createCompilerError(44, exp.loc)); 17243 return createTransformProps(); 17244 } 17245 if (!expString.trim() || !isMemberExpression(exp) && true) { 17246 context.onError( 17247 createCompilerError(42, exp.loc) 17248 ); 17249 return createTransformProps(); 17250 } 17251 const propName = arg ? arg : createSimpleExpression("modelValue", true); 17252 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`; 17253 let assignmentExp; 17254 const eventArg = context.isTS ? `($event: any)` : `$event`; 17255 { 17256 assignmentExp = createCompoundExpression([ 17257 `${eventArg} => ((`, 17258 exp, 17259 `) = $event)` 17260 ]); 17261 } 17262 const props = [ 17263 // modelValue: foo 17264 createObjectProperty(propName, dir.exp), 17265 // "onUpdate:modelValue": $event => (foo = $event) 17266 createObjectProperty(eventName, assignmentExp) 17267 ]; 17268 if (dir.modifiers.length && node.tagType === 1) { 17269 const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `); 17270 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`; 17271 props.push( 17272 createObjectProperty( 17273 modifiersKey, 17274 createSimpleExpression( 17275 `{ ${modifiers} }`, 17276 false, 17277 dir.loc, 17278 2 17279 ) 17280 ) 17281 ); 17282 } 17283 return createTransformProps(props); 17284 }; 17285 function createTransformProps(props = []) { 17286 return { props }; 17287 } 17288 17289 const seen = /* @__PURE__ */ new WeakSet(); 17290 const transformMemo = (node, context) => { 17291 if (node.type === 1) { 17292 const dir = findDir(node, "memo"); 17293 if (!dir || seen.has(node) || context.inSSR) { 17294 return; 17295 } 17296 seen.add(node); 17297 return () => { 17298 const codegenNode = node.codegenNode || context.currentNode.codegenNode; 17299 if (codegenNode && codegenNode.type === 13) { 17300 if (node.tagType !== 1) { 17301 convertToBlock(codegenNode, context); 17302 } 17303 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [ 17304 dir.exp, 17305 createFunctionExpression(void 0, codegenNode), 17306 `_cache`, 17307 String(context.cached.length) 17308 ]); 17309 context.cached.push(null); 17310 } 17311 }; 17312 } 17313 }; 17314 17315 function getBaseTransformPreset(prefixIdentifiers) { 17316 return [ 17317 [ 17318 transformOnce, 17319 transformIf, 17320 transformMemo, 17321 transformFor, 17322 ...[], 17323 ...[transformExpression] , 17324 transformSlotOutlet, 17325 transformElement, 17326 trackSlotScopes, 17327 transformText 17328 ], 17329 { 17330 on: transformOn$1, 17331 bind: transformBind, 17332 model: transformModel$1 17333 } 17334 ]; 17335 } 17336 function baseCompile(source, options = {}) { 17337 const onError = options.onError || defaultOnError; 17338 const isModuleMode = options.mode === "module"; 17339 { 17340 if (options.prefixIdentifiers === true) { 17341 onError(createCompilerError(47)); 17342 } else if (isModuleMode) { 17343 onError(createCompilerError(48)); 17344 } 17345 } 17346 const prefixIdentifiers = false; 17347 if (options.cacheHandlers) { 17348 onError(createCompilerError(49)); 17349 } 17350 if (options.scopeId && !isModuleMode) { 17351 onError(createCompilerError(50)); 17352 } 17353 const resolvedOptions = extend({}, options, { 17354 prefixIdentifiers 17355 }); 17356 const ast = isString(source) ? baseParse(source, resolvedOptions) : source; 17357 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(); 17358 transform( 17359 ast, 17360 extend({}, resolvedOptions, { 17361 nodeTransforms: [ 17362 ...nodeTransforms, 17363 ...options.nodeTransforms || [] 17364 // user transforms 17365 ], 17366 directiveTransforms: extend( 17367 {}, 17368 directiveTransforms, 17369 options.directiveTransforms || {} 17370 // user transforms 17371 ) 17372 }) 17373 ); 17374 return generate(ast, resolvedOptions); 17375 } 17376 17377 const noopDirectiveTransform = () => ({ props: [] }); 17378 17379 const V_MODEL_RADIO = Symbol(`vModelRadio` ); 17380 const V_MODEL_CHECKBOX = Symbol( 17381 `vModelCheckbox` 17382 );
17383 const V_MODEL_TEXT = Symbol(`vModelText` ); 17384 const V_MODEL_SELECT = Symbol( 17385 `vModelSelect` 17386 ); 17387 const V_MODEL_DYNAMIC = Symbol( 17388 `vModelDynamic` 17389 ); 17390 const V_ON_WITH_MODIFIERS = Symbol( 17391 `vOnModifiersGuard` 17392 ); 17393 const V_ON_WITH_KEYS = Symbol( 17394 `vOnKeysGuard` 17395 ); 17396 const V_SHOW = Symbol(`vShow` ); 17397 const TRANSITION = Symbol(`Transition` ); 17398 const TRANSITION_GROUP = Symbol( 17399 `TransitionGroup` 17400 ); 17401 registerRuntimeHelpers({ 17402 [V_MODEL_RADIO]: `vModelRadio`, 17403 [V_MODEL_CHECKBOX]: `vModelCheckbox`, 17404 [V_MODEL_TEXT]: `vModelText`, 17405 [V_MODEL_SELECT]: `vModelSelect`, 17406 [V_MODEL_DYNAMIC]: `vModelDynamic`, 17407 [V_ON_WITH_MODIFIERS]: `withModifiers`, 17408 [V_ON_WITH_KEYS]: `withKeys`, 17409 [V_SHOW]: `vShow`, 17410 [TRANSITION]: `Transition`, 17411 [TRANSITION_GROUP]: `TransitionGroup` 17412 }); 17413 17414 let decoder; 17415 function decodeHtmlBrowser(raw, asAttr = false) { 17416 if (!decoder) { 17417 decoder = document.createElement("div"); 17418 } 17419 if (asAttr) { 17420 decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`; 17421 return decoder.children[0].getAttribute("foo"); 17422 } else { 17423 decoder.innerHTML = raw; 17424 return decoder.textContent; 17425 } 17426 } 17427 17428 const parserOptions = { 17429 parseMode: "html", 17430 isVoidTag, 17431 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 17432 isPreTag: (tag) => tag === "pre", 17433 isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea", 17434 decodeEntities: decodeHtmlBrowser , 17435 isBuiltInComponent: (tag) => { 17436 if (tag === "Transition" || tag === "transition") { 17437 return TRANSITION; 17438 } else if (tag === "TransitionGroup" || tag === "transition-group") { 17439 return TRANSITION_GROUP; 17440 } 17441 }, 17442 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher 17443 getNamespace(tag, parent, rootNamespace) { 17444 let ns = parent ? parent.ns : rootNamespace; 17445 if (parent && ns === 2) { 17446 if (parent.tag === "annotation-xml") { 17447 if (tag === "svg") { 17448 return 1; 17449 } 17450 if (parent.props.some( 17451 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml") 17452 )) { 17453 ns = 0; 17454 } 17455 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") { 17456 ns = 0; 17457 } 17458 } else if (parent && ns === 1) { 17459 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") { 17460 ns = 0; 17461 } 17462 } 17463 if (ns === 0) { 17464 if (tag === "svg") { 17465 return 1; 17466 } 17467 if (tag === "math") { 17468 return 2; 17469 } 17470 } 17471 return ns; 17472 } 17473 }; 17474 17475 const transformStyle = (node) => { 17476 if (node.type === 1) { 17477 node.props.forEach((p, i) => { 17478 if (p.type === 6 && p.name === "style" && p.value) { 17479 node.props[i] = { 17480 type: 7, 17481 name: `bind`, 17482 arg: createSimpleExpression(`style`, true, p.loc), 17483 exp: parseInlineCSS(p.value.content, p.loc), 17484 modifiers: [], 17485 loc: p.loc 17486 }; 17487 } 17488 }); 17489 } 17490 }; 17491 const parseInlineCSS = (cssText, loc) => { 17492 const normalized = parseStringStyle(cssText); 17493 return createSimpleExpression( 17494 JSON.stringify(normalized), 17495 false, 17496 loc, 17497 3 17498 ); 17499 }; 17500 17501 function createDOMCompilerError(code, loc) { 17502 return createCompilerError( 17503 code, 17504 loc, 17505 DOMErrorMessages 17506 ); 17507 } 17508 const DOMErrorMessages = { 17509 [53]: `v-html is missing expression.`, 17510 [54]: `v-html will override element children.`, 17511 [55]: `v-text is missing expression.`, 17512 [56]: `v-text will override element children.`, 17513 [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`, 17514 [58]: `v-model argument is not supported on plain elements.`, 17515 [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`, 17516 [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`, 17517 [61]: `v-show is missing expression.`, 17518 [62]: `<Transition> expects exactly one child element or component.`, 17519 [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.` 17520 }; 17521 17522 const transformVHtml = (dir, node, context) => { 17523 const { exp, loc } = dir; 17524 if (!exp) { 17525 context.onError( 17526 createDOMCompilerError(53, loc) 17527 ); 17528 } 17529 if (node.children.length) { 17530 context.onError( 17531 createDOMCompilerError(54, loc) 17532 ); 17533 node.children.length = 0; 17534 } 17535 return { 17536 props: [ 17537 createObjectProperty( 17538 createSimpleExpression(`innerHTML`, true, loc), 17539 exp || createSimpleExpression("", true) 17540 ) 17541 ] 17542 }; 17543 }; 17544 17545 const transformVText = (dir, node, context) => { 17546 const { exp, loc } = dir; 17547 if (!exp) { 17548 context.onError( 17549 createDOMCompilerError(55, loc) 17550 ); 17551 } 17552 if (node.children.length) { 17553 context.onError( 17554 createDOMCompilerError(56, loc) 17555 ); 17556 node.children.length = 0; 17557 } 17558 return { 17559 props: [ 17560 createObjectProperty( 17561 createSimpleExpression(`textContent`, true), 17562 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression( 17563 context.helperString(TO_DISPLAY_STRING), 17564 [exp], 17565 loc 17566 ) : createSimpleExpression("", true) 17567 ) 17568 ] 17569 }; 17570 }; 17571 17572 const transformModel = (dir, node, context) => { 17573 const baseResult = transformModel$1(dir, node, context); 17574 if (!baseResult.props.length || node.tagType === 1) { 17575 return baseResult; 17576 } 17577 if (dir.arg) { 17578 context.onError( 17579 createDOMCompilerError( 17580 58, 17581 dir.arg.loc 17582 ) 17583 ); 17584 } 17585 function checkDuplicatedValue() { 17586 const value = findDir(node, "bind"); 17587 if (value && isStaticArgOf(value.arg, "value")) { 17588 context.onError( 17589 createDOMCompilerError( 17590 60, 17591 value.loc 17592 ) 17593 ); 17594 } 17595 } 17596 const { tag } = node;
vendor: 5,110 bytes, lines 17597-17739
17597 const isCustomElement = context.isCustomElement(tag); 17598 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) { 17599 let directiveToUse = V_MODEL_TEXT; 17600 let isInvalidType = false; 17601 if (tag === "input" || isCustomElement) { 17602 const type = findProp(node, `type`); 17603 if (type) { 17604 if (type.type === 7) { 17605 directiveToUse = V_MODEL_DYNAMIC; 17606 } else if (type.value) { 17607 switch (type.value.content) { 17608 case "radio": 17609 directiveToUse = V_MODEL_RADIO; 17610 break; 17611 case "checkbox": 17612 directiveToUse = V_MODEL_CHECKBOX; 17613 break; 17614 case "file": 17615 isInvalidType = true; 17616 context.onError( 17617 createDOMCompilerError( 17618 59, 17619 dir.loc 17620 ) 17621 ); 17622 break; 17623 default: 17624 checkDuplicatedValue(); 17625 break; 17626 } 17627 } 17628 } else if (hasDynamicKeyVBind(node)) { 17629 directiveToUse = V_MODEL_DYNAMIC; 17630 } else { 17631 checkDuplicatedValue(); 17632 } 17633 } else if (tag === "select") { 17634 directiveToUse = V_MODEL_SELECT; 17635 } else { 17636 checkDuplicatedValue(); 17637 } 17638 if (!isInvalidType) { 17639 baseResult.needRuntime = context.helper(directiveToUse); 17640 } 17641 } else { 17642 context.onError( 17643 createDOMCompilerError( 17644 57, 17645 dir.loc 17646 ) 17647 ); 17648 } 17649 baseResult.props = baseResult.props.filter( 17650 (p) => !(p.key.type === 4 && p.key.content === "modelValue") 17651 ); 17652 return baseResult; 17653 }; 17654 17655 const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`); 17656 const isNonKeyModifier = /* @__PURE__ */ makeMap( 17657 // event propagation management 17658 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle` 17659 ); 17660 const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right"); 17661 const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`); 17662 const resolveModifiers = (key, modifiers, context, loc) => { 17663 const keyModifiers = []; 17664 const nonKeyModifiers = []; 17665 const eventOptionModifiers = []; 17666 for (let i = 0; i < modifiers.length; i++) { 17667 const modifier = modifiers[i].content; 17668 if (isEventOptionModifier(modifier)) { 17669 eventOptionModifiers.push(modifier); 17670 } else { 17671 if (maybeKeyModifier(modifier)) { 17672 if (isStaticExp(key)) { 17673 if (isKeyboardEvent(key.content.toLowerCase())) { 17674 keyModifiers.push(modifier); 17675 } else { 17676 nonKeyModifiers.push(modifier); 17677 } 17678 } else { 17679 keyModifiers.push(modifier); 17680 nonKeyModifiers.push(modifier); 17681 } 17682 } else { 17683 if (isNonKeyModifier(modifier)) { 17684 nonKeyModifiers.push(modifier); 17685 } else { 17686 keyModifiers.push(modifier); 17687 } 17688 } 17689 } 17690 } 17691 return { 17692 keyModifiers, 17693 nonKeyModifiers, 17694 eventOptionModifiers 17695 }; 17696 }; 17697 const transformClick = (key, event) => { 17698 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick"; 17699 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([ 17700 `(`, 17701 key, 17702 `) === "onClick" ? "${event}" : (`, 17703 key, 17704 `)` 17705 ]) : key; 17706 }; 17707 const transformOn = (dir, node, context) => { 17708 return transformOn$1(dir, node, context, (baseResult) => { 17709 const { modifiers } = dir; 17710 if (!modifiers.length) return baseResult; 17711 let { key, value: handlerExp } = baseResult.props[0]; 17712 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc); 17713 if (nonKeyModifiers.includes("right")) { 17714 key = transformClick(key, `onContextmenu`); 17715 } 17716 if (nonKeyModifiers.includes("middle")) { 17717 key = transformClick(key, `onMouseup`); 17718 } 17719 if (nonKeyModifiers.length) { 17720 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [ 17721 handlerExp, 17722 JSON.stringify(nonKeyModifiers) 17723 ]); 17724 } 17725 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard 17726 (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) { 17727 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [ 17728 handlerExp, 17729 JSON.stringify(keyModifiers) 17730 ]); 17731 } 17732 if (eventOptionModifiers.length) { 17733 const modifierPostfix = eventOptionModifiers.map(capitalize).join(""); 17734 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]); 17735 } 17736 return { 17737 props: [createObjectProperty(key, handlerExp)] 17738 }; 17739 });
vendor: 12,264 bytes, lines 17740-18144
17740 }; 17741 17742 const transformShow = (dir, node, context) => { 17743 const { exp, loc } = dir; 17744 if (!exp) { 17745 context.onError( 17746 createDOMCompilerError(61, loc) 17747 ); 17748 } 17749 return { 17750 props: [], 17751 needRuntime: context.helper(V_SHOW) 17752 }; 17753 }; 17754 17755 const transformTransition = (node, context) => { 17756 if (node.type === 1 && node.tagType === 1) { 17757 const component = context.isBuiltInComponent(node.tag); 17758 if (component === TRANSITION) { 17759 return () => { 17760 if (!node.children.length) { 17761 return; 17762 } 17763 if (hasMultipleChildren(node)) { 17764 context.onError( 17765 createDOMCompilerError( 17766 62, 17767 { 17768 start: node.children[0].loc.start, 17769 end: node.children[node.children.length - 1].loc.end, 17770 source: "" 17771 } 17772 ) 17773 ); 17774 } 17775 const child = node.children[0]; 17776 if (child.type === 1) { 17777 for (const p of child.props) { 17778 if (p.type === 7 && p.name === "show") { 17779 node.props.push({ 17780 type: 6, 17781 name: "persisted", 17782 nameLoc: node.loc, 17783 value: void 0, 17784 loc: node.loc 17785 }); 17786 } 17787 } 17788 } 17789 }; 17790 } 17791 } 17792 }; 17793 function hasMultipleChildren(node) { 17794 const children = node.children = node.children.filter( 17795 (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim()) 17796 ); 17797 const child = children[0]; 17798 return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren); 17799 } 17800 17801 const ignoreSideEffectTags = (node, context) => { 17802 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) { 17803 context.onError( 17804 createDOMCompilerError( 17805 63, 17806 node.loc 17807 ) 17808 ); 17809 context.removeNode(); 17810 } 17811 }; 17812 17813 function isValidHTMLNesting(parent, child) { 17814 if (parent === "template") { 17815 return true; 17816 } 17817 if (parent in onlyValidChildren) { 17818 return onlyValidChildren[parent].has(child); 17819 } 17820 if (child in onlyValidParents) { 17821 return onlyValidParents[child].has(parent); 17822 } 17823 if (parent in knownInvalidChildren) { 17824 if (knownInvalidChildren[parent].has(child)) return false; 17825 } 17826 if (child in knownInvalidParents) { 17827 if (knownInvalidParents[child].has(parent)) return false; 17828 } 17829 return true; 17830 } 17831 const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]); 17832 const emptySet = /* @__PURE__ */ new Set([]); 17833 const onlyValidChildren = { 17834 head: /* @__PURE__ */ new Set([ 17835 "base", 17836 "basefront", 17837 "bgsound", 17838 "link", 17839 "meta", 17840 "title", 17841 "noscript", 17842 "noframes", 17843 "style", 17844 "script", 17845 "template" 17846 ]), 17847 optgroup: /* @__PURE__ */ new Set(["option"]), 17848 select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]), 17849 // table 17850 table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]), 17851 tr: /* @__PURE__ */ new Set(["td", "th"]), 17852 colgroup: /* @__PURE__ */ new Set(["col"]), 17853 tbody: /* @__PURE__ */ new Set(["tr"]), 17854 thead: /* @__PURE__ */ new Set(["tr"]), 17855 tfoot: /* @__PURE__ */ new Set(["tr"]), 17856 // these elements can not have any children elements 17857 script: emptySet, 17858 iframe: emptySet, 17859 option: emptySet, 17860 textarea: emptySet, 17861 style: emptySet, 17862 title: emptySet 17863 }; 17864 const onlyValidParents = { 17865 // sections 17866 html: emptySet, 17867 body: /* @__PURE__ */ new Set(["html"]), 17868 head: /* @__PURE__ */ new Set(["html"]), 17869 // table 17870 td: /* @__PURE__ */ new Set(["tr"]), 17871 colgroup: /* @__PURE__ */ new Set(["table"]), 17872 caption: /* @__PURE__ */ new Set(["table"]), 17873 tbody: /* @__PURE__ */ new Set(["table"]), 17874 tfoot: /* @__PURE__ */ new Set(["table"]), 17875 col: /* @__PURE__ */ new Set(["colgroup"]), 17876 th: /* @__PURE__ */ new Set(["tr"]), 17877 thead: /* @__PURE__ */ new Set(["table"]), 17878 tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]), 17879 // data list 17880 dd: /* @__PURE__ */ new Set(["dl", "div"]), 17881 dt: /* @__PURE__ */ new Set(["dl", "div"]), 17882 // other 17883 figcaption: /* @__PURE__ */ new Set(["figure"]), 17884 // li: new Set(["ul", "ol"]), 17885 summary: /* @__PURE__ */ new Set(["details"]), 17886 area: /* @__PURE__ */ new Set(["map"]) 17887 }; 17888 const knownInvalidChildren = { 17889 p: /* @__PURE__ */ new Set([ 17890 "address", 17891 "article", 17892 "aside", 17893 "blockquote", 17894 "center", 17895 "details", 17896 "dialog", 17897 "dir", 17898 "div", 17899 "dl", 17900 "fieldset", 17901 "figure", 17902 "footer", 17903 "form", 17904 "h1", 17905 "h2", 17906 "h3", 17907 "h4", 17908 "h5", 17909 "h6", 17910 "header", 17911 "hgroup", 17912 "hr", 17913 "li", 17914 "main", 17915 "nav", 17916 "menu", 17917 "ol", 17918 "p", 17919 "pre", 17920 "section", 17921 "table", 17922 "ul" 17923 ]), 17924 svg: /* @__PURE__ */ new Set([ 17925 "b", 17926 "blockquote", 17927 "br", 17928 "code", 17929 "dd", 17930 "div", 17931 "dl", 17932 "dt", 17933 "em", 17934 "embed", 17935 "h1", 17936 "h2", 17937 "h3", 17938 "h4", 17939 "h5", 17940 "h6", 17941 "hr", 17942 "i", 17943 "img", 17944 "li", 17945 "menu", 17946 "meta", 17947 "ol", 17948 "p", 17949 "pre", 17950 "ruby", 17951 "s", 17952 "small", 17953 "span", 17954 "strong", 17955 "sub", 17956 "sup", 17957 "table", 17958 "u", 17959 "ul", 17960 "var" 17961 ]) 17962 }; 17963 const knownInvalidParents = { 17964 a: /* @__PURE__ */ new Set(["a"]), 17965 button: /* @__PURE__ */ new Set(["button"]), 17966 dd: /* @__PURE__ */ new Set(["dd", "dt"]), 17967 dt: /* @__PURE__ */ new Set(["dd", "dt"]), 17968 form: /* @__PURE__ */ new Set(["form"]), 17969 li: /* @__PURE__ */ new Set(["li"]), 17970 h1: headings, 17971 h2: headings, 17972 h3: headings, 17973 h4: headings, 17974 h5: headings, 17975 h6: headings 17976 }; 17977 17978 const validateHtmlNesting = (node, context) => { 17979 if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) { 17980 const error = new SyntaxError( 17981 `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.` 17982 ); 17983 error.loc = node.loc; 17984 context.onWarn(error); 17985 } 17986 }; 17987 17988 const DOMNodeTransforms = [ 17989 transformStyle, 17990 ...[transformTransition, validateHtmlNesting] 17991 ]; 17992 const DOMDirectiveTransforms = { 17993 cloak: noopDirectiveTransform, 17994 html: transformVHtml, 17995 text: transformVText, 17996 model: transformModel, 17997 // override compiler-core 17998 on: transformOn, 17999 // override compiler-core 18000 show: transformShow 18001 }; 18002 function compile(src, options = {}) { 18003 return baseCompile( 18004 src, 18005 extend({}, parserOptions, options, { 18006 nodeTransforms: [ 18007 // ignore <script> and <tag> 18008 // this is not put inside DOMNodeTransforms because that list is used 18009 // by compiler-ssr to generate vnode fallback branches 18010 ignoreSideEffectTags, 18011 ...DOMNodeTransforms, 18012 ...options.nodeTransforms || [] 18013 ], 18014 directiveTransforms: extend( 18015 {}, 18016 DOMDirectiveTransforms, 18017 options.directiveTransforms || {} 18018 ), 18019 transformHoist: null 18020 }) 18021 ); 18022 } 18023 18024 { 18025 initDev(); 18026 } 18027 const compileCache = /* @__PURE__ */ Object.create(null); 18028 function compileToFunction(template, options) { 18029 if (!isString(template)) { 18030 if (template.nodeType) { 18031 template = template.innerHTML; 18032 } else { 18033 warn(`invalid template option: `, template); 18034 return NOOP; 18035 } 18036 } 18037 const key = genCacheKey(template, options); 18038 const cached = compileCache[key]; 18039 if (cached) { 18040 return cached; 18041 } 18042 if (template[0] === "#") { 18043 const el = document.querySelector(template); 18044 if (!el) { 18045 warn(`Template element not found or is empty: ${template}`); 18046 } 18047 template = el ? el.innerHTML : ``; 18048 } 18049 const opts = extend( 18050 { 18051 hoistStatic: true, 18052 onError: onError , 18053 onWarn: (e) => onError(e, true) 18054 }, 18055 options 18056 ); 18057 if (!opts.isCustomElement && typeof customElements !== "undefined") { 18058 opts.isCustomElement = (tag) => !!customElements.get(tag); 18059 } 18060 const { code } = compile(template, opts); 18061 function onError(err, asWarning = false) { 18062 const message = asWarning ? err.message : `Template compilation error: ${err.message}`; 18063 const codeFrame = err.loc && generateCodeFrame( 18064 template, 18065 err.loc.start.offset, 18066 err.loc.end.offset 18067 ); 18068 warn(codeFrame ? `${message} 18069${codeFrame}` : message); 18070 } 18071 const render = new Function(code)() ; 18072 render._rc = true; 18073 return compileCache[key] = render; 18074 } 18075 registerRuntimeCompiler(compileToFunction); 18076 18077 exports.BaseTransition = BaseTransition; 18078 exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators; 18079 exports.Comment = Comment; 18080 exports.DeprecationTypes = DeprecationTypes; 18081 exports.EffectScope = EffectScope; 18082 exports.ErrorCodes = ErrorCodes; 18083 exports.ErrorTypeStrings = ErrorTypeStrings; 18084 exports.Fragment = Fragment; 18085 exports.KeepAlive = KeepAlive; 18086 exports.ReactiveEffect = ReactiveEffect; 18087 exports.Static = Static; 18088 exports.Suspense = Suspense; 18089 exports.Teleport = Teleport; 18090 exports.Text = Text; 18091 exports.TrackOpTypes = TrackOpTypes; 18092 exports.Transition = Transition; 18093 exports.TransitionGroup = TransitionGroup; 18094 exports.TriggerOpTypes = TriggerOpTypes; 18095 exports.VueElement = VueElement; 18096 exports.assertNumber = assertNumber; 18097 exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling; 18098 exports.callWithErrorHandling = callWithErrorHandling; 18099 exports.camelize = camelize; 18100 exports.capitalize = capitalize; 18101 exports.cloneVNode = cloneVNode; 18102 exports.compatUtils = compatUtils; 18103 exports.compile = compileToFunction; 18104 exports.computed = computed; 18105 exports.createApp = createApp; 18106 exports.createBlock = createBlock; 18107 exports.createCommentVNode = createCommentVNode; 18108 exports.createElementBlock = createElementBlock; 18109 exports.createElementVNode = createBaseVNode; 18110 exports.createHydrationRenderer = createHydrationRenderer; 18111 exports.createPropsRestProxy = createPropsRestProxy; 18112 exports.createRenderer = createRenderer; 18113 exports.createSSRApp = createSSRApp; 18114 exports.createSlots = createSlots; 18115 exports.createStaticVNode = createStaticVNode; 18116 exports.createTextVNode = createTextVNode; 18117 exports.createVNode = createVNode; 18118 exports.customRef = customRef; 18119 exports.defineAsyncComponent = defineAsyncComponent; 18120 exports.defineComponent = defineComponent; 18121 exports.defineCustomElement = defineCustomElement; 18122 exports.defineEmits = defineEmits; 18123 exports.defineExpose = defineExpose; 18124 exports.defineModel = defineModel; 18125 exports.defineOptions = defineOptions; 18126 exports.defineProps = defineProps; 18127 exports.defineSSRCustomElement = defineSSRCustomElement; 18128 exports.defineSlots = defineSlots; 18129 exports.devtools = devtools; 18130 exports.effect = effect; 18131 exports.effectScope = effectScope; 18132 exports.getCurrentInstance = getCurrentInstance; 18133 exports.getCurrentScope = getCurrentScope; 18134 exports.getCurrentWatcher = getCurrentWatcher; 18135 exports.getTransitionRawChildren = getTransitionRawChildren; 18136 exports.guardReactiveProps = guardReactiveProps; 18137 exports.h = h; 18138 exports.handleError = handleError; 18139 exports.hasInjectionContext = hasInjectionContext; 18140 exports.hydrate = hydrate; 18141 exports.hydrateOnIdle = hydrateOnIdle; 18142 exports.hydrateOnInteraction = hydrateOnInteraction; 18143 exports.hydrateOnMediaQuery = hydrateOnMediaQuery; 18144 exports.hydrateOnVisible = hydrateOnVisible;
18145 exports.initCustomFormatter = initCustomFormatter; 18146 exports.initDirectivesForSSR = initDirectivesForSSR; 18147 exports.inject = inject; 18148 exports.isMemoSame = isMemoSame; 18149 exports.isProxy = isProxy; 18150 exports.isReactive = isReactive; 18151 exports.isReadonly = isReadonly; 18152 exports.isRef = isRef; 18153 exports.isRuntimeOnly = isRuntimeOnly; 18154 exports.isShallow = isShallow; 18155 exports.isVNode = isVNode; 18156 exports.markRaw = markRaw; 18157 exports.mergeDefaults = mergeDefaults; 18158 exports.mergeModels = mergeModels; 18159 exports.mergeProps = mergeProps; 18160 exports.nextTick = nextTick; 18161 exports.normalizeClass = normalizeClass; 18162 exports.normalizeProps = normalizeProps; 18163 exports.normalizeStyle = normalizeStyle; 18164 exports.onActivated = onActivated; 18165 exports.onBeforeMount = onBeforeMount; 18166 exports.onBeforeUnmount = onBeforeUnmount; 18167 exports.onBeforeUpdate = onBeforeUpdate; 18168 exports.onDeactivated = onDeactivated; 18169 exports.onErrorCaptured = onErrorCaptured; 18170 exports.onMounted = onMounted; 18171 exports.onRenderTracked = onRenderTracked; 18172 exports.onRenderTriggered = onRenderTriggered; 18173 exports.onScopeDispose = onScopeDispose; 18174 exports.onServerPrefetch = onServerPrefetch; 18175 exports.onUnmounted = onUnmounted; 18176 exports.onUpdated = onUpdated; 18177 exports.onWatcherCleanup = onWatcherCleanup; 18178 exports.openBlock = openBlock; 18179 exports.popScopeId = popScopeId; 18180 exports.provide = provide; 18181 exports.proxyRefs = proxyRefs; 18182 exports.pushScopeId = pushScopeId; 18183 exports.queuePostFlushCb = queuePostFlushCb; 18184 exports.reactive = reactive; 18185 exports.readonly = readonly; 18186 exports.ref = ref; 18187 exports.registerRuntimeCompiler = registerRuntimeCompiler; 18188 exports.render = render; 18189 exports.renderList = renderList; 18190 exports.renderSlot = renderSlot; 18191 exports.resolveComponent = resolveComponent; 18192 exports.resolveDirective = resolveDirective; 18193 exports.resolveDynamicComponent = resolveDynamicComponent; 18194 exports.resolveFilter = resolveFilter; 18195 exports.resolveTransitionHooks = resolveTransitionHooks; 18196 exports.setBlockTracking = setBlockTracking; 18197 exports.setDevtoolsHook = setDevtoolsHook; 18198 exports.setTransitionHooks = setTransitionHooks; 18199 exports.shallowReactive = shallowReactive; 18200 exports.shallowReadonly = shallowReadonly; 18201 exports.shallowRef = shallowRef; 18202 exports.ssrContextKey = ssrContextKey; 18203 exports.ssrUtils = ssrUtils; 18204 exports.stop = stop; 18205 exports.toDisplayString = toDisplayString; 18206 exports.toHandlerKey = toHandlerKey; 18207 exports.toHandlers = toHandlers; 18208 exports.toRaw = toRaw; 18209 exports.toRef = toRef; 18210 exports.toRefs = toRefs; 18211 exports.toValue = toValue; 18212 exports.transformVNodeArgs = transformVNodeArgs; 18213 exports.triggerRef = triggerRef; 18214 exports.unref = unref; 18215 exports.useAttrs = useAttrs; 18216 exports.useCssModule = useCssModule; 18217 exports.useCssVars = useCssVars; 18218 exports.useHost = useHost; 18219 exports.useId = useId; 18220 exports.useModel = useModel; 18221 exports.useSSRContext = useSSRContext; 18222 exports.useShadowRoot = useShadowRoot; 18223 exports.useSlots = useSlots; 18224 exports.useTemplateRef = useTemplateRef; 18225 exports.useTransitionState = useTransitionState; 18226 exports.vModelCheckbox = vModelCheckbox; 18227 exports.vModelDynamic = vModelDynamic; 18228 exports.vModelRadio = vModelRadio; 18229 exports.vModelSelect = vModelSelect; 18230 exports.vModelText = vModelText; 18231 exports.vShow = vShow; 18232 exports.version = version; 18233 exports.warn = warn; 18234 exports.watch = watch; 18235 exports.watchEffect = watchEffect; 18236 exports.watchPostEffect = watchPostEffect; 18237 exports.watchSyncEffect = watchSyncEffect; 18238 exports.withAsyncContext = withAsyncContext; 18239 exports.withCtx = withCtx; 18240 exports.withDefaults = withDefaults; 18241 exports.withDirectives = withDirectives; 18242 exports.withKeys = withKeys; 18243 exports.withMemo = withMemo; 18244 exports.withModifiers = withModifiers; 18245 exports.withScopeId = withScopeId; 18246 18247 return exports; 18248 18249})({});
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.