1/* eslint-disable */ 2;(function() { 3 4 if ( 5 typeof this.BX !== 'undefined' 6 && typeof this.BX.Vue3 !== 'undefined' 7 && typeof this.BX.Vue3.version !== 'undefined' 8 ) 9 { 10 var currentVersion = '3.5.4'; 11 12 if (this.BX.Vue3.version !== currentVersion) 13 { 14 console.warn('BX.Vue3 already loaded. Loaded: ' + this.BX.Vue3.version + ', Skipped: ' + currentVersion + '. Version differences may cause errors!'); 15 } 16 17 return; 18 } 19 20this.BX = this.BX || {}; 21(function (exports,ui_vue3_bitrixvue) { 22 'use strict'; 23 24 /** 25 * Bitrix integration with external Vue DevTools 26 * 27 * @package bitrix 28 * @subpackage ui 29 * @copyright 2001-2022 Bitrix 30 */ 31 32 class DevTools 33 { 34 constructor(params) 35 { 36 this.host = 'http://localhost'; 37 this.port = '8098'; 38 39 40 this.script = null; 41 this.changeToast = false; 42 43 if ( 44 !navigator.userAgent.toLowerCase().includes('chrome') 45 && !navigator.userAgent.toLowerCase().includes('firefox') 46 ) 47 { 48 this.changeToast = true; 49 console.info( 50 "Install the Vue Remote Devtools application for a better development experience: https://github.com/vuejs/vue-devtools/blob/master/shells/electron/\n"+ 51 "For connect to localhost use %cBX.VueDevTools.connect();%c for remote host %cBX.VueDevTools.connect('__devtools_ip_address__');", 52 "font-weight: bold", "font-weight: initial", "font-weight: bold", "font-weight: initial", 53 ); 54 } 55 } 56 57 connect(address) 58 { 59 if (this.script) 60 { 61 document.body.removeChild(this.script); 62 } 63 64 if (address) 65 { 66 this.setUrl(address); 67 } 68 69 window.__VUE_DEVTOOLS_HOST__ = this.host; 70 window.__VUE_DEVTOOLS_PORT__ = this.port; 71 72 this.script = document.createElement('script'); 73 if (this.changeToast) 74 { 75 this.script.addEventListener('load', this.load.bind(this)); 76 } 77 this.script.src = __VUE_DEVTOOLS_HOST__+':'+__VUE_DEVTOOLS_PORT__; 78 79 document.body.appendChild(this.script); 80 81 return true; 82 } 83 84 reconnect() 85 { 86 this.connect(); 87 } 88 89 setUrl(address = 'localhost') 90 { 91 if (!address.startsWith('http')) 92 { 93 address = 'http://'+address; 94 } 95 96 let parts = address.split(':'); 97 if (parts.length > 2) 98 { 99 this.host = parts.slice(0,2).join(':'); 100 this.port = parts[2]; 101 } 102 else 103 { 104 this.host = address; 105 this.port = '8098'; 106 } 107 108 return this; 109 } 110 111 load() 112 { 113 window.__VUE_DEVTOOLS_TOAST__ = new Proxy(window.__VUE_DEVTOOLS_TOAST__, 114 { 115 apply: (target, thisArg, argumentsList) => 116 { 117 if (argumentsList[0].toString().toLowerCase().includes('disconnect')) 118 { 119 console.info( 120 '%cDevTools:%c try to reconnect, if vue-devtools is not running, run and call %cBX.VueDevTools.reconnect();', 121 "font-weight: bold", "font-weight: initial", "font-weight: bold", 122 ); 123 setTimeout(() => this.reconnect(), 5000); 124 } 125 return target.apply(thisArg, argumentsList); 126 } 127 }); 128 } 129 } 130 131 /*! 132 * Vue.js v3.5.4 133 * (c) 2018-present Yuxi (Evan) You and Vue contributors 134 * Released under the MIT License. 135 * 136 * @source: https://unpkg.com/[email protected]/dist/vue.esm-browser.js 137 */ 138 ui_vue3_bitrixvue.BitrixVue.developerMode = true; 139 ui_vue3_bitrixvue.BitrixVue.createApp = ((rootComponent, rootProps) => createApp(rootComponent, rootProps).use(ui_vue3_bitrixvue.BitrixVue)); 140 const DevToolsConnector = new DevTools; 141 142 // origin-start 143 /*! #__NO_SIDE_EFFECTS__ */ 144 // @__NO_SIDE_EFFECTS__ 145 function makeMap(str) { 146 const map = /* @__PURE__ */ Object.create(null); 147 for (const key of str.split(",")) map[key] = 1; 148 return (val) => val in map; 149 } 150 151 const EMPTY_OBJ = Object.freeze({}) ; 152 const EMPTY_ARR = Object.freeze([]) ; 153 const NOOP = () => { 154 }; 155 const NO = () => false; 156 const isOn = (key) =>
vendor: 6,069 bytes, lines 156-331
156 key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter 157 (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); 158 const isModelListener = (key) => key.startsWith("onUpdate:"); 159 const extend = Object.assign; 160 const remove = (arr, el) => { 161 const i = arr.indexOf(el); 162 if (i > -1) { 163 arr.splice(i, 1); 164 } 165 }; 166 const hasOwnProperty$1 = Object.prototype.hasOwnProperty; 167 const hasOwn = (val, key) => hasOwnProperty$1.call(val, key); 168 const isArray = Array.isArray; 169 const isMap = (val) => toTypeString(val) === "[object Map]"; 170 const isSet = (val) => toTypeString(val) === "[object Set]"; 171 const isDate = (val) => toTypeString(val) === "[object Date]"; 172 const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; 173 const isFunction = (val) => typeof val === "function"; 174 const isString = (val) => typeof val === "string"; 175 const isSymbol = (val) => typeof val === "symbol"; 176 const isObject = (val) => val !== null && typeof val === "object"; 177 const isPromise = (val) => { 178 return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); 179 }; 180 const objectToString = Object.prototype.toString; 181 const toTypeString = (value) => objectToString.call(value); 182 const toRawType = (value) => { 183 return toTypeString(value).slice(8, -1); 184 }; 185 const isPlainObject = (val) => toTypeString(val) === "[object Object]"; 186 const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; 187 const isReservedProp = /* @__PURE__ */ makeMap( 188 // the leading comma is intentional so empty string "" is also included 189 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" 190 ); 191 const isBuiltInDirective = /* @__PURE__ */ makeMap( 192 "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" 193 ); 194 const cacheStringFunction = (fn) => { 195 const cache = /* @__PURE__ */ Object.create(null); 196 return (str) => { 197 const hit = cache[str]; 198 return hit || (cache[str] = fn(str)); 199 }; 200 }; 201 const camelizeRE = /-(\w)/g; 202 const camelize = cacheStringFunction( 203 (str) => { 204 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); 205 } 206 ); 207 const hyphenateRE = /\B([A-Z])/g; 208 const hyphenate = cacheStringFunction( 209 (str) => str.replace(hyphenateRE, "-$1").toLowerCase() 210 ); 211 const capitalize = cacheStringFunction((str) => { 212 return str.charAt(0).toUpperCase() + str.slice(1); 213 }); 214 const toHandlerKey = cacheStringFunction( 215 (str) => { 216 const s = str ? `on${capitalize(str)}` : ``; 217 return s; 218 } 219 ); 220 const hasChanged = (value, oldValue) => !Object.is(value, oldValue); 221 const invokeArrayFns = (fns, ...arg) => { 222 for (let i = 0; i < fns.length; i++) { 223 fns[i](...arg); 224 } 225 }; 226 const def = (obj, key, value, writable = false) => { 227 Object.defineProperty(obj, key, { 228 configurable: true, 229 enumerable: false, 230 writable, 231 value 232 }); 233 }; 234 const looseToNumber = (val) => { 235 const n = parseFloat(val); 236 return isNaN(n) ? val : n; 237 }; 238 const toNumber = (val) => { 239 const n = isString(val) ? Number(val) : NaN; 240 return isNaN(n) ? val : n; 241 }; 242 let _globalThis; 243 const getGlobalThis = () => { 244 return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); 245 }; 246 247 const PatchFlagNames = { 248 [1]: `TEXT`, 249 [2]: `CLASS`, 250 [4]: `STYLE`, 251 [8]: `PROPS`, 252 [16]: `FULL_PROPS`, 253 [32]: `NEED_HYDRATION`, 254 [64]: `STABLE_FRAGMENT`, 255 [128]: `KEYED_FRAGMENT`, 256 [256]: `UNKEYED_FRAGMENT`, 257 [512]: `NEED_PATCH`, 258 [1024]: `DYNAMIC_SLOTS`, 259 [2048]: `DEV_ROOT_FRAGMENT`, 260 [-1]: `HOISTED`, 261 [-2]: `BAIL` 262 }; 263 264 const slotFlagsText = { 265 [1]: "STABLE", 266 [2]: "DYNAMIC", 267 [3]: "FORWARDED" 268 }; 269 270 const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"; 271 const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); 272 273 const range = 2; 274 function generateCodeFrame(source, start = 0, end = source.length) { 275 start = Math.max(0, Math.min(start, source.length)); 276 end = Math.max(0, Math.min(end, source.length)); 277 if (start > end) return ""; 278 let lines = source.split(/(\r?\n)/); 279 const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); 280 lines = lines.filter((_, idx) => idx % 2 === 0); 281 let count = 0; 282 const res = []; 283 for (let i = 0; i < lines.length; i++) { 284 count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); 285 if (count >= start) { 286 for (let j = i - range; j <= i + range || end > count; j++) { 287 if (j < 0 || j >= lines.length) continue; 288 const line = j + 1; 289 res.push( 290 `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` 291 ); 292 const lineLength = lines[j].length; 293 const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; 294 if (j === i) { 295 const pad = start - (count - (lineLength + newLineSeqLength)); 296 const length = Math.max( 297 1, 298 end > count ? lineLength - pad : end - start 299 ); 300 res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); 301 } else if (j > i) { 302 if (end > count) { 303 const length = Math.max(Math.min(end - count, lineLength), 1); 304 res.push(` | ` + "^".repeat(length)); 305 } 306 count += lineLength + newLineSeqLength; 307 } 308 } 309 break; 310 } 311 } 312 return res.join("\n"); 313 } 314 315 function normalizeStyle(value) { 316 if (isArray(value)) { 317 const res = {}; 318 for (let i = 0; i < value.length; i++) { 319 const item = value[i]; 320 const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); 321 if (normalized) { 322 for (const key in normalized) { 323 res[key] = normalized[key]; 324 } 325 } 326 } 327 return res; 328 } else if (isString(value) || isObject(value)) { 329 return value; 330 } 331 }
vendor: 4,174 bytes, lines 332-409
332 const listDelimiterRE = /;(?![^(]*\))/g; 333 const propertyDelimiterRE = /:([^]+)/; 334 const styleCommentRE = /\/\*[^]*?\*\//g; 335 function parseStringStyle(cssText) { 336 const ret = {}; 337 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { 338 if (item) { 339 const tmp = item.split(propertyDelimiterRE); 340 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); 341 } 342 }); 343 return ret; 344 } 345 function stringifyStyle(styles) { 346 let ret = ""; 347 if (!styles || isString(styles)) { 348 return ret; 349 } 350 for (const key in styles) { 351 const value = styles[key]; 352 if (isString(value) || typeof value === "number") { 353 const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); 354 ret += `${normalizedKey}:${value};`; 355 } 356 } 357 return ret; 358 } 359 function normalizeClass(value) { 360 let res = ""; 361 if (isString(value)) { 362 res = value; 363 } else if (isArray(value)) { 364 for (let i = 0; i < value.length; i++) { 365 const normalized = normalizeClass(value[i]); 366 if (normalized) { 367 res += normalized + " "; 368 } 369 } 370 } else if (isObject(value)) { 371 for (const name in value) { 372 if (value[name]) { 373 res += name + " "; 374 } 375 } 376 } 377 return res.trim(); 378 } 379 function normalizeProps(props) { 380 if (!props) return null; 381 let { class: klass, style } = props; 382 if (klass && !isString(klass)) { 383 props.class = normalizeClass(klass); 384 } 385 if (style) { 386 props.style = normalizeStyle(style); 387 } 388 return props; 389 } 390 391 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"; 392 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"; 393 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"; 394 const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; 395 const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); 396 const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); 397 const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); 398 const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); 399 400 const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; 401 const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); 402 const isBooleanAttr = /* @__PURE__ */ makeMap( 403 specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` 404 ); 405 function includeBooleanAttr(value) { 406 return !!value || value === ""; 407 } 408 const isKnownHtmlAttr = /* @__PURE__ */ makeMap( 409 `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,c
409olspan,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` 410 ); 411 const isKnownSvgAttr = /* @__PURE__ */ makeMap( 412 `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: 4,502 bytes, lines 412-570
412-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` 413 ); 414 function isRenderableAttrValue(value) { 415 if (value == null) { 416 return false; 417 } 418 const type = typeof value; 419 return type === "string" || type === "number" || type === "boolean"; 420 } 421 422 const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g; 423 function getEscapedCssVarName(key, doubleEscape) { 424 return key.replace( 425 cssVarNameEscapeSymbolsRE, 426 (s) => `\\${s}` 427 ); 428 } 429 430 function looseCompareArrays(a, b) { 431 if (a.length !== b.length) return false; 432 let equal = true; 433 for (let i = 0; equal && i < a.length; i++) { 434 equal = looseEqual(a[i], b[i]); 435 } 436 return equal; 437 } 438 function looseEqual(a, b) { 439 if (a === b) return true; 440 let aValidType = isDate(a); 441 let bValidType = isDate(b); 442 if (aValidType || bValidType) { 443 return aValidType && bValidType ? a.getTime() === b.getTime() : false; 444 } 445 aValidType = isSymbol(a); 446 bValidType = isSymbol(b); 447 if (aValidType || bValidType) { 448 return a === b; 449 } 450 aValidType = isArray(a); 451 bValidType = isArray(b); 452 if (aValidType || bValidType) { 453 return aValidType && bValidType ? looseCompareArrays(a, b) : false; 454 } 455 aValidType = isObject(a); 456 bValidType = isObject(b); 457 if (aValidType || bValidType) { 458 if (!aValidType || !bValidType) { 459 return false; 460 } 461 const aKeysCount = Object.keys(a).length; 462 const bKeysCount = Object.keys(b).length; 463 if (aKeysCount !== bKeysCount) { 464 return false; 465 } 466 for (const key in a) { 467 const aHasKey = a.hasOwnProperty(key); 468 const bHasKey = b.hasOwnProperty(key); 469 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { 470 return false; 471 } 472 } 473 } 474 return String(a) === String(b); 475 } 476 function looseIndexOf(arr, val) { 477 return arr.findIndex((item) => looseEqual(item, val)); 478 } 479 480 const isRef$1 = (val) => { 481 return !!(val && val["__v_isRef"] === true); 482 }; 483 const toDisplayString = (val) => { 484 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); 485 }; 486 const replacer = (_key, val) => { 487 if (isRef$1(val)) { 488 return replacer(_key, val.value); 489 } else if (isMap(val)) { 490 return { 491 [`Map(${val.size})`]: [...val.entries()].reduce( 492 (entries, [key, val2], i) => { 493 entries[stringifySymbol(key, i) + " =>"] = val2; 494 return entries; 495 }, 496 {} 497 ) 498 }; 499 } else if (isSet(val)) { 500 return { 501 [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) 502 }; 503 } else if (isSymbol(val)) { 504 return stringifySymbol(val); 505 } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { 506 return String(val); 507 } 508 return val; 509 }; 510 const stringifySymbol = (v, i = "") => { 511 var _a; 512 return ( 513 // Symbol.description in es2019+ so we need to cast here to pass 514 // the lib: es2016 check 515 isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v 516 ); 517 }; 518 519 function warn$2(msg, ...args) { 520 console.warn(`[Vue warn] ${msg}`, ...args); 521 } 522 523 let activeEffectScope; 524 class EffectScope { 525 constructor(detached = false) { 526 this.detached = detached; 527 /** 528 * @internal 529 */ 530 this._active = true; 531 /** 532 * @internal 533 */ 534 this.effects = []; 535 /** 536 * @internal 537 */ 538 this.cleanups = []; 539 this._isPaused = false; 540 this.parent = activeEffectScope; 541 if (!detached && activeEffectScope) { 542 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( 543 this 544 ) - 1; 545 } 546 } 547 get active() { 548 return this._active; 549 } 550 pause() { 551 if (this._active) { 552 this._isPaused = true; 553 let i, l; 554 if (this.scopes) { 555 for (i = 0, l = this.scopes.length; i < l; i++) { 556 this.scopes[i].pause(); 557 } 558 } 559 for (i = 0, l = this.effects.length; i < l; i++) { 560 this.effects[i].pause(); 561 } 562 } 563 } 564 /** 565 * Resumes the effect scope, including all child scopes and effects. 566 */ 567 resume() { 568 if (this._active) { 569 if (this._isPaused) { 570 this._isPaused = false;
571 let i, l; 572 if (this.scopes) { 573 for (i = 0, l = this.scopes.length; i < l; i++) { 574 this.scopes[i].resume(); 575 } 576 } 577 for (i = 0, l = this.effects.length; i < l; i++) { 578 this.effects[i].resume(); 579 } 580 } 581 } 582 } 583 run(fn) { 584 if (this._active) { 585 const currentEffectScope = activeEffectScope; 586 try { 587 activeEffectScope = this; 588 return fn(); 589 } finally { 590 activeEffectScope = currentEffectScope; 591 } 592 } else { 593 warn$2(`cannot run an inactive effect scope.`); 594 } 595 } 596 /** 597 * This should only be called on non-detached scopes 598 * @internal 599 */ 600 on() { 601 activeEffectScope = this; 602 } 603 /** 604 * This should only be called on non-detached scopes 605 * @internal 606 */ 607 off() { 608 activeEffectScope = this.parent; 609 } 610 stop(fromParent) { 611 if (this._active) { 612 let i, l; 613 for (i = 0, l = this.effects.length; i < l; i++) { 614 this.effects[i].stop(); 615 } 616 for (i = 0, l = this.cleanups.length; i < l; i++) { 617 this.cleanups[i](); 618 } 619 if (this.scopes) { 620 for (i = 0, l = this.scopes.length; i < l; i++) { 621 this.scopes[i].stop(true); 622 } 623 } 624 if (!this.detached && this.parent && !fromParent) { 625 const last = this.parent.scopes.pop(); 626 if (last && last !== this) { 627 this.parent.scopes[this.index] = last; 628 last.index = this.index; 629 } 630 } 631 this.parent = void 0; 632 this._active = false; 633 } 634 } 635 } 636 function effectScope(detached) { 637 return new EffectScope(detached); 638 } 639 function getCurrentScope() { 640 return activeEffectScope; 641 } 642 function onScopeDispose(fn, failSilently = false) { 643 if (activeEffectScope) { 644 activeEffectScope.cleanups.push(fn); 645 } else if (!failSilently) { 646 warn$2( 647 `onScopeDispose() is called when there is no active effect scope to be associated with.` 648 ); 649 } 650 } 651 652 let activeSub; 653 const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); 654 class ReactiveEffect { 655 constructor(fn) { 656 this.fn = fn; 657 /** 658 * @internal 659 */ 660 this.deps = void 0; 661 /** 662 * @internal 663 */ 664 this.depsTail = void 0; 665 /** 666 * @internal 667 */ 668 this.flags = 1 | 4; 669 /** 670 * @internal 671 */ 672 this.nextEffect = void 0; 673 /** 674 * @internal 675 */ 676 this.cleanup = void 0; 677 this.scheduler = void 0; 678 if (activeEffectScope && activeEffectScope.active) { 679 activeEffectScope.effects.push(this); 680 } 681 } 682 pause() { 683 this.flags |= 64; 684 } 685 resume() { 686 if (this.flags & 64) { 687 this.flags &= ~64; 688 if (pausedQueueEffects.has(this)) { 689 pausedQueueEffects.delete(this); 690 this.trigger(); 691 } 692 } 693 } 694 /** 695 * @internal 696 */ 697 notify() { 698 if (this.flags & 2 && !(this.flags & 32)) { 699 return; 700 } 701 if (!(this.flags & 8)) { 702 this.flags |= 8; 703 this.nextEffect = batchedEffect; 704 batchedEffect = this; 705 } 706 } 707 run() { 708 if (!(this.flags & 1)) { 709 return this.fn(); 710 } 711 this.flags |= 2; 712 cleanupEffect(this); 713 prepareDeps(this); 714 const prevEffect = activeSub; 715 const prevShouldTrack = shouldTrack; 716 activeSub = this; 717 shouldTrack = true; 718 try { 719 return this.fn(); 720 } finally { 721 if (activeSub !== this) { 722 warn$2( 723 "Active effect was not restored correctly - this is likely a Vue internal bug." 724 ); 725 } 726 cleanupDeps(this); 727 activeSub = prevEffect; 728 shouldTrack = prevShouldTrack; 729 this.flags &= ~2; 730 } 731 } 732 stop() { 733 if (this.flags & 1) { 734 for (let link = this.deps; link; link = link.nextDep) { 735 removeSub(link); 736 } 737 this.deps = this.depsTail = void 0; 738 cleanupEffect(this); 739 this.onStop && this.onStop(); 740 this.flags &= ~1; 741 } 742 } 743 trigger() { 744 if (this.flags & 64) { 745 pausedQueueEffects.add(this); 746 } else if (this.scheduler) { 747 this.scheduler(); 748 } else { 749 this.runIfDirty(); 750 } 751 } 752 /** 753 * @internal 754 */ 755 runIfDirty() { 756 if (isDirty(this)) { 757 this.run(); 758 } 759 } 760 get dirty() { 761 return isDirty(this); 762 } 763 } 764 let batchDepth = 0; 765 let batchedEffect; 766 function startBatch() { 767 batchDepth++; 768 } 769 function endBatch() { 770 if (--batchDepth > 0) { 771 return; 772 } 773 let error; 774 while (batchedEffect) { 775 let e = batchedEffect; 776 batchedEffect = void 0; 777 while (e) { 778 const next = e.nextEffect; 779 e.nextEffect = void 0; 780 e.flags &= ~8; 781 if (e.flags & 1) { 782 try { 783 e.trigger(); 784 } catch (err) { 785 if (!error) error = err; 786 } 787 } 788 e = next; 789 } 790 } 791 if (error) throw error; 792 } 793 function prepareDeps(sub) { 794 for (let link = sub.deps; link; link = link.nextDep) { 795 link.version = -1; 796 link.prevActiveLink = link.dep.activeLink; 797 link.dep.activeLink = link; 798 } 799 } 800 function cleanupDeps(sub) { 801 let head; 802 let tail = sub.depsTail; 803 for (let link = tail; link; link = link.prevDep) { 804 if (link.version === -1) { 805 if (link === tail) tail = link.prevDep; 806 removeSub(link); 807 removeDep(link); 808 } else { 809 head = link; 810 } 811 link.dep.activeLink = link.prevActiveLink; 812 link.prevActiveLink = void 0; 813 } 814 sub.deps = head; 815 sub.depsTail = tail; 816 } 817 function isDirty(sub) { 818 for (let link = sub.deps; link; link = link.nextDep) { 819 if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) { 820 return true; 821 } 822 } 823 if (sub._dirty) { 824 return true; 825 } 826 return false;
827 } 828 function refreshComputed(computed) { 829 if (computed.flags & 4 && !(computed.flags & 16)) { 830 return; 831 } 832 computed.flags &= ~16; 833 if (computed.globalVersion === globalVersion) { 834 return; 835 } 836 computed.globalVersion = globalVersion; 837 const dep = computed.dep; 838 computed.flags |= 2; 839 if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) { 840 computed.flags &= ~2; 841 return; 842 } 843 const prevSub = activeSub; 844 const prevShouldTrack = shouldTrack; 845 activeSub = computed; 846 shouldTrack = true; 847 try { 848 prepareDeps(computed); 849 const value = computed.fn(computed._value); 850 if (dep.version === 0 || hasChanged(value, computed._value)) { 851 computed._value = value; 852 dep.version++; 853 } 854 } catch (err) { 855 dep.version++; 856 throw err; 857 } finally { 858 activeSub = prevSub; 859 shouldTrack = prevShouldTrack; 860 cleanupDeps(computed); 861 computed.flags &= ~2; 862 } 863 } 864 function removeSub(link) { 865 const { dep, prevSub, nextSub } = link; 866 if (prevSub) { 867 prevSub.nextSub = nextSub; 868 link.prevSub = void 0; 869 } 870 if (nextSub) { 871 nextSub.prevSub = prevSub; 872 link.nextSub = void 0; 873 } 874 if (dep.subs === link) { 875 dep.subs = prevSub; 876 } 877 if (!dep.subs && dep.computed) { 878 dep.computed.flags &= ~4; 879 for (let l = dep.computed.deps; l; l = l.nextDep) { 880 removeSub(l); 881 } 882 } 883 } 884 function removeDep(link) { 885 const { prevDep, nextDep } = link; 886 if (prevDep) { 887 prevDep.nextDep = nextDep; 888 link.prevDep = void 0; 889 } 890 if (nextDep) { 891 nextDep.prevDep = prevDep; 892 link.nextDep = void 0; 893 } 894 } 895 function effect(fn, options) { 896 if (fn.effect instanceof ReactiveEffect) { 897 fn = fn.effect.fn; 898 } 899 const e = new ReactiveEffect(fn); 900 if (options) { 901 extend(e, options); 902 } 903 try { 904 e.run(); 905 } catch (err) { 906 e.stop(); 907 throw err; 908 } 909 const runner = e.run.bind(e); 910 runner.effect = e; 911 return runner; 912 } 913 function stop(runner) { 914 runner.effect.stop(); 915 } 916 let shouldTrack = true; 917 const trackStack = []; 918 function pauseTracking() { 919 trackStack.push(shouldTrack); 920 shouldTrack = false; 921 } 922 function resetTracking() { 923 const last = trackStack.pop(); 924 shouldTrack = last === void 0 ? true : last; 925 } 926 function cleanupEffect(e) { 927 const { cleanup } = e; 928 e.cleanup = void 0; 929 if (cleanup) { 930 const prevSub = activeSub; 931 activeSub = void 0; 932 try { 933 cleanup(); 934 } finally { 935 activeSub = prevSub; 936 } 937 } 938 } 939 940 let globalVersion = 0; 941 class Dep { 942 constructor(computed) { 943 this.computed = computed; 944 this.version = 0; 945 /** 946 * Link between this dep and the current active effect 947 */ 948 this.activeLink = void 0; 949 /** 950 * Doubly linked list representing the subscribing effects (tail) 951 */ 952 this.subs = void 0; 953 { 954 this.subsHead = void 0; 955 } 956 } 957 track(debugInfo) { 958 if (!activeSub || !shouldTrack || activeSub === this.computed) { 959 return; 960 } 961 let link = this.activeLink; 962 if (link === void 0 || link.sub !== activeSub) { 963 link = this.activeLink = { 964 dep: this, 965 sub: activeSub, 966 version: this.version, 967 nextDep: void 0, 968 prevDep: void 0, 969 nextSub: void 0, 970 prevSub: void 0, 971 prevActiveLink: void 0 972 }; 973 if (!activeSub.deps) { 974 activeSub.deps = activeSub.depsTail = link; 975 } else { 976 link.prevDep = activeSub.depsTail; 977 activeSub.depsTail.nextDep = link; 978 activeSub.depsTail = link; 979 } 980 if (activeSub.flags & 4) { 981 addSub(link); 982 } 983 } else if (link.version === -1) { 984 link.version = this.version; 985 if (link.nextDep) { 986 const next = link.nextDep; 987 next.prevDep = link.prevDep; 988 if (link.prevDep) { 989 link.prevDep.nextDep = next; 990 } 991 link.prevDep = activeSub.depsTail; 992 link.nextDep = void 0; 993 activeSub.depsTail.nextDep = link; 994 activeSub.depsTail = link; 995 if (activeSub.deps === link) { 996 activeSub.deps = next; 997 } 998 } 999 }
vendor: 7,129 bytes, lines 1000-1292
1000 if (activeSub.onTrack) { 1001 activeSub.onTrack( 1002 extend( 1003 { 1004 effect: activeSub 1005 }, 1006 debugInfo 1007 ) 1008 ); 1009 } 1010 return link; 1011 } 1012 trigger(debugInfo) { 1013 this.version++; 1014 globalVersion++; 1015 this.notify(debugInfo); 1016 } 1017 notify(debugInfo) { 1018 startBatch(); 1019 try { 1020 { 1021 for (let head = this.subsHead; head; head = head.nextSub) { 1022 if (head.sub.onTrigger && !(head.sub.flags & 8)) { 1023 head.sub.onTrigger( 1024 extend( 1025 { 1026 effect: head.sub 1027 }, 1028 debugInfo 1029 ) 1030 ); 1031 } 1032 } 1033 } 1034 for (let link = this.subs; link; link = link.prevSub) { 1035 link.sub.notify(); 1036 } 1037 } finally { 1038 endBatch(); 1039 } 1040 } 1041 } 1042 function addSub(link) { 1043 const computed = link.dep.computed; 1044 if (computed && !link.dep.subs) { 1045 computed.flags |= 4 | 16; 1046 for (let l = computed.deps; l; l = l.nextDep) { 1047 addSub(l); 1048 } 1049 } 1050 const currentTail = link.dep.subs; 1051 if (currentTail !== link) { 1052 link.prevSub = currentTail; 1053 if (currentTail) currentTail.nextSub = link; 1054 } 1055 if (link.dep.subsHead === void 0) { 1056 link.dep.subsHead = link; 1057 } 1058 link.dep.subs = link; 1059 } 1060 const targetMap = /* @__PURE__ */ new WeakMap(); 1061 const ITERATE_KEY = Symbol( 1062 "Object iterate" 1063 ); 1064 const MAP_KEY_ITERATE_KEY = Symbol( 1065 "Map keys iterate" 1066 ); 1067 const ARRAY_ITERATE_KEY = Symbol( 1068 "Array iterate" 1069 ); 1070 function track(target, type, key) { 1071 if (shouldTrack && activeSub) { 1072 let depsMap = targetMap.get(target); 1073 if (!depsMap) { 1074 targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); 1075 } 1076 let dep = depsMap.get(key); 1077 if (!dep) { 1078 depsMap.set(key, dep = new Dep()); 1079 } 1080 { 1081 dep.track({ 1082 target, 1083 type, 1084 key 1085 }); 1086 } 1087 } 1088 } 1089 function trigger(target, type, key, newValue, oldValue, oldTarget) { 1090 const depsMap = targetMap.get(target); 1091 if (!depsMap) { 1092 globalVersion++; 1093 return; 1094 } 1095 const run = (dep) => { 1096 if (dep) { 1097 { 1098 dep.trigger({ 1099 target, 1100 type, 1101 key, 1102 newValue, 1103 oldValue, 1104 oldTarget 1105 }); 1106 } 1107 } 1108 }; 1109 startBatch(); 1110 if (type === "clear") { 1111 depsMap.forEach(run); 1112 } else { 1113 const targetIsArray = isArray(target); 1114 const isArrayIndex = targetIsArray && isIntegerKey(key); 1115 if (targetIsArray && key === "length") { 1116 const newLength = Number(newValue); 1117 depsMap.forEach((dep, key2) => { 1118 if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) { 1119 run(dep); 1120 } 1121 }); 1122 } else { 1123 if (key !== void 0) { 1124 run(depsMap.get(key)); 1125 } 1126 if (isArrayIndex) { 1127 run(depsMap.get(ARRAY_ITERATE_KEY)); 1128 } 1129 switch (type) { 1130 case "add": 1131 if (!targetIsArray) { 1132 run(depsMap.get(ITERATE_KEY)); 1133 if (isMap(target)) { 1134 run(depsMap.get(MAP_KEY_ITERATE_KEY)); 1135 } 1136 } else if (isArrayIndex) { 1137 run(depsMap.get("length")); 1138 } 1139 break; 1140 case "delete": 1141 if (!targetIsArray) { 1142 run(depsMap.get(ITERATE_KEY)); 1143 if (isMap(target)) { 1144 run(depsMap.get(MAP_KEY_ITERATE_KEY)); 1145 } 1146 } 1147 break; 1148 case "set": 1149 if (isMap(target)) { 1150 run(depsMap.get(ITERATE_KEY)); 1151 } 1152 break; 1153 } 1154 } 1155 } 1156 endBatch(); 1157 } 1158 function getDepFromReactive(object, key) { 1159 var _a; 1160 return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key); 1161 } 1162 1163 function reactiveReadArray(array) { 1164 const raw = toRaw(array); 1165 if (raw === array) return raw; 1166 track(raw, "iterate", ARRAY_ITERATE_KEY); 1167 return isShallow(array) ? raw : raw.map(toReactive); 1168 } 1169 function shallowReadArray(arr) { 1170 track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY); 1171 return arr; 1172 } 1173 const arrayInstrumentations = { 1174 __proto__: null, 1175 [Symbol.iterator]() { 1176 return iterator(this, Symbol.iterator, toReactive); 1177 }, 1178 concat(...args) { 1179 return reactiveReadArray(this).concat( 1180 ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x) 1181 ); 1182 }, 1183 entries() { 1184 return iterator(this, "entries", (value) => { 1185 value[1] = toReactive(value[1]); 1186 return value; 1187 }); 1188 }, 1189 every(fn, thisArg) { 1190 return apply(this, "every", fn, thisArg, void 0, arguments); 1191 }, 1192 filter(fn, thisArg) { 1193 return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments); 1194 }, 1195 find(fn, thisArg) { 1196 return apply(this, "find", fn, thisArg, toReactive, arguments); 1197 }, 1198 findIndex(fn, thisArg) { 1199 return apply(this, "findIndex", fn, thisArg, void 0, arguments); 1200 }, 1201 findLast(fn, thisArg) { 1202 return apply(this, "findLast", fn, thisArg, toReactive, arguments); 1203 }, 1204 findLastIndex(fn, thisArg) { 1205 return apply(this, "findLastIndex", fn, thisArg, void 0, arguments); 1206 }, 1207 // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement 1208 forEach(fn, thisArg) { 1209 return apply(this, "forEach", fn, thisArg, void 0, arguments); 1210 }, 1211 includes(...args) { 1212 return searchProxy(this, "includes", args); 1213 }, 1214 indexOf(...args) { 1215 return searchProxy(this, "indexOf", args); 1216 }, 1217 join(separator) { 1218 return reactiveReadArray(this).join(separator); 1219 }, 1220 // keys() iterator only reads `length`, no optimisation required 1221 lastIndexOf(...args) { 1222 return searchProxy(this, "lastIndexOf", args); 1223 }, 1224 map(fn, thisArg) { 1225 return apply(this, "map", fn, thisArg, void 0, arguments); 1226 }, 1227 pop() { 1228 return noTracking(this, "pop"); 1229 }, 1230 push(...args) { 1231 return noTracking(this, "push", args); 1232 }, 1233 reduce(fn, ...args) { 1234 return reduce(this, "reduce", fn, args); 1235 }, 1236 reduceRight(fn, ...args) { 1237 return reduce(this, "reduceRight", fn, args); 1238 }, 1239 shift() { 1240 return noTracking(this, "shift"); 1241 }, 1242 // slice could use ARRAY_ITERATE but also seems to beg for range tracking 1243 some(fn, thisArg) { 1244 return apply(this, "some", fn, thisArg, void 0, arguments); 1245 }, 1246 splice(...args) { 1247 return noTracking(this, "splice", args); 1248 }, 1249 toReversed() { 1250 return reactiveReadArray(this).toReversed(); 1251 }, 1252 toSorted(comparer) { 1253 return reactiveReadArray(this).toSorted(comparer); 1254 }, 1255 toSpliced(...args) { 1256 return reactiveReadArray(this).toSpliced(...args); 1257 }, 1258 unshift(...args) { 1259 return noTracking(this, "unshift", args); 1260 }, 1261 values() { 1262 return iterator(this, "values", toReactive); 1263 } 1264 }; 1265 function iterator(self, method, wrapValue) { 1266 const arr = shallowReadArray(self); 1267 const iter = arr[method](); 1268 if (arr !== self && !isShallow(self)) { 1269 iter._next = iter.next; 1270 iter.next = () => { 1271 const result = iter._next(); 1272 if (result.value) { 1273 result.value = wrapValue(result.value); 1274 } 1275 return result; 1276 }; 1277 } 1278 return iter; 1279 } 1280 const arrayProto = Array.prototype; 1281 function apply(self, method, fn, thisArg, wrappedRetFn, args) { 1282 const arr = shallowReadArray(self); 1283 const needsWrap = arr !== self && !isShallow(self); 1284 const methodFn = arr[method]; 1285 if (methodFn !== arrayProto[method]) { 1286 const result2 = methodFn.apply(self, args); 1287 return needsWrap ? toReactive(result2) : result2; 1288 } 1289 let wrappedFn = fn; 1290 if (arr !== self) { 1291 if (needsWrap) { 1292 wrappedFn = function(item, index) {
vendor: 4,846 bytes, lines 1293-1453
1293 return fn.call(this, toReactive(item), index, self); 1294 }; 1295 } else if (fn.length > 2) { 1296 wrappedFn = function(item, index) { 1297 return fn.call(this, item, index, self); 1298 }; 1299 } 1300 } 1301 const result = methodFn.call(arr, wrappedFn, thisArg); 1302 return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result; 1303 } 1304 function reduce(self, method, fn, args) { 1305 const arr = shallowReadArray(self); 1306 let wrappedFn = fn; 1307 if (arr !== self) { 1308 if (!isShallow(self)) { 1309 wrappedFn = function(acc, item, index) { 1310 return fn.call(this, acc, toReactive(item), index, self); 1311 }; 1312 } else if (fn.length > 3) { 1313 wrappedFn = function(acc, item, index) { 1314 return fn.call(this, acc, item, index, self); 1315 }; 1316 } 1317 } 1318 return arr[method](wrappedFn, ...args); 1319 } 1320 function searchProxy(self, method, args) { 1321 const arr = toRaw(self); 1322 track(arr, "iterate", ARRAY_ITERATE_KEY); 1323 const res = arr[method](...args); 1324 if ((res === -1 || res === false) && isProxy(args[0])) { 1325 args[0] = toRaw(args[0]); 1326 return arr[method](...args); 1327 } 1328 return res; 1329 } 1330 function noTracking(self, method, args = []) { 1331 pauseTracking(); 1332 startBatch(); 1333 const res = toRaw(self)[method].apply(self, args); 1334 endBatch(); 1335 resetTracking(); 1336 return res; 1337 } 1338 1339 const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); 1340 const builtInSymbols = new Set( 1341 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) 1342 ); 1343 function hasOwnProperty(key) { 1344 if (!isSymbol(key)) key = String(key); 1345 const obj = toRaw(this); 1346 track(obj, "has", key); 1347 return obj.hasOwnProperty(key); 1348 } 1349 class BaseReactiveHandler { 1350 constructor(_isReadonly = false, _isShallow = false) { 1351 this._isReadonly = _isReadonly; 1352 this._isShallow = _isShallow; 1353 } 1354 get(target, key, receiver) { 1355 const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; 1356 if (key === "__v_isReactive") { 1357 return !isReadonly2; 1358 } else if (key === "__v_isReadonly") { 1359 return isReadonly2; 1360 } else if (key === "__v_isShallow") { 1361 return isShallow2; 1362 } else if (key === "__v_raw") { 1363 if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype 1364 // this means the receiver is a user proxy of the reactive proxy 1365 Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { 1366 return target; 1367 } 1368 return; 1369 } 1370 const targetIsArray = isArray(target); 1371 if (!isReadonly2) { 1372 let fn; 1373 if (targetIsArray && (fn = arrayInstrumentations[key])) { 1374 return fn; 1375 } 1376 if (key === "hasOwnProperty") { 1377 return hasOwnProperty; 1378 } 1379 } 1380 const res = Reflect.get( 1381 target, 1382 key, 1383 // if this is a proxy wrapping a ref, return methods using the raw ref 1384 // as receiver so that we don't have to call `toRaw` on the ref in all 1385 // its class methods 1386 isRef(target) ? target : receiver 1387 ); 1388 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { 1389 return res; 1390 } 1391 if (!isReadonly2) { 1392 track(target, "get", key); 1393 } 1394 if (isShallow2) { 1395 return res; 1396 } 1397 if (isRef(res)) { 1398 return targetIsArray && isIntegerKey(key) ? res : res.value; 1399 } 1400 if (isObject(res)) { 1401 return isReadonly2 ? readonly(res) : reactive(res); 1402 } 1403 return res; 1404 } 1405 } 1406 class MutableReactiveHandler extends BaseReactiveHandler { 1407 constructor(isShallow2 = false) { 1408 super(false, isShallow2); 1409 } 1410 set(target, key, value, receiver) { 1411 let oldValue = target[key]; 1412 if (!this._isShallow) { 1413 const isOldValueReadonly = isReadonly(oldValue); 1414 if (!isShallow(value) && !isReadonly(value)) { 1415 oldValue = toRaw(oldValue); 1416 value = toRaw(value); 1417 } 1418 if (!isArray(target) && isRef(oldValue) && !isRef(value)) { 1419 if (isOldValueReadonly) { 1420 return false; 1421 } else { 1422 oldValue.value = value; 1423 return true; 1424 } 1425 } 1426 } 1427 const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); 1428 const result = Reflect.set( 1429 target, 1430 key, 1431 value, 1432 isRef(target) ? target : receiver 1433 ); 1434 if (target === toRaw(receiver)) { 1435 if (!hadKey) { 1436 trigger(target, "add", key, value); 1437 } else if (hasChanged(value, oldValue)) { 1438 trigger(target, "set", key, value, oldValue); 1439 } 1440 } 1441 return result; 1442 } 1443 deleteProperty(target, key) { 1444 const hadKey = hasOwn(target, key); 1445 const oldValue = target[key]; 1446 const result = Reflect.deleteProperty(target, key); 1447 if (result && hadKey) { 1448 trigger(target, "delete", key, void 0, oldValue); 1449 } 1450 return result; 1451 } 1452 has(target, key) { 1453 const result = Reflect.has(target, key);
vendor: 1,464 bytes, lines 1454-1508
1454 if (!isSymbol(key) || !builtInSymbols.has(key)) { 1455 track(target, "has", key); 1456 } 1457 return result; 1458 } 1459 ownKeys(target) { 1460 track( 1461 target, 1462 "iterate", 1463 isArray(target) ? "length" : ITERATE_KEY 1464 ); 1465 return Reflect.ownKeys(target); 1466 } 1467 } 1468 class ReadonlyReactiveHandler extends BaseReactiveHandler { 1469 constructor(isShallow2 = false) { 1470 super(true, isShallow2); 1471 } 1472 set(target, key) { 1473 { 1474 warn$2( 1475 `Set operation on key "${String(key)}" failed: target is readonly.`, 1476 target 1477 ); 1478 } 1479 return true; 1480 } 1481 deleteProperty(target, key) { 1482 { 1483 warn$2( 1484 `Delete operation on key "${String(key)}" failed: target is readonly.`, 1485 target 1486 ); 1487 } 1488 return true; 1489 } 1490 } 1491 const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); 1492 const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); 1493 const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true); 1494 const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); 1495 1496 const toShallow = (value) => value; 1497 const getProto = (v) => Reflect.getPrototypeOf(v); 1498 function get(target, key, isReadonly2 = false, isShallow2 = false) { 1499 target = target["__v_raw"]; 1500 const rawTarget = toRaw(target); 1501 const rawKey = toRaw(key); 1502 if (!isReadonly2) { 1503 if (hasChanged(key, rawKey)) { 1504 track(rawTarget, "get", key); 1505 } 1506 track(rawTarget, "get", rawKey); 1507 } 1508 const { has: has2 } = getProto(rawTarget);
vendor: 10,506 bytes, lines 1509-1886
1509 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; 1510 if (has2.call(rawTarget, key)) { 1511 return wrap(target.get(key)); 1512 } else if (has2.call(rawTarget, rawKey)) { 1513 return wrap(target.get(rawKey)); 1514 } else if (target !== rawTarget) { 1515 target.get(key); 1516 } 1517 } 1518 function has(key, isReadonly2 = false) { 1519 const target = this["__v_raw"]; 1520 const rawTarget = toRaw(target); 1521 const rawKey = toRaw(key); 1522 if (!isReadonly2) { 1523 if (hasChanged(key, rawKey)) { 1524 track(rawTarget, "has", key); 1525 } 1526 track(rawTarget, "has", rawKey); 1527 } 1528 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); 1529 } 1530 function size(target, isReadonly2 = false) { 1531 target = target["__v_raw"]; 1532 !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); 1533 return Reflect.get(target, "size", target); 1534 } 1535 function add(value, _isShallow = false) { 1536 if (!_isShallow && !isShallow(value) && !isReadonly(value)) { 1537 value = toRaw(value); 1538 } 1539 const target = toRaw(this); 1540 const proto = getProto(target); 1541 const hadKey = proto.has.call(target, value); 1542 if (!hadKey) { 1543 target.add(value); 1544 trigger(target, "add", value, value); 1545 } 1546 return this; 1547 } 1548 function set(key, value, _isShallow = false) { 1549 if (!_isShallow && !isShallow(value) && !isReadonly(value)) { 1550 value = toRaw(value); 1551 } 1552 const target = toRaw(this); 1553 const { has: has2, get: get2 } = getProto(target); 1554 let hadKey = has2.call(target, key); 1555 if (!hadKey) { 1556 key = toRaw(key); 1557 hadKey = has2.call(target, key); 1558 } else { 1559 checkIdentityKeys(target, has2, key); 1560 } 1561 const oldValue = get2.call(target, key); 1562 target.set(key, value); 1563 if (!hadKey) { 1564 trigger(target, "add", key, value); 1565 } else if (hasChanged(value, oldValue)) { 1566 trigger(target, "set", key, value, oldValue); 1567 } 1568 return this; 1569 } 1570 function deleteEntry(key) { 1571 const target = toRaw(this); 1572 const { has: has2, get: get2 } = getProto(target); 1573 let hadKey = has2.call(target, key); 1574 if (!hadKey) { 1575 key = toRaw(key); 1576 hadKey = has2.call(target, key); 1577 } else { 1578 checkIdentityKeys(target, has2, key); 1579 } 1580 const oldValue = get2 ? get2.call(target, key) : void 0; 1581 const result = target.delete(key); 1582 if (hadKey) { 1583 trigger(target, "delete", key, void 0, oldValue); 1584 } 1585 return result; 1586 } 1587 function clear() { 1588 const target = toRaw(this); 1589 const hadItems = target.size !== 0; 1590 const oldTarget = isMap(target) ? new Map(target) : new Set(target) ; 1591 const result = target.clear(); 1592 if (hadItems) { 1593 trigger(target, "clear", void 0, void 0, oldTarget); 1594 } 1595 return result; 1596 } 1597 function createForEach(isReadonly2, isShallow2) { 1598 return function forEach(callback, thisArg) { 1599 const observed = this; 1600 const target = observed["__v_raw"]; 1601 const rawTarget = toRaw(target); 1602 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; 1603 !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); 1604 return target.forEach((value, key) => { 1605 return callback.call(thisArg, wrap(value), wrap(key), observed); 1606 }); 1607 }; 1608 } 1609 function createIterableMethod(method, isReadonly2, isShallow2) { 1610 return function(...args) { 1611 const target = this["__v_raw"]; 1612 const rawTarget = toRaw(target); 1613 const targetIsMap = isMap(rawTarget); 1614 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; 1615 const isKeyOnly = method === "keys" && targetIsMap; 1616 const innerIterator = target[method](...args); 1617 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; 1618 !isReadonly2 && track( 1619 rawTarget, 1620 "iterate", 1621 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY 1622 ); 1623 return { 1624 // iterator protocol 1625 next() { 1626 const { value, done } = innerIterator.next(); 1627 return done ? { value, done } : { 1628 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), 1629 done 1630 }; 1631 }, 1632 // iterable protocol 1633 [Symbol.iterator]() { 1634 return this; 1635 } 1636 }; 1637 }; 1638 } 1639 function createReadonlyMethod(type) { 1640 return function(...args) { 1641 { 1642 const key = args[0] ? `on key "${args[0]}" ` : ``; 1643 warn$2( 1644 `${capitalize(type)} operation ${key}failed: target is readonly.`, 1645 toRaw(this) 1646 ); 1647 } 1648 return type === "delete" ? false : type === "clear" ? void 0 : this; 1649 }; 1650 } 1651 function createInstrumentations() { 1652 const mutableInstrumentations2 = { 1653 get(key) { 1654 return get(this, key); 1655 }, 1656 get size() { 1657 return size(this); 1658 }, 1659 has, 1660 add, 1661 set, 1662 delete: deleteEntry, 1663 clear, 1664 forEach: createForEach(false, false) 1665 }; 1666 const shallowInstrumentations2 = { 1667 get(key) { 1668 return get(this, key, false, true); 1669 }, 1670 get size() { 1671 return size(this); 1672 }, 1673 has, 1674 add(value) { 1675 return add.call(this, value, true); 1676 }, 1677 set(key, value) { 1678 return set.call(this, key, value, true); 1679 }, 1680 delete: deleteEntry, 1681 clear, 1682 forEach: createForEach(false, true) 1683 }; 1684 const readonlyInstrumentations2 = { 1685 get(key) { 1686 return get(this, key, true); 1687 }, 1688 get size() { 1689 return size(this, true); 1690 }, 1691 has(key) { 1692 return has.call(this, key, true); 1693 }, 1694 add: createReadonlyMethod("add"), 1695 set: createReadonlyMethod("set"), 1696 delete: createReadonlyMethod("delete"), 1697 clear: createReadonlyMethod("clear"), 1698 forEach: createForEach(true, false) 1699 }; 1700 const shallowReadonlyInstrumentations2 = { 1701 get(key) { 1702 return get(this, key, true, true); 1703 }, 1704 get size() { 1705 return size(this, true); 1706 }, 1707 has(key) { 1708 return has.call(this, key, true); 1709 }, 1710 add: createReadonlyMethod("add"), 1711 set: createReadonlyMethod("set"), 1712 delete: createReadonlyMethod("delete"), 1713 clear: createReadonlyMethod("clear"), 1714 forEach: createForEach(true, true) 1715 }; 1716 const iteratorMethods = [ 1717 "keys", 1718 "values", 1719 "entries", 1720 Symbol.iterator 1721 ]; 1722 iteratorMethods.forEach((method) => { 1723 mutableInstrumentations2[method] = createIterableMethod(method, false, false); 1724 readonlyInstrumentations2[method] = createIterableMethod(method, true, false); 1725 shallowInstrumentations2[method] = createIterableMethod(method, false, true); 1726 shallowReadonlyInstrumentations2[method] = createIterableMethod( 1727 method, 1728 true, 1729 true 1730 ); 1731 }); 1732 return [ 1733 mutableInstrumentations2, 1734 readonlyInstrumentations2, 1735 shallowInstrumentations2, 1736 shallowReadonlyInstrumentations2 1737 ]; 1738 } 1739 const [ 1740 mutableInstrumentations, 1741 readonlyInstrumentations, 1742 shallowInstrumentations, 1743 shallowReadonlyInstrumentations 1744 ] = /* @__PURE__ */ createInstrumentations(); 1745 function createInstrumentationGetter(isReadonly2, shallow) { 1746 const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations; 1747 return (target, key, receiver) => { 1748 if (key === "__v_isReactive") { 1749 return !isReadonly2; 1750 } else if (key === "__v_isReadonly") { 1751 return isReadonly2; 1752 } else if (key === "__v_raw") { 1753 return target; 1754 } 1755 return Reflect.get( 1756 hasOwn(instrumentations, key) && key in target ? instrumentations : target, 1757 key, 1758 receiver 1759 ); 1760 }; 1761 } 1762 const mutableCollectionHandlers = { 1763 get: /* @__PURE__ */ createInstrumentationGetter(false, false) 1764 }; 1765 const shallowCollectionHandlers = { 1766 get: /* @__PURE__ */ createInstrumentationGetter(false, true) 1767 }; 1768 const readonlyCollectionHandlers = { 1769 get: /* @__PURE__ */ createInstrumentationGetter(true, false) 1770 }; 1771 const shallowReadonlyCollectionHandlers = { 1772 get: /* @__PURE__ */ createInstrumentationGetter(true, true) 1773 }; 1774 function checkIdentityKeys(target, has2, key) { 1775 const rawKey = toRaw(key); 1776 if (rawKey !== key && has2.call(target, rawKey)) { 1777 const type = toRawType(target); 1778 warn$2( 1779 `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.` 1780 ); 1781 } 1782 } 1783 1784 const reactiveMap = /* @__PURE__ */ new WeakMap(); 1785 const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); 1786 const readonlyMap = /* @__PURE__ */ new WeakMap(); 1787 const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); 1788 function targetTypeMap(rawType) { 1789 switch (rawType) { 1790 case "Object": 1791 case "Array": 1792 return 1 /* COMMON */; 1793 case "Map": 1794 case "Set": 1795 case "WeakMap": 1796 case "WeakSet": 1797 return 2 /* COLLECTION */; 1798 default: 1799 return 0 /* INVALID */; 1800 } 1801 } 1802 function getTargetType(value) { 1803 return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value)); 1804 } 1805 function reactive(target) { 1806 if (isReadonly(target)) { 1807 return target; 1808 } 1809 return createReactiveObject( 1810 target, 1811 false, 1812 mutableHandlers, 1813 mutableCollectionHandlers, 1814 reactiveMap 1815 ); 1816 } 1817 function shallowReactive(target) { 1818 return createReactiveObject( 1819 target, 1820 false, 1821 shallowReactiveHandlers, 1822 shallowCollectionHandlers, 1823 shallowReactiveMap 1824 ); 1825 } 1826 function readonly(target) { 1827 return createReactiveObject( 1828 target, 1829 true, 1830 readonlyHandlers, 1831 readonlyCollectionHandlers, 1832 readonlyMap 1833 ); 1834 } 1835 function shallowReadonly(target) { 1836 return createReactiveObject( 1837 target, 1838 true, 1839 shallowReadonlyHandlers, 1840 shallowReadonlyCollectionHandlers, 1841 shallowReadonlyMap 1842 ); 1843 } 1844 function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { 1845 if (!isObject(target)) { 1846 { 1847 warn$2( 1848 `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( 1849 target 1850 )}` 1851 ); 1852 } 1853 return target; 1854 } 1855 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { 1856 return target; 1857 } 1858 const existingProxy = proxyMap.get(target); 1859 if (existingProxy) { 1860 return existingProxy; 1861 } 1862 const targetType = getTargetType(target); 1863 if (targetType === 0 /* INVALID */) { 1864 return target; 1865 } 1866 const proxy = new Proxy( 1867 target, 1868 targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers 1869 ); 1870 proxyMap.set(target, proxy); 1871 return proxy; 1872 } 1873 function isReactive(value) { 1874 if (isReadonly(value)) { 1875 return isReactive(value["__v_raw"]); 1876 } 1877 return !!(value && value["__v_isReactive"]); 1878 } 1879 function isReadonly(value) { 1880 return !!(value && value["__v_isReadonly"]); 1881 } 1882 function isShallow(value) { 1883 return !!(value && value["__v_isShallow"]); 1884 } 1885 function isProxy(value) { 1886 return value ? !!value["__v_raw"] : false;
vendor: 15,387 bytes, lines 1887-2489
1887 } 1888 function toRaw(observed) { 1889 const raw = observed && observed["__v_raw"]; 1890 return raw ? toRaw(raw) : observed; 1891 } 1892 function markRaw(value) { 1893 if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) { 1894 def(value, "__v_skip", true); 1895 } 1896 return value; 1897 } 1898 const toReactive = (value) => isObject(value) ? reactive(value) : value; 1899 const toReadonly = (value) => isObject(value) ? readonly(value) : value; 1900 1901 function isRef(r) { 1902 return r ? r["__v_isRef"] === true : false; 1903 } 1904 function ref(value) { 1905 return createRef(value, false); 1906 } 1907 function shallowRef(value) { 1908 return createRef(value, true); 1909 } 1910 function createRef(rawValue, shallow) { 1911 if (isRef(rawValue)) { 1912 return rawValue; 1913 } 1914 return new RefImpl(rawValue, shallow); 1915 } 1916 class RefImpl { 1917 constructor(value, isShallow2) { 1918 this.dep = new Dep(); 1919 this["__v_isRef"] = true; 1920 this["__v_isShallow"] = false; 1921 this._rawValue = isShallow2 ? value : toRaw(value); 1922 this._value = isShallow2 ? value : toReactive(value); 1923 this["__v_isShallow"] = isShallow2; 1924 } 1925 get value() { 1926 { 1927 this.dep.track({ 1928 target: this, 1929 type: "get", 1930 key: "value" 1931 }); 1932 } 1933 return this._value; 1934 } 1935 set value(newValue) { 1936 const oldValue = this._rawValue; 1937 const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue); 1938 newValue = useDirectValue ? newValue : toRaw(newValue); 1939 if (hasChanged(newValue, oldValue)) { 1940 this._rawValue = newValue; 1941 this._value = useDirectValue ? newValue : toReactive(newValue); 1942 { 1943 this.dep.trigger({ 1944 target: this, 1945 type: "set", 1946 key: "value", 1947 newValue, 1948 oldValue 1949 }); 1950 } 1951 } 1952 } 1953 } 1954 function triggerRef(ref2) { 1955 { 1956 ref2.dep.trigger({ 1957 target: ref2, 1958 type: "set", 1959 key: "value", 1960 newValue: ref2._value 1961 }); 1962 } 1963 } 1964 function unref(ref2) { 1965 return isRef(ref2) ? ref2.value : ref2; 1966 } 1967 function toValue(source) { 1968 return isFunction(source) ? source() : unref(source); 1969 } 1970 const shallowUnwrapHandlers = { 1971 get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)), 1972 set: (target, key, value, receiver) => { 1973 const oldValue = target[key]; 1974 if (isRef(oldValue) && !isRef(value)) { 1975 oldValue.value = value; 1976 return true; 1977 } else { 1978 return Reflect.set(target, key, value, receiver); 1979 } 1980 } 1981 }; 1982 function proxyRefs(objectWithRefs) { 1983 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); 1984 } 1985 class CustomRefImpl { 1986 constructor(factory) { 1987 this["__v_isRef"] = true; 1988 this._value = void 0; 1989 const dep = this.dep = new Dep(); 1990 const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep)); 1991 this._get = get; 1992 this._set = set; 1993 } 1994 get value() { 1995 return this._value = this._get(); 1996 } 1997 set value(newVal) { 1998 this._set(newVal); 1999 } 2000 } 2001 function customRef(factory) { 2002 return new CustomRefImpl(factory); 2003 } 2004 function toRefs(object) { 2005 if (!isProxy(object)) { 2006 warn$2(`toRefs() expects a reactive object but received a plain one.`); 2007 } 2008 const ret = isArray(object) ? new Array(object.length) : {}; 2009 for (const key in object) { 2010 ret[key] = propertyToRef(object, key); 2011 } 2012 return ret; 2013 } 2014 class ObjectRefImpl { 2015 constructor(_object, _key, _defaultValue) { 2016 this._object = _object; 2017 this._key = _key; 2018 this._defaultValue = _defaultValue; 2019 this["__v_isRef"] = true; 2020 this._value = void 0; 2021 } 2022 get value() { 2023 const val = this._object[this._key]; 2024 return this._value = val === void 0 ? this._defaultValue : val; 2025 } 2026 set value(newVal) { 2027 this._object[this._key] = newVal; 2028 } 2029 get dep() { 2030 return getDepFromReactive(toRaw(this._object), this._key); 2031 } 2032 } 2033 class GetterRefImpl { 2034 constructor(_getter) { 2035 this._getter = _getter; 2036 this["__v_isRef"] = true; 2037 this["__v_isReadonly"] = true; 2038 this._value = void 0; 2039 } 2040 get value() { 2041 return this._value = this._getter(); 2042 } 2043 } 2044 function toRef(source, key, defaultValue) { 2045 if (isRef(source)) { 2046 return source; 2047 } else if (isFunction(source)) { 2048 return new GetterRefImpl(source); 2049 } else if (isObject(source) && arguments.length > 1) { 2050 return propertyToRef(source, key, defaultValue); 2051 } else { 2052 return ref(source); 2053 } 2054 } 2055 function propertyToRef(source, key, defaultValue) { 2056 const val = source[key]; 2057 return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); 2058 } 2059 2060 class ComputedRefImpl { 2061 constructor(fn, setter, isSSR) { 2062 this.fn = fn; 2063 this.setter = setter; 2064 /** 2065 * @internal 2066 */ 2067 this._value = void 0; 2068 /** 2069 * @internal 2070 */ 2071 this.dep = new Dep(this); 2072 /** 2073 * @internal 2074 */ 2075 this.__v_isRef = true; 2076 // TODO isolatedDeclarations "__v_isReadonly" 2077 // A computed is also a subscriber that tracks other deps 2078 /** 2079 * @internal 2080 */ 2081 this.deps = void 0; 2082 /** 2083 * @internal 2084 */ 2085 this.depsTail = void 0; 2086 /** 2087 * @internal 2088 */ 2089 this.flags = 16; 2090 /** 2091 * @internal 2092 */ 2093 this.globalVersion = globalVersion - 1; 2094 // for backwards compat 2095 this.effect = this; 2096 this["__v_isReadonly"] = !setter; 2097 this.isSSR = isSSR; 2098 } 2099 /** 2100 * @internal 2101 */ 2102 notify() { 2103 this.flags |= 16; 2104 if (activeSub !== this) { 2105 this.dep.notify(); 2106 } 2107 } 2108 get value() { 2109 const link = this.dep.track({ 2110 target: this, 2111 type: "get", 2112 key: "value" 2113 }) ; 2114 refreshComputed(this); 2115 if (link) { 2116 link.version = this.dep.version; 2117 } 2118 return this._value; 2119 } 2120 set value(newValue) { 2121 if (this.setter) { 2122 this.setter(newValue); 2123 } else { 2124 warn$2("Write operation failed: computed value is readonly"); 2125 } 2126 } 2127 } 2128 function computed$1(getterOrOptions, debugOptions, isSSR = false) { 2129 let getter; 2130 let setter; 2131 if (isFunction(getterOrOptions)) { 2132 getter = getterOrOptions; 2133 } else { 2134 getter = getterOrOptions.get; 2135 setter = getterOrOptions.set; 2136 } 2137 const cRef = new ComputedRefImpl(getter, setter, isSSR); 2138 if (debugOptions && !isSSR) { 2139 cRef.onTrack = debugOptions.onTrack; 2140 cRef.onTrigger = debugOptions.onTrigger; 2141 } 2142 return cRef; 2143 } 2144 2145 const TrackOpTypes = { 2146 "GET": "get", 2147 "HAS": "has", 2148 "ITERATE": "iterate" 2149 }; 2150 const TriggerOpTypes = { 2151 "SET": "set", 2152 "ADD": "add", 2153 "DELETE": "delete", 2154 "CLEAR": "clear" 2155 }; 2156 2157 const INITIAL_WATCHER_VALUE = {}; 2158 const cleanupMap = /* @__PURE__ */ new WeakMap(); 2159 let activeWatcher = void 0; 2160 function getCurrentWatcher() { 2161 return activeWatcher; 2162 } 2163 function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) { 2164 if (owner) { 2165 let cleanups = cleanupMap.get(owner); 2166 if (!cleanups) cleanupMap.set(owner, cleanups = []); 2167 cleanups.push(cleanupFn); 2168 } else if (!failSilently) { 2169 warn$2( 2170 `onWatcherCleanup() was called when there was no active watcher to associate with.` 2171 ); 2172 } 2173 } 2174 function watch$1(source, cb, options = EMPTY_OBJ) { 2175 const { immediate, deep, once, scheduler, augmentJob, call } = options; 2176 const warnInvalidSource = (s) => { 2177 (options.onWarn || warn$2)( 2178 `Invalid watch source: `, 2179 s, 2180 `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.` 2181 ); 2182 }; 2183 const reactiveGetter = (source2) => { 2184 if (deep) return source2; 2185 if (isShallow(source2) || deep === false || deep === 0) 2186 return traverse(source2, 1); 2187 return traverse(source2); 2188 }; 2189 let effect; 2190 let getter; 2191 let cleanup; 2192 let boundCleanup; 2193 let forceTrigger = false; 2194 let isMultiSource = false; 2195 if (isRef(source)) { 2196 getter = () => source.value; 2197 forceTrigger = isShallow(source); 2198 } else if (isReactive(source)) { 2199 getter = () => reactiveGetter(source); 2200 forceTrigger = true; 2201 } else if (isArray(source)) { 2202 isMultiSource = true; 2203 forceTrigger = source.some((s) => isReactive(s) || isShallow(s)); 2204 getter = () => source.map((s) => { 2205 if (isRef(s)) { 2206 return s.value; 2207 } else if (isReactive(s)) { 2208 return reactiveGetter(s); 2209 } else if (isFunction(s)) { 2210 return call ? call(s, 2) : s(); 2211 } else { 2212 warnInvalidSource(s); 2213 } 2214 }); 2215 } else if (isFunction(source)) { 2216 if (cb) { 2217 getter = call ? () => call(source, 2) : source; 2218 } else { 2219 getter = () => { 2220 if (cleanup) { 2221 pauseTracking(); 2222 try { 2223 cleanup(); 2224 } finally { 2225 resetTracking(); 2226 } 2227 } 2228 const currentEffect = activeWatcher; 2229 activeWatcher = effect; 2230 try { 2231 return call ? call(source, 3, [boundCleanup]) : source(boundCleanup); 2232 } finally { 2233 activeWatcher = currentEffect; 2234 } 2235 }; 2236 } 2237 } else { 2238 getter = NOOP; 2239 warnInvalidSource(source); 2240 } 2241 if (cb && deep) { 2242 const baseGetter = getter; 2243 const depth = deep === true ? Infinity : deep; 2244 getter = () => traverse(baseGetter(), depth); 2245 } 2246 const scope = getCurrentScope(); 2247 const watchHandle = () => { 2248 effect.stop(); 2249 if (scope) { 2250 remove(scope.effects, effect); 2251 } 2252 }; 2253 if (once) { 2254 if (cb) { 2255 const _cb = cb; 2256 cb = (...args) => { 2257 _cb(...args); 2258 watchHandle(); 2259 }; 2260 } else { 2261 const _getter = getter; 2262 getter = () => { 2263 _getter(); 2264 watchHandle(); 2265 }; 2266 } 2267 } 2268 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; 2269 const job = (immediateFirstRun) => { 2270 if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) { 2271 return; 2272 } 2273 if (cb) { 2274 const newValue = effect.run(); 2275 if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) { 2276 if (cleanup) { 2277 cleanup(); 2278 } 2279 const currentWatcher = activeWatcher; 2280 activeWatcher = effect; 2281 try { 2282 const args = [ 2283 newValue, 2284 // pass undefined as the old value when it's changed for the first time 2285 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, 2286 boundCleanup 2287 ]; 2288 call ? call(cb, 3, args) : ( 2289 // @ts-expect-error 2290 cb(...args) 2291 ); 2292 oldValue = newValue; 2293 } finally { 2294 activeWatcher = currentWatcher; 2295 } 2296 } 2297 } else { 2298 effect.run(); 2299 } 2300 }; 2301 if (augmentJob) { 2302 augmentJob(job); 2303 } 2304 effect = new ReactiveEffect(getter); 2305 effect.scheduler = scheduler ? () => scheduler(job, false) : job; 2306 boundCleanup = (fn) => onWatcherCleanup(fn, false, effect); 2307 cleanup = effect.onStop = () => { 2308 const cleanups = cleanupMap.get(effect); 2309 if (cleanups) { 2310 if (call) { 2311 call(cleanups, 4); 2312 } else { 2313 for (const cleanup2 of cleanups) cleanup2(); 2314 } 2315 cleanupMap.delete(effect); 2316 } 2317 }; 2318 { 2319 effect.onTrack = options.onTrack; 2320 effect.onTrigger = options.onTrigger; 2321 } 2322 if (cb) { 2323 if (immediate) { 2324 job(true); 2325 } else { 2326 oldValue = effect.run(); 2327 } 2328 } else if (scheduler) { 2329 scheduler(job.bind(null, true), true); 2330 } else { 2331 effect.run(); 2332 } 2333 watchHandle.pause = effect.pause.bind(effect); 2334 watchHandle.resume = effect.resume.bind(effect); 2335 watchHandle.stop = watchHandle; 2336 return watchHandle; 2337 } 2338 function traverse(value, depth = Infinity, seen) { 2339 if (depth <= 0 || !isObject(value) || value["__v_skip"]) { 2340 return value; 2341 } 2342 seen = seen || /* @__PURE__ */ new Set(); 2343 if (seen.has(value)) { 2344 return value; 2345 } 2346 seen.add(value); 2347 depth--; 2348 if (isRef(value)) { 2349 traverse(value.value, depth, seen); 2350 } else if (isArray(value)) { 2351 for (let i = 0; i < value.length; i++) { 2352 traverse(value[i], depth, seen); 2353 } 2354 } else if (isSet(value) || isMap(value)) { 2355 value.forEach((v) => { 2356 traverse(v, depth, seen); 2357 }); 2358 } else if (isPlainObject(value)) { 2359 for (const key in value) { 2360 traverse(value[key], depth, seen); 2361 } 2362 for (const key of Object.getOwnPropertySymbols(value)) { 2363 if (Object.prototype.propertyIsEnumerable.call(value, key)) { 2364 traverse(value[key], depth, seen); 2365 } 2366 } 2367 } 2368 return value; 2369 } 2370 2371 const stack$1 = []; 2372 function pushWarningContext(vnode) { 2373 stack$1.push(vnode); 2374 } 2375 function popWarningContext() { 2376 stack$1.pop(); 2377 } 2378 let isWarning = false; 2379 function warn$1(msg, ...args) { 2380 if (isWarning) return; 2381 isWarning = true; 2382 pauseTracking(); 2383 const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null; 2384 const appWarnHandler = instance && instance.appContext.config.warnHandler; 2385 const trace = getComponentTrace(); 2386 if (appWarnHandler) { 2387 callWithErrorHandling( 2388 appWarnHandler, 2389 instance, 2390 11, 2391 [ 2392 // eslint-disable-next-line no-restricted-syntax 2393 msg + args.map((a) => { 2394 var _a, _b; 2395 return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a); 2396 }).join(""), 2397 instance && instance.proxy, 2398 trace.map( 2399 ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>` 2400 ).join("\n"), 2401 trace 2402 ] 2403 ); 2404 } else { 2405 const warnArgs = [`[Vue warn]: ${msg}`, ...args]; 2406 if (trace.length && // avoid spamming console during tests 2407 true) { 2408 warnArgs.push(` 2409`, ...formatTrace(trace)); 2410 } 2411 console.warn(...warnArgs); 2412 } 2413 resetTracking(); 2414 isWarning = false; 2415 } 2416 function getComponentTrace() { 2417 let currentVNode = stack$1[stack$1.length - 1]; 2418 if (!currentVNode) { 2419 return []; 2420 } 2421 const normalizedStack = []; 2422 while (currentVNode) { 2423 const last = normalizedStack[0]; 2424 if (last && last.vnode === currentVNode) { 2425 last.recurseCount++; 2426 } else { 2427 normalizedStack.push({ 2428 vnode: currentVNode, 2429 recurseCount: 0 2430 }); 2431 } 2432 const parentInstance = currentVNode.component && currentVNode.component.parent; 2433 currentVNode = parentInstance && parentInstance.vnode; 2434 } 2435 return normalizedStack; 2436 } 2437 function formatTrace(trace) { 2438 const logs = []; 2439 trace.forEach((entry, i) => { 2440 logs.push(...i === 0 ? [] : [` 2441`], ...formatTraceEntry(entry)); 2442 }); 2443 return logs; 2444 } 2445 function formatTraceEntry({ vnode, recurseCount }) { 2446 const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``; 2447 const isRoot = vnode.component ? vnode.component.parent == null : false; 2448 const open = ` at <${formatComponentName( 2449 vnode.component, 2450 vnode.type, 2451 isRoot 2452 )}`; 2453 const close = `>` + postfix; 2454 return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close]; 2455 } 2456 function formatProps(props) { 2457 const res = []; 2458 const keys = Object.keys(props); 2459 keys.slice(0, 3).forEach((key) => { 2460 res.push(...formatProp(key, props[key])); 2461 }); 2462 if (keys.length > 3) { 2463 res.push(` ...`); 2464 } 2465 return res; 2466 } 2467 function formatProp(key, value, raw) { 2468 if (isString(value)) { 2469 value = JSON.stringify(value); 2470 return raw ? value : [`${key}=${value}`]; 2471 } else if (typeof value === "number" || typeof value === "boolean" || value == null) { 2472 return raw ? value : [`${key}=${value}`]; 2473 } else if (isRef(value)) { 2474 value = formatProp(key, toRaw(value.value), true); 2475 return raw ? value : [`${key}=Ref<`, value, `>`]; 2476 } else if (isFunction(value)) { 2477 return [`${key}=fn${value.name ? `<${value.name}>` : ``}`]; 2478 } else { 2479 value = toRaw(value); 2480 return raw ? value : [`${key}=`, value]; 2481 } 2482 } 2483 function assertNumber(val, type) { 2484 if (val === void 0) { 2485 return; 2486 } else if (typeof val !== "number") { 2487 warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`); 2488 } else if (isNaN(val)) { 2489 warn$1(`${type}
2489 is NaN - the duration expression might be incorrect.`); 2490 } 2491 } 2492 2493 const ErrorCodes = { 2494 "SETUP_FUNCTION": 0, 2495 "0": "SETUP_FUNCTION", 2496 "RENDER_FUNCTION": 1, 2497 "1": "RENDER_FUNCTION", 2498 "NATIVE_EVENT_HANDLER": 5, 2499 "5": "NATIVE_EVENT_HANDLER", 2500 "COMPONENT_EVENT_HANDLER": 6, 2501 "6": "COMPONENT_EVENT_HANDLER", 2502 "VNODE_HOOK": 7, 2503 "7": "VNODE_HOOK", 2504 "DIRECTIVE_HOOK": 8, 2505 "8": "DIRECTIVE_HOOK", 2506 "TRANSITION_HOOK": 9, 2507 "9": "TRANSITION_HOOK", 2508 "APP_ERROR_HANDLER": 10, 2509 "10": "APP_ERROR_HANDLER", 2510 "APP_WARN_HANDLER": 11, 2511 "11": "APP_WARN_HANDLER", 2512 "FUNCTION_REF": 12, 2513 "12": "FUNCTION_REF", 2514 "ASYNC_COMPONENT_LOADER": 13, 2515 "13": "ASYNC_COMPONENT_LOADER", 2516 "SCHEDULER": 14, 2517 "14": "SCHEDULER", 2518 "COMPONENT_UPDATE": 15, 2519 "15": "COMPONENT_UPDATE", 2520 "APP_UNMOUNT_CLEANUP": 16, 2521 "16": "APP_UNMOUNT_CLEANUP" 2522 }; 2523 const ErrorTypeStrings$1 = { 2524 ["sp"]: "serverPrefetch hook", 2525 ["bc"]: "beforeCreate hook", 2526 ["c"]: "created hook", 2527 ["bm"]: "beforeMount hook", 2528 ["m"]: "mounted hook", 2529 ["bu"]: "beforeUpdate hook", 2530 ["u"]: "updated", 2531 ["bum"]: "beforeUnmount hook", 2532 ["um"]: "unmounted hook", 2533 ["a"]: "activated hook", 2534 ["da"]: "deactivated hook", 2535 ["ec"]: "errorCaptured hook", 2536 ["rtc"]: "renderTracked hook", 2537 ["rtg"]: "renderTriggered hook", 2538 [0]: "setup function", 2539 [1]: "render function", 2540 [2]: "watcher getter", 2541 [3]: "watcher callback", 2542 [4]: "watcher cleanup function", 2543 [5]: "native event handler", 2544 [6]: "component event handler", 2545 [7]: "vnode hook", 2546 [8]: "directive hook", 2547 [9]: "transition hook", 2548 [10]: "app errorHandler", 2549 [11]: "app warnHandler", 2550 [12]: "ref function", 2551 [13]: "async component loader", 2552 [14]: "scheduler flush", 2553 [15]: "component update", 2554 [16]: "app unmount cleanup function" 2555 }; 2556 function callWithErrorHandling(fn, instance, type, args) { 2557 try { 2558 return args ? fn(...args) : fn(); 2559 } catch (err) { 2560 handleError(err, instance, type); 2561 } 2562 } 2563 function callWithAsyncErrorHandling(fn, instance, type, args) { 2564 if (isFunction(fn)) { 2565 const res = callWithErrorHandling(fn, instance, type, args); 2566 if (res && isPromise(res)) { 2567 res.catch((err) => { 2568 handleError(err, instance, type); 2569 }); 2570 } 2571 return res; 2572 } 2573 if (isArray(fn)) { 2574 const values = []; 2575 for (let i = 0; i < fn.length; i++) { 2576 values.push(callWithAsyncErrorHandling(fn[i], instance, type, args)); 2577 } 2578 return values; 2579 } else { 2580 warn$1( 2581 `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}` 2582 ); 2583 } 2584 } 2585 function handleError(err, instance, type, throwInDev = true) { 2586 const contextVNode = instance ? instance.vnode : null; 2587 const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ; 2588 if (instance) { 2589 let cur = instance.parent; 2590 const exposedInstance = instance.proxy; 2591 const errorInfo = ErrorTypeStrings$1[type] ; 2592 while (cur) {
vendor: 14,249 bytes, lines 2593-3111
2593 const errorCapturedHooks = cur.ec; 2594 if (errorCapturedHooks) { 2595 for (let i = 0; i < errorCapturedHooks.length; i++) { 2596 if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) { 2597 return; 2598 } 2599 } 2600 } 2601 cur = cur.parent; 2602 } 2603 if (errorHandler) { 2604 pauseTracking(); 2605 callWithErrorHandling(errorHandler, null, 10, [ 2606 err, 2607 exposedInstance, 2608 errorInfo 2609 ]); 2610 resetTracking(); 2611 return; 2612 } 2613 } 2614 logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction); 2615 } 2616 function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) { 2617 { 2618 const info = ErrorTypeStrings$1[type]; 2619 if (contextVNode) { 2620 pushWarningContext(contextVNode); 2621 } 2622 warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`); 2623 if (contextVNode) { 2624 popWarningContext(); 2625 } 2626 if (throwInDev) { 2627 throw err; 2628 } else { 2629 console.error(err); 2630 } 2631 } 2632 } 2633 2634 let isFlushing = false; 2635 let isFlushPending = false; 2636 const queue = []; 2637 let flushIndex = 0; 2638 const pendingPostFlushCbs = []; 2639 let activePostFlushCbs = null; 2640 let postFlushIndex = 0; 2641 const resolvedPromise = /* @__PURE__ */ Promise.resolve(); 2642 let currentFlushPromise = null; 2643 const RECURSION_LIMIT = 100; 2644 function nextTick(fn) { 2645 const p = currentFlushPromise || resolvedPromise; 2646 return fn ? p.then(this ? fn.bind(this) : fn) : p; 2647 } 2648 function findInsertionIndex(id) { 2649 let start = isFlushing ? flushIndex + 1 : 0; 2650 let end = queue.length; 2651 while (start < end) { 2652 const middle = start + end >>> 1; 2653 const middleJob = queue[middle]; 2654 const middleJobId = getId(middleJob); 2655 if (middleJobId < id || middleJobId === id && middleJob.flags & 2) { 2656 start = middle + 1; 2657 } else { 2658 end = middle; 2659 } 2660 } 2661 return start; 2662 } 2663 function queueJob(job) { 2664 if (!(job.flags & 1)) { 2665 const jobId = getId(job); 2666 const lastJob = queue[queue.length - 1]; 2667 if (!lastJob || // fast path when the job id is larger than the tail 2668 !(job.flags & 2) && jobId >= getId(lastJob)) { 2669 queue.push(job); 2670 } else { 2671 queue.splice(findInsertionIndex(jobId), 0, job); 2672 } 2673 job.flags |= 1; 2674 queueFlush(); 2675 } 2676 } 2677 function queueFlush() { 2678 if (!isFlushing && !isFlushPending) { 2679 isFlushPending = true; 2680 currentFlushPromise = resolvedPromise.then(flushJobs); 2681 } 2682 } 2683 function queuePostFlushCb(cb) { 2684 if (!isArray(cb)) { 2685 if (activePostFlushCbs && cb.id === -1) { 2686 activePostFlushCbs.splice(postFlushIndex + 1, 0, cb); 2687 } else if (!(cb.flags & 1)) { 2688 pendingPostFlushCbs.push(cb); 2689 cb.flags |= 1; 2690 } 2691 } else { 2692 pendingPostFlushCbs.push(...cb); 2693 } 2694 queueFlush(); 2695 } 2696 function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) { 2697 { 2698 seen = seen || /* @__PURE__ */ new Map(); 2699 } 2700 for (; i < queue.length; i++) { 2701 const cb = queue[i]; 2702 if (cb && cb.flags & 2) { 2703 if (instance && cb.id !== instance.uid) { 2704 continue; 2705 } 2706 if (checkRecursiveUpdates(seen, cb)) { 2707 continue; 2708 } 2709 queue.splice(i, 1); 2710 i--; 2711 if (cb.flags & 4) { 2712 cb.flags &= ~1; 2713 } 2714 cb(); 2715 cb.flags &= ~1; 2716 } 2717 } 2718 } 2719 function flushPostFlushCbs(seen) { 2720 if (pendingPostFlushCbs.length) { 2721 const deduped = [...new Set(pendingPostFlushCbs)].sort( 2722 (a, b) => getId(a) - getId(b) 2723 ); 2724 pendingPostFlushCbs.length = 0; 2725 if (activePostFlushCbs) { 2726 activePostFlushCbs.push(...deduped); 2727 return; 2728 } 2729 activePostFlushCbs = deduped; 2730 { 2731 seen = seen || /* @__PURE__ */ new Map(); 2732 } 2733 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) { 2734 const cb = activePostFlushCbs[postFlushIndex]; 2735 if (checkRecursiveUpdates(seen, cb)) { 2736 continue; 2737 } 2738 if (cb.flags & 4) { 2739 cb.flags &= ~1; 2740 } 2741 if (!(cb.flags & 8)) cb(); 2742 cb.flags &= ~1; 2743 } 2744 activePostFlushCbs = null; 2745 postFlushIndex = 0; 2746 } 2747 } 2748 const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id; 2749 function flushJobs(seen) { 2750 isFlushPending = false; 2751 isFlushing = true; 2752 { 2753 seen = seen || /* @__PURE__ */ new Map(); 2754 } 2755 const check = (job) => checkRecursiveUpdates(seen, job) ; 2756 try { 2757 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { 2758 const job = queue[flushIndex]; 2759 if (job && !(job.flags & 8)) { 2760 if (check(job)) { 2761 continue; 2762 } 2763 if (job.flags & 4) { 2764 job.flags &= ~1; 2765 } 2766 callWithErrorHandling( 2767 job, 2768 job.i, 2769 job.i ? 15 : 14 2770 ); 2771 job.flags &= ~1; 2772 } 2773 } 2774 } finally { 2775 for (; flushIndex < queue.length; flushIndex++) { 2776 const job = queue[flushIndex]; 2777 if (job) { 2778 job.flags &= ~1; 2779 } 2780 } 2781 flushIndex = 0; 2782 queue.length = 0; 2783 flushPostFlushCbs(seen); 2784 isFlushing = false; 2785 currentFlushPromise = null; 2786 if (queue.length || pendingPostFlushCbs.length) { 2787 flushJobs(seen); 2788 } 2789 } 2790 } 2791 function checkRecursiveUpdates(seen, fn) { 2792 const count = seen.get(fn) || 0; 2793 if (count > RECURSION_LIMIT) { 2794 const instance = fn.i; 2795 const componentName = instance && getComponentName(instance.type); 2796 handleError( 2797 `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.`, 2798 null, 2799 10 2800 ); 2801 return true; 2802 } 2803 seen.set(fn, count + 1); 2804 return false; 2805 } 2806 2807 let isHmrUpdating = false; 2808 const hmrDirtyComponents = /* @__PURE__ */ new Map(); 2809 { 2810 getGlobalThis().__VUE_HMR_RUNTIME__ = { 2811 createRecord: tryWrap(createRecord), 2812 rerender: tryWrap(rerender), 2813 reload: tryWrap(reload) 2814 }; 2815 } 2816 const map = /* @__PURE__ */ new Map(); 2817 function registerHMR(instance) { 2818 const id = instance.type.__hmrId; 2819 let record = map.get(id); 2820 if (!record) { 2821 createRecord(id, instance.type); 2822 record = map.get(id); 2823 } 2824 record.instances.add(instance); 2825 } 2826 function unregisterHMR(instance) { 2827 map.get(instance.type.__hmrId).instances.delete(instance); 2828 } 2829 function createRecord(id, initialDef) { 2830 if (map.has(id)) { 2831 return false; 2832 } 2833 map.set(id, { 2834 initialDef: normalizeClassComponent(initialDef), 2835 instances: /* @__PURE__ */ new Set() 2836 }); 2837 return true; 2838 } 2839 function normalizeClassComponent(component) { 2840 return isClassComponent(component) ? component.__vccOpts : component; 2841 } 2842 function rerender(id, newRender) { 2843 const record = map.get(id); 2844 if (!record) { 2845 return; 2846 } 2847 record.initialDef.render = newRender; 2848 [...record.instances].forEach((instance) => { 2849 if (newRender) { 2850 instance.render = newRender; 2851 normalizeClassComponent(instance.type).render = newRender; 2852 } 2853 instance.renderCache = []; 2854 isHmrUpdating = true; 2855 instance.update(); 2856 isHmrUpdating = false; 2857 }); 2858 } 2859 function reload(id, newComp) { 2860 const record = map.get(id); 2861 if (!record) return; 2862 newComp = normalizeClassComponent(newComp); 2863 updateComponentDef(record.initialDef, newComp); 2864 const instances = [...record.instances]; 2865 for (let i = 0; i < instances.length; i++) { 2866 const instance = instances[i]; 2867 const oldComp = normalizeClassComponent(instance.type); 2868 let dirtyInstances = hmrDirtyComponents.get(oldComp); 2869 if (!dirtyInstances) { 2870 if (oldComp !== record.initialDef) { 2871 updateComponentDef(oldComp, newComp); 2872 } 2873 hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set()); 2874 } 2875 dirtyInstances.add(instance); 2876 instance.appContext.propsCache.delete(instance.type); 2877 instance.appContext.emitsCache.delete(instance.type); 2878 instance.appContext.optionsCache.delete(instance.type); 2879 if (instance.ceReload) { 2880 dirtyInstances.add(instance); 2881 instance.ceReload(newComp.styles); 2882 dirtyInstances.delete(instance); 2883 } else if (instance.parent) { 2884 queueJob(() => { 2885 instance.parent.update(); 2886 dirtyInstances.delete(instance); 2887 }); 2888 } else if (instance.appContext.reload) { 2889 instance.appContext.reload(); 2890 } else if (typeof window !== "undefined") { 2891 window.location.reload(); 2892 } else { 2893 console.warn( 2894 "[HMR] Root or manually mounted instance modified. Full reload required." 2895 ); 2896 } 2897 if (instance.root.ce && instance !== instance.root) { 2898 instance.root.ce._removeChildStyle(oldComp); 2899 } 2900 } 2901 queuePostFlushCb(() => { 2902 hmrDirtyComponents.clear(); 2903 }); 2904 } 2905 function updateComponentDef(oldComp, newComp) { 2906 extend(oldComp, newComp); 2907 for (const key in oldComp) { 2908 if (key !== "__file" && !(key in newComp)) { 2909 delete oldComp[key]; 2910 } 2911 } 2912 } 2913 function tryWrap(fn) { 2914 return (id, arg) => { 2915 try { 2916 return fn(id, arg); 2917 } catch (e) { 2918 console.error(e); 2919 console.warn( 2920 `[HMR] Something went wrong during Vue component hot-reload. Full reload required.` 2921 ); 2922 } 2923 }; 2924 } 2925 2926 let devtools$1; 2927 let buffer = []; 2928 let devtoolsNotInstalled = false; 2929 function emit$1(event, ...args) { 2930 if (devtools$1) { 2931 devtools$1.emit(event, ...args); 2932 } else if (!devtoolsNotInstalled) { 2933 buffer.push({ event, args }); 2934 } 2935 } 2936 function setDevtoolsHook$1(hook, target) { 2937 var _a, _b; 2938 devtools$1 = hook; 2939 if (devtools$1) { 2940 devtools$1.enabled = true; 2941 buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args)); 2942 buffer = []; 2943 } else if ( 2944 // handle late devtools injection - only do this if we are in an actual 2945 // browser environment to avoid the timer handle stalling test runner exit 2946 // (#4815) 2947 typeof window !== "undefined" && // some envs mock window but not fully 2948 window.HTMLElement && // also exclude jsdom 2949 // eslint-disable-next-line no-restricted-syntax 2950 !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom")) 2951 ) { 2952 const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; 2953 replay.push((newHook) => { 2954 setDevtoolsHook$1(newHook, target); 2955 }); 2956 setTimeout(() => { 2957 if (!devtools$1) { 2958 target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null; 2959 devtoolsNotInstalled = true; 2960 buffer = []; 2961 } 2962 }, 3e3); 2963 } else { 2964 devtoolsNotInstalled = true; 2965 buffer = []; 2966 } 2967 } 2968 function devtoolsInitApp(app, version) { 2969 emit$1("app:init" /* APP_INIT */, app, version, { 2970 Fragment, 2971 Text, 2972 Comment, 2973 Static 2974 }); 2975 } 2976 function devtoolsUnmountApp(app) { 2977 emit$1("app:unmount" /* APP_UNMOUNT */, app); 2978 } 2979 const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */); 2980 const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */); 2981 const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook( 2982 "component:removed" /* COMPONENT_REMOVED */ 2983 ); 2984 const devtoolsComponentRemoved = (component) => { 2985 if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered 2986 !devtools$1.cleanupBuffer(component)) { 2987 _devtoolsComponentRemoved(component); 2988 } 2989 }; 2990 /*! #__NO_SIDE_EFFECTS__ */ 2991 // @__NO_SIDE_EFFECTS__ 2992 function createDevtoolsComponentHook(hook) { 2993 return (component) => { 2994 emit$1( 2995 hook, 2996 component.appContext.app, 2997 component.uid, 2998 component.parent ? component.parent.uid : void 0, 2999 component 3000 ); 3001 }; 3002 } 3003 const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */); 3004 const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */); 3005 function createDevtoolsPerformanceHook(hook) { 3006 return (component, type, time) => { 3007 emit$1(hook, component.appContext.app, component.uid, component, type, time); 3008 }; 3009 } 3010 function devtoolsComponentEmit(component, event, params) { 3011 emit$1( 3012 "component:emit" /* COMPONENT_EMIT */, 3013 component.appContext.app, 3014 component, 3015 event, 3016 params 3017 ); 3018 } 3019 3020 let currentRenderingInstance = null; 3021 let currentScopeId = null; 3022 function setCurrentRenderingInstance(instance) { 3023 const prev = currentRenderingInstance; 3024 currentRenderingInstance = instance; 3025 currentScopeId = instance && instance.type.__scopeId || null; 3026 return prev; 3027 } 3028 function pushScopeId(id) { 3029 currentScopeId = id; 3030 } 3031 function popScopeId() { 3032 currentScopeId = null; 3033 } 3034 const withScopeId = (_id) => withCtx; 3035 function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) { 3036 if (!ctx) return fn; 3037 if (fn._n) { 3038 return fn; 3039 } 3040 const renderFnWithContext = (...args) => { 3041 if (renderFnWithContext._d) { 3042 setBlockTracking(-1); 3043 } 3044 const prevInstance = setCurrentRenderingInstance(ctx); 3045 let res; 3046 try { 3047 res = fn(...args); 3048 } finally { 3049 setCurrentRenderingInstance(prevInstance); 3050 if (renderFnWithContext._d) { 3051 setBlockTracking(1); 3052 } 3053 } 3054 { 3055 devtoolsComponentUpdated(ctx); 3056 } 3057 return res; 3058 }; 3059 renderFnWithContext._n = true; 3060 renderFnWithContext._c = true; 3061 renderFnWithContext._d = true; 3062 return renderFnWithContext; 3063 } 3064 3065 function validateDirectiveName(name) { 3066 if (isBuiltInDirective(name)) { 3067 warn$1("Do not use built-in directive ids as custom directive id: " + name); 3068 } 3069 } 3070 function withDirectives(vnode, directives) { 3071 if (currentRenderingInstance === null) { 3072 warn$1(`withDirectives can only be used inside render functions.`); 3073 return vnode; 3074 } 3075 const instance = getComponentPublicInstance(currentRenderingInstance); 3076 const bindings = vnode.dirs || (vnode.dirs = []); 3077 for (let i = 0; i < directives.length; i++) { 3078 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i]; 3079 if (dir) { 3080 if (isFunction(dir)) { 3081 dir = { 3082 mounted: dir, 3083 updated: dir 3084 }; 3085 } 3086 if (dir.deep) { 3087 traverse(value); 3088 } 3089 bindings.push({ 3090 dir, 3091 instance, 3092 value, 3093 oldValue: void 0, 3094 arg, 3095 modifiers 3096 }); 3097 } 3098 } 3099 return vnode; 3100 } 3101 function invokeDirectiveHook(vnode, prevVNode, instance, name) { 3102 const bindings = vnode.dirs; 3103 const oldBindings = prevVNode && prevVNode.dirs; 3104 for (let i = 0; i < bindings.length; i++) { 3105 const binding = bindings[i]; 3106 if (oldBindings) { 3107 binding.oldValue = oldBindings[i].value; 3108 } 3109 let hook = binding.dir[name]; 3110 if (hook) { 3111 pauseTracking();
vendor: 10,787 bytes, lines 3112-3495
3112 callWithAsyncErrorHandling(hook, instance, 8, [ 3113 vnode.el, 3114 binding, 3115 vnode, 3116 prevVNode 3117 ]); 3118 resetTracking(); 3119 } 3120 } 3121 } 3122 3123 const TeleportEndKey = Symbol("_vte"); 3124 const isTeleport = (type) => type.__isTeleport; 3125 const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === ""); 3126 const isTeleportDeferred = (props) => props && (props.defer || props.defer === ""); 3127 const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement; 3128 const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement; 3129 const resolveTarget = (props, select) => { 3130 const targetSelector = props && props.to; 3131 if (isString(targetSelector)) { 3132 if (!select) { 3133 warn$1( 3134 `Current renderer does not support string target for Teleports. (missing querySelector renderer option)` 3135 ); 3136 return null; 3137 } else { 3138 const target = select(targetSelector); 3139 if (!target && !isTeleportDisabled(props)) { 3140 warn$1( 3141 `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.` 3142 ); 3143 } 3144 return target; 3145 } 3146 } else { 3147 if (!targetSelector && !isTeleportDisabled(props)) { 3148 warn$1(`Invalid Teleport target: ${targetSelector}`); 3149 } 3150 return targetSelector; 3151 } 3152 }; 3153 const TeleportImpl = { 3154 name: "Teleport", 3155 __isTeleport: true, 3156 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) { 3157 const { 3158 mc: mountChildren, 3159 pc: patchChildren, 3160 pbc: patchBlockChildren, 3161 o: { insert, querySelector, createText, createComment } 3162 } = internals; 3163 const disabled = isTeleportDisabled(n2.props); 3164 let { shapeFlag, children, dynamicChildren } = n2; 3165 if (isHmrUpdating) { 3166 optimized = false; 3167 dynamicChildren = null; 3168 } 3169 if (n1 == null) { 3170 const placeholder = n2.el = createComment("teleport start") ; 3171 const mainAnchor = n2.anchor = createComment("teleport end") ; 3172 insert(placeholder, container, anchor); 3173 insert(mainAnchor, container, anchor); 3174 const mount = (container2, anchor2) => { 3175 if (shapeFlag & 16) { 3176 mountChildren( 3177 children, 3178 container2, 3179 anchor2, 3180 parentComponent, 3181 parentSuspense, 3182 namespace, 3183 slotScopeIds, 3184 optimized 3185 ); 3186 } 3187 }; 3188 const mountToTarget = () => { 3189 const target = n2.target = resolveTarget(n2.props, querySelector); 3190 const targetAnchor = prepareAnchor(target, n2, createText, insert); 3191 if (target) { 3192 if (namespace !== "svg" && isTargetSVG(target)) { 3193 namespace = "svg"; 3194 } else if (namespace !== "mathml" && isTargetMathML(target)) { 3195 namespace = "mathml"; 3196 } 3197 if (!disabled) { 3198 mount(target, targetAnchor); 3199 updateCssVars(n2); 3200 } 3201 } else if (!disabled) { 3202 warn$1( 3203 "Invalid Teleport target on mount:", 3204 target, 3205 `(${typeof target})` 3206 ); 3207 } 3208 }; 3209 if (disabled) { 3210 mount(container, mainAnchor); 3211 updateCssVars(n2); 3212 } 3213 if (isTeleportDeferred(n2.props)) { 3214 queuePostRenderEffect(mountToTarget, parentSuspense); 3215 } else { 3216 mountToTarget(); 3217 } 3218 } else { 3219 n2.el = n1.el; 3220 n2.targetStart = n1.targetStart; 3221 const mainAnchor = n2.anchor = n1.anchor; 3222 const target = n2.target = n1.target; 3223 const targetAnchor = n2.targetAnchor = n1.targetAnchor; 3224 const wasDisabled = isTeleportDisabled(n1.props); 3225 const currentContainer = wasDisabled ? container : target; 3226 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor; 3227 if (namespace === "svg" || isTargetSVG(target)) { 3228 namespace = "svg"; 3229 } else if (namespace === "mathml" || isTargetMathML(target)) { 3230 namespace = "mathml"; 3231 } 3232 if (dynamicChildren) { 3233 patchBlockChildren( 3234 n1.dynamicChildren, 3235 dynamicChildren, 3236 currentContainer, 3237 parentComponent, 3238 parentSuspense, 3239 namespace, 3240 slotScopeIds 3241 ); 3242 traverseStaticChildren(n1, n2, true); 3243 } else if (!optimized) { 3244 patchChildren( 3245 n1, 3246 n2, 3247 currentContainer, 3248 currentAnchor, 3249 parentComponent, 3250 parentSuspense, 3251 namespace, 3252 slotScopeIds, 3253 false 3254 ); 3255 } 3256 if (disabled) { 3257 if (!wasDisabled) { 3258 moveTeleport( 3259 n2, 3260 container, 3261 mainAnchor, 3262 internals, 3263 1 3264 ); 3265 } else { 3266 if (n2.props && n1.props && n2.props.to !== n1.props.to) { 3267 n2.props.to = n1.props.to; 3268 } 3269 } 3270 } else { 3271 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) { 3272 const nextTarget = n2.target = resolveTarget( 3273 n2.props, 3274 querySelector 3275 ); 3276 if (nextTarget) { 3277 moveTeleport( 3278 n2, 3279 nextTarget, 3280 null, 3281 internals, 3282 0 3283 ); 3284 } else { 3285 warn$1( 3286 "Invalid Teleport target on update:", 3287 target, 3288 `(${typeof target})` 3289 ); 3290 } 3291 } else if (wasDisabled) { 3292 moveTeleport( 3293 n2, 3294 target, 3295 targetAnchor, 3296 internals, 3297 1 3298 ); 3299 } 3300 } 3301 updateCssVars(n2); 3302 } 3303 }, 3304 remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) { 3305 const { 3306 shapeFlag, 3307 children, 3308 anchor, 3309 targetStart, 3310 targetAnchor, 3311 target, 3312 props 3313 } = vnode; 3314 if (target) { 3315 hostRemove(targetStart); 3316 hostRemove(targetAnchor); 3317 } 3318 doRemove && hostRemove(anchor); 3319 if (shapeFlag & 16) { 3320 const shouldRemove = doRemove || !isTeleportDisabled(props); 3321 for (let i = 0; i < children.length; i++) { 3322 const child = children[i]; 3323 unmount( 3324 child, 3325 parentComponent, 3326 parentSuspense, 3327 shouldRemove, 3328 !!child.dynamicChildren 3329 ); 3330 } 3331 } 3332 }, 3333 move: moveTeleport, 3334 hydrate: hydrateTeleport 3335 }; 3336 function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) { 3337 if (moveType === 0) { 3338 insert(vnode.targetAnchor, container, parentAnchor); 3339 } 3340 const { el, anchor, shapeFlag, children, props } = vnode; 3341 const isReorder = moveType === 2; 3342 if (isReorder) { 3343 insert(el, container, parentAnchor); 3344 } 3345 if (!isReorder || isTeleportDisabled(props)) { 3346 if (shapeFlag & 16) { 3347 for (let i = 0; i < children.length; i++) { 3348 move( 3349 children[i], 3350 container, 3351 parentAnchor, 3352 2 3353 ); 3354 } 3355 } 3356 } 3357 if (isReorder) { 3358 insert(anchor, container, parentAnchor); 3359 } 3360 } 3361 function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { 3362 o: { nextSibling, parentNode, querySelector, insert, createText } 3363 }, hydrateChildren) { 3364 const target = vnode.target = resolveTarget( 3365 vnode.props, 3366 querySelector 3367 ); 3368 if (target) { 3369 const targetNode = target._lpa || target.firstChild; 3370 if (vnode.shapeFlag & 16) { 3371 if (isTeleportDisabled(vnode.props)) { 3372 vnode.anchor = hydrateChildren( 3373 nextSibling(node), 3374 vnode, 3375 parentNode(node), 3376 parentComponent, 3377 parentSuspense, 3378 slotScopeIds, 3379 optimized 3380 ); 3381 vnode.targetStart = targetNode; 3382 vnode.targetAnchor = targetNode && nextSibling(targetNode); 3383 } else { 3384 vnode.anchor = nextSibling(node); 3385 let targetAnchor = targetNode; 3386 while (targetAnchor) { 3387 if (targetAnchor && targetAnchor.nodeType === 8) { 3388 if (targetAnchor.data === "teleport start anchor") { 3389 vnode.targetStart = targetAnchor; 3390 } else if (targetAnchor.data === "teleport anchor") { 3391 vnode.targetAnchor = targetAnchor; 3392 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor); 3393 break; 3394 } 3395 } 3396 targetAnchor = nextSibling(targetAnchor); 3397 } 3398 if (!vnode.targetAnchor) { 3399 prepareAnchor(target, vnode, createText, insert); 3400 } 3401 hydrateChildren( 3402 targetNode && nextSibling(targetNode), 3403 vnode, 3404 target, 3405 parentComponent, 3406 parentSuspense, 3407 slotScopeIds, 3408 optimized 3409 ); 3410 } 3411 } 3412 updateCssVars(vnode); 3413 } 3414 return vnode.anchor && nextSibling(vnode.anchor); 3415 } 3416 const Teleport = TeleportImpl; 3417 function updateCssVars(vnode) { 3418 const ctx = vnode.ctx; 3419 if (ctx && ctx.ut) { 3420 let node = vnode.targetStart; 3421 while (node && node !== vnode.targetAnchor) { 3422 if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid); 3423 node = node.nextSibling; 3424 } 3425 ctx.ut(); 3426 } 3427 } 3428 function prepareAnchor(target, vnode, createText, insert) { 3429 const targetStart = vnode.targetStart = createText(""); 3430 const targetAnchor = vnode.targetAnchor = createText(""); 3431 targetStart[TeleportEndKey] = targetAnchor; 3432 if (target) { 3433 insert(targetStart, target); 3434 insert(targetAnchor, target); 3435 } 3436 return targetAnchor; 3437 } 3438 3439 const leaveCbKey = Symbol("_leaveCb"); 3440 const enterCbKey$1 = Symbol("_enterCb"); 3441 function useTransitionState() { 3442 const state = { 3443 isMounted: false, 3444 isLeaving: false, 3445 isUnmounting: false, 3446 leavingVNodes: /* @__PURE__ */ new Map() 3447 }; 3448 onMounted(() => { 3449 state.isMounted = true; 3450 }); 3451 onBeforeUnmount(() => { 3452 state.isUnmounting = true; 3453 }); 3454 return state; 3455 } 3456 const TransitionHookValidator = [Function, Array]; 3457 const BaseTransitionPropsValidators = { 3458 mode: String, 3459 appear: Boolean, 3460 persisted: Boolean, 3461 // enter 3462 onBeforeEnter: TransitionHookValidator, 3463 onEnter: TransitionHookValidator, 3464 onAfterEnter: TransitionHookValidator, 3465 onEnterCancelled: TransitionHookValidator, 3466 // leave 3467 onBeforeLeave: TransitionHookValidator, 3468 onLeave: TransitionHookValidator, 3469 onAfterLeave: TransitionHookValidator, 3470 onLeaveCancelled: TransitionHookValidator, 3471 // appear 3472 onBeforeAppear: TransitionHookValidator, 3473 onAppear: TransitionHookValidator, 3474 onAfterAppear: TransitionHookValidator, 3475 onAppearCancelled: TransitionHookValidator 3476 }; 3477 const recursiveGetSubtree = (instance) => { 3478 const subTree = instance.subTree; 3479 return subTree.component ? recursiveGetSubtree(subTree.component) : subTree; 3480 }; 3481 const BaseTransitionImpl = { 3482 name: `BaseTransition`, 3483 props: BaseTransitionPropsValidators, 3484 setup(props, { slots }) { 3485 const instance = getCurrentInstance(); 3486 const state = useTransitionState(); 3487 return () => { 3488 const children = slots.default && getTransitionRawChildren(slots.default(), true); 3489 if (!children || !children.length) { 3490 return; 3491 } 3492 const child = findNonCommentChild(children); 3493 const rawProps = toRaw(props); 3494 const { mode } = rawProps; 3495 if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
vendor: 9,274 bytes, lines 3496-3848
3496 warn$1(`invalid <transition> mode: ${mode}`); 3497 } 3498 if (state.isLeaving) { 3499 return emptyPlaceholder(child); 3500 } 3501 const innerChild = getInnerChild$1(child); 3502 if (!innerChild) { 3503 return emptyPlaceholder(child); 3504 } 3505 let enterHooks = resolveTransitionHooks( 3506 innerChild, 3507 rawProps, 3508 state, 3509 instance, 3510 // #11061, ensure enterHooks is fresh after clone 3511 (hooks) => enterHooks = hooks 3512 ); 3513 if (innerChild.type !== Comment) { 3514 setTransitionHooks(innerChild, enterHooks); 3515 } 3516 const oldChild = instance.subTree; 3517 const oldInnerChild = oldChild && getInnerChild$1(oldChild); 3518 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) { 3519 const leavingHooks = resolveTransitionHooks( 3520 oldInnerChild, 3521 rawProps, 3522 state, 3523 instance 3524 ); 3525 setTransitionHooks(oldInnerChild, leavingHooks); 3526 if (mode === "out-in" && innerChild.type !== Comment) { 3527 state.isLeaving = true; 3528 leavingHooks.afterLeave = () => { 3529 state.isLeaving = false; 3530 if (!(instance.job.flags & 8)) { 3531 instance.update(); 3532 } 3533 delete leavingHooks.afterLeave; 3534 }; 3535 return emptyPlaceholder(child); 3536 } else if (mode === "in-out" && innerChild.type !== Comment) { 3537 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { 3538 const leavingVNodesCache = getLeavingNodesForType( 3539 state, 3540 oldInnerChild 3541 ); 3542 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; 3543 el[leaveCbKey] = () => { 3544 earlyRemove(); 3545 el[leaveCbKey] = void 0; 3546 delete enterHooks.delayedLeave; 3547 }; 3548 enterHooks.delayedLeave = delayedLeave; 3549 }; 3550 } 3551 } 3552 return child; 3553 }; 3554 } 3555 }; 3556 function findNonCommentChild(children) { 3557 let child = children[0]; 3558 if (children.length > 1) { 3559 let hasFound = false; 3560 for (const c of children) { 3561 if (c.type !== Comment) { 3562 if (hasFound) { 3563 warn$1( 3564 "<transition> can only be used on a single element or component. Use <transition-group> for lists." 3565 ); 3566 break; 3567 } 3568 child = c; 3569 hasFound = true; 3570 } 3571 } 3572 } 3573 return child; 3574 } 3575 const BaseTransition = BaseTransitionImpl; 3576 function getLeavingNodesForType(state, vnode) { 3577 const { leavingVNodes } = state; 3578 let leavingVNodesCache = leavingVNodes.get(vnode.type); 3579 if (!leavingVNodesCache) { 3580 leavingVNodesCache = /* @__PURE__ */ Object.create(null); 3581 leavingVNodes.set(vnode.type, leavingVNodesCache); 3582 } 3583 return leavingVNodesCache; 3584 } 3585 function resolveTransitionHooks(vnode, props, state, instance, postClone) { 3586 const { 3587 appear, 3588 mode, 3589 persisted = false, 3590 onBeforeEnter, 3591 onEnter, 3592 onAfterEnter, 3593 onEnterCancelled, 3594 onBeforeLeave, 3595 onLeave, 3596 onAfterLeave, 3597 onLeaveCancelled, 3598 onBeforeAppear, 3599 onAppear, 3600 onAfterAppear, 3601 onAppearCancelled 3602 } = props; 3603 const key = String(vnode.key); 3604 const leavingVNodesCache = getLeavingNodesForType(state, vnode); 3605 const callHook = (hook, args) => { 3606 hook && callWithAsyncErrorHandling( 3607 hook, 3608 instance, 3609 9, 3610 args 3611 ); 3612 }; 3613 const callAsyncHook = (hook, args) => { 3614 const done = args[1]; 3615 callHook(hook, args); 3616 if (isArray(hook)) { 3617 if (hook.every((hook2) => hook2.length <= 1)) done(); 3618 } else if (hook.length <= 1) { 3619 done(); 3620 } 3621 }; 3622 const hooks = { 3623 mode, 3624 persisted, 3625 beforeEnter(el) { 3626 let hook = onBeforeEnter; 3627 if (!state.isMounted) { 3628 if (appear) { 3629 hook = onBeforeAppear || onBeforeEnter; 3630 } else { 3631 return; 3632 } 3633 } 3634 if (el[leaveCbKey]) { 3635 el[leaveCbKey]( 3636 true 3637 /* cancelled */ 3638 ); 3639 } 3640 const leavingVNode = leavingVNodesCache[key]; 3641 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) { 3642 leavingVNode.el[leaveCbKey](); 3643 } 3644 callHook(hook, [el]); 3645 }, 3646 enter(el) { 3647 let hook = onEnter; 3648 let afterHook = onAfterEnter; 3649 let cancelHook = onEnterCancelled; 3650 if (!state.isMounted) { 3651 if (appear) { 3652 hook = onAppear || onEnter; 3653 afterHook = onAfterAppear || onAfterEnter; 3654 cancelHook = onAppearCancelled || onEnterCancelled; 3655 } else { 3656 return; 3657 } 3658 } 3659 let called = false; 3660 const done = el[enterCbKey$1] = (cancelled) => { 3661 if (called) return; 3662 called = true; 3663 if (cancelled) { 3664 callHook(cancelHook, [el]); 3665 } else { 3666 callHook(afterHook, [el]); 3667 } 3668 if (hooks.delayedLeave) { 3669 hooks.delayedLeave(); 3670 } 3671 el[enterCbKey$1] = void 0; 3672 }; 3673 if (hook) { 3674 callAsyncHook(hook, [el, done]); 3675 } else { 3676 done(); 3677 } 3678 }, 3679 leave(el, remove) { 3680 const key2 = String(vnode.key); 3681 if (el[enterCbKey$1]) { 3682 el[enterCbKey$1]( 3683 true 3684 /* cancelled */ 3685 ); 3686 } 3687 if (state.isUnmounting) { 3688 return remove(); 3689 } 3690 callHook(onBeforeLeave, [el]); 3691 let called = false; 3692 const done = el[leaveCbKey] = (cancelled) => { 3693 if (called) return; 3694 called = true; 3695 remove(); 3696 if (cancelled) { 3697 callHook(onLeaveCancelled, [el]); 3698 } else { 3699 callHook(onAfterLeave, [el]); 3700 } 3701 el[leaveCbKey] = void 0; 3702 if (leavingVNodesCache[key2] === vnode) { 3703 delete leavingVNodesCache[key2]; 3704 } 3705 }; 3706 leavingVNodesCache[key2] = vnode; 3707 if (onLeave) { 3708 callAsyncHook(onLeave, [el, done]); 3709 } else { 3710 done(); 3711 } 3712 }, 3713 clone(vnode2) { 3714 const hooks2 = resolveTransitionHooks( 3715 vnode2, 3716 props, 3717 state, 3718 instance, 3719 postClone 3720 ); 3721 if (postClone) postClone(hooks2); 3722 return hooks2; 3723 } 3724 }; 3725 return hooks; 3726 } 3727 function emptyPlaceholder(vnode) { 3728 if (isKeepAlive(vnode)) { 3729 vnode = cloneVNode(vnode); 3730 vnode.children = null; 3731 return vnode; 3732 } 3733 } 3734 function getInnerChild$1(vnode) { 3735 if (!isKeepAlive(vnode)) { 3736 if (isTeleport(vnode.type) && vnode.children) { 3737 return findNonCommentChild(vnode.children); 3738 } 3739 return vnode; 3740 } 3741 if (vnode.component) { 3742 return vnode.component.subTree; 3743 } 3744 const { shapeFlag, children } = vnode; 3745 if (children) { 3746 if (shapeFlag & 16) { 3747 return children[0]; 3748 } 3749 if (shapeFlag & 32 && isFunction(children.default)) { 3750 return children.default(); 3751 } 3752 } 3753 } 3754 function setTransitionHooks(vnode, hooks) { 3755 if (vnode.shapeFlag & 6 && vnode.component) { 3756 vnode.transition = hooks; 3757 setTransitionHooks(vnode.component.subTree, hooks); 3758 } else if (vnode.shapeFlag & 128) { 3759 vnode.ssContent.transition = hooks.clone(vnode.ssContent); 3760 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback); 3761 } else { 3762 vnode.transition = hooks; 3763 } 3764 } 3765 function getTransitionRawChildren(children, keepComment = false, parentKey) { 3766 let ret = []; 3767 let keyedFragmentCount = 0; 3768 for (let i = 0; i < children.length; i++) { 3769 let child = children[i]; 3770 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i); 3771 if (child.type === Fragment) { 3772 if (child.patchFlag & 128) keyedFragmentCount++; 3773 ret = ret.concat( 3774 getTransitionRawChildren(child.children, keepComment, key) 3775 ); 3776 } else if (keepComment || child.type !== Comment) { 3777 ret.push(key != null ? cloneVNode(child, { key }) : child); 3778 } 3779 } 3780 if (keyedFragmentCount > 1) { 3781 for (let i = 0; i < ret.length; i++) { 3782 ret[i].patchFlag = -2; 3783 } 3784 } 3785 return ret; 3786 } 3787 3788 /*! #__NO_SIDE_EFFECTS__ */ 3789 // @__NO_SIDE_EFFECTS__ 3790 function defineComponent(options, extraOptions) { 3791 return isFunction(options) ? ( 3792 // #8236: extend call and options.name access are considered side-effects 3793 // by Rollup, so we have to wrap it in a pure-annotated IIFE. 3794 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))() 3795 ) : options; 3796 } 3797 3798 function useId() { 3799 const i = getCurrentInstance(); 3800 if (i) { 3801 return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++; 3802 } else { 3803 warn$1( 3804 `useId() is called when there is no active component instance to be associated with.` 3805 ); 3806 } 3807 } 3808 function markAsyncBoundary(instance) { 3809 instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0]; 3810 } 3811 3812 const knownTemplateRefs = /* @__PURE__ */ new WeakSet(); 3813 function useTemplateRef(key) { 3814 const i = getCurrentInstance(); 3815 const r = shallowRef(null); 3816 if (i) { 3817 const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs; 3818 let desc; 3819 if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) { 3820 warn$1(`useTemplateRef('${key}') already exists.`); 3821 } else { 3822 Object.defineProperty(refs, key, { 3823 enumerable: true, 3824 get: () => r.value, 3825 set: (val) => r.value = val 3826 }); 3827 } 3828 } else { 3829 warn$1( 3830 `useTemplateRef() is called when there is no active component instance to be associated with.` 3831 ); 3832 } 3833 const ret = readonly(r) ; 3834 { 3835 knownTemplateRefs.add(ret); 3836 } 3837 return ret; 3838 } 3839 3840 function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { 3841 if (isArray(rawRef)) { 3842 rawRef.forEach( 3843 (r, i) => setRef( 3844 r, 3845 oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), 3846 parentSuspense, 3847 vnode, 3848 isUnmount
vendor: 4,417 bytes, lines 3849-3999
3849 ) 3850 ); 3851 return; 3852 } 3853 if (isAsyncWrapper(vnode) && !isUnmount) { 3854 return; 3855 } 3856 const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el; 3857 const value = isUnmount ? null : refValue; 3858 const { i: owner, r: ref } = rawRef; 3859 if (!owner) { 3860 warn$1( 3861 `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.` 3862 ); 3863 return; 3864 } 3865 const oldRef = oldRawRef && oldRawRef.r; 3866 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs; 3867 const setupState = owner.setupState; 3868 const rawSetupState = toRaw(setupState); 3869 const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => { 3870 if (knownTemplateRefs.has(rawSetupState[key])) { 3871 return false; 3872 } 3873 return hasOwn(rawSetupState, key); 3874 }; 3875 if (oldRef != null && oldRef !== ref) { 3876 if (isString(oldRef)) { 3877 refs[oldRef] = null; 3878 if (canSetSetupRef(oldRef)) { 3879 setupState[oldRef] = null; 3880 } 3881 } else if (isRef(oldRef)) { 3882 oldRef.value = null; 3883 } 3884 } 3885 if (isFunction(ref)) { 3886 callWithErrorHandling(ref, owner, 12, [value, refs]); 3887 } else { 3888 const _isString = isString(ref); 3889 const _isRef = isRef(ref); 3890 if (_isString || _isRef) { 3891 const doSet = () => { 3892 if (rawRef.f) { 3893 const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value; 3894 if (isUnmount) { 3895 isArray(existing) && remove(existing, refValue); 3896 } else { 3897 if (!isArray(existing)) { 3898 if (_isString) { 3899 refs[ref] = [refValue]; 3900 if (canSetSetupRef(ref)) { 3901 setupState[ref] = refs[ref]; 3902 } 3903 } else { 3904 ref.value = [refValue]; 3905 if (rawRef.k) refs[rawRef.k] = ref.value; 3906 } 3907 } else if (!existing.includes(refValue)) { 3908 existing.push(refValue); 3909 } 3910 } 3911 } else if (_isString) { 3912 refs[ref] = value; 3913 if (canSetSetupRef(ref)) { 3914 setupState[ref] = value; 3915 } 3916 } else if (_isRef) { 3917 ref.value = value; 3918 if (rawRef.k) refs[rawRef.k] = value; 3919 } else { 3920 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 3921 } 3922 }; 3923 if (value) { 3924 doSet.id = -1; 3925 queuePostRenderEffect(doSet, parentSuspense); 3926 } else { 3927 doSet(); 3928 } 3929 } else { 3930 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 3931 } 3932 } 3933 } 3934 3935 let hasLoggedMismatchError = false; 3936 const logMismatchError = () => { 3937 if (hasLoggedMismatchError) { 3938 return; 3939 } 3940 console.error("Hydration completed but contains mismatches."); 3941 hasLoggedMismatchError = true; 3942 }; 3943 const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject"; 3944 const isMathMLContainer = (container) => container.namespaceURI.includes("MathML"); 3945 const getContainerType = (container) => { 3946 if (container.nodeType !== 1) return void 0; 3947 if (isSVGContainer(container)) return "svg"; 3948 if (isMathMLContainer(container)) return "mathml"; 3949 return void 0; 3950 }; 3951 const isComment = (node) => node.nodeType === 8; 3952 function createHydrationFunctions(rendererInternals) { 3953 const { 3954 mt: mountComponent, 3955 p: patch, 3956 o: { 3957 patchProp, 3958 createText, 3959 nextSibling, 3960 parentNode, 3961 remove, 3962 insert, 3963 createComment 3964 } 3965 } = rendererInternals; 3966 const hydrate = (vnode, container) => { 3967 if (!container.hasChildNodes()) { 3968 warn$1( 3969 `Attempting to hydrate existing markup but container is empty. Performing full mount instead.` 3970 ); 3971 patch(null, vnode, container); 3972 flushPostFlushCbs(); 3973 container._vnode = vnode; 3974 return; 3975 } 3976 hydrateNode(container.firstChild, vnode, null, null, null); 3977 flushPostFlushCbs(); 3978 container._vnode = vnode; 3979 }; 3980 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => { 3981 optimized = optimized || !!vnode.dynamicChildren; 3982 const isFragmentStart = isComment(node) && node.data === "["; 3983 const onMismatch = () => handleMismatch( 3984 node, 3985 vnode, 3986 parentComponent, 3987 parentSuspense, 3988 slotScopeIds, 3989 isFragmentStart 3990 ); 3991 const { type, ref, shapeFlag, patchFlag } = vnode; 3992 let domType = node.nodeType; 3993 vnode.el = node; 3994 { 3995 def(node, "__vnode", vnode, true); 3996 def(node, "__vueParentComponent", parentComponent, true); 3997 } 3998 if (patchFlag === -2) { 3999 optimized = false;
vendor: 22,159 bytes, lines 4000-4793
4000 vnode.dynamicChildren = null; 4001 } 4002 let nextNode = null; 4003 switch (type) { 4004 case Text: 4005 if (domType !== 3) { 4006 if (vnode.children === "") { 4007 insert(vnode.el = createText(""), parentNode(node), node); 4008 nextNode = node; 4009 } else { 4010 nextNode = onMismatch(); 4011 } 4012 } else { 4013 if (node.data !== vnode.children) { 4014 warn$1( 4015 `Hydration text mismatch in`, 4016 node.parentNode, 4017 ` 4018 - rendered on server: ${JSON.stringify( 4019 node.data 4020 )} 4021 - expected on client: ${JSON.stringify(vnode.children)}` 4022 ); 4023 logMismatchError(); 4024 node.data = vnode.children; 4025 } 4026 nextNode = nextSibling(node); 4027 } 4028 break; 4029 case Comment: 4030 if (isTemplateNode(node)) { 4031 nextNode = nextSibling(node); 4032 replaceNode( 4033 vnode.el = node.content.firstChild, 4034 node, 4035 parentComponent 4036 ); 4037 } else if (domType !== 8 || isFragmentStart) { 4038 nextNode = onMismatch(); 4039 } else { 4040 nextNode = nextSibling(node); 4041 } 4042 break; 4043 case Static: 4044 if (isFragmentStart) { 4045 node = nextSibling(node); 4046 domType = node.nodeType; 4047 } 4048 if (domType === 1 || domType === 3) { 4049 nextNode = node; 4050 const needToAdoptContent = !vnode.children.length; 4051 for (let i = 0; i < vnode.staticCount; i++) { 4052 if (needToAdoptContent) 4053 vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data; 4054 if (i === vnode.staticCount - 1) { 4055 vnode.anchor = nextNode; 4056 } 4057 nextNode = nextSibling(nextNode); 4058 } 4059 return isFragmentStart ? nextSibling(nextNode) : nextNode; 4060 } else { 4061 onMismatch(); 4062 } 4063 break; 4064 case Fragment: 4065 if (!isFragmentStart) { 4066 nextNode = onMismatch(); 4067 } else { 4068 nextNode = hydrateFragment( 4069 node, 4070 vnode, 4071 parentComponent, 4072 parentSuspense, 4073 slotScopeIds, 4074 optimized 4075 ); 4076 } 4077 break; 4078 default: 4079 if (shapeFlag & 1) { 4080 if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) { 4081 nextNode = onMismatch(); 4082 } else { 4083 nextNode = hydrateElement( 4084 node, 4085 vnode, 4086 parentComponent, 4087 parentSuspense, 4088 slotScopeIds, 4089 optimized 4090 ); 4091 } 4092 } else if (shapeFlag & 6) { 4093 vnode.slotScopeIds = slotScopeIds; 4094 const container = parentNode(node); 4095 if (isFragmentStart) { 4096 nextNode = locateClosingAnchor(node); 4097 } else if (isComment(node) && node.data === "teleport start") { 4098 nextNode = locateClosingAnchor(node, node.data, "teleport end"); 4099 } else { 4100 nextNode = nextSibling(node); 4101 } 4102 mountComponent( 4103 vnode, 4104 container, 4105 null, 4106 parentComponent, 4107 parentSuspense, 4108 getContainerType(container), 4109 optimized 4110 ); 4111 if (isAsyncWrapper(vnode)) { 4112 let subTree; 4113 if (isFragmentStart) { 4114 subTree = createVNode(Fragment); 4115 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild; 4116 } else { 4117 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div"); 4118 } 4119 subTree.el = node; 4120 vnode.component.subTree = subTree; 4121 } 4122 } else if (shapeFlag & 64) { 4123 if (domType !== 8) { 4124 nextNode = onMismatch(); 4125 } else { 4126 nextNode = vnode.type.hydrate( 4127 node, 4128 vnode, 4129 parentComponent, 4130 parentSuspense, 4131 slotScopeIds, 4132 optimized, 4133 rendererInternals, 4134 hydrateChildren 4135 ); 4136 } 4137 } else if (shapeFlag & 128) { 4138 nextNode = vnode.type.hydrate( 4139 node, 4140 vnode, 4141 parentComponent, 4142 parentSuspense, 4143 getContainerType(parentNode(node)), 4144 slotScopeIds, 4145 optimized, 4146 rendererInternals, 4147 hydrateNode 4148 ); 4149 } else { 4150 warn$1("Invalid HostVNode type:", type, `(${typeof type})`); 4151 } 4152 } 4153 if (ref != null) { 4154 setRef(ref, null, parentSuspense, vnode); 4155 } 4156 return nextNode; 4157 }; 4158 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4159 optimized = optimized || !!vnode.dynamicChildren; 4160 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode; 4161 const forcePatch = type === "input" || type === "option"; 4162 { 4163 if (dirs) { 4164 invokeDirectiveHook(vnode, null, parentComponent, "created"); 4165 } 4166 let needCallTransitionHooks = false; 4167 if (isTemplateNode(el)) { 4168 needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; 4169 const content = el.content.firstChild; 4170 if (needCallTransitionHooks) { 4171 transition.beforeEnter(content); 4172 } 4173 replaceNode(content, el, parentComponent); 4174 vnode.el = el = content; 4175 } 4176 if (shapeFlag & 16 && // skip if element has innerHTML / textContent 4177 !(props && (props.innerHTML || props.textContent))) { 4178 let next = hydrateChildren( 4179 el.firstChild, 4180 vnode, 4181 el, 4182 parentComponent, 4183 parentSuspense, 4184 slotScopeIds, 4185 optimized 4186 ); 4187 let hasWarned = false; 4188 while (next) { 4189 if (!isMismatchAllowed(el, 1 /* CHILDREN */)) { 4190 if (!hasWarned) { 4191 warn$1( 4192 `Hydration children mismatch on`, 4193 el, 4194 ` 4195Server rendered element contains more child nodes than client vdom.` 4196 ); 4197 hasWarned = true; 4198 } 4199 logMismatchError(); 4200 } 4201 const cur = next; 4202 next = next.nextSibling; 4203 remove(cur); 4204 } 4205 } else if (shapeFlag & 8) { 4206 if (el.textContent !== vnode.children) { 4207 if (!isMismatchAllowed(el, 0 /* TEXT */)) { 4208 warn$1( 4209 `Hydration text content mismatch on`, 4210 el, 4211 ` 4212 - rendered on server: ${el.textContent} 4213 - expected on client: ${vnode.children}` 4214 ); 4215 logMismatchError(); 4216 } 4217 el.textContent = vnode.children; 4218 } 4219 } 4220 if (props) { 4221 { 4222 const isCustomElement = el.tagName.includes("-"); 4223 for (const key in props) { 4224 if (// #11189 skip if this node has directives that have created hooks 4225 // as it could have mutated the DOM in any possible way 4226 !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) { 4227 logMismatchError(); 4228 } 4229 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers 4230 key[0] === "." || isCustomElement) { 4231 patchProp(el, key, null, props[key], void 0, parentComponent); 4232 } 4233 } 4234 } 4235 } 4236 let vnodeHooks; 4237 if (vnodeHooks = props && props.onVnodeBeforeMount) { 4238 invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4239 } 4240 if (dirs) { 4241 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 4242 } 4243 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) { 4244 queueEffectWithSuspense(() => { 4245 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4246 needCallTransitionHooks && transition.enter(el); 4247 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 4248 }, parentSuspense); 4249 } 4250 } 4251 return el.nextSibling; 4252 }; 4253 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4254 optimized = optimized || !!parentVNode.dynamicChildren; 4255 const children = parentVNode.children; 4256 const l = children.length; 4257 let hasWarned = false; 4258 for (let i = 0; i < l; i++) { 4259 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]); 4260 const isText = vnode.type === Text; 4261 if (node) { 4262 if (isText && !optimized) { 4263 if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) { 4264 insert( 4265 createText( 4266 node.data.slice(vnode.children.length) 4267 ), 4268 container, 4269 nextSibling(node) 4270 ); 4271 node.data = vnode.children; 4272 } 4273 } 4274 node = hydrateNode( 4275 node, 4276 vnode, 4277 parentComponent, 4278 parentSuspense, 4279 slotScopeIds, 4280 optimized 4281 ); 4282 } else if (isText && !vnode.children) { 4283 insert(vnode.el = createText(""), container); 4284 } else { 4285 if (!isMismatchAllowed(container, 1 /* CHILDREN */)) { 4286 if (!hasWarned) { 4287 warn$1( 4288 `Hydration children mismatch on`, 4289 container, 4290 ` 4291Server rendered element contains fewer child nodes than client vdom.` 4292 ); 4293 hasWarned = true; 4294 } 4295 logMismatchError(); 4296 } 4297 patch( 4298 null, 4299 vnode, 4300 container, 4301 null, 4302 parentComponent, 4303 parentSuspense, 4304 getContainerType(container), 4305 slotScopeIds 4306 ); 4307 } 4308 } 4309 return node; 4310 }; 4311 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4312 const { slotScopeIds: fragmentSlotScopeIds } = vnode; 4313 if (fragmentSlotScopeIds) { 4314 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 4315 } 4316 const container = parentNode(node); 4317 const next = hydrateChildren( 4318 nextSibling(node), 4319 vnode, 4320 container, 4321 parentComponent, 4322 parentSuspense, 4323 slotScopeIds, 4324 optimized 4325 ); 4326 if (next && isComment(next) && next.data === "]") { 4327 return nextSibling(vnode.anchor = next); 4328 } else { 4329 logMismatchError(); 4330 insert(vnode.anchor = createComment(`]`), container, next); 4331 return next; 4332 } 4333 }; 4334 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => { 4335 if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) { 4336 warn$1( 4337 `Hydration node mismatch: 4338- rendered on server:`, 4339 node, 4340 node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``, 4341 ` 4342- expected on client:`, 4343 vnode.type 4344 ); 4345 logMismatchError(); 4346 } 4347 vnode.el = null; 4348 if (isFragment) { 4349 const end = locateClosingAnchor(node); 4350 while (true) { 4351 const next2 = nextSibling(node); 4352 if (next2 && next2 !== end) { 4353 remove(next2); 4354 } else { 4355 break; 4356 } 4357 } 4358 } 4359 const next = nextSibling(node); 4360 const container = parentNode(node); 4361 remove(node); 4362 patch( 4363 null, 4364 vnode, 4365 container, 4366 next, 4367 parentComponent, 4368 parentSuspense, 4369 getContainerType(container), 4370 slotScopeIds 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.toLowerCase() === "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 actual = el.getAttribute("class"); 4416 expected = normalizeClass(clientValue); 4417 if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { 4418 mismatchType = 2 /* CLASS */; 4419 mismatchKey = `class`; 4420 } 4421 } else if (key === "style") { 4422 actual = el.getAttribute("style") || ""; 4423 expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue)); 4424 const actualMap = toStyleMap(actual); 4425 const expectedMap = toStyleMap(expected); 4426 if (vnode.dirs) { 4427 for (const { dir, value } of vnode.dirs) { 4428 if (dir.name === "show" && !value) { 4429 expectedMap.set("display", "none"); 4430 } 4431 } 4432 } 4433 if (instance) { 4434 resolveCssVars(instance, vnode, expectedMap); 4435 } 4436 if (!isMapEqual(actualMap, expectedMap)) { 4437 mismatchType = 3 /* STYLE */; 4438 mismatchKey = "style"; 4439 } 4440 } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) { 4441 if (isBooleanAttr(key)) { 4442 actual = el.hasAttribute(key); 4443 expected = includeBooleanAttr(clientValue); 4444 } else if (clientValue == null) { 4445 actual = el.hasAttribute(key); 4446 expected = false; 4447 } else { 4448 if (el.hasAttribute(key)) { 4449 actual = el.getAttribute(key); 4450 } else if (key === "value" && el.tagName === "TEXTAREA") { 4451 actual = el.value; 4452 } else { 4453 actual = false; 4454 } 4455 expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false; 4456 } 4457 if (actual !== expected) { 4458 mismatchType = 4 /* ATTRIBUTE */; 4459 mismatchKey = key; 4460 } 4461 } 4462 if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) { 4463 const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`; 4464 const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`; 4465 const postSegment = ` 4466 - rendered on server: ${format(actual)} 4467 - expected on client: ${format(expected)} 4468 Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead. 4469 You should fix the source of the mismatch.`; 4470 { 4471 warn$1(preSegment, el, postSegment); 4472 } 4473 return true; 4474 } 4475 return false; 4476 } 4477 function toClassSet(str) { 4478 return new Set(str.trim().split(/\s+/)); 4479 } 4480 function isSetEqual(a, b) { 4481 if (a.size !== b.size) { 4482 return false; 4483 } 4484 for (const s of a) { 4485 if (!b.has(s)) { 4486 return false; 4487 } 4488 } 4489 return true; 4490 } 4491 function toStyleMap(str) { 4492 const styleMap = /* @__PURE__ */ new Map(); 4493 for (const item of str.split(";")) { 4494 let [key, value] = item.split(":"); 4495 key = key.trim(); 4496 value = value && value.trim(); 4497 if (key && value) { 4498 styleMap.set(key, value); 4499 } 4500 } 4501 return styleMap; 4502 } 4503 function isMapEqual(a, b) { 4504 if (a.size !== b.size) { 4505 return false; 4506 } 4507 for (const [key, value] of a) { 4508 if (value !== b.get(key)) { 4509 return false; 4510 } 4511 } 4512 return true; 4513 } 4514 function resolveCssVars(instance, vnode, expectedMap) { 4515 const root = instance.subTree; 4516 if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) { 4517 const cssVars = instance.getCssVars(); 4518 for (const key in cssVars) { 4519 expectedMap.set( 4520 `--${getEscapedCssVarName(key)}`, 4521 String(cssVars[key]) 4522 ); 4523 } 4524 } 4525 if (vnode === root && instance.parent) { 4526 resolveCssVars(instance.parent, instance.vnode, expectedMap); 4527 } 4528 } 4529 const allowMismatchAttr = "data-allow-mismatch"; 4530 const MismatchTypeString = { 4531 [0 /* TEXT */]: "text", 4532 [1 /* CHILDREN */]: "children", 4533 [2 /* CLASS */]: "class", 4534 [3 /* STYLE */]: "style", 4535 [4 /* ATTRIBUTE */]: "attribute" 4536 }; 4537 function isMismatchAllowed(el, allowedType) { 4538 if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) { 4539 while (el && !el.hasAttribute(allowMismatchAttr)) { 4540 el = el.parentElement; 4541 } 4542 } 4543 const allowedAttr = el && el.getAttribute(allowMismatchAttr); 4544 if (allowedAttr == null) { 4545 return false; 4546 } else if (allowedAttr === "") { 4547 return true; 4548 } else { 4549 const list = allowedAttr.split(","); 4550 if (allowedType === 0 /* TEXT */ && list.includes("children")) { 4551 return true; 4552 } 4553 return allowedAttr.split(",").includes(MismatchTypeString[allowedType]); 4554 } 4555 } 4556 4557 const hydrateOnIdle = (timeout = 1e4) => (hydrate) => { 4558 const id = requestIdleCallback(hydrate, { timeout }); 4559 return () => cancelIdleCallback(id); 4560 }; 4561 const hydrateOnVisible = (opts) => (hydrate, forEach) => { 4562 const ob = new IntersectionObserver((entries) => { 4563 for (const e of entries) { 4564 if (!e.isIntersecting) continue; 4565 ob.disconnect(); 4566 hydrate(); 4567 break; 4568 } 4569 }, opts); 4570 forEach((el) => ob.observe(el)); 4571 return () => ob.disconnect(); 4572 }; 4573 const hydrateOnMediaQuery = (query) => (hydrate) => { 4574 if (query) { 4575 const mql = matchMedia(query); 4576 if (mql.matches) { 4577 hydrate(); 4578 } else { 4579 mql.addEventListener("change", hydrate, { once: true }); 4580 return () => mql.removeEventListener("change", hydrate); 4581 } 4582 } 4583 }; 4584 const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => { 4585 if (isString(interactions)) interactions = [interactions]; 4586 let hasHydrated = false; 4587 const doHydrate = (e) => { 4588 if (!hasHydrated) { 4589 hasHydrated = true; 4590 teardown(); 4591 hydrate(); 4592 e.target.dispatchEvent(new e.constructor(e.type, e)); 4593 } 4594 }; 4595 const teardown = () => { 4596 forEach((el) => { 4597 for (const i of interactions) { 4598 el.removeEventListener(i, doHydrate); 4599 } 4600 }); 4601 }; 4602 forEach((el) => { 4603 for (const i of interactions) { 4604 el.addEventListener(i, doHydrate, { once: true }); 4605 } 4606 }); 4607 return teardown; 4608 }; 4609 function forEachElement(node, cb) { 4610 if (isComment(node) && node.data === "[") { 4611 let depth = 1; 4612 let next = node.nextSibling; 4613 while (next) { 4614 if (next.nodeType === 1) { 4615 cb(next); 4616 } else if (isComment(next)) { 4617 if (next.data === "]") { 4618 if (--depth === 0) break; 4619 } else if (next.data === "[") { 4620 depth++; 4621 } 4622 } 4623 next = next.nextSibling; 4624 } 4625 } else { 4626 cb(node); 4627 } 4628 } 4629 4630 const isAsyncWrapper = (i) => !!i.type.__asyncLoader; 4631 /*! #__NO_SIDE_EFFECTS__ */ 4632 // @__NO_SIDE_EFFECTS__ 4633 function defineAsyncComponent(source) { 4634 if (isFunction(source)) { 4635 source = { loader: source }; 4636 } 4637 const { 4638 loader, 4639 loadingComponent, 4640 errorComponent, 4641 delay = 200, 4642 hydrate: hydrateStrategy, 4643 timeout, 4644 // undefined = never times out 4645 suspensible = true, 4646 onError: userOnError 4647 } = source; 4648 let pendingRequest = null; 4649 let resolvedComp; 4650 let retries = 0; 4651 const retry = () => { 4652 retries++; 4653 pendingRequest = null; 4654 return load(); 4655 }; 4656 const load = () => { 4657 let thisRequest; 4658 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => { 4659 err = err instanceof Error ? err : new Error(String(err)); 4660 if (userOnError) { 4661 return new Promise((resolve, reject) => { 4662 const userRetry = () => resolve(retry()); 4663 const userFail = () => reject(err); 4664 userOnError(err, userRetry, userFail, retries + 1); 4665 }); 4666 } else { 4667 throw err; 4668 } 4669 }).then((comp) => { 4670 if (thisRequest !== pendingRequest && pendingRequest) { 4671 return pendingRequest; 4672 } 4673 if (!comp) { 4674 warn$1( 4675 `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.` 4676 ); 4677 } 4678 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) { 4679 comp = comp.default; 4680 } 4681 if (comp && !isObject(comp) && !isFunction(comp)) { 4682 throw new Error(`Invalid async component load result: ${comp}`); 4683 } 4684 resolvedComp = comp; 4685 return comp; 4686 })); 4687 }; 4688 return defineComponent({ 4689 name: "AsyncComponentWrapper", 4690 __asyncLoader: load, 4691 __asyncHydrate(el, instance, hydrate) { 4692 const doHydrate = hydrateStrategy ? () => { 4693 const teardown = hydrateStrategy( 4694 hydrate, 4695 (cb) => forEachElement(el, cb) 4696 ); 4697 if (teardown) { 4698 (instance.bum || (instance.bum = [])).push(teardown); 4699 } 4700 } : hydrate; 4701 if (resolvedComp) { 4702 doHydrate(); 4703 } else { 4704 load().then(() => !instance.isUnmounted && doHydrate()); 4705 } 4706 }, 4707 get __asyncResolved() { 4708 return resolvedComp; 4709 }, 4710 setup() { 4711 const instance = currentInstance; 4712 markAsyncBoundary(instance); 4713 if (resolvedComp) { 4714 return () => createInnerComp(resolvedComp, instance); 4715 } 4716 const onError = (err) => { 4717 pendingRequest = null; 4718 handleError( 4719 err, 4720 instance, 4721 13, 4722 !errorComponent 4723 ); 4724 }; 4725 if (suspensible && instance.suspense || isInSSRComponentSetup) { 4726 return load().then((comp) => { 4727 return () => createInnerComp(comp, instance); 4728 }).catch((err) => { 4729 onError(err); 4730 return () => errorComponent ? createVNode(errorComponent, { 4731 error: err 4732 }) : null; 4733 }); 4734 } 4735 const loaded = ref(false); 4736 const error = ref(); 4737 const delayed = ref(!!delay); 4738 if (delay) { 4739 setTimeout(() => { 4740 delayed.value = false; 4741 }, delay); 4742 } 4743 if (timeout != null) { 4744 setTimeout(() => { 4745 if (!loaded.value && !error.value) { 4746 const err = new Error( 4747 `Async component timed out after ${timeout}ms.` 4748 ); 4749 onError(err); 4750 error.value = err; 4751 } 4752 }, timeout); 4753 } 4754 load().then(() => { 4755 loaded.value = true; 4756 if (instance.parent && isKeepAlive(instance.parent.vnode)) { 4757 queueJob(instance.parent.update); 4758 } 4759 }).catch((err) => { 4760 onError(err); 4761 error.value = err; 4762 }); 4763 return () => { 4764 if (loaded.value && resolvedComp) { 4765 return createInnerComp(resolvedComp, instance); 4766 } else if (error.value && errorComponent) { 4767 return createVNode(errorComponent, { 4768 error: error.value 4769 }); 4770 } else if (loadingComponent && !delayed.value) { 4771 return createVNode(loadingComponent); 4772 } 4773 }; 4774 } 4775 }); 4776 } 4777 function createInnerComp(comp, parent) { 4778 const { ref: ref2, props, children, ce } = parent.vnode; 4779 const vnode = createVNode(comp, props, children); 4780 vnode.ref = ref2; 4781 vnode.ce = ce; 4782 delete parent.vnode.ce; 4783 return vnode; 4784 } 4785 4786 const isKeepAlive = (vnode) => vnode.type.__isKeepAlive; 4787 const KeepAliveImpl = { 4788 name: `KeepAlive`, 4789 // Marker for special handling inside the renderer. We are not using a === 4790 // check directly on KeepAlive in the renderer, because importing it directly 4791 // would prevent it from being tree-shaken. 4792 __isKeepAlive: true, 4793 props: {
vendor: 4,790 bytes, lines 4794-4959
4794 include: [String, RegExp, Array], 4795 exclude: [String, RegExp, Array], 4796 max: [String, Number] 4797 }, 4798 setup(props, { slots }) { 4799 const instance = getCurrentInstance(); 4800 const sharedContext = instance.ctx; 4801 if (!sharedContext.renderer) { 4802 return () => { 4803 const children = slots.default && slots.default(); 4804 return children && children.length === 1 ? children[0] : children; 4805 }; 4806 } 4807 const cache = /* @__PURE__ */ new Map(); 4808 const keys = /* @__PURE__ */ new Set(); 4809 let current = null; 4810 { 4811 instance.__v_cache = cache; 4812 } 4813 const parentSuspense = instance.suspense; 4814 const { 4815 renderer: { 4816 p: patch, 4817 m: move, 4818 um: _unmount, 4819 o: { createElement } 4820 } 4821 } = sharedContext; 4822 const storageContainer = createElement("div"); 4823 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => { 4824 const instance2 = vnode.component; 4825 move(vnode, container, anchor, 0, parentSuspense); 4826 patch( 4827 instance2.vnode, 4828 vnode, 4829 container, 4830 anchor, 4831 instance2, 4832 parentSuspense, 4833 namespace, 4834 vnode.slotScopeIds, 4835 optimized 4836 ); 4837 queuePostRenderEffect(() => { 4838 instance2.isDeactivated = false; 4839 if (instance2.a) { 4840 invokeArrayFns(instance2.a); 4841 } 4842 const vnodeHook = vnode.props && vnode.props.onVnodeMounted; 4843 if (vnodeHook) { 4844 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 4845 } 4846 }, parentSuspense); 4847 { 4848 devtoolsComponentAdded(instance2); 4849 } 4850 }; 4851 sharedContext.deactivate = (vnode) => { 4852 const instance2 = vnode.component; 4853 invalidateMount(instance2.m); 4854 invalidateMount(instance2.a); 4855 move(vnode, storageContainer, null, 1, parentSuspense); 4856 queuePostRenderEffect(() => { 4857 if (instance2.da) { 4858 invokeArrayFns(instance2.da); 4859 } 4860 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted; 4861 if (vnodeHook) { 4862 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 4863 } 4864 instance2.isDeactivated = true; 4865 }, parentSuspense); 4866 { 4867 devtoolsComponentAdded(instance2); 4868 } 4869 }; 4870 function unmount(vnode) { 4871 resetShapeFlag(vnode); 4872 _unmount(vnode, instance, parentSuspense, true); 4873 } 4874 function pruneCache(filter) { 4875 cache.forEach((vnode, key) => { 4876 const name = getComponentName(vnode.type); 4877 if (name && !filter(name)) { 4878 pruneCacheEntry(key); 4879 } 4880 }); 4881 } 4882 function pruneCacheEntry(key) { 4883 const cached = cache.get(key); 4884 if (cached && (!current || !isSameVNodeType(cached, current))) { 4885 unmount(cached); 4886 } else if (current) { 4887 resetShapeFlag(current); 4888 } 4889 cache.delete(key); 4890 keys.delete(key); 4891 } 4892 watch( 4893 () => [props.include, props.exclude], 4894 ([include, exclude]) => { 4895 include && pruneCache((name) => matches(include, name)); 4896 exclude && pruneCache((name) => !matches(exclude, name)); 4897 }, 4898 // prune post-render after `current` has been updated 4899 { flush: "post", deep: true } 4900 ); 4901 let pendingCacheKey = null; 4902 const cacheSubtree = () => { 4903 if (pendingCacheKey != null) { 4904 if (isSuspense(instance.subTree.type)) { 4905 queuePostRenderEffect(() => { 4906 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 4907 }, instance.subTree.suspense); 4908 } else { 4909 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 4910 } 4911 } 4912 }; 4913 onMounted(cacheSubtree); 4914 onUpdated(cacheSubtree); 4915 onBeforeUnmount(() => { 4916 cache.forEach((cached) => { 4917 const { subTree, suspense } = instance; 4918 const vnode = getInnerChild(subTree); 4919 if (cached.type === vnode.type && cached.key === vnode.key) { 4920 resetShapeFlag(vnode); 4921 const da = vnode.component.da; 4922 da && queuePostRenderEffect(da, suspense); 4923 return; 4924 } 4925 unmount(cached); 4926 }); 4927 }); 4928 return () => { 4929 pendingCacheKey = null; 4930 if (!slots.default) { 4931 return current = null; 4932 } 4933 const children = slots.default(); 4934 const rawVNode = children[0]; 4935 if (children.length > 1) { 4936 { 4937 warn$1(`KeepAlive should contain exactly one component child.`); 4938 } 4939 current = null; 4940 return children; 4941 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { 4942 current = null; 4943 return rawVNode; 4944 } 4945 let vnode = getInnerChild(rawVNode); 4946 if (vnode.type === Comment) { 4947 current = null; 4948 return vnode; 4949 } 4950 const comp = vnode.type; 4951 const name = getComponentName( 4952 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp 4953 ); 4954 const { include, exclude, max } = props; 4955 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { 4956 vnode.shapeFlag &= ~256; 4957 current = vnode; 4958 return rawVNode; 4959 }
vendor: 80,938 bytes, lines 4960-7876
4960 const key = vnode.key == null ? comp : vnode.key; 4961 const cachedVNode = cache.get(key); 4962 if (vnode.el) { 4963 vnode = cloneVNode(vnode); 4964 if (rawVNode.shapeFlag & 128) { 4965 rawVNode.ssContent = vnode; 4966 } 4967 } 4968 pendingCacheKey = key; 4969 if (cachedVNode) { 4970 vnode.el = cachedVNode.el; 4971 vnode.component = cachedVNode.component; 4972 if (vnode.transition) { 4973 setTransitionHooks(vnode, vnode.transition); 4974 } 4975 vnode.shapeFlag |= 512; 4976 keys.delete(key); 4977 keys.add(key); 4978 } else { 4979 keys.add(key); 4980 if (max && keys.size > parseInt(max, 10)) { 4981 pruneCacheEntry(keys.values().next().value); 4982 } 4983 } 4984 vnode.shapeFlag |= 256; 4985 current = vnode; 4986 return isSuspense(rawVNode.type) ? rawVNode : vnode; 4987 }; 4988 } 4989 }; 4990 const KeepAlive = KeepAliveImpl; 4991 function matches(pattern, name) { 4992 if (isArray(pattern)) { 4993 return pattern.some((p) => matches(p, name)); 4994 } else if (isString(pattern)) { 4995 return pattern.split(",").includes(name); 4996 } else if (isRegExp(pattern)) { 4997 pattern.lastIndex = 0; 4998 return pattern.test(name); 4999 } 5000 return false; 5001 } 5002 function onActivated(hook, target) { 5003 registerKeepAliveHook(hook, "a", target); 5004 } 5005 function onDeactivated(hook, target) { 5006 registerKeepAliveHook(hook, "da", target); 5007 } 5008 function registerKeepAliveHook(hook, type, target = currentInstance) { 5009 const wrappedHook = hook.__wdc || (hook.__wdc = () => { 5010 let current = target; 5011 while (current) { 5012 if (current.isDeactivated) { 5013 return; 5014 } 5015 current = current.parent; 5016 } 5017 return hook(); 5018 }); 5019 injectHook(type, wrappedHook, target); 5020 if (target) { 5021 let current = target.parent; 5022 while (current && current.parent) { 5023 if (isKeepAlive(current.parent.vnode)) { 5024 injectToKeepAliveRoot(wrappedHook, type, target, current); 5025 } 5026 current = current.parent; 5027 } 5028 } 5029 } 5030 function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) { 5031 const injected = injectHook( 5032 type, 5033 hook, 5034 keepAliveRoot, 5035 true 5036 /* prepend */ 5037 ); 5038 onUnmounted(() => { 5039 remove(keepAliveRoot[type], injected); 5040 }, target); 5041 } 5042 function resetShapeFlag(vnode) { 5043 vnode.shapeFlag &= ~256; 5044 vnode.shapeFlag &= ~512; 5045 } 5046 function getInnerChild(vnode) { 5047 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; 5048 } 5049 5050 function injectHook(type, hook, target = currentInstance, prepend = false) { 5051 if (target) { 5052 const hooks = target[type] || (target[type] = []); 5053 const wrappedHook = hook.__weh || (hook.__weh = (...args) => { 5054 pauseTracking(); 5055 const reset = setCurrentInstance(target); 5056 const res = callWithAsyncErrorHandling(hook, target, type, args); 5057 reset(); 5058 resetTracking(); 5059 return res; 5060 }); 5061 if (prepend) { 5062 hooks.unshift(wrappedHook); 5063 } else { 5064 hooks.push(wrappedHook); 5065 } 5066 return wrappedHook; 5067 } else { 5068 const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, "")); 5069 warn$1( 5070 `${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.` ) 5071 ); 5072 } 5073 } 5074 const createHook = (lifecycle) => (hook, target = currentInstance) => { 5075 if (!isInSSRComponentSetup || lifecycle === "sp") { 5076 injectHook(lifecycle, (...args) => hook(...args), target); 5077 } 5078 }; 5079 const onBeforeMount = createHook("bm"); 5080 const onMounted = createHook("m"); 5081 const onBeforeUpdate = createHook( 5082 "bu" 5083 ); 5084 const onUpdated = createHook("u"); 5085 const onBeforeUnmount = createHook( 5086 "bum" 5087 ); 5088 const onUnmounted = createHook("um"); 5089 const onServerPrefetch = createHook( 5090 "sp" 5091 ); 5092 const onRenderTriggered = createHook("rtg"); 5093 const onRenderTracked = createHook("rtc"); 5094 function onErrorCaptured(hook, target = currentInstance) { 5095 injectHook("ec", hook, target); 5096 } 5097 5098 const COMPONENTS = "components"; 5099 const DIRECTIVES = "directives"; 5100 function resolveComponent(name, maybeSelfReference) { 5101 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; 5102 } 5103 const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); 5104 function resolveDynamicComponent(component) { 5105 if (isString(component)) { 5106 return resolveAsset(COMPONENTS, component, false) || component; 5107 } else { 5108 return component || NULL_DYNAMIC_COMPONENT; 5109 } 5110 } 5111 function resolveDirective(name) { 5112 return resolveAsset(DIRECTIVES, name); 5113 } 5114 function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) { 5115 const instance = currentRenderingInstance || currentInstance; 5116 if (instance) { 5117 const Component = instance.type; 5118 if (type === COMPONENTS) { 5119 const selfName = getComponentName( 5120 Component, 5121 false 5122 ); 5123 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) { 5124 return Component; 5125 } 5126 } 5127 const res = ( 5128 // local registration 5129 // check instance[type] first which is resolved for options API 5130 resolve(instance[type] || Component[type], name) || // global registration 5131 resolve(instance.appContext[type], name) 5132 ); 5133 if (!res && maybeSelfReference) { 5134 return Component; 5135 } 5136 if (warnMissing && !res) { 5137 const extra = type === COMPONENTS ? ` 5138If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``; 5139 warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`); 5140 } 5141 return res; 5142 } else { 5143 warn$1( 5144 `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().` 5145 ); 5146 } 5147 } 5148 function resolve(registry, name) { 5149 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]); 5150 } 5151 5152 function renderList(source, renderItem, cache, index) { 5153 let ret; 5154 const cached = cache && cache[index]; 5155 const sourceIsArray = isArray(source); 5156 if (sourceIsArray || isString(source)) { 5157 const sourceIsReactiveArray = sourceIsArray && isReactive(source); 5158 let needsWrap = false; 5159 if (sourceIsReactiveArray) { 5160 needsWrap = !isShallow(source); 5161 source = shallowReadArray(source); 5162 } 5163 ret = new Array(source.length); 5164 for (let i = 0, l = source.length; i < l; i++) { 5165 ret[i] = renderItem( 5166 needsWrap ? toReactive(source[i]) : source[i], 5167 i, 5168 void 0, 5169 cached && cached[i] 5170 ); 5171 } 5172 } else if (typeof source === "number") { 5173 if (!Number.isInteger(source)) { 5174 warn$1(`The v-for range expect an integer value but got ${source}.`); 5175 } 5176 ret = new Array(source); 5177 for (let i = 0; i < source; i++) { 5178 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]); 5179 } 5180 } else if (isObject(source)) { 5181 if (source[Symbol.iterator]) { 5182 ret = Array.from( 5183 source, 5184 (item, i) => renderItem(item, i, void 0, cached && cached[i]) 5185 ); 5186 } else { 5187 const keys = Object.keys(source); 5188 ret = new Array(keys.length); 5189 for (let i = 0, l = keys.length; i < l; i++) { 5190 const key = keys[i]; 5191 ret[i] = renderItem(source[key], key, i, cached && cached[i]); 5192 } 5193 } 5194 } else { 5195 ret = []; 5196 } 5197 if (cache) { 5198 cache[index] = ret; 5199 } 5200 return ret; 5201 } 5202 5203 function createSlots(slots, dynamicSlots) { 5204 for (let i = 0; i < dynamicSlots.length; i++) { 5205 const slot = dynamicSlots[i]; 5206 if (isArray(slot)) { 5207 for (let j = 0; j < slot.length; j++) { 5208 slots[slot[j].name] = slot[j].fn; 5209 } 5210 } else if (slot) { 5211 slots[slot.name] = slot.key ? (...args) => { 5212 const res = slot.fn(...args); 5213 if (res) res.key = slot.key; 5214 return res; 5215 } : slot.fn; 5216 } 5217 } 5218 return slots; 5219 } 5220 5221 function renderSlot(slots, name, props = {}, fallback, noSlotted) { 5222 if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) { 5223 if (name !== "default") props.name = name; 5224 return openBlock(), createBlock( 5225 Fragment, 5226 null, 5227 [createVNode("slot", props, fallback && fallback())], 5228 64 5229 ); 5230 } 5231 let slot = slots[name]; 5232 if (slot && slot.length > 1) { 5233 warn$1( 5234 `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.` 5235 ); 5236 slot = () => []; 5237 } 5238 if (slot && slot._c) { 5239 slot._d = false; 5240 } 5241 openBlock(); 5242 const validSlotContent = slot && ensureValidVNode(slot(props)); 5243 const rendered = createBlock( 5244 Fragment, 5245 { 5246 key: (props.key || // slot content array of a dynamic conditional slot may have a branch 5247 // key attached in the `createSlots` helper, respect that 5248 validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content 5249 (!validSlotContent && fallback ? "_fb" : "") 5250 }, 5251 validSlotContent || (fallback ? fallback() : []), 5252 validSlotContent && slots._ === 1 ? 64 : -2 5253 ); 5254 if (!noSlotted && rendered.scopeId) { 5255 rendered.slotScopeIds = [rendered.scopeId + "-s"]; 5256 } 5257 if (slot && slot._c) { 5258 slot._d = true; 5259 } 5260 return rendered; 5261 } 5262 function ensureValidVNode(vnodes) { 5263 return vnodes.some((child) => { 5264 if (!isVNode(child)) return true; 5265 if (child.type === Comment) return false; 5266 if (child.type === Fragment && !ensureValidVNode(child.children)) 5267 return false; 5268 return true; 5269 }) ? vnodes : null; 5270 } 5271 5272 function toHandlers(obj, preserveCaseIfNecessary) { 5273 const ret = {}; 5274 if (!isObject(obj)) { 5275 warn$1(`v-on with no argument expects an object value.`); 5276 return ret; 5277 } 5278 for (const key in obj) { 5279 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key]; 5280 } 5281 return ret; 5282 } 5283 5284 const getPublicInstance = (i) => { 5285 if (!i) return null; 5286 if (isStatefulComponent(i)) return getComponentPublicInstance(i); 5287 return getPublicInstance(i.parent); 5288 }; 5289 const publicPropertiesMap = ( 5290 // Move PURE marker to new line to workaround compiler discarding it 5291 // due to type annotation 5292 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), { 5293 $: (i) => i, 5294 $el: (i) => i.vnode.el, 5295 $data: (i) => i.data, 5296 $props: (i) => shallowReadonly(i.props) , 5297 $attrs: (i) => shallowReadonly(i.attrs) , 5298 $slots: (i) => shallowReadonly(i.slots) , 5299 $refs: (i) => shallowReadonly(i.refs) , 5300 $parent: (i) => getPublicInstance(i.parent), 5301 $root: (i) => getPublicInstance(i.root), 5302 $host: (i) => i.ce, 5303 $emit: (i) => i.emit, 5304 $options: (i) => resolveMergedOptions(i) , 5305 $forceUpdate: (i) => i.f || (i.f = () => { 5306 queueJob(i.update); 5307 }), 5308 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)), 5309 $watch: (i) => instanceWatch.bind(i) 5310 }) 5311 ); 5312 const isReservedPrefix = (key) => key === "_" || key === "$"; 5313 const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key); 5314 const PublicInstanceProxyHandlers = { 5315 get({ _: instance }, key) { 5316 if (key === "__v_skip") { 5317 return true; 5318 } 5319 const { ctx, setupState, data, props, accessCache, type, appContext } = instance; 5320 if (key === "__isVue") { 5321 return true; 5322 } 5323 let normalizedProps; 5324 if (key[0] !== "$") { 5325 const n = accessCache[key]; 5326 if (n !== void 0) { 5327 switch (n) { 5328 case 1 /* SETUP */: 5329 return setupState[key]; 5330 case 2 /* DATA */: 5331 return data[key]; 5332 case 4 /* CONTEXT */: 5333 return ctx[key]; 5334 case 3 /* PROPS */: 5335 return props[key]; 5336 } 5337 } else if (hasSetupBinding(setupState, key)) { 5338 accessCache[key] = 1 /* SETUP */; 5339 return setupState[key]; 5340 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 5341 accessCache[key] = 2 /* DATA */; 5342 return data[key]; 5343 } else if ( 5344 // only cache other properties when instance has declared (thus stable) 5345 // props 5346 (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key) 5347 ) { 5348 accessCache[key] = 3 /* PROPS */; 5349 return props[key]; 5350 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 5351 accessCache[key] = 4 /* CONTEXT */; 5352 return ctx[key]; 5353 } else if (shouldCacheAccess) { 5354 accessCache[key] = 0 /* OTHER */; 5355 } 5356 } 5357 const publicGetter = publicPropertiesMap[key]; 5358 let cssModule, globalProperties; 5359 if (publicGetter) { 5360 if (key === "$attrs") { 5361 track(instance.attrs, "get", ""); 5362 markAttrsAccessed(); 5363 } else if (key === "$slots") { 5364 track(instance, "get", key); 5365 } 5366 return publicGetter(instance); 5367 } else if ( 5368 // css module (injected by vue-loader) 5369 (cssModule = type.__cssModules) && (cssModule = cssModule[key]) 5370 ) { 5371 return cssModule; 5372 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 5373 accessCache[key] = 4 /* CONTEXT */; 5374 return ctx[key]; 5375 } else if ( 5376 // global properties 5377 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key) 5378 ) { 5379 { 5380 return globalProperties[key]; 5381 } 5382 } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading 5383 // to infinite warning loop 5384 key.indexOf("__v") !== 0)) { 5385 if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) { 5386 warn$1( 5387 `Property ${JSON.stringify( 5388 key 5389 )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.` 5390 ); 5391 } else if (instance === currentRenderingInstance) { 5392 warn$1( 5393 `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.` 5394 ); 5395 } 5396 } 5397 }, 5398 set({ _: instance }, key, value) { 5399 const { data, setupState, ctx } = instance; 5400 if (hasSetupBinding(setupState, key)) { 5401 setupState[key] = value; 5402 return true; 5403 } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) { 5404 warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`); 5405 return false; 5406 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 5407 data[key] = value; 5408 return true; 5409 } else if (hasOwn(instance.props, key)) { 5410 warn$1(`Attempting to mutate prop "${key}". Props are readonly.`); 5411 return false; 5412 } 5413 if (key[0] === "$" && key.slice(1) in instance) { 5414 warn$1( 5415 `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.` 5416 ); 5417 return false; 5418 } else { 5419 if (key in instance.appContext.config.globalProperties) { 5420 Object.defineProperty(ctx, key, { 5421 enumerable: true, 5422 configurable: true, 5423 value 5424 }); 5425 } else { 5426 ctx[key] = value; 5427 } 5428 } 5429 return true; 5430 }, 5431 has({ 5432 _: { data, setupState, accessCache, ctx, appContext, propsOptions } 5433 }, key) { 5434 let normalizedProps; 5435 return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key); 5436 }, 5437 defineProperty(target, key, descriptor) { 5438 if (descriptor.get != null) { 5439 target._.accessCache[key] = 0; 5440 } else if (hasOwn(descriptor, "value")) { 5441 this.set(target, key, descriptor.value, null); 5442 } 5443 return Reflect.defineProperty(target, key, descriptor); 5444 } 5445 }; 5446 { 5447 PublicInstanceProxyHandlers.ownKeys = (target) => { 5448 warn$1( 5449 `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.` 5450 ); 5451 return Reflect.ownKeys(target); 5452 }; 5453 } 5454 const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, { 5455 get(target, key) { 5456 if (key === Symbol.unscopables) { 5457 return; 5458 } 5459 return PublicInstanceProxyHandlers.get(target, key, target); 5460 }, 5461 has(_, key) { 5462 const has = key[0] !== "_" && !isGloballyAllowed(key); 5463 if (!has && PublicInstanceProxyHandlers.has(_, key)) { 5464 warn$1( 5465 `Property ${JSON.stringify( 5466 key 5467 )} should not start with _ which is a reserved prefix for Vue internals.` 5468 ); 5469 } 5470 return has; 5471 } 5472 }); 5473 function createDevRenderContext(instance) { 5474 const target = {}; 5475 Object.defineProperty(target, `_`, { 5476 configurable: true, 5477 enumerable: false, 5478 get: () => instance 5479 }); 5480 Object.keys(publicPropertiesMap).forEach((key) => { 5481 Object.defineProperty(target, key, { 5482 configurable: true, 5483 enumerable: false, 5484 get: () => publicPropertiesMap[key](instance), 5485 // intercepted by the proxy so no need for implementation, 5486 // but needed to prevent set errors 5487 set: NOOP 5488 }); 5489 }); 5490 return target; 5491 } 5492 function exposePropsOnRenderContext(instance) { 5493 const { 5494 ctx, 5495 propsOptions: [propsOptions] 5496 } = instance; 5497 if (propsOptions) { 5498 Object.keys(propsOptions).forEach((key) => { 5499 Object.defineProperty(ctx, key, { 5500 enumerable: true, 5501 configurable: true, 5502 get: () => instance.props[key], 5503 set: NOOP 5504 }); 5505 }); 5506 } 5507 } 5508 function exposeSetupStateOnRenderContext(instance) { 5509 const { ctx, setupState } = instance; 5510 Object.keys(toRaw(setupState)).forEach((key) => { 5511 if (!setupState.__isScriptSetup) { 5512 if (isReservedPrefix(key[0])) { 5513 warn$1( 5514 `setup() return property ${JSON.stringify( 5515 key 5516 )} should not start with "$" or "_" which are reserved prefixes for Vue internals.` 5517 ); 5518 return; 5519 } 5520 Object.defineProperty(ctx, key, { 5521 enumerable: true, 5522 configurable: true, 5523 get: () => setupState[key], 5524 set: NOOP 5525 }); 5526 } 5527 }); 5528 } 5529 5530 const warnRuntimeUsage = (method) => warn$1( 5531 `${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.` 5532 ); 5533 function defineProps() { 5534 { 5535 warnRuntimeUsage(`defineProps`); 5536 } 5537 return null; 5538 } 5539 function defineEmits() { 5540 { 5541 warnRuntimeUsage(`defineEmits`); 5542 } 5543 return null; 5544 } 5545 function defineExpose(exposed) { 5546 { 5547 warnRuntimeUsage(`defineExpose`); 5548 } 5549 } 5550 function defineOptions(options) { 5551 { 5552 warnRuntimeUsage(`defineOptions`); 5553 } 5554 } 5555 function defineSlots() { 5556 { 5557 warnRuntimeUsage(`defineSlots`); 5558 } 5559 return null; 5560 } 5561 function defineModel() { 5562 { 5563 warnRuntimeUsage("defineModel"); 5564 } 5565 } 5566 function withDefaults(props, defaults) { 5567 { 5568 warnRuntimeUsage(`withDefaults`); 5569 } 5570 return null; 5571 } 5572 function useSlots() { 5573 return getContext().slots; 5574 } 5575 function useAttrs() { 5576 return getContext().attrs; 5577 } 5578 function getContext() { 5579 const i = getCurrentInstance(); 5580 if (!i) { 5581 warn$1(`useContext() called without active instance.`); 5582 } 5583 return i.setupContext || (i.setupContext = createSetupContext(i)); 5584 } 5585 function normalizePropsOrEmits(props) { 5586 return isArray(props) ? props.reduce( 5587 (normalized, p) => (normalized[p] = null, normalized), 5588 {} 5589 ) : props; 5590 } 5591 function mergeDefaults(raw, defaults) { 5592 const props = normalizePropsOrEmits(raw); 5593 for (const key in defaults) { 5594 if (key.startsWith("__skip")) continue; 5595 let opt = props[key]; 5596 if (opt) { 5597 if (isArray(opt) || isFunction(opt)) { 5598 opt = props[key] = { type: opt, default: defaults[key] }; 5599 } else { 5600 opt.default = defaults[key]; 5601 } 5602 } else if (opt === null) { 5603 opt = props[key] = { default: defaults[key] }; 5604 } else { 5605 warn$1(`props default key "${key}" has no corresponding declaration.`); 5606 } 5607 if (opt && defaults[`__skip_${key}`]) { 5608 opt.skipFactory = true; 5609 } 5610 } 5611 return props; 5612 } 5613 function mergeModels(a, b) { 5614 if (!a || !b) return a || b; 5615 if (isArray(a) && isArray(b)) return a.concat(b); 5616 return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b)); 5617 } 5618 function createPropsRestProxy(props, excludedKeys) { 5619 const ret = {}; 5620 for (const key in props) { 5621 if (!excludedKeys.includes(key)) { 5622 Object.defineProperty(ret, key, { 5623 enumerable: true, 5624 get: () => props[key] 5625 }); 5626 } 5627 } 5628 return ret; 5629 } 5630 function withAsyncContext(getAwaitable) { 5631 const ctx = getCurrentInstance(); 5632 if (!ctx) { 5633 warn$1( 5634 `withAsyncContext called without active current instance. This is likely a bug.` 5635 ); 5636 } 5637 let awaitable = getAwaitable(); 5638 unsetCurrentInstance(); 5639 if (isPromise(awaitable)) { 5640 awaitable = awaitable.catch((e) => { 5641 setCurrentInstance(ctx); 5642 throw e; 5643 }); 5644 } 5645 return [awaitable, () => setCurrentInstance(ctx)]; 5646 } 5647 5648 function createDuplicateChecker() { 5649 const cache = /* @__PURE__ */ Object.create(null); 5650 return (type, key) => { 5651 if (cache[key]) { 5652 warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`); 5653 } else { 5654 cache[key] = type; 5655 } 5656 }; 5657 } 5658 let shouldCacheAccess = true; 5659 function applyOptions(instance) { 5660 const options = resolveMergedOptions(instance); 5661 const publicThis = instance.proxy; 5662 const ctx = instance.ctx; 5663 shouldCacheAccess = false; 5664 if (options.beforeCreate) { 5665 callHook$1(options.beforeCreate, instance, "bc"); 5666 } 5667 const { 5668 // state 5669 data: dataOptions, 5670 computed: computedOptions, 5671 methods, 5672 watch: watchOptions, 5673 provide: provideOptions, 5674 inject: injectOptions, 5675 // lifecycle 5676 created, 5677 beforeMount, 5678 mounted, 5679 beforeUpdate, 5680 updated, 5681 activated, 5682 deactivated, 5683 beforeDestroy, 5684 beforeUnmount, 5685 destroyed, 5686 unmounted, 5687 render, 5688 renderTracked, 5689 renderTriggered, 5690 errorCaptured, 5691 serverPrefetch, 5692 // public API 5693 expose, 5694 inheritAttrs, 5695 // assets 5696 components, 5697 directives, 5698 filters 5699 } = options; 5700 const checkDuplicateProperties = createDuplicateChecker() ; 5701 { 5702 const [propsOptions] = instance.propsOptions; 5703 if (propsOptions) { 5704 for (const key in propsOptions) { 5705 checkDuplicateProperties("Props" /* PROPS */, key); 5706 } 5707 } 5708 } 5709 if (injectOptions) { 5710 resolveInjections(injectOptions, ctx, checkDuplicateProperties); 5711 } 5712 if (methods) { 5713 for (const key in methods) { 5714 const methodHandler = methods[key]; 5715 if (isFunction(methodHandler)) { 5716 { 5717 Object.defineProperty(ctx, key, { 5718 value: methodHandler.bind(publicThis), 5719 configurable: true, 5720 enumerable: true, 5721 writable: true 5722 }); 5723 } 5724 { 5725 checkDuplicateProperties("Methods" /* METHODS */, key); 5726 } 5727 } else { 5728 warn$1( 5729 `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?` 5730 ); 5731 } 5732 } 5733 } 5734 if (dataOptions) { 5735 if (!isFunction(dataOptions)) { 5736 warn$1( 5737 `The data option must be a function. Plain object usage is no longer supported.` 5738 ); 5739 } 5740 const data = dataOptions.call(publicThis, publicThis); 5741 if (isPromise(data)) { 5742 warn$1( 5743 `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.` 5744 ); 5745 } 5746 if (!isObject(data)) { 5747 warn$1(`data() should return an object.`); 5748 } else { 5749 instance.data = reactive(data); 5750 { 5751 for (const key in data) { 5752 checkDuplicateProperties("Data" /* DATA */, key); 5753 if (!isReservedPrefix(key[0])) { 5754 Object.defineProperty(ctx, key, { 5755 configurable: true, 5756 enumerable: true, 5757 get: () => data[key], 5758 set: NOOP 5759 }); 5760 } 5761 } 5762 } 5763 } 5764 } 5765 shouldCacheAccess = true; 5766 if (computedOptions) { 5767 for (const key in computedOptions) { 5768 const opt = computedOptions[key]; 5769 const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; 5770 if (get === NOOP) { 5771 warn$1(`Computed property "${key}" has no getter.`); 5772 } 5773 const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => { 5774 warn$1( 5775 `Write operation failed: computed property "${key}" is readonly.` 5776 ); 5777 } ; 5778 const c = computed({ 5779 get, 5780 set 5781 }); 5782 Object.defineProperty(ctx, key, { 5783 enumerable: true, 5784 configurable: true, 5785 get: () => c.value, 5786 set: (v) => c.value = v 5787 }); 5788 { 5789 checkDuplicateProperties("Computed" /* COMPUTED */, key); 5790 } 5791 } 5792 } 5793 if (watchOptions) { 5794 for (const key in watchOptions) { 5795 createWatcher(watchOptions[key], ctx, publicThis, key); 5796 } 5797 } 5798 if (provideOptions) { 5799 const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions; 5800 Reflect.ownKeys(provides).forEach((key) => { 5801 provide(key, provides[key]); 5802 }); 5803 } 5804 if (created) { 5805 callHook$1(created, instance, "c"); 5806 } 5807 function registerLifecycleHook(register, hook) { 5808 if (isArray(hook)) { 5809 hook.forEach((_hook) => register(_hook.bind(publicThis))); 5810 } else if (hook) { 5811 register(hook.bind(publicThis)); 5812 } 5813 } 5814 registerLifecycleHook(onBeforeMount, beforeMount); 5815 registerLifecycleHook(onMounted, mounted); 5816 registerLifecycleHook(onBeforeUpdate, beforeUpdate); 5817 registerLifecycleHook(onUpdated, updated); 5818 registerLifecycleHook(onActivated, activated); 5819 registerLifecycleHook(onDeactivated, deactivated); 5820 registerLifecycleHook(onErrorCaptured, errorCaptured); 5821 registerLifecycleHook(onRenderTracked, renderTracked); 5822 registerLifecycleHook(onRenderTriggered, renderTriggered); 5823 registerLifecycleHook(onBeforeUnmount, beforeUnmount); 5824 registerLifecycleHook(onUnmounted, unmounted); 5825 registerLifecycleHook(onServerPrefetch, serverPrefetch); 5826 if (isArray(expose)) { 5827 if (expose.length) { 5828 const exposed = instance.exposed || (instance.exposed = {}); 5829 expose.forEach((key) => { 5830 Object.defineProperty(exposed, key, { 5831 get: () => publicThis[key], 5832 set: (val) => publicThis[key] = val 5833 }); 5834 }); 5835 } else if (!instance.exposed) { 5836 instance.exposed = {}; 5837 } 5838 } 5839 if (render && instance.render === NOOP) { 5840 instance.render = render; 5841 } 5842 if (inheritAttrs != null) { 5843 instance.inheritAttrs = inheritAttrs; 5844 } 5845 if (components) instance.components = components; 5846 if (directives) instance.directives = directives; 5847 if (serverPrefetch) { 5848 markAsyncBoundary(instance); 5849 } 5850 } 5851 function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) { 5852 if (isArray(injectOptions)) { 5853 injectOptions = normalizeInject(injectOptions); 5854 } 5855 for (const key in injectOptions) { 5856 const opt = injectOptions[key]; 5857 let injected; 5858 if (isObject(opt)) { 5859 if ("default" in opt) { 5860 injected = inject( 5861 opt.from || key, 5862 opt.default, 5863 true 5864 ); 5865 } else { 5866 injected = inject(opt.from || key); 5867 } 5868 } else { 5869 injected = inject(opt); 5870 } 5871 if (isRef(injected)) { 5872 Object.defineProperty(ctx, key, { 5873 enumerable: true, 5874 configurable: true, 5875 get: () => injected.value, 5876 set: (v) => injected.value = v 5877 }); 5878 } else { 5879 ctx[key] = injected; 5880 } 5881 { 5882 checkDuplicateProperties("Inject" /* INJECT */, key); 5883 } 5884 } 5885 } 5886 function callHook$1(hook, instance, type) { 5887 callWithAsyncErrorHandling( 5888 isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy), 5889 instance, 5890 type 5891 ); 5892 } 5893 function createWatcher(raw, ctx, publicThis, key) { 5894 let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; 5895 if (isString(raw)) { 5896 const handler = ctx[raw]; 5897 if (isFunction(handler)) { 5898 { 5899 watch(getter, handler); 5900 } 5901 } else { 5902 warn$1(`Invalid watch handler specified by key "${raw}"`, handler); 5903 } 5904 } else if (isFunction(raw)) { 5905 { 5906 watch(getter, raw.bind(publicThis)); 5907 } 5908 } else if (isObject(raw)) { 5909 if (isArray(raw)) { 5910 raw.forEach((r) => createWatcher(r, ctx, publicThis, key)); 5911 } else { 5912 const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; 5913 if (isFunction(handler)) { 5914 watch(getter, handler, raw); 5915 } else { 5916 warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler); 5917 } 5918 } 5919 } else { 5920 warn$1(`Invalid watch option: "${key}"`, raw); 5921 } 5922 } 5923 function resolveMergedOptions(instance) { 5924 const base = instance.type; 5925 const { mixins, extends: extendsOptions } = base; 5926 const { 5927 mixins: globalMixins, 5928 optionsCache: cache, 5929 config: { optionMergeStrategies } 5930 } = instance.appContext; 5931 const cached = cache.get(base); 5932 let resolved; 5933 if (cached) { 5934 resolved = cached; 5935 } else if (!globalMixins.length && !mixins && !extendsOptions) { 5936 { 5937 resolved = base; 5938 } 5939 } else { 5940 resolved = {}; 5941 if (globalMixins.length) { 5942 globalMixins.forEach( 5943 (m) => mergeOptions(resolved, m, optionMergeStrategies, true) 5944 ); 5945 } 5946 mergeOptions(resolved, base, optionMergeStrategies); 5947 } 5948 if (isObject(base)) { 5949 cache.set(base, resolved); 5950 } 5951 return resolved; 5952 } 5953 function mergeOptions(to, from, strats, asMixin = false) { 5954 const { mixins, extends: extendsOptions } = from; 5955 if (extendsOptions) { 5956 mergeOptions(to, extendsOptions, strats, true); 5957 } 5958 if (mixins) { 5959 mixins.forEach( 5960 (m) => mergeOptions(to, m, strats, true) 5961 ); 5962 } 5963 for (const key in from) { 5964 if (asMixin && key === "expose") { 5965 warn$1( 5966 `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.` 5967 ); 5968 } else { 5969 const strat = internalOptionMergeStrats[key] || strats && strats[key]; 5970 to[key] = strat ? strat(to[key], from[key]) : from[key]; 5971 } 5972 } 5973 return to; 5974 } 5975 const internalOptionMergeStrats = { 5976 data: mergeDataFn, 5977 props: mergeEmitsOrPropsOptions, 5978 emits: mergeEmitsOrPropsOptions, 5979 // objects 5980 methods: mergeObjectOptions, 5981 computed: mergeObjectOptions, 5982 // lifecycle 5983 beforeCreate: mergeAsArray$1, 5984 created: mergeAsArray$1, 5985 beforeMount: mergeAsArray$1, 5986 mounted: mergeAsArray$1, 5987 beforeUpdate: mergeAsArray$1, 5988 updated: mergeAsArray$1, 5989 beforeDestroy: mergeAsArray$1, 5990 beforeUnmount: mergeAsArray$1, 5991 destroyed: mergeAsArray$1, 5992 unmounted: mergeAsArray$1, 5993 activated: mergeAsArray$1, 5994 deactivated: mergeAsArray$1, 5995 errorCaptured: mergeAsArray$1, 5996 serverPrefetch: mergeAsArray$1, 5997 // assets 5998 components: mergeObjectOptions, 5999 directives: mergeObjectOptions, 6000 // watch 6001 watch: mergeWatchOptions, 6002 // provide / inject 6003 provide: mergeDataFn, 6004 inject: mergeInject 6005 }; 6006 function mergeDataFn(to, from) { 6007 if (!from) { 6008 return to; 6009 } 6010 if (!to) { 6011 return from; 6012 } 6013 return function mergedDataFn() { 6014 return (extend)( 6015 isFunction(to) ? to.call(this, this) : to, 6016 isFunction(from) ? from.call(this, this) : from 6017 ); 6018 }; 6019 } 6020 function mergeInject(to, from) { 6021 return mergeObjectOptions(normalizeInject(to), normalizeInject(from)); 6022 } 6023 function normalizeInject(raw) { 6024 if (isArray(raw)) { 6025 const res = {}; 6026 for (let i = 0; i < raw.length; i++) { 6027 res[raw[i]] = raw[i]; 6028 } 6029 return res; 6030 } 6031 return raw; 6032 } 6033 function mergeAsArray$1(to, from) { 6034 return to ? [...new Set([].concat(to, from))] : from; 6035 } 6036 function mergeObjectOptions(to, from) { 6037 return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from; 6038 } 6039 function mergeEmitsOrPropsOptions(to, from) { 6040 if (to) { 6041 if (isArray(to) && isArray(from)) { 6042 return [.../* @__PURE__ */ new Set([...to, ...from])]; 6043 } 6044 return extend( 6045 /* @__PURE__ */ Object.create(null), 6046 normalizePropsOrEmits(to), 6047 normalizePropsOrEmits(from != null ? from : {}) 6048 ); 6049 } else { 6050 return from; 6051 } 6052 } 6053 function mergeWatchOptions(to, from) { 6054 if (!to) return from; 6055 if (!from) return to; 6056 const merged = extend(/* @__PURE__ */ Object.create(null), to); 6057 for (const key in from) { 6058 merged[key] = mergeAsArray$1(to[key], from[key]); 6059 } 6060 return merged; 6061 } 6062 6063 function createAppContext() { 6064 return { 6065 app: null, 6066 config: { 6067 isNativeTag: NO, 6068 performance: false, 6069 globalProperties: {}, 6070 optionMergeStrategies: {}, 6071 errorHandler: void 0, 6072 warnHandler: void 0, 6073 compilerOptions: {} 6074 }, 6075 mixins: [], 6076 components: {}, 6077 directives: {}, 6078 provides: /* @__PURE__ */ Object.create(null), 6079 optionsCache: /* @__PURE__ */ new WeakMap(), 6080 propsCache: /* @__PURE__ */ new WeakMap(), 6081 emitsCache: /* @__PURE__ */ new WeakMap() 6082 }; 6083 } 6084 let uid$1 = 0; 6085 function createAppAPI(render, hydrate) { 6086 return function createApp(rootComponent, rootProps = null) { 6087 if (!isFunction(rootComponent)) { 6088 rootComponent = extend({}, rootComponent); 6089 } 6090 if (rootProps != null && !isObject(rootProps)) { 6091 warn$1(`root props passed to app.mount() must be an object.`); 6092 rootProps = null; 6093 } 6094 const context = createAppContext(); 6095 const installedPlugins = /* @__PURE__ */ new WeakSet(); 6096 const pluginCleanupFns = []; 6097 let isMounted = false; 6098 const app = context.app = { 6099 _uid: uid$1++, 6100 _component: rootComponent, 6101 _props: rootProps, 6102 _container: null, 6103 _context: context, 6104 _instance: null, 6105 version, 6106 get config() { 6107 return context.config; 6108 }, 6109 set config(v) { 6110 { 6111 warn$1( 6112 `app.config cannot be replaced. Modify individual options instead.` 6113 ); 6114 } 6115 }, 6116 use(plugin, ...options) { 6117 if (installedPlugins.has(plugin)) { 6118 warn$1(`Plugin has already been applied to target app.`); 6119 } else if (plugin && isFunction(plugin.install)) { 6120 installedPlugins.add(plugin); 6121 plugin.install(app, ...options); 6122 } else if (isFunction(plugin)) { 6123 installedPlugins.add(plugin); 6124 plugin(app, ...options); 6125 } else { 6126 warn$1( 6127 `A plugin must either be a function or an object with an "install" function.` 6128 ); 6129 } 6130 return app; 6131 }, 6132 mixin(mixin) { 6133 { 6134 if (!context.mixins.includes(mixin)) { 6135 context.mixins.push(mixin); 6136 } else { 6137 warn$1( 6138 "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "") 6139 ); 6140 } 6141 } 6142 return app; 6143 }, 6144 component(name, component) { 6145 { 6146 validateComponentName(name, context.config); 6147 } 6148 if (!component) { 6149 return context.components[name]; 6150 } 6151 if (context.components[name]) { 6152 warn$1(`Component "${name}" has already been registered in target app.`); 6153 } 6154 context.components[name] = component; 6155 return app; 6156 }, 6157 directive(name, directive) { 6158 { 6159 validateDirectiveName(name); 6160 } 6161 if (!directive) { 6162 return context.directives[name]; 6163 } 6164 if (context.directives[name]) { 6165 warn$1(`Directive "${name}" has already been registered in target app.`); 6166 } 6167 context.directives[name] = directive; 6168 return app; 6169 }, 6170 mount(rootContainer, isHydrate, namespace) { 6171 if (!isMounted) { 6172 if (rootContainer.__vue_app__) { 6173 warn$1( 6174 `There is already an app instance mounted on the host container. 6175 If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.` 6176 ); 6177 } 6178 const vnode = app._ceVNode || createVNode(rootComponent, rootProps); 6179 vnode.appContext = context; 6180 if (namespace === true) { 6181 namespace = "svg"; 6182 } else if (namespace === false) { 6183 namespace = void 0; 6184 } 6185 { 6186 context.reload = () => { 6187 render( 6188 cloneVNode(vnode), 6189 rootContainer, 6190 namespace 6191 ); 6192 }; 6193 } 6194 if (isHydrate && hydrate) { 6195 hydrate(vnode, rootContainer); 6196 } else { 6197 render(vnode, rootContainer, namespace); 6198 } 6199 isMounted = true; 6200 app._container = rootContainer; 6201 rootContainer.__vue_app__ = app; 6202 { 6203 app._instance = vnode.component; 6204 devtoolsInitApp(app, version); 6205 } 6206 return getComponentPublicInstance(vnode.component); 6207 } else { 6208 warn$1( 6209 `App has already been mounted. 6210If 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)\`` 6211 ); 6212 } 6213 }, 6214 onUnmount(cleanupFn) { 6215 if (typeof cleanupFn !== "function") { 6216 warn$1( 6217 `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}` 6218 ); 6219 } 6220 pluginCleanupFns.push(cleanupFn); 6221 }, 6222 unmount() { 6223 if (isMounted) { 6224 callWithAsyncErrorHandling( 6225 pluginCleanupFns, 6226 app._instance, 6227 16 6228 ); 6229 render(null, app._container); 6230 { 6231 app._instance = null; 6232 devtoolsUnmountApp(app); 6233 } 6234 delete app._container.__vue_app__; 6235 } else { 6236 warn$1(`Cannot unmount an app that is not mounted.`); 6237 } 6238 }, 6239 provide(key, value) { 6240 if (key in context.provides) { 6241 warn$1( 6242 `App already provides property with key "${String(key)}". It will be overwritten with the new value.` 6243 ); 6244 } 6245 context.provides[key] = value; 6246 return app; 6247 }, 6248 runWithContext(fn) { 6249 const lastApp = currentApp; 6250 currentApp = app; 6251 try { 6252 return fn(); 6253 } finally { 6254 currentApp = lastApp; 6255 } 6256 } 6257 }; 6258 return app; 6259 }; 6260 } 6261 let currentApp = null; 6262 6263 function provide(key, value) { 6264 if (!currentInstance) { 6265 { 6266 warn$1(`provide() can only be used inside setup().`); 6267 } 6268 } else { 6269 let provides = currentInstance.provides; 6270 const parentProvides = currentInstance.parent && currentInstance.parent.provides; 6271 if (parentProvides === provides) { 6272 provides = currentInstance.provides = Object.create(parentProvides); 6273 } 6274 provides[key] = value; 6275 } 6276 } 6277 function inject(key, defaultValue, treatDefaultAsFactory = false) { 6278 const instance = currentInstance || currentRenderingInstance; 6279 if (instance || currentApp) { 6280 const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; 6281 if (provides && key in provides) { 6282 return provides[key]; 6283 } else if (arguments.length > 1) { 6284 return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; 6285 } else { 6286 warn$1(`injection "${String(key)}" not found.`); 6287 } 6288 } else { 6289 warn$1(`inject() can only be used inside setup() or functional components.`); 6290 } 6291 } 6292 function hasInjectionContext() { 6293 return !!(currentInstance || currentRenderingInstance || currentApp); 6294 } 6295 6296 const internalObjectProto = {}; 6297 const createInternalObject = () => Object.create(internalObjectProto); 6298 const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto; 6299 6300 function initProps(instance, rawProps, isStateful, isSSR = false) { 6301 const props = {}; 6302 const attrs = createInternalObject(); 6303 instance.propsDefaults = /* @__PURE__ */ Object.create(null); 6304 setFullProps(instance, rawProps, props, attrs); 6305 for (const key in instance.propsOptions[0]) { 6306 if (!(key in props)) { 6307 props[key] = void 0; 6308 } 6309 } 6310 { 6311 validateProps(rawProps || {}, props, instance); 6312 } 6313 if (isStateful) { 6314 instance.props = isSSR ? props : shallowReactive(props); 6315 } else { 6316 if (!instance.type.props) { 6317 instance.props = attrs; 6318 } else { 6319 instance.props = props; 6320 } 6321 } 6322 instance.attrs = attrs; 6323 } 6324 function isInHmrContext(instance) { 6325 while (instance) { 6326 if (instance.type.__hmrId) return true; 6327 instance = instance.parent; 6328 } 6329 } 6330 function updateProps(instance, rawProps, rawPrevProps, optimized) { 6331 const { 6332 props, 6333 attrs, 6334 vnode: { patchFlag } 6335 } = instance; 6336 const rawCurrentProps = toRaw(props); 6337 const [options] = instance.propsOptions; 6338 let hasAttrsChanged = false; 6339 if ( 6340 // always force full diff in dev 6341 // - #1942 if hmr is enabled with sfc component 6342 // - vite#872 non-sfc component used by sfc component 6343 !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16) 6344 ) { 6345 if (patchFlag & 8) { 6346 const propsToUpdate = instance.vnode.dynamicProps; 6347 for (let i = 0; i < propsToUpdate.length; i++) { 6348 let key = propsToUpdate[i]; 6349 if (isEmitListener(instance.emitsOptions, key)) { 6350 continue; 6351 } 6352 const value = rawProps[key]; 6353 if (options) { 6354 if (hasOwn(attrs, key)) { 6355 if (value !== attrs[key]) { 6356 attrs[key] = value; 6357 hasAttrsChanged = true; 6358 } 6359 } else { 6360 const camelizedKey = camelize(key); 6361 props[camelizedKey] = resolvePropValue( 6362 options, 6363 rawCurrentProps, 6364 camelizedKey, 6365 value, 6366 instance, 6367 false 6368 ); 6369 } 6370 } else { 6371 if (value !== attrs[key]) { 6372 attrs[key] = value; 6373 hasAttrsChanged = true; 6374 } 6375 } 6376 } 6377 } 6378 } else { 6379 if (setFullProps(instance, rawProps, props, attrs)) { 6380 hasAttrsChanged = true; 6381 } 6382 let kebabKey; 6383 for (const key in rawCurrentProps) { 6384 if (!rawProps || // for camelCase 6385 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case 6386 // and converted to camelCase (#955) 6387 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) { 6388 if (options) { 6389 if (rawPrevProps && // for camelCase 6390 (rawPrevProps[key] !== void 0 || // for kebab-case 6391 rawPrevProps[kebabKey] !== void 0)) { 6392 props[key] = resolvePropValue( 6393 options, 6394 rawCurrentProps, 6395 key, 6396 void 0, 6397 instance, 6398 true 6399 ); 6400 } 6401 } else { 6402 delete props[key]; 6403 } 6404 } 6405 } 6406 if (attrs !== rawCurrentProps) { 6407 for (const key in attrs) { 6408 if (!rawProps || !hasOwn(rawProps, key) && true) { 6409 delete attrs[key]; 6410 hasAttrsChanged = true; 6411 } 6412 } 6413 } 6414 } 6415 if (hasAttrsChanged) { 6416 trigger(instance.attrs, "set", ""); 6417 } 6418 { 6419 validateProps(rawProps || {}, props, instance); 6420 } 6421 } 6422 function setFullProps(instance, rawProps, props, attrs) { 6423 const [options, needCastKeys] = instance.propsOptions; 6424 let hasAttrsChanged = false; 6425 let rawCastValues; 6426 if (rawProps) { 6427 for (let key in rawProps) { 6428 if (isReservedProp(key)) { 6429 continue; 6430 } 6431 const value = rawProps[key]; 6432 let camelKey; 6433 if (options && hasOwn(options, camelKey = camelize(key))) { 6434 if (!needCastKeys || !needCastKeys.includes(camelKey)) { 6435 props[camelKey] = value; 6436 } else { 6437 (rawCastValues || (rawCastValues = {}))[camelKey] = value; 6438 } 6439 } else if (!isEmitListener(instance.emitsOptions, key)) { 6440 if (!(key in attrs) || value !== attrs[key]) { 6441 attrs[key] = value; 6442 hasAttrsChanged = true; 6443 } 6444 } 6445 } 6446 } 6447 if (needCastKeys) { 6448 const rawCurrentProps = toRaw(props); 6449 const castValues = rawCastValues || EMPTY_OBJ; 6450 for (let i = 0; i < needCastKeys.length; i++) { 6451 const key = needCastKeys[i]; 6452 props[key] = resolvePropValue( 6453 options, 6454 rawCurrentProps, 6455 key, 6456 castValues[key], 6457 instance, 6458 !hasOwn(castValues, key) 6459 ); 6460 } 6461 } 6462 return hasAttrsChanged; 6463 } 6464 function resolvePropValue(options, props, key, value, instance, isAbsent) { 6465 const opt = options[key]; 6466 if (opt != null) { 6467 const hasDefault = hasOwn(opt, "default"); 6468 if (hasDefault && value === void 0) { 6469 const defaultValue = opt.default; 6470 if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) { 6471 const { propsDefaults } = instance; 6472 if (key in propsDefaults) { 6473 value = propsDefaults[key]; 6474 } else { 6475 const reset = setCurrentInstance(instance); 6476 value = propsDefaults[key] = defaultValue.call( 6477 null, 6478 props 6479 ); 6480 reset(); 6481 } 6482 } else { 6483 value = defaultValue; 6484 } 6485 if (instance.ce) { 6486 instance.ce._setProp(key, value); 6487 } 6488 } 6489 if (opt[0 /* shouldCast */]) { 6490 if (isAbsent && !hasDefault) { 6491 value = false; 6492 } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) { 6493 value = true; 6494 } 6495 } 6496 } 6497 return value; 6498 } 6499 const mixinPropsCache = /* @__PURE__ */ new WeakMap(); 6500 function normalizePropsOptions(comp, appContext, asMixin = false) { 6501 const cache = asMixin ? mixinPropsCache : appContext.propsCache; 6502 const cached = cache.get(comp); 6503 if (cached) { 6504 return cached; 6505 } 6506 const raw = comp.props; 6507 const normalized = {}; 6508 const needCastKeys = []; 6509 let hasExtends = false; 6510 if (!isFunction(comp)) { 6511 const extendProps = (raw2) => { 6512 hasExtends = true; 6513 const [props, keys] = normalizePropsOptions(raw2, appContext, true); 6514 extend(normalized, props); 6515 if (keys) needCastKeys.push(...keys); 6516 }; 6517 if (!asMixin && appContext.mixins.length) { 6518 appContext.mixins.forEach(extendProps); 6519 } 6520 if (comp.extends) { 6521 extendProps(comp.extends); 6522 } 6523 if (comp.mixins) { 6524 comp.mixins.forEach(extendProps); 6525 } 6526 } 6527 if (!raw && !hasExtends) { 6528 if (isObject(comp)) { 6529 cache.set(comp, EMPTY_ARR); 6530 } 6531 return EMPTY_ARR; 6532 } 6533 if (isArray(raw)) { 6534 for (let i = 0; i < raw.length; i++) { 6535 if (!isString(raw[i])) { 6536 warn$1(`props must be strings when using array syntax.`, raw[i]); 6537 } 6538 const normalizedKey = camelize(raw[i]); 6539 if (validatePropName(normalizedKey)) { 6540 normalized[normalizedKey] = EMPTY_OBJ; 6541 } 6542 } 6543 } else if (raw) { 6544 if (!isObject(raw)) { 6545 warn$1(`invalid props options`, raw); 6546 } 6547 for (const key in raw) { 6548 const normalizedKey = camelize(key); 6549 if (validatePropName(normalizedKey)) { 6550 const opt = raw[key]; 6551 const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt); 6552 const propType = prop.type; 6553 let shouldCast = false; 6554 let shouldCastTrue = true; 6555 if (isArray(propType)) { 6556 for (let index = 0; index < propType.length; ++index) { 6557 const type = propType[index]; 6558 const typeName = isFunction(type) && type.name; 6559 if (typeName === "Boolean") { 6560 shouldCast = true; 6561 break; 6562 } else if (typeName === "String") { 6563 shouldCastTrue = false; 6564 } 6565 } 6566 } else { 6567 shouldCast = isFunction(propType) && propType.name === "Boolean"; 6568 } 6569 prop[0 /* shouldCast */] = shouldCast; 6570 prop[1 /* shouldCastTrue */] = shouldCastTrue; 6571 if (shouldCast || hasOwn(prop, "default")) { 6572 needCastKeys.push(normalizedKey); 6573 } 6574 } 6575 } 6576 } 6577 const res = [normalized, needCastKeys]; 6578 if (isObject(comp)) { 6579 cache.set(comp, res); 6580 } 6581 return res; 6582 } 6583 function validatePropName(key) { 6584 if (key[0] !== "$" && !isReservedProp(key)) { 6585 return true; 6586 } else { 6587 warn$1(`Invalid prop name: "${key}" is a reserved property.`); 6588 } 6589 return false; 6590 } 6591 function getType(ctor) { 6592 if (ctor === null) { 6593 return "null"; 6594 } 6595 if (typeof ctor === "function") { 6596 return ctor.name || ""; 6597 } else if (typeof ctor === "object") { 6598 const name = ctor.constructor && ctor.constructor.name; 6599 return name || ""; 6600 } 6601 return ""; 6602 } 6603 function validateProps(rawProps, props, instance) { 6604 const resolvedValues = toRaw(props); 6605 const options = instance.propsOptions[0]; 6606 for (const key in options) { 6607 let opt = options[key]; 6608 if (opt == null) continue; 6609 validateProp( 6610 key, 6611 resolvedValues[key], 6612 opt, 6613 shallowReadonly(resolvedValues) , 6614 !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)) 6615 ); 6616 } 6617 } 6618 function validateProp(name, value, prop, props, isAbsent) { 6619 const { type, required, validator, skipCheck } = prop; 6620 if (required && isAbsent) { 6621 warn$1('Missing required prop: "' + name + '"'); 6622 return; 6623 } 6624 if (value == null && !required) { 6625 return; 6626 } 6627 if (type != null && type !== true && !skipCheck) { 6628 let isValid = false; 6629 const types = isArray(type) ? type : [type]; 6630 const expectedTypes = []; 6631 for (let i = 0; i < types.length && !isValid; i++) { 6632 const { valid, expectedType } = assertType(value, types[i]); 6633 expectedTypes.push(expectedType || ""); 6634 isValid = valid; 6635 } 6636 if (!isValid) { 6637 warn$1(getInvalidTypeMessage(name, value, expectedTypes)); 6638 return; 6639 } 6640 } 6641 if (validator && !validator(value, props)) { 6642 warn$1('Invalid prop: custom validator check failed for prop "' + name + '".'); 6643 } 6644 } 6645 const isSimpleType = /* @__PURE__ */ makeMap( 6646 "String,Number,Boolean,Function,Symbol,BigInt" 6647 ); 6648 function assertType(value, type) { 6649 let valid; 6650 const expectedType = getType(type); 6651 if (expectedType === "null") { 6652 valid = value === null; 6653 } else if (isSimpleType(expectedType)) { 6654 const t = typeof value; 6655 valid = t === expectedType.toLowerCase(); 6656 if (!valid && t === "object") { 6657 valid = value instanceof type; 6658 } 6659 } else if (expectedType === "Object") { 6660 valid = isObject(value); 6661 } else if (expectedType === "Array") { 6662 valid = isArray(value); 6663 } else { 6664 valid = value instanceof type; 6665 } 6666 return { 6667 valid, 6668 expectedType 6669 }; 6670 } 6671 function getInvalidTypeMessage(name, value, expectedTypes) { 6672 if (expectedTypes.length === 0) { 6673 return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`; 6674 } 6675 let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`; 6676 const expectedType = expectedTypes[0]; 6677 const receivedType = toRawType(value); 6678 const expectedValue = styleValue(value, expectedType); 6679 const receivedValue = styleValue(value, receivedType); 6680 if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) { 6681 message += ` with value ${expectedValue}`; 6682 } 6683 message += `, got ${receivedType} `; 6684 if (isExplicable(receivedType)) { 6685 message += `with value ${receivedValue}.`; 6686 } 6687 return message; 6688 } 6689 function styleValue(value, type) { 6690 if (type === "String") { 6691 return `"${value}"`; 6692 } else if (type === "Number") { 6693 return `${Number(value)}`; 6694 } else { 6695 return `${value}`; 6696 } 6697 } 6698 function isExplicable(type) { 6699 const explicitTypes = ["string", "number", "boolean"]; 6700 return explicitTypes.some((elem) => type.toLowerCase() === elem); 6701 } 6702 function isBoolean(...args) { 6703 return args.some((elem) => elem.toLowerCase() === "boolean"); 6704 } 6705 6706 const isInternalKey = (key) => key[0] === "_" || key === "$stable"; 6707 const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; 6708 const normalizeSlot = (key, rawSlot, ctx) => { 6709 if (rawSlot._n) { 6710 return rawSlot; 6711 } 6712 const normalized = withCtx((...args) => { 6713 if (currentInstance && (!ctx || ctx.root === currentInstance.root)) { 6714 warn$1( 6715 `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.` 6716 ); 6717 } 6718 return normalizeSlotValue(rawSlot(...args)); 6719 }, ctx); 6720 normalized._c = false; 6721 return normalized; 6722 }; 6723 const normalizeObjectSlots = (rawSlots, slots, instance) => { 6724 const ctx = rawSlots._ctx; 6725 for (const key in rawSlots) { 6726 if (isInternalKey(key)) continue; 6727 const value = rawSlots[key]; 6728 if (isFunction(value)) { 6729 slots[key] = normalizeSlot(key, value, ctx); 6730 } else if (value != null) { 6731 { 6732 warn$1( 6733 `Non-function value encountered for slot "${key}". Prefer function slots for better performance.` 6734 ); 6735 } 6736 const normalized = normalizeSlotValue(value); 6737 slots[key] = () => normalized; 6738 } 6739 } 6740 }; 6741 const normalizeVNodeSlots = (instance, children) => { 6742 if (!isKeepAlive(instance.vnode) && true) { 6743 warn$1( 6744 `Non-function value encountered for default slot. Prefer function slots for better performance.` 6745 ); 6746 } 6747 const normalized = normalizeSlotValue(children); 6748 instance.slots.default = () => normalized; 6749 }; 6750 const assignSlots = (slots, children, optimized) => { 6751 for (const key in children) { 6752 if (optimized || key !== "_") { 6753 slots[key] = children[key]; 6754 } 6755 } 6756 }; 6757 const initSlots = (instance, children, optimized) => { 6758 const slots = instance.slots = createInternalObject(); 6759 if (instance.vnode.shapeFlag & 32) { 6760 const type = children._; 6761 if (type) { 6762 assignSlots(slots, children, optimized); 6763 if (optimized) { 6764 def(slots, "_", type, true); 6765 } 6766 } else { 6767 normalizeObjectSlots(children, slots); 6768 } 6769 } else if (children) { 6770 normalizeVNodeSlots(instance, children); 6771 } 6772 }; 6773 const updateSlots = (instance, children, optimized) => { 6774 const { vnode, slots } = instance; 6775 let needDeletionCheck = true; 6776 let deletionComparisonTarget = EMPTY_OBJ; 6777 if (vnode.shapeFlag & 32) { 6778 const type = children._; 6779 if (type) { 6780 if (isHmrUpdating) { 6781 assignSlots(slots, children, optimized); 6782 trigger(instance, "set", "$slots"); 6783 } else if (optimized && type === 1) { 6784 needDeletionCheck = false; 6785 } else { 6786 assignSlots(slots, children, optimized); 6787 } 6788 } else { 6789 needDeletionCheck = !children.$stable; 6790 normalizeObjectSlots(children, slots); 6791 } 6792 deletionComparisonTarget = children; 6793 } else if (children) { 6794 normalizeVNodeSlots(instance, children); 6795 deletionComparisonTarget = { default: 1 }; 6796 } 6797 if (needDeletionCheck) { 6798 for (const key in slots) { 6799 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) { 6800 delete slots[key]; 6801 } 6802 } 6803 } 6804 }; 6805 6806 let supported; 6807 let perf; 6808 function startMeasure(instance, type) { 6809 if (instance.appContext.config.performance && isSupported()) { 6810 perf.mark(`vue-${type}-${instance.uid}`); 6811 } 6812 { 6813 devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now()); 6814 } 6815 } 6816 function endMeasure(instance, type) { 6817 if (instance.appContext.config.performance && isSupported()) { 6818 const startTag = `vue-${type}-${instance.uid}`; 6819 const endTag = startTag + `:end`; 6820 perf.mark(endTag); 6821 perf.measure( 6822 `<${formatComponentName(instance, instance.type)}> ${type}`, 6823 startTag, 6824 endTag 6825 ); 6826 perf.clearMarks(startTag); 6827 perf.clearMarks(endTag); 6828 } 6829 { 6830 devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now()); 6831 } 6832 } 6833 function isSupported() { 6834 if (supported !== void 0) { 6835 return supported; 6836 } 6837 if (typeof window !== "undefined" && window.performance) { 6838 supported = true; 6839 perf = window.performance; 6840 } else { 6841 supported = false; 6842 } 6843 return supported; 6844 } 6845 6846 const queuePostRenderEffect = queueEffectWithSuspense ; 6847 function createRenderer(options) { 6848 return baseCreateRenderer(options); 6849 } 6850 function createHydrationRenderer(options) { 6851 return baseCreateRenderer(options, createHydrationFunctions); 6852 } 6853 function baseCreateRenderer(options, createHydrationFns) { 6854 const target = getGlobalThis(); 6855 target.__VUE__ = true; 6856 { 6857 setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target); 6858 } 6859 const { 6860 insert: hostInsert, 6861 remove: hostRemove, 6862 patchProp: hostPatchProp, 6863 createElement: hostCreateElement, 6864 createText: hostCreateText, 6865 createComment: hostCreateComment, 6866 setText: hostSetText, 6867 setElementText: hostSetElementText, 6868 parentNode: hostParentNode, 6869 nextSibling: hostNextSibling, 6870 setScopeId: hostSetScopeId = NOOP, 6871 insertStaticContent: hostInsertStaticContent 6872 } = options; 6873 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => { 6874 if (n1 === n2) { 6875 return; 6876 } 6877 if (n1 && !isSameVNodeType(n1, n2)) { 6878 anchor = getNextHostNode(n1); 6879 unmount(n1, parentComponent, parentSuspense, true); 6880 n1 = null; 6881 } 6882 if (n2.patchFlag === -2) { 6883 optimized = false; 6884 n2.dynamicChildren = null; 6885 } 6886 const { type, ref, shapeFlag } = n2; 6887 switch (type) { 6888 case Text: 6889 processText(n1, n2, container, anchor); 6890 break; 6891 case Comment: 6892 processCommentNode(n1, n2, container, anchor); 6893 break; 6894 case Static: 6895 if (n1 == null) { 6896 mountStaticNode(n2, container, anchor, namespace); 6897 } else { 6898 patchStaticNode(n1, n2, container, namespace); 6899 } 6900 break; 6901 case Fragment: 6902 processFragment( 6903 n1, 6904 n2, 6905 container, 6906 anchor, 6907 parentComponent, 6908 parentSuspense, 6909 namespace, 6910 slotScopeIds, 6911 optimized 6912 ); 6913 break; 6914 default: 6915 if (shapeFlag & 1) { 6916 processElement( 6917 n1, 6918 n2, 6919 container, 6920 anchor, 6921 parentComponent, 6922 parentSuspense, 6923 namespace, 6924 slotScopeIds, 6925 optimized 6926 ); 6927 } else if (shapeFlag & 6) { 6928 processComponent( 6929 n1, 6930 n2, 6931 container, 6932 anchor, 6933 parentComponent, 6934 parentSuspense, 6935 namespace, 6936 slotScopeIds, 6937 optimized 6938 ); 6939 } else if (shapeFlag & 64) { 6940 type.process( 6941 n1, 6942 n2, 6943 container, 6944 anchor, 6945 parentComponent, 6946 parentSuspense, 6947 namespace, 6948 slotScopeIds, 6949 optimized, 6950 internals 6951 ); 6952 } else if (shapeFlag & 128) { 6953 type.process( 6954 n1, 6955 n2, 6956 container, 6957 anchor, 6958 parentComponent, 6959 parentSuspense, 6960 namespace, 6961 slotScopeIds, 6962 optimized, 6963 internals 6964 ); 6965 } else { 6966 warn$1("Invalid VNode type:", type, `(${typeof type})`); 6967 } 6968 } 6969 if (ref != null && parentComponent) { 6970 setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); 6971 } 6972 }; 6973 const processText = (n1, n2, container, anchor) => { 6974 if (n1 == null) { 6975 hostInsert( 6976 n2.el = hostCreateText(n2.children), 6977 container, 6978 anchor 6979 ); 6980 } else { 6981 const el = n2.el = n1.el; 6982 if (n2.children !== n1.children) { 6983 hostSetText(el, n2.children); 6984 } 6985 } 6986 }; 6987 const processCommentNode = (n1, n2, container, anchor) => { 6988 if (n1 == null) { 6989 hostInsert( 6990 n2.el = hostCreateComment(n2.children || ""), 6991 container, 6992 anchor 6993 ); 6994 } else { 6995 n2.el = n1.el; 6996 } 6997 }; 6998 const mountStaticNode = (n2, container, anchor, namespace) => { 6999 [n2.el, n2.anchor] = hostInsertStaticContent( 7000 n2.children, 7001 container, 7002 anchor, 7003 namespace, 7004 n2.el, 7005 n2.anchor 7006 ); 7007 }; 7008 const patchStaticNode = (n1, n2, container, namespace) => { 7009 if (n2.children !== n1.children) { 7010 const anchor = hostNextSibling(n1.anchor); 7011 removeStaticNode(n1); 7012 [n2.el, n2.anchor] = hostInsertStaticContent( 7013 n2.children, 7014 container, 7015 anchor, 7016 namespace 7017 ); 7018 } else { 7019 n2.el = n1.el; 7020 n2.anchor = n1.anchor; 7021 } 7022 }; 7023 const moveStaticNode = ({ el, anchor }, container, nextSibling) => { 7024 let next; 7025 while (el && el !== anchor) { 7026 next = hostNextSibling(el); 7027 hostInsert(el, container, nextSibling); 7028 el = next; 7029 } 7030 hostInsert(anchor, container, nextSibling); 7031 }; 7032 const removeStaticNode = ({ el, anchor }) => { 7033 let next; 7034 while (el && el !== anchor) { 7035 next = hostNextSibling(el); 7036 hostRemove(el); 7037 el = next; 7038 } 7039 hostRemove(anchor); 7040 }; 7041 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7042 if (n2.type === "svg") { 7043 namespace = "svg"; 7044 } else if (n2.type === "math") { 7045 namespace = "mathml"; 7046 } 7047 if (n1 == null) { 7048 mountElement( 7049 n2, 7050 container, 7051 anchor, 7052 parentComponent, 7053 parentSuspense, 7054 namespace, 7055 slotScopeIds, 7056 optimized 7057 ); 7058 } else { 7059 patchElement( 7060 n1, 7061 n2, 7062 parentComponent, 7063 parentSuspense, 7064 namespace, 7065 slotScopeIds, 7066 optimized 7067 ); 7068 } 7069 }; 7070 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7071 let el; 7072 let vnodeHook; 7073 const { props, shapeFlag, transition, dirs } = vnode; 7074 el = vnode.el = hostCreateElement( 7075 vnode.type, 7076 namespace, 7077 props && props.is, 7078 props 7079 ); 7080 if (shapeFlag & 8) { 7081 hostSetElementText(el, vnode.children); 7082 } else if (shapeFlag & 16) { 7083 mountChildren( 7084 vnode.children, 7085 el, 7086 null, 7087 parentComponent, 7088 parentSuspense, 7089 resolveChildrenNamespace(vnode, namespace), 7090 slotScopeIds, 7091 optimized 7092 ); 7093 } 7094 if (dirs) { 7095 invokeDirectiveHook(vnode, null, parentComponent, "created"); 7096 } 7097 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent); 7098 if (props) { 7099 for (const key in props) { 7100 if (key !== "value" && !isReservedProp(key)) { 7101 hostPatchProp(el, key, null, props[key], namespace, parentComponent); 7102 } 7103 } 7104 if ("value" in props) { 7105 hostPatchProp(el, "value", null, props.value, namespace); 7106 } 7107 if (vnodeHook = props.onVnodeBeforeMount) { 7108 invokeVNodeHook(vnodeHook, parentComponent, vnode); 7109 } 7110 } 7111 { 7112 def(el, "__vnode", vnode, true); 7113 def(el, "__vueParentComponent", parentComponent, true); 7114 } 7115 if (dirs) { 7116 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 7117 } 7118 const needCallTransitionHooks = needTransition(parentSuspense, transition); 7119 if (needCallTransitionHooks) { 7120 transition.beforeEnter(el); 7121 } 7122 hostInsert(el, container, anchor); 7123 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) { 7124 queuePostRenderEffect(() => { 7125 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 7126 needCallTransitionHooks && transition.enter(el); 7127 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 7128 }, parentSuspense); 7129 } 7130 }; 7131 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => { 7132 if (scopeId) { 7133 hostSetScopeId(el, scopeId); 7134 } 7135 if (slotScopeIds) { 7136 for (let i = 0; i < slotScopeIds.length; i++) { 7137 hostSetScopeId(el, slotScopeIds[i]); 7138 } 7139 } 7140 if (parentComponent) { 7141 let subTree = parentComponent.subTree; 7142 if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) { 7143 subTree = filterSingleRoot(subTree.children) || subTree; 7144 } 7145 if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) { 7146 const parentVNode = parentComponent.vnode; 7147 setScopeId( 7148 el, 7149 parentVNode, 7150 parentVNode.scopeId, 7151 parentVNode.slotScopeIds, 7152 parentComponent.parent 7153 ); 7154 } 7155 } 7156 }; 7157 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => { 7158 for (let i = start; i < children.length; i++) { 7159 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]); 7160 patch( 7161 null, 7162 child, 7163 container, 7164 anchor, 7165 parentComponent, 7166 parentSuspense, 7167 namespace, 7168 slotScopeIds, 7169 optimized 7170 ); 7171 } 7172 }; 7173 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7174 const el = n2.el = n1.el; 7175 { 7176 el.__vnode = n2; 7177 } 7178 let { patchFlag, dynamicChildren, dirs } = n2; 7179 patchFlag |= n1.patchFlag & 16; 7180 const oldProps = n1.props || EMPTY_OBJ; 7181 const newProps = n2.props || EMPTY_OBJ; 7182 let vnodeHook; 7183 parentComponent && toggleRecurse(parentComponent, false); 7184 if (vnodeHook = newProps.onVnodeBeforeUpdate) { 7185 invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7186 } 7187 if (dirs) { 7188 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate"); 7189 } 7190 parentComponent && toggleRecurse(parentComponent, true); 7191 if (isHmrUpdating) { 7192 patchFlag = 0; 7193 optimized = false; 7194 dynamicChildren = null; 7195 } 7196 if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) { 7197 hostSetElementText(el, ""); 7198 } 7199 if (dynamicChildren) { 7200 patchBlockChildren( 7201 n1.dynamicChildren, 7202 dynamicChildren, 7203 el, 7204 parentComponent, 7205 parentSuspense, 7206 resolveChildrenNamespace(n2, namespace), 7207 slotScopeIds 7208 ); 7209 { 7210 traverseStaticChildren(n1, n2); 7211 } 7212 } else if (!optimized) { 7213 patchChildren( 7214 n1, 7215 n2, 7216 el, 7217 null, 7218 parentComponent, 7219 parentSuspense, 7220 resolveChildrenNamespace(n2, namespace), 7221 slotScopeIds, 7222 false 7223 ); 7224 } 7225 if (patchFlag > 0) { 7226 if (patchFlag & 16) { 7227 patchProps(el, oldProps, newProps, parentComponent, namespace); 7228 } else { 7229 if (patchFlag & 2) { 7230 if (oldProps.class !== newProps.class) { 7231 hostPatchProp(el, "class", null, newProps.class, namespace); 7232 } 7233 } 7234 if (patchFlag & 4) { 7235 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace); 7236 } 7237 if (patchFlag & 8) { 7238 const propsToUpdate = n2.dynamicProps; 7239 for (let i = 0; i < propsToUpdate.length; i++) { 7240 const key = propsToUpdate[i]; 7241 const prev = oldProps[key]; 7242 const next = newProps[key]; 7243 if (next !== prev || key === "value") { 7244 hostPatchProp(el, key, prev, next, namespace, parentComponent); 7245 } 7246 } 7247 } 7248 } 7249 if (patchFlag & 1) { 7250 if (n1.children !== n2.children) { 7251 hostSetElementText(el, n2.children); 7252 } 7253 } 7254 } else if (!optimized && dynamicChildren == null) { 7255 patchProps(el, oldProps, newProps, parentComponent, namespace); 7256 } 7257 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) { 7258 queuePostRenderEffect(() => { 7259 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7260 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated"); 7261 }, parentSuspense); 7262 } 7263 }; 7264 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => { 7265 for (let i = 0; i < newChildren.length; i++) { 7266 const oldVNode = oldChildren[i]; 7267 const newVNode = newChildren[i]; 7268 const container = ( 7269 // oldVNode may be an errored async setup() component inside Suspense 7270 // which will not have a mounted element 7271 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent 7272 // of the Fragment itself so it can move its children. 7273 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement 7274 // which also requires the correct parent container 7275 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. 7276 oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( 7277 // In other cases, the parent container is not actually used so we 7278 // just pass the block element here to avoid a DOM parentNode call. 7279 fallbackContainer 7280 ) 7281 ); 7282 patch( 7283 oldVNode, 7284 newVNode, 7285 container, 7286 null, 7287 parentComponent, 7288 parentSuspense, 7289 namespace, 7290 slotScopeIds, 7291 true 7292 ); 7293 } 7294 }; 7295 const patchProps = (el, oldProps, newProps, parentComponent, namespace) => { 7296 if (oldProps !== newProps) { 7297 if (oldProps !== EMPTY_OBJ) { 7298 for (const key in oldProps) { 7299 if (!isReservedProp(key) && !(key in newProps)) { 7300 hostPatchProp( 7301 el, 7302 key, 7303 oldProps[key], 7304 null, 7305 namespace, 7306 parentComponent 7307 ); 7308 } 7309 } 7310 } 7311 for (const key in newProps) { 7312 if (isReservedProp(key)) continue; 7313 const next = newProps[key]; 7314 const prev = oldProps[key]; 7315 if (next !== prev && key !== "value") { 7316 hostPatchProp(el, key, prev, next, namespace, parentComponent); 7317 } 7318 } 7319 if ("value" in newProps) { 7320 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace); 7321 } 7322 } 7323 }; 7324 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7325 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText(""); 7326 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText(""); 7327 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2; 7328 if ( 7329 // #5523 dev root fragment may inherit directives 7330 isHmrUpdating || patchFlag & 2048 7331 ) { 7332 patchFlag = 0; 7333 optimized = false; 7334 dynamicChildren = null; 7335 } 7336 if (fragmentSlotScopeIds) { 7337 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 7338 } 7339 if (n1 == null) { 7340 hostInsert(fragmentStartAnchor, container, anchor); 7341 hostInsert(fragmentEndAnchor, container, anchor); 7342 mountChildren( 7343 // #10007 7344 // such fragment like `<></>` will be compiled into 7345 // a fragment which doesn't have a children. 7346 // In this case fallback to an empty array 7347 n2.children || [], 7348 container, 7349 fragmentEndAnchor, 7350 parentComponent, 7351 parentSuspense, 7352 namespace, 7353 slotScopeIds, 7354 optimized 7355 ); 7356 } else { 7357 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result 7358 // of renderSlot() with no valid children 7359 n1.dynamicChildren) { 7360 patchBlockChildren( 7361 n1.dynamicChildren, 7362 dynamicChildren, 7363 container, 7364 parentComponent, 7365 parentSuspense, 7366 namespace, 7367 slotScopeIds 7368 ); 7369 { 7370 traverseStaticChildren(n1, n2); 7371 } 7372 } else { 7373 patchChildren( 7374 n1, 7375 n2, 7376 container, 7377 fragmentEndAnchor, 7378 parentComponent, 7379 parentSuspense, 7380 namespace, 7381 slotScopeIds, 7382 optimized 7383 ); 7384 } 7385 } 7386 }; 7387 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7388 n2.slotScopeIds = slotScopeIds; 7389 if (n1 == null) { 7390 if (n2.shapeFlag & 512) { 7391 parentComponent.ctx.activate( 7392 n2, 7393 container, 7394 anchor, 7395 namespace, 7396 optimized 7397 ); 7398 } else { 7399 mountComponent( 7400 n2, 7401 container, 7402 anchor, 7403 parentComponent, 7404 parentSuspense, 7405 namespace, 7406 optimized 7407 ); 7408 } 7409 } else { 7410 updateComponent(n1, n2, optimized); 7411 } 7412 }; 7413 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => { 7414 const instance = (initialVNode.component = createComponentInstance( 7415 initialVNode, 7416 parentComponent, 7417 parentSuspense 7418 )); 7419 if (instance.type.__hmrId) { 7420 registerHMR(instance); 7421 } 7422 { 7423 pushWarningContext(initialVNode); 7424 startMeasure(instance, `mount`); 7425 } 7426 if (isKeepAlive(initialVNode)) { 7427 instance.ctx.renderer = internals; 7428 } 7429 { 7430 { 7431 startMeasure(instance, `init`); 7432 } 7433 setupComponent(instance, false, optimized); 7434 { 7435 endMeasure(instance, `init`); 7436 } 7437 } 7438 if (instance.asyncDep) { 7439 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); 7440 if (!initialVNode.el) { 7441 const placeholder = instance.subTree = createVNode(Comment); 7442 processCommentNode(null, placeholder, container, anchor); 7443 } 7444 } else { 7445 setupRenderEffect( 7446 instance, 7447 initialVNode, 7448 container, 7449 anchor, 7450 parentSuspense, 7451 namespace, 7452 optimized 7453 ); 7454 } 7455 { 7456 popWarningContext(); 7457 endMeasure(instance, `mount`); 7458 } 7459 }; 7460 const updateComponent = (n1, n2, optimized) => { 7461 const instance = n2.component = n1.component; 7462 if (shouldUpdateComponent(n1, n2, optimized)) { 7463 if (instance.asyncDep && !instance.asyncResolved) { 7464 { 7465 pushWarningContext(n2); 7466 } 7467 updateComponentPreRender(instance, n2, optimized); 7468 { 7469 popWarningContext(); 7470 } 7471 return; 7472 } else { 7473 instance.next = n2; 7474 instance.update(); 7475 } 7476 } else { 7477 n2.el = n1.el; 7478 instance.vnode = n2; 7479 } 7480 }; 7481 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => { 7482 const componentUpdateFn = () => { 7483 if (!instance.isMounted) { 7484 let vnodeHook; 7485 const { el, props } = initialVNode; 7486 const { bm, m, parent, root, type } = instance; 7487 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode); 7488 toggleRecurse(instance, false); 7489 if (bm) { 7490 invokeArrayFns(bm); 7491 } 7492 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) { 7493 invokeVNodeHook(vnodeHook, parent, initialVNode); 7494 } 7495 toggleRecurse(instance, true); 7496 if (el && hydrateNode) { 7497 const hydrateSubTree = () => { 7498 { 7499 startMeasure(instance, `render`); 7500 } 7501 instance.subTree = renderComponentRoot(instance); 7502 { 7503 endMeasure(instance, `render`); 7504 } 7505 { 7506 startMeasure(instance, `hydrate`); 7507 } 7508 hydrateNode( 7509 el, 7510 instance.subTree, 7511 instance, 7512 parentSuspense, 7513 null 7514 ); 7515 { 7516 endMeasure(instance, `hydrate`); 7517 } 7518 }; 7519 if (isAsyncWrapperVNode && type.__asyncHydrate) { 7520 type.__asyncHydrate( 7521 el, 7522 instance, 7523 hydrateSubTree 7524 ); 7525 } else { 7526 hydrateSubTree(); 7527 } 7528 } else { 7529 if (root.ce) { 7530 root.ce._injectChildStyle(type); 7531 } 7532 { 7533 startMeasure(instance, `render`); 7534 } 7535 const subTree = instance.subTree = renderComponentRoot(instance); 7536 { 7537 endMeasure(instance, `render`); 7538 } 7539 { 7540 startMeasure(instance, `patch`); 7541 } 7542 patch( 7543 null, 7544 subTree, 7545 container, 7546 anchor, 7547 instance, 7548 parentSuspense, 7549 namespace 7550 ); 7551 { 7552 endMeasure(instance, `patch`); 7553 } 7554 initialVNode.el = subTree.el; 7555 } 7556 if (m) { 7557 queuePostRenderEffect(m, parentSuspense); 7558 } 7559 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) { 7560 const scopedInitialVNode = initialVNode; 7561 queuePostRenderEffect( 7562 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), 7563 parentSuspense 7564 ); 7565 } 7566 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) { 7567 instance.a && queuePostRenderEffect(instance.a, parentSuspense); 7568 } 7569 instance.isMounted = true; 7570 { 7571 devtoolsComponentAdded(instance); 7572 } 7573 initialVNode = container = anchor = null; 7574 } else { 7575 let { next, bu, u, parent, vnode } = instance; 7576 { 7577 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance); 7578 if (nonHydratedAsyncRoot) { 7579 if (next) { 7580 next.el = vnode.el; 7581 updateComponentPreRender(instance, next, optimized); 7582 } 7583 nonHydratedAsyncRoot.asyncDep.then(() => { 7584 if (!instance.isUnmounted) { 7585 componentUpdateFn(); 7586 } 7587 }); 7588 return; 7589 } 7590 } 7591 let originNext = next; 7592 let vnodeHook; 7593 { 7594 pushWarningContext(next || instance.vnode); 7595 } 7596 toggleRecurse(instance, false); 7597 if (next) { 7598 next.el = vnode.el; 7599 updateComponentPreRender(instance, next, optimized); 7600 } else { 7601 next = vnode; 7602 } 7603 if (bu) { 7604 invokeArrayFns(bu); 7605 } 7606 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) { 7607 invokeVNodeHook(vnodeHook, parent, next, vnode); 7608 } 7609 toggleRecurse(instance, true); 7610 { 7611 startMeasure(instance, `render`); 7612 } 7613 const nextTree = renderComponentRoot(instance); 7614 { 7615 endMeasure(instance, `render`); 7616 } 7617 const prevTree = instance.subTree; 7618 instance.subTree = nextTree; 7619 { 7620 startMeasure(instance, `patch`); 7621 } 7622 patch( 7623 prevTree, 7624 nextTree, 7625 // parent may have changed if it's in a teleport 7626 hostParentNode(prevTree.el), 7627 // anchor may have changed if it's in a fragment 7628 getNextHostNode(prevTree), 7629 instance, 7630 parentSuspense, 7631 namespace 7632 ); 7633 { 7634 endMeasure(instance, `patch`); 7635 } 7636 next.el = nextTree.el; 7637 if (originNext === null) { 7638 updateHOCHostEl(instance, nextTree.el); 7639 } 7640 if (u) { 7641 queuePostRenderEffect(u, parentSuspense); 7642 } 7643 if (vnodeHook = next.props && next.props.onVnodeUpdated) { 7644 queuePostRenderEffect( 7645 () => invokeVNodeHook(vnodeHook, parent, next, vnode), 7646 parentSuspense 7647 ); 7648 } 7649 { 7650 devtoolsComponentUpdated(instance); 7651 } 7652 { 7653 popWarningContext(); 7654 } 7655 } 7656 }; 7657 instance.scope.on(); 7658 const effect = instance.effect = new ReactiveEffect(componentUpdateFn); 7659 instance.scope.off(); 7660 const update = instance.update = effect.run.bind(effect); 7661 const job = instance.job = effect.runIfDirty.bind(effect); 7662 job.i = instance; 7663 job.id = instance.uid; 7664 effect.scheduler = () => queueJob(job); 7665 toggleRecurse(instance, true); 7666 { 7667 effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0; 7668 effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0; 7669 } 7670 update(); 7671 }; 7672 const updateComponentPreRender = (instance, nextVNode, optimized) => { 7673 nextVNode.component = instance; 7674 const prevProps = instance.vnode.props; 7675 instance.vnode = nextVNode; 7676 instance.next = null; 7677 updateProps(instance, nextVNode.props, prevProps, optimized); 7678 updateSlots(instance, nextVNode.children, optimized); 7679 pauseTracking(); 7680 flushPreFlushCbs(instance); 7681 resetTracking(); 7682 }; 7683 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => { 7684 const c1 = n1 && n1.children; 7685 const prevShapeFlag = n1 ? n1.shapeFlag : 0; 7686 const c2 = n2.children; 7687 const { patchFlag, shapeFlag } = n2; 7688 if (patchFlag > 0) { 7689 if (patchFlag & 128) { 7690 patchKeyedChildren( 7691 c1, 7692 c2, 7693 container, 7694 anchor, 7695 parentComponent, 7696 parentSuspense, 7697 namespace, 7698 slotScopeIds, 7699 optimized 7700 ); 7701 return; 7702 } else if (patchFlag & 256) { 7703 patchUnkeyedChildren( 7704 c1, 7705 c2, 7706 container, 7707 anchor, 7708 parentComponent, 7709 parentSuspense, 7710 namespace, 7711 slotScopeIds, 7712 optimized 7713 ); 7714 return; 7715 } 7716 } 7717 if (shapeFlag & 8) { 7718 if (prevShapeFlag & 16) { 7719 unmountChildren(c1, parentComponent, parentSuspense); 7720 } 7721 if (c2 !== c1) { 7722 hostSetElementText(container, c2); 7723 } 7724 } else { 7725 if (prevShapeFlag & 16) { 7726 if (shapeFlag & 16) { 7727 patchKeyedChildren( 7728 c1, 7729 c2, 7730 container, 7731 anchor, 7732 parentComponent, 7733 parentSuspense, 7734 namespace, 7735 slotScopeIds, 7736 optimized 7737 ); 7738 } else { 7739 unmountChildren(c1, parentComponent, parentSuspense, true); 7740 } 7741 } else { 7742 if (prevShapeFlag & 8) { 7743 hostSetElementText(container, ""); 7744 } 7745 if (shapeFlag & 16) { 7746 mountChildren( 7747 c2, 7748 container, 7749 anchor, 7750 parentComponent, 7751 parentSuspense, 7752 namespace, 7753 slotScopeIds, 7754 optimized 7755 ); 7756 } 7757 } 7758 } 7759 }; 7760 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7761 c1 = c1 || EMPTY_ARR; 7762 c2 = c2 || EMPTY_ARR; 7763 const oldLength = c1.length; 7764 const newLength = c2.length; 7765 const commonLength = Math.min(oldLength, newLength); 7766 let i; 7767 for (i = 0; i < commonLength; i++) { 7768 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7769 patch( 7770 c1[i], 7771 nextChild, 7772 container, 7773 null, 7774 parentComponent, 7775 parentSuspense, 7776 namespace, 7777 slotScopeIds, 7778 optimized 7779 ); 7780 } 7781 if (oldLength > newLength) { 7782 unmountChildren( 7783 c1, 7784 parentComponent, 7785 parentSuspense, 7786 true, 7787 false, 7788 commonLength 7789 ); 7790 } else { 7791 mountChildren( 7792 c2, 7793 container, 7794 anchor, 7795 parentComponent, 7796 parentSuspense, 7797 namespace, 7798 slotScopeIds, 7799 optimized, 7800 commonLength 7801 ); 7802 } 7803 }; 7804 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7805 let i = 0; 7806 const l2 = c2.length; 7807 let e1 = c1.length - 1; 7808 let e2 = l2 - 1; 7809 while (i <= e1 && i <= e2) { 7810 const n1 = c1[i]; 7811 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7812 if (isSameVNodeType(n1, n2)) { 7813 patch( 7814 n1, 7815 n2, 7816 container, 7817 null, 7818 parentComponent, 7819 parentSuspense, 7820 namespace, 7821 slotScopeIds, 7822 optimized 7823 ); 7824 } else { 7825 break; 7826 } 7827 i++; 7828 } 7829 while (i <= e1 && i <= e2) { 7830 const n1 = c1[e1]; 7831 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]); 7832 if (isSameVNodeType(n1, n2)) { 7833 patch( 7834 n1, 7835 n2, 7836 container, 7837 null, 7838 parentComponent, 7839 parentSuspense, 7840 namespace, 7841 slotScopeIds, 7842 optimized 7843 ); 7844 } else { 7845 break; 7846 } 7847 e1--; 7848 e2--; 7849 } 7850 if (i > e1) { 7851 if (i <= e2) { 7852 const nextPos = e2 + 1; 7853 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor; 7854 while (i <= e2) { 7855 patch( 7856 null, 7857 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]), 7858 container, 7859 anchor, 7860 parentComponent, 7861 parentSuspense, 7862 namespace, 7863 slotScopeIds, 7864 optimized 7865 ); 7866 i++; 7867 } 7868 } 7869 } else if (i > e2) { 7870 while (i <= e1) { 7871 unmount(c1[i], parentComponent, parentSuspense, true); 7872 i++; 7873 } 7874 } else { 7875 const s1 = i; 7876 const s2 = i;
vendor: 4,255 bytes, lines 7877-8030
7877 const keyToNewIndexMap = /* @__PURE__ */ new Map(); 7878 for (i = s2; i <= e2; i++) { 7879 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7880 if (nextChild.key != null) { 7881 if (keyToNewIndexMap.has(nextChild.key)) { 7882 warn$1( 7883 `Duplicate keys found during update:`, 7884 JSON.stringify(nextChild.key), 7885 `Make sure keys are unique.` 7886 ); 7887 } 7888 keyToNewIndexMap.set(nextChild.key, i); 7889 } 7890 } 7891 let j; 7892 let patched = 0; 7893 const toBePatched = e2 - s2 + 1; 7894 let moved = false; 7895 let maxNewIndexSoFar = 0; 7896 const newIndexToOldIndexMap = new Array(toBePatched); 7897 for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0; 7898 for (i = s1; i <= e1; i++) { 7899 const prevChild = c1[i]; 7900 if (patched >= toBePatched) { 7901 unmount(prevChild, parentComponent, parentSuspense, true); 7902 continue; 7903 } 7904 let newIndex; 7905 if (prevChild.key != null) { 7906 newIndex = keyToNewIndexMap.get(prevChild.key); 7907 } else { 7908 for (j = s2; j <= e2; j++) { 7909 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) { 7910 newIndex = j; 7911 break; 7912 } 7913 } 7914 } 7915 if (newIndex === void 0) { 7916 unmount(prevChild, parentComponent, parentSuspense, true); 7917 } else { 7918 newIndexToOldIndexMap[newIndex - s2] = i + 1; 7919 if (newIndex >= maxNewIndexSoFar) { 7920 maxNewIndexSoFar = newIndex; 7921 } else { 7922 moved = true; 7923 } 7924 patch( 7925 prevChild, 7926 c2[newIndex], 7927 container, 7928 null, 7929 parentComponent, 7930 parentSuspense, 7931 namespace, 7932 slotScopeIds, 7933 optimized 7934 ); 7935 patched++; 7936 } 7937 } 7938 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR; 7939 j = increasingNewIndexSequence.length - 1; 7940 for (i = toBePatched - 1; i >= 0; i--) { 7941 const nextIndex = s2 + i; 7942 const nextChild = c2[nextIndex]; 7943 const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor; 7944 if (newIndexToOldIndexMap[i] === 0) { 7945 patch( 7946 null, 7947 nextChild, 7948 container, 7949 anchor, 7950 parentComponent, 7951 parentSuspense, 7952 namespace, 7953 slotScopeIds, 7954 optimized 7955 ); 7956 } else if (moved) { 7957 if (j < 0 || i !== increasingNewIndexSequence[j]) { 7958 move(nextChild, container, anchor, 2); 7959 } else { 7960 j--; 7961 } 7962 } 7963 } 7964 } 7965 }; 7966 const move = (vnode, container, anchor, moveType, parentSuspense = null) => { 7967 const { el, type, transition, children, shapeFlag } = vnode; 7968 if (shapeFlag & 6) { 7969 move(vnode.component.subTree, container, anchor, moveType); 7970 return; 7971 } 7972 if (shapeFlag & 128) { 7973 vnode.suspense.move(container, anchor, moveType); 7974 return; 7975 } 7976 if (shapeFlag & 64) { 7977 type.move(vnode, container, anchor, internals); 7978 return; 7979 } 7980 if (type === Fragment) { 7981 hostInsert(el, container, anchor); 7982 for (let i = 0; i < children.length; i++) { 7983 move(children[i], container, anchor, moveType); 7984 } 7985 hostInsert(vnode.anchor, container, anchor); 7986 return; 7987 } 7988 if (type === Static) { 7989 moveStaticNode(vnode, container, anchor); 7990 return; 7991 } 7992 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition; 7993 if (needTransition2) { 7994 if (moveType === 0) { 7995 transition.beforeEnter(el); 7996 hostInsert(el, container, anchor); 7997 queuePostRenderEffect(() => transition.enter(el), parentSuspense); 7998 } else { 7999 const { leave, delayLeave, afterLeave } = transition; 8000 const remove2 = () => hostInsert(el, container, anchor); 8001 const performLeave = () => { 8002 leave(el, () => { 8003 remove2(); 8004 afterLeave && afterLeave(); 8005 }); 8006 }; 8007 if (delayLeave) { 8008 delayLeave(el, remove2, performLeave); 8009 } else { 8010 performLeave(); 8011 } 8012 } 8013 } else { 8014 hostInsert(el, container, anchor); 8015 } 8016 }; 8017 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => { 8018 const { 8019 type, 8020 props, 8021 ref, 8022 children, 8023 dynamicChildren, 8024 shapeFlag, 8025 patchFlag, 8026 dirs, 8027 cacheIndex 8028 } = vnode; 8029 if (patchFlag === -2) { 8030 optimized = false;
vendor: 4,856 bytes, lines 8031-8188
8031 } 8032 if (ref != null) { 8033 setRef(ref, null, parentSuspense, vnode, true); 8034 } 8035 if (cacheIndex != null) { 8036 parentComponent.renderCache[cacheIndex] = void 0; 8037 } 8038 if (shapeFlag & 256) { 8039 parentComponent.ctx.deactivate(vnode); 8040 return; 8041 } 8042 const shouldInvokeDirs = shapeFlag & 1 && dirs; 8043 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode); 8044 let vnodeHook; 8045 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) { 8046 invokeVNodeHook(vnodeHook, parentComponent, vnode); 8047 } 8048 if (shapeFlag & 6) { 8049 unmountComponent(vnode.component, parentSuspense, doRemove); 8050 } else { 8051 if (shapeFlag & 128) { 8052 vnode.suspense.unmount(parentSuspense, doRemove); 8053 return; 8054 } 8055 if (shouldInvokeDirs) { 8056 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount"); 8057 } 8058 if (shapeFlag & 64) { 8059 vnode.type.remove( 8060 vnode, 8061 parentComponent, 8062 parentSuspense, 8063 internals, 8064 doRemove 8065 ); 8066 } else if (dynamicChildren && // #5154 8067 // when v-once is used inside a block, setBlockTracking(-1) marks the 8068 // parent block with hasOnce: true 8069 // so that it doesn't take the fast path during unmount - otherwise 8070 // components nested in v-once are never unmounted. 8071 !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments 8072 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) { 8073 unmountChildren( 8074 dynamicChildren, 8075 parentComponent, 8076 parentSuspense, 8077 false, 8078 true 8079 ); 8080 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) { 8081 unmountChildren(children, parentComponent, parentSuspense); 8082 } 8083 if (doRemove) { 8084 remove(vnode); 8085 } 8086 } 8087 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) { 8088 queuePostRenderEffect(() => { 8089 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 8090 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted"); 8091 }, parentSuspense); 8092 } 8093 }; 8094 const remove = (vnode) => { 8095 const { type, el, anchor, transition } = vnode; 8096 if (type === Fragment) { 8097 if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) { 8098 vnode.children.forEach((child) => { 8099 if (child.type === Comment) { 8100 hostRemove(child.el); 8101 } else { 8102 remove(child); 8103 } 8104 }); 8105 } else { 8106 removeFragment(el, anchor); 8107 } 8108 return; 8109 } 8110 if (type === Static) { 8111 removeStaticNode(vnode); 8112 return; 8113 } 8114 const performRemove = () => { 8115 hostRemove(el); 8116 if (transition && !transition.persisted && transition.afterLeave) { 8117 transition.afterLeave(); 8118 } 8119 }; 8120 if (vnode.shapeFlag & 1 && transition && !transition.persisted) { 8121 const { leave, delayLeave } = transition; 8122 const performLeave = () => leave(el, performRemove); 8123 if (delayLeave) { 8124 delayLeave(vnode.el, performRemove, performLeave); 8125 } else { 8126 performLeave(); 8127 } 8128 } else { 8129 performRemove(); 8130 } 8131 }; 8132 const removeFragment = (cur, end) => { 8133 let next; 8134 while (cur !== end) { 8135 next = hostNextSibling(cur); 8136 hostRemove(cur); 8137 cur = next; 8138 } 8139 hostRemove(end); 8140 }; 8141 const unmountComponent = (instance, parentSuspense, doRemove) => { 8142 if (instance.type.__hmrId) { 8143 unregisterHMR(instance); 8144 } 8145 const { bum, scope, job, subTree, um, m, a } = instance; 8146 invalidateMount(m); 8147 invalidateMount(a); 8148 if (bum) { 8149 invokeArrayFns(bum); 8150 } 8151 scope.stop(); 8152 if (job) { 8153 job.flags |= 8; 8154 unmount(subTree, instance, parentSuspense, doRemove); 8155 } 8156 if (um) { 8157 queuePostRenderEffect(um, parentSuspense); 8158 } 8159 queuePostRenderEffect(() => { 8160 instance.isUnmounted = true; 8161 }, parentSuspense); 8162 if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) { 8163 parentSuspense.deps--; 8164 if (parentSuspense.deps === 0) { 8165 parentSuspense.resolve(); 8166 } 8167 } 8168 { 8169 devtoolsComponentRemoved(instance); 8170 } 8171 }; 8172 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => { 8173 for (let i = start; i < children.length; i++) { 8174 unmount(children[i], parentComponent, parentSuspense, doRemove, optimized); 8175 } 8176 }; 8177 const getNextHostNode = (vnode) => { 8178 if (vnode.shapeFlag & 6) { 8179 return getNextHostNode(vnode.component.subTree); 8180 } 8181 if (vnode.shapeFlag & 128) { 8182 return vnode.suspense.next(); 8183 } 8184 const el = hostNextSibling(vnode.anchor || vnode.el); 8185 const teleportEnd = el && el[TeleportEndKey]; 8186 return teleportEnd ? hostNextSibling(teleportEnd) : el; 8187 }; 8188 let isFlushing = false;
vendor: 3,177 bytes, lines 8189-8326
8189 const render = (vnode, container, namespace) => { 8190 if (vnode == null) { 8191 if (container._vnode) { 8192 unmount(container._vnode, null, null, true); 8193 } 8194 } else { 8195 patch( 8196 container._vnode || null, 8197 vnode, 8198 container, 8199 null, 8200 null, 8201 null, 8202 namespace 8203 ); 8204 } 8205 container._vnode = vnode; 8206 if (!isFlushing) { 8207 isFlushing = true; 8208 flushPreFlushCbs(); 8209 flushPostFlushCbs(); 8210 isFlushing = false; 8211 } 8212 }; 8213 const internals = { 8214 p: patch, 8215 um: unmount, 8216 m: move, 8217 r: remove, 8218 mt: mountComponent, 8219 mc: mountChildren, 8220 pc: patchChildren, 8221 pbc: patchBlockChildren, 8222 n: getNextHostNode, 8223 o: options 8224 }; 8225 let hydrate; 8226 let hydrateNode; 8227 if (createHydrationFns) { 8228 [hydrate, hydrateNode] = createHydrationFns( 8229 internals 8230 ); 8231 } 8232 return { 8233 render, 8234 hydrate, 8235 createApp: createAppAPI(render, hydrate) 8236 }; 8237 } 8238 function resolveChildrenNamespace({ type, props }, currentNamespace) { 8239 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace; 8240 } 8241 function toggleRecurse({ effect, job }, allowed) { 8242 if (allowed) { 8243 effect.flags |= 32; 8244 job.flags |= 4; 8245 } else { 8246 effect.flags &= ~32; 8247 job.flags &= ~4; 8248 } 8249 } 8250 function needTransition(parentSuspense, transition) { 8251 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted; 8252 } 8253 function traverseStaticChildren(n1, n2, shallow = false) { 8254 const ch1 = n1.children; 8255 const ch2 = n2.children; 8256 if (isArray(ch1) && isArray(ch2)) { 8257 for (let i = 0; i < ch1.length; i++) { 8258 const c1 = ch1[i]; 8259 let c2 = ch2[i]; 8260 if (c2.shapeFlag & 1 && !c2.dynamicChildren) { 8261 if (c2.patchFlag <= 0 || c2.patchFlag === 32) { 8262 c2 = ch2[i] = cloneIfMounted(ch2[i]); 8263 c2.el = c1.el; 8264 } 8265 if (!shallow && c2.patchFlag !== -2) 8266 traverseStaticChildren(c1, c2); 8267 } 8268 if (c2.type === Text) { 8269 c2.el = c1.el; 8270 } 8271 if (c2.type === Comment && !c2.el) { 8272 c2.el = c1.el; 8273 } 8274 } 8275 } 8276 } 8277 function getSequence(arr) { 8278 const p = arr.slice(); 8279 const result = [0]; 8280 let i, j, u, v, c; 8281 const len = arr.length; 8282 for (i = 0; i < len; i++) { 8283 const arrI = arr[i]; 8284 if (arrI !== 0) { 8285 j = result[result.length - 1]; 8286 if (arr[j] < arrI) { 8287 p[i] = j; 8288 result.push(i); 8289 continue; 8290 } 8291 u = 0; 8292 v = result.length - 1; 8293 while (u < v) { 8294 c = u + v >> 1; 8295 if (arr[result[c]] < arrI) { 8296 u = c + 1; 8297 } else { 8298 v = c; 8299 } 8300 } 8301 if (arrI < arr[result[u]]) { 8302 if (u > 0) { 8303 p[i] = result[u - 1]; 8304 } 8305 result[u] = i; 8306 } 8307 } 8308 } 8309 u = result.length; 8310 v = result[u - 1]; 8311 while (u-- > 0) { 8312 result[u] = v; 8313 v = p[v]; 8314 } 8315 return result; 8316 } 8317 function locateNonHydratedAsyncRoot(instance) { 8318 const subComponent = instance.subTree.component; 8319 if (subComponent) { 8320 if (subComponent.asyncDep && !subComponent.asyncResolved) { 8321 return subComponent; 8322 } else { 8323 return locateNonHydratedAsyncRoot(subComponent); 8324 } 8325 } 8326 }
vendor: 6,003 bytes, lines 8327-8537
8327 function invalidateMount(hooks) { 8328 if (hooks) { 8329 for (let i = 0; i < hooks.length; i++) 8330 hooks[i].flags |= 8; 8331 } 8332 } 8333 8334 const ssrContextKey = Symbol.for("v-scx"); 8335 const useSSRContext = () => { 8336 { 8337 const ctx = inject(ssrContextKey); 8338 if (!ctx) { 8339 warn$1( 8340 `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.` 8341 ); 8342 } 8343 return ctx; 8344 } 8345 }; 8346 8347 function watchEffect(effect, options) { 8348 return doWatch(effect, null, options); 8349 } 8350 function watchPostEffect(effect, options) { 8351 return doWatch( 8352 effect, 8353 null, 8354 extend({}, options, { flush: "post" }) 8355 ); 8356 } 8357 function watchSyncEffect(effect, options) { 8358 return doWatch( 8359 effect, 8360 null, 8361 extend({}, options, { flush: "sync" }) 8362 ); 8363 } 8364 function watch(source, cb, options) { 8365 if (!isFunction(cb)) { 8366 warn$1( 8367 `\`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.` 8368 ); 8369 } 8370 return doWatch(source, cb, options); 8371 } 8372 function doWatch(source, cb, options = EMPTY_OBJ) { 8373 const { immediate, deep, flush, once } = options; 8374 if (!cb) { 8375 if (immediate !== void 0) { 8376 warn$1( 8377 `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.` 8378 ); 8379 } 8380 if (deep !== void 0) { 8381 warn$1( 8382 `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.` 8383 ); 8384 } 8385 if (once !== void 0) { 8386 warn$1( 8387 `watch() "once" option is only respected when using the watch(source, callback, options?) signature.` 8388 ); 8389 } 8390 } 8391 const baseWatchOptions = extend({}, options); 8392 baseWatchOptions.onWarn = warn$1; 8393 let ssrCleanup; 8394 if (isInSSRComponentSetup) { 8395 if (flush === "sync") { 8396 const ctx = useSSRContext(); 8397 ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []); 8398 } else if (!cb || immediate) { 8399 baseWatchOptions.once = true; 8400 } else { 8401 return { 8402 stop: NOOP, 8403 resume: NOOP, 8404 pause: NOOP 8405 }; 8406 } 8407 } 8408 const instance = currentInstance; 8409 baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args); 8410 let isPre = false; 8411 if (flush === "post") { 8412 baseWatchOptions.scheduler = (job) => { 8413 queuePostRenderEffect(job, instance && instance.suspense); 8414 }; 8415 } else if (flush !== "sync") { 8416 isPre = true; 8417 baseWatchOptions.scheduler = (job, isFirstRun) => { 8418 if (isFirstRun) { 8419 job(); 8420 } else { 8421 queueJob(job); 8422 } 8423 }; 8424 } 8425 baseWatchOptions.augmentJob = (job) => { 8426 if (cb) { 8427 job.flags |= 4; 8428 } 8429 if (isPre) { 8430 job.flags |= 2; 8431 if (instance) { 8432 job.id = instance.uid; 8433 job.i = instance; 8434 } 8435 } 8436 }; 8437 const watchHandle = watch$1(source, cb, baseWatchOptions); 8438 if (ssrCleanup) ssrCleanup.push(watchHandle); 8439 return watchHandle; 8440 } 8441 function instanceWatch(source, value, options) { 8442 const publicThis = this.proxy; 8443 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); 8444 let cb; 8445 if (isFunction(value)) { 8446 cb = value; 8447 } else { 8448 cb = value.handler; 8449 options = value; 8450 } 8451 const reset = setCurrentInstance(this); 8452 const res = doWatch(getter, cb.bind(publicThis), options); 8453 reset(); 8454 return res; 8455 } 8456 function createPathGetter(ctx, path) { 8457 const segments = path.split("."); 8458 return () => { 8459 let cur = ctx; 8460 for (let i = 0; i < segments.length && cur; i++) { 8461 cur = cur[segments[i]]; 8462 } 8463 return cur; 8464 }; 8465 } 8466 8467 function useModel(props, name, options = EMPTY_OBJ) { 8468 const i = getCurrentInstance(); 8469 if (!i) { 8470 warn$1(`useModel() called without active instance.`); 8471 return ref(); 8472 } 8473 if (!i.propsOptions[0][name]) { 8474 warn$1(`useModel() called with prop "${name}" which is not declared.`); 8475 return ref(); 8476 } 8477 const camelizedName = camelize(name); 8478 const hyphenatedName = hyphenate(name); 8479 const modifiers = getModelModifiers(props, name); 8480 const res = customRef((track, trigger) => { 8481 let localValue; 8482 let prevSetValue = EMPTY_OBJ; 8483 let prevEmittedValue; 8484 watchSyncEffect(() => { 8485 const propValue = props[name]; 8486 if (hasChanged(localValue, propValue)) { 8487 localValue = propValue; 8488 trigger(); 8489 } 8490 }); 8491 return { 8492 get() { 8493 track(); 8494 return options.get ? options.get(localValue) : localValue; 8495 }, 8496 set(value) { 8497 const emittedValue = options.set ? options.set(value) : value; 8498 if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) { 8499 return; 8500 } 8501 const rawProps = i.vnode.props; 8502 if (!(rawProps && // check if parent has passed v-model 8503 (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) { 8504 localValue = value; 8505 trigger(); 8506 } 8507 i.emit(`update:${name}`, emittedValue); 8508 if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) { 8509 trigger(); 8510 } 8511 prevSetValue = value; 8512 prevEmittedValue = emittedValue; 8513 } 8514 }; 8515 }); 8516 res[Symbol.iterator] = () => { 8517 let i2 = 0; 8518 return { 8519 next() { 8520 if (i2 < 2) { 8521 return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false }; 8522 } else { 8523 return { done: true }; 8524 } 8525 } 8526 }; 8527 }; 8528 return res; 8529 } 8530 const getModelModifiers = (props, modelName) => { 8531 return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`]; 8532 }; 8533 8534 function emit(instance, event, ...rawArgs) { 8535 if (instance.isUnmounted) return; 8536 const props = instance.vnode.props || EMPTY_OBJ; 8537 {
vendor: 19,328 bytes, lines 8538-9285
8538 const { 8539 emitsOptions, 8540 propsOptions: [propsOptions] 8541 } = instance; 8542 if (emitsOptions) { 8543 if (!(event in emitsOptions) && true) { 8544 if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) { 8545 warn$1( 8546 `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.` 8547 ); 8548 } 8549 } else { 8550 const validator = emitsOptions[event]; 8551 if (isFunction(validator)) { 8552 const isValid = validator(...rawArgs); 8553 if (!isValid) { 8554 warn$1( 8555 `Invalid event arguments: event validation failed for event "${event}".` 8556 ); 8557 } 8558 } 8559 } 8560 } 8561 } 8562 let args = rawArgs; 8563 const isModelListener = event.startsWith("update:"); 8564 const modifiers = isModelListener && getModelModifiers(props, event.slice(7)); 8565 if (modifiers) { 8566 if (modifiers.trim) { 8567 args = rawArgs.map((a) => isString(a) ? a.trim() : a); 8568 } 8569 if (modifiers.number) { 8570 args = rawArgs.map(looseToNumber); 8571 } 8572 } 8573 { 8574 devtoolsComponentEmit(instance, event, args); 8575 } 8576 { 8577 const lowerCaseEvent = event.toLowerCase(); 8578 if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) { 8579 warn$1( 8580 `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName( 8581 instance, 8582 instance.type 8583 )} 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( 8584 event 8585 )}" instead of "${event}".` 8586 ); 8587 } 8588 } 8589 let handlerName; 8590 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249) 8591 props[handlerName = toHandlerKey(camelize(event))]; 8592 if (!handler && isModelListener) { 8593 handler = props[handlerName = toHandlerKey(hyphenate(event))]; 8594 } 8595 if (handler) { 8596 callWithAsyncErrorHandling( 8597 handler, 8598 instance, 8599 6, 8600 args 8601 ); 8602 } 8603 const onceHandler = props[handlerName + `Once`]; 8604 if (onceHandler) { 8605 if (!instance.emitted) { 8606 instance.emitted = {}; 8607 } else if (instance.emitted[handlerName]) { 8608 return; 8609 } 8610 instance.emitted[handlerName] = true; 8611 callWithAsyncErrorHandling( 8612 onceHandler, 8613 instance, 8614 6, 8615 args 8616 ); 8617 } 8618 } 8619 function normalizeEmitsOptions(comp, appContext, asMixin = false) { 8620 const cache = appContext.emitsCache; 8621 const cached = cache.get(comp); 8622 if (cached !== void 0) { 8623 return cached; 8624 } 8625 const raw = comp.emits; 8626 let normalized = {}; 8627 let hasExtends = false; 8628 if (!isFunction(comp)) { 8629 const extendEmits = (raw2) => { 8630 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); 8631 if (normalizedFromExtend) { 8632 hasExtends = true; 8633 extend(normalized, normalizedFromExtend); 8634 } 8635 }; 8636 if (!asMixin && appContext.mixins.length) { 8637 appContext.mixins.forEach(extendEmits); 8638 } 8639 if (comp.extends) { 8640 extendEmits(comp.extends); 8641 } 8642 if (comp.mixins) { 8643 comp.mixins.forEach(extendEmits); 8644 } 8645 } 8646 if (!raw && !hasExtends) { 8647 if (isObject(comp)) { 8648 cache.set(comp, null); 8649 } 8650 return null; 8651 } 8652 if (isArray(raw)) { 8653 raw.forEach((key) => normalized[key] = null); 8654 } else { 8655 extend(normalized, raw); 8656 } 8657 if (isObject(comp)) { 8658 cache.set(comp, normalized); 8659 } 8660 return normalized; 8661 } 8662 function isEmitListener(options, key) { 8663 if (!options || !isOn(key)) { 8664 return false; 8665 } 8666 key = key.slice(2).replace(/Once$/, ""); 8667 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); 8668 } 8669 8670 let accessedAttrs = false; 8671 function markAttrsAccessed() { 8672 accessedAttrs = true; 8673 } 8674 function renderComponentRoot(instance) { 8675 const { 8676 type: Component, 8677 vnode, 8678 proxy, 8679 withProxy, 8680 propsOptions: [propsOptions], 8681 slots, 8682 attrs, 8683 emit, 8684 render, 8685 renderCache, 8686 props, 8687 data, 8688 setupState, 8689 ctx, 8690 inheritAttrs 8691 } = instance; 8692 const prev = setCurrentRenderingInstance(instance); 8693 let result; 8694 let fallthroughAttrs; 8695 { 8696 accessedAttrs = false; 8697 } 8698 try { 8699 if (vnode.shapeFlag & 4) { 8700 const proxyToUse = withProxy || proxy; 8701 const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, { 8702 get(target, key, receiver) { 8703 warn$1( 8704 `Property '${String( 8705 key 8706 )}' was accessed via 'this'. Avoid using 'this' in templates.` 8707 ); 8708 return Reflect.get(target, key, receiver); 8709 } 8710 }) : proxyToUse; 8711 result = normalizeVNode( 8712 render.call( 8713 thisProxy, 8714 proxyToUse, 8715 renderCache, 8716 shallowReadonly(props), 8717 setupState, 8718 data, 8719 ctx 8720 ) 8721 ); 8722 fallthroughAttrs = attrs; 8723 } else { 8724 const render2 = Component; 8725 if (attrs === props) { 8726 markAttrsAccessed(); 8727 } 8728 result = normalizeVNode( 8729 render2.length > 1 ? render2( 8730 shallowReadonly(props), 8731 { 8732 get attrs() { 8733 markAttrsAccessed(); 8734 return shallowReadonly(attrs); 8735 }, 8736 slots, 8737 emit 8738 } 8739 ) : render2( 8740 shallowReadonly(props), 8741 null 8742 ) 8743 ); 8744 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs); 8745 } 8746 } catch (err) { 8747 blockStack.length = 0; 8748 handleError(err, instance, 1); 8749 result = createVNode(Comment); 8750 } 8751 let root = result; 8752 let setRoot = void 0; 8753 if (result.patchFlag > 0 && result.patchFlag & 2048) { 8754 [root, setRoot] = getChildRoot(result); 8755 } 8756 if (fallthroughAttrs && inheritAttrs !== false) { 8757 const keys = Object.keys(fallthroughAttrs); 8758 const { shapeFlag } = root; 8759 if (keys.length) { 8760 if (shapeFlag & (1 | 6)) { 8761 if (propsOptions && keys.some(isModelListener)) { 8762 fallthroughAttrs = filterModelListeners( 8763 fallthroughAttrs, 8764 propsOptions 8765 ); 8766 } 8767 root = cloneVNode(root, fallthroughAttrs, false, true); 8768 } else if (!accessedAttrs && root.type !== Comment) { 8769 const allAttrs = Object.keys(attrs); 8770 const eventAttrs = []; 8771 const extraAttrs = []; 8772 for (let i = 0, l = allAttrs.length; i < l; i++) { 8773 const key = allAttrs[i]; 8774 if (isOn(key)) { 8775 if (!isModelListener(key)) { 8776 eventAttrs.push(key[2].toLowerCase() + key.slice(3)); 8777 } 8778 } else { 8779 extraAttrs.push(key); 8780 } 8781 } 8782 if (extraAttrs.length) { 8783 warn$1( 8784 `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.` 8785 ); 8786 } 8787 if (eventAttrs.length) { 8788 warn$1( 8789 `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.` 8790 ); 8791 } 8792 } 8793 } 8794 } 8795 if (vnode.dirs) { 8796 if (!isElementRoot(root)) { 8797 warn$1( 8798 `Runtime directive used on component with non-element root node. The directives will not function as intended.` 8799 ); 8800 } 8801 root = cloneVNode(root, null, false, true); 8802 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs; 8803 } 8804 if (vnode.transition) { 8805 if (!isElementRoot(root)) { 8806 warn$1( 8807 `Component inside <Transition> renders non-element root node that cannot be animated.` 8808 ); 8809 } 8810 setTransitionHooks(root, vnode.transition); 8811 } 8812 if (setRoot) { 8813 setRoot(root); 8814 } else { 8815 result = root; 8816 } 8817 setCurrentRenderingInstance(prev); 8818 return result; 8819 } 8820 const getChildRoot = (vnode) => { 8821 const rawChildren = vnode.children; 8822 const dynamicChildren = vnode.dynamicChildren; 8823 const childRoot = filterSingleRoot(rawChildren, false); 8824 if (!childRoot) { 8825 return [vnode, void 0]; 8826 } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) { 8827 return getChildRoot(childRoot); 8828 } 8829 const index = rawChildren.indexOf(childRoot); 8830 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1; 8831 const setRoot = (updatedRoot) => { 8832 rawChildren[index] = updatedRoot; 8833 if (dynamicChildren) { 8834 if (dynamicIndex > -1) { 8835 dynamicChildren[dynamicIndex] = updatedRoot; 8836 } else if (updatedRoot.patchFlag > 0) { 8837 vnode.dynamicChildren = [...dynamicChildren, updatedRoot]; 8838 } 8839 } 8840 }; 8841 return [normalizeVNode(childRoot), setRoot]; 8842 }; 8843 function filterSingleRoot(children, recurse = true) { 8844 let singleRoot; 8845 for (let i = 0; i < children.length; i++) { 8846 const child = children[i]; 8847 if (isVNode(child)) { 8848 if (child.type !== Comment || child.children === "v-if") { 8849 if (singleRoot) { 8850 return; 8851 } else { 8852 singleRoot = child; 8853 if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) { 8854 return filterSingleRoot(singleRoot.children); 8855 } 8856 } 8857 } 8858 } else { 8859 return; 8860 } 8861 } 8862 return singleRoot; 8863 } 8864 const getFunctionalFallthrough = (attrs) => { 8865 let res; 8866 for (const key in attrs) { 8867 if (key === "class" || key === "style" || isOn(key)) { 8868 (res || (res = {}))[key] = attrs[key]; 8869 } 8870 } 8871 return res; 8872 }; 8873 const filterModelListeners = (attrs, props) => { 8874 const res = {}; 8875 for (const key in attrs) { 8876 if (!isModelListener(key) || !(key.slice(9) in props)) { 8877 res[key] = attrs[key]; 8878 } 8879 } 8880 return res; 8881 }; 8882 const isElementRoot = (vnode) => { 8883 return vnode.shapeFlag & (6 | 1) || vnode.type === Comment; 8884 }; 8885 function shouldUpdateComponent(prevVNode, nextVNode, optimized) { 8886 const { props: prevProps, children: prevChildren, component } = prevVNode; 8887 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; 8888 const emits = component.emitsOptions; 8889 if ((prevChildren || nextChildren) && isHmrUpdating) { 8890 return true; 8891 } 8892 if (nextVNode.dirs || nextVNode.transition) { 8893 return true; 8894 } 8895 if (optimized && patchFlag >= 0) { 8896 if (patchFlag & 1024) { 8897 return true; 8898 } 8899 if (patchFlag & 16) { 8900 if (!prevProps) { 8901 return !!nextProps; 8902 } 8903 return hasPropsChanged(prevProps, nextProps, emits); 8904 } else if (patchFlag & 8) { 8905 const dynamicProps = nextVNode.dynamicProps; 8906 for (let i = 0; i < dynamicProps.length; i++) { 8907 const key = dynamicProps[i]; 8908 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) { 8909 return true; 8910 } 8911 } 8912 } 8913 } else { 8914 if (prevChildren || nextChildren) { 8915 if (!nextChildren || !nextChildren.$stable) { 8916 return true; 8917 } 8918 } 8919 if (prevProps === nextProps) { 8920 return false; 8921 } 8922 if (!prevProps) { 8923 return !!nextProps; 8924 } 8925 if (!nextProps) { 8926 return true; 8927 } 8928 return hasPropsChanged(prevProps, nextProps, emits); 8929 } 8930 return false; 8931 } 8932 function hasPropsChanged(prevProps, nextProps, emitsOptions) { 8933 const nextKeys = Object.keys(nextProps); 8934 if (nextKeys.length !== Object.keys(prevProps).length) { 8935 return true; 8936 } 8937 for (let i = 0; i < nextKeys.length; i++) { 8938 const key = nextKeys[i]; 8939 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { 8940 return true; 8941 } 8942 } 8943 return false; 8944 } 8945 function updateHOCHostEl({ vnode, parent }, el) { 8946 while (parent) { 8947 const root = parent.subTree; 8948 if (root.suspense && root.suspense.activeBranch === vnode) { 8949 root.el = vnode.el; 8950 } 8951 if (root === vnode) { 8952 (vnode = parent.vnode).el = el; 8953 parent = parent.parent; 8954 } else { 8955 break; 8956 } 8957 } 8958 } 8959 8960 const isSuspense = (type) => type.__isSuspense; 8961 let suspenseId = 0; 8962 const SuspenseImpl = { 8963 name: "Suspense", 8964 // In order to make Suspense tree-shakable, we need to avoid importing it 8965 // directly in the renderer. The renderer checks for the __isSuspense flag 8966 // on a vnode's type and calls the `process` method, passing in renderer 8967 // internals. 8968 __isSuspense: true, 8969 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 8970 if (n1 == null) { 8971 mountSuspense( 8972 n2, 8973 container, 8974 anchor, 8975 parentComponent, 8976 parentSuspense, 8977 namespace, 8978 slotScopeIds, 8979 optimized, 8980 rendererInternals 8981 ); 8982 } else { 8983 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) { 8984 n2.suspense = n1.suspense; 8985 n2.suspense.vnode = n2; 8986 n2.el = n1.el; 8987 return; 8988 } 8989 patchSuspense( 8990 n1, 8991 n2, 8992 container, 8993 anchor, 8994 parentComponent, 8995 namespace, 8996 slotScopeIds, 8997 optimized, 8998 rendererInternals 8999 ); 9000 } 9001 }, 9002 hydrate: hydrateSuspense, 9003 normalize: normalizeSuspenseChildren 9004 }; 9005 const Suspense = SuspenseImpl ; 9006 function triggerEvent(vnode, name) { 9007 const eventListener = vnode.props && vnode.props[name]; 9008 if (isFunction(eventListener)) { 9009 eventListener(); 9010 } 9011 } 9012 function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 9013 const { 9014 p: patch, 9015 o: { createElement } 9016 } = rendererInternals; 9017 const hiddenContainer = createElement("div"); 9018 const suspense = vnode.suspense = createSuspenseBoundary( 9019 vnode, 9020 parentSuspense, 9021 parentComponent, 9022 container, 9023 hiddenContainer, 9024 anchor, 9025 namespace, 9026 slotScopeIds, 9027 optimized, 9028 rendererInternals 9029 ); 9030 patch( 9031 null, 9032 suspense.pendingBranch = vnode.ssContent, 9033 hiddenContainer, 9034 null, 9035 parentComponent, 9036 suspense, 9037 namespace, 9038 slotScopeIds 9039 ); 9040 if (suspense.deps > 0) { 9041 triggerEvent(vnode, "onPending"); 9042 triggerEvent(vnode, "onFallback"); 9043 patch( 9044 null, 9045 vnode.ssFallback, 9046 container, 9047 anchor, 9048 parentComponent, 9049 null, 9050 // fallback tree will not have suspense context 9051 namespace, 9052 slotScopeIds 9053 ); 9054 setActiveBranch(suspense, vnode.ssFallback); 9055 } else { 9056 suspense.resolve(false, true); 9057 } 9058 } 9059 function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) { 9060 const suspense = n2.suspense = n1.suspense; 9061 suspense.vnode = n2; 9062 n2.el = n1.el; 9063 const newBranch = n2.ssContent; 9064 const newFallback = n2.ssFallback; 9065 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense; 9066 if (pendingBranch) { 9067 suspense.pendingBranch = newBranch; 9068 if (isSameVNodeType(newBranch, pendingBranch)) { 9069 patch( 9070 pendingBranch, 9071 newBranch, 9072 suspense.hiddenContainer, 9073 null, 9074 parentComponent, 9075 suspense, 9076 namespace, 9077 slotScopeIds, 9078 optimized 9079 ); 9080 if (suspense.deps <= 0) { 9081 suspense.resolve(); 9082 } else if (isInFallback) { 9083 if (!isHydrating) { 9084 patch( 9085 activeBranch, 9086 newFallback, 9087 container, 9088 anchor, 9089 parentComponent, 9090 null, 9091 // fallback tree will not have suspense context 9092 namespace, 9093 slotScopeIds, 9094 optimized 9095 ); 9096 setActiveBranch(suspense, newFallback); 9097 } 9098 } 9099 } else { 9100 suspense.pendingId = suspenseId++; 9101 if (isHydrating) { 9102 suspense.isHydrating = false; 9103 suspense.activeBranch = pendingBranch; 9104 } else { 9105 unmount(pendingBranch, parentComponent, suspense); 9106 } 9107 suspense.deps = 0; 9108 suspense.effects.length = 0; 9109 suspense.hiddenContainer = createElement("div"); 9110 if (isInFallback) { 9111 patch( 9112 null, 9113 newBranch, 9114 suspense.hiddenContainer, 9115 null, 9116 parentComponent, 9117 suspense, 9118 namespace, 9119 slotScopeIds, 9120 optimized 9121 ); 9122 if (suspense.deps <= 0) { 9123 suspense.resolve(); 9124 } else { 9125 patch( 9126 activeBranch, 9127 newFallback, 9128 container, 9129 anchor, 9130 parentComponent, 9131 null, 9132 // fallback tree will not have suspense context 9133 namespace, 9134 slotScopeIds, 9135 optimized 9136 ); 9137 setActiveBranch(suspense, newFallback); 9138 } 9139 } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { 9140 patch( 9141 activeBranch, 9142 newBranch, 9143 container, 9144 anchor, 9145 parentComponent, 9146 suspense, 9147 namespace, 9148 slotScopeIds, 9149 optimized 9150 ); 9151 suspense.resolve(true); 9152 } else { 9153 patch( 9154 null, 9155 newBranch, 9156 suspense.hiddenContainer, 9157 null, 9158 parentComponent, 9159 suspense, 9160 namespace, 9161 slotScopeIds, 9162 optimized 9163 ); 9164 if (suspense.deps <= 0) { 9165 suspense.resolve(); 9166 } 9167 } 9168 } 9169 } else { 9170 if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { 9171 patch( 9172 activeBranch, 9173 newBranch, 9174 container, 9175 anchor, 9176 parentComponent, 9177 suspense, 9178 namespace, 9179 slotScopeIds, 9180 optimized 9181 ); 9182 setActiveBranch(suspense, newBranch); 9183 } else { 9184 triggerEvent(n2, "onPending"); 9185 suspense.pendingBranch = newBranch; 9186 if (newBranch.shapeFlag & 512) { 9187 suspense.pendingId = newBranch.component.suspenseId; 9188 } else { 9189 suspense.pendingId = suspenseId++; 9190 } 9191 patch( 9192 null, 9193 newBranch, 9194 suspense.hiddenContainer, 9195 null, 9196 parentComponent, 9197 suspense, 9198 namespace, 9199 slotScopeIds, 9200 optimized 9201 ); 9202 if (suspense.deps <= 0) { 9203 suspense.resolve(); 9204 } else { 9205 const { timeout, pendingId } = suspense; 9206 if (timeout > 0) { 9207 setTimeout(() => { 9208 if (suspense.pendingId === pendingId) { 9209 suspense.fallback(newFallback); 9210 } 9211 }, timeout); 9212 } else if (timeout === 0) { 9213 suspense.fallback(newFallback); 9214 } 9215 } 9216 } 9217 } 9218 } 9219 let hasWarned = false; 9220 function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) { 9221 if (!hasWarned) { 9222 hasWarned = true; 9223 console[console.info ? "info" : "log"]( 9224 `<Suspense> is an experimental feature and its API will likely change.` 9225 ); 9226 } 9227 const { 9228 p: patch, 9229 m: move, 9230 um: unmount, 9231 n: next, 9232 o: { parentNode, remove } 9233 } = rendererInternals; 9234 let parentSuspenseId; 9235 const isSuspensible = isVNodeSuspensible(vnode); 9236 if (isSuspensible) { 9237 if (parentSuspense && parentSuspense.pendingBranch) { 9238 parentSuspenseId = parentSuspense.pendingId; 9239 parentSuspense.deps++; 9240 } 9241 } 9242 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; 9243 { 9244 assertNumber(timeout, `Suspense timeout`); 9245 } 9246 const initialAnchor = anchor; 9247 const suspense = { 9248 vnode, 9249 parent: parentSuspense, 9250 parentComponent, 9251 namespace, 9252 container, 9253 hiddenContainer, 9254 deps: 0, 9255 pendingId: suspenseId++, 9256 timeout: typeof timeout === "number" ? timeout : -1, 9257 activeBranch: null, 9258 pendingBranch: null, 9259 isInFallback: !isHydrating, 9260 isHydrating, 9261 isUnmounted: false, 9262 effects: [], 9263 resolve(resume = false, sync = false) { 9264 { 9265 if (!resume && !suspense.pendingBranch) { 9266 throw new Error( 9267 `suspense.resolve() is called without a pending branch.` 9268 ); 9269 } 9270 if (suspense.isUnmounted) { 9271 throw new Error( 9272 `suspense.resolve() is called on an already unmounted suspense boundary.` 9273 ); 9274 } 9275 } 9276 const { 9277 vnode: vnode2, 9278 activeBranch, 9279 pendingBranch, 9280 pendingId, 9281 effects, 9282 parentComponent: parentComponent2, 9283 container: container2 9284 } = suspense; 9285 let delayEnter = false;
9286 if (suspense.isHydrating) { 9287 suspense.isHydrating = false; 9288 } else if (!resume) { 9289 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in"; 9290 if (delayEnter) { 9291 activeBranch.transition.afterLeave = () => { 9292 if (pendingId === suspense.pendingId) { 9293 move( 9294 pendingBranch, 9295 container2, 9296 anchor === initialAnchor ? next(activeBranch) : anchor, 9297 0 9298 ); 9299 queuePostFlushCb(effects); 9300 } 9301 }; 9302 } 9303 if (activeBranch) { 9304 if (parentNode(activeBranch.el) === container2) { 9305 anchor = next(activeBranch); 9306 } 9307 unmount(activeBranch, parentComponent2, suspense, true); 9308 } 9309 if (!delayEnter) { 9310 move(pendingBranch, container2, anchor, 0); 9311 } 9312 } 9313 setActiveBranch(suspense, pendingBranch); 9314 suspense.pendingBranch = null; 9315 suspense.isInFallback = false; 9316 let parent = suspense.parent; 9317 let hasUnresolvedAncestor = false; 9318 while (parent) { 9319 if (parent.pendingBranch) { 9320 parent.effects.push(...effects); 9321 hasUnresolvedAncestor = true; 9322 break; 9323 } 9324 parent = parent.parent; 9325 } 9326 if (!hasUnresolvedAncestor && !delayEnter) { 9327 queuePostFlushCb(effects); 9328 } 9329 suspense.effects = []; 9330 if (isSuspensible) { 9331 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { 9332 parentSuspense.deps--; 9333 if (parentSuspense.deps === 0 && !sync) { 9334 parentSuspense.resolve(); 9335 } 9336 } 9337 } 9338 triggerEvent(vnode2, "onResolve"); 9339 }, 9340 fallback(fallbackVNode) { 9341 if (!suspense.pendingBranch) { 9342 return; 9343 } 9344 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense; 9345 triggerEvent(vnode2, "onFallback"); 9346 const anchor2 = next(activeBranch); 9347 const mountFallback = () => { 9348 if (!suspense.isInFallback) { 9349 return; 9350 } 9351 patch( 9352 null, 9353 fallbackVNode, 9354 container2, 9355 anchor2, 9356 parentComponent2, 9357 null, 9358 // fallback tree will not have suspense context 9359 namespace2, 9360 slotScopeIds, 9361 optimized 9362 ); 9363 setActiveBranch(suspense, fallbackVNode); 9364 }; 9365 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in"; 9366 if (delayEnter) { 9367 activeBranch.transition.afterLeave = mountFallback; 9368 } 9369 suspense.isInFallback = true; 9370 unmount( 9371 activeBranch, 9372 parentComponent2, 9373 null, 9374 // no suspense so unmount hooks fire now 9375 true 9376 // shouldRemove 9377 ); 9378 if (!delayEnter) { 9379 mountFallback(); 9380 } 9381 },
vendor: 12,094 bytes, lines 9382-9790
9382 move(container2, anchor2, type) { 9383 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type); 9384 suspense.container = container2; 9385 }, 9386 next() { 9387 return suspense.activeBranch && next(suspense.activeBranch); 9388 }, 9389 registerDep(instance, setupRenderEffect, optimized2) { 9390 const isInPendingSuspense = !!suspense.pendingBranch; 9391 if (isInPendingSuspense) { 9392 suspense.deps++; 9393 } 9394 const hydratedEl = instance.vnode.el; 9395 instance.asyncDep.catch((err) => { 9396 handleError(err, instance, 0); 9397 }).then((asyncSetupResult) => { 9398 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { 9399 return; 9400 } 9401 instance.asyncResolved = true; 9402 const { vnode: vnode2 } = instance; 9403 { 9404 pushWarningContext(vnode2); 9405 } 9406 handleSetupResult(instance, asyncSetupResult, false); 9407 if (hydratedEl) { 9408 vnode2.el = hydratedEl; 9409 } 9410 const placeholder = !hydratedEl && instance.subTree.el; 9411 setupRenderEffect( 9412 instance, 9413 vnode2, 9414 // component may have been moved before resolve. 9415 // if this is not a hydration, instance.subTree will be the comment 9416 // placeholder. 9417 parentNode(hydratedEl || instance.subTree.el), 9418 // anchor will not be used if this is hydration, so only need to 9419 // consider the comment placeholder case. 9420 hydratedEl ? null : next(instance.subTree), 9421 suspense, 9422 namespace, 9423 optimized2 9424 ); 9425 if (placeholder) { 9426 remove(placeholder); 9427 } 9428 updateHOCHostEl(instance, vnode2.el); 9429 { 9430 popWarningContext(); 9431 } 9432 if (isInPendingSuspense && --suspense.deps === 0) { 9433 suspense.resolve(); 9434 } 9435 }); 9436 }, 9437 unmount(parentSuspense2, doRemove) { 9438 suspense.isUnmounted = true; 9439 if (suspense.activeBranch) { 9440 unmount( 9441 suspense.activeBranch, 9442 parentComponent, 9443 parentSuspense2, 9444 doRemove 9445 ); 9446 } 9447 if (suspense.pendingBranch) { 9448 unmount( 9449 suspense.pendingBranch, 9450 parentComponent, 9451 parentSuspense2, 9452 doRemove 9453 ); 9454 } 9455 } 9456 }; 9457 return suspense; 9458 } 9459 function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) { 9460 const suspense = vnode.suspense = createSuspenseBoundary( 9461 vnode, 9462 parentSuspense, 9463 parentComponent, 9464 node.parentNode, 9465 // eslint-disable-next-line no-restricted-globals 9466 document.createElement("div"), 9467 null, 9468 namespace, 9469 slotScopeIds, 9470 optimized, 9471 rendererInternals, 9472 true 9473 ); 9474 const result = hydrateNode( 9475 node, 9476 suspense.pendingBranch = vnode.ssContent, 9477 parentComponent, 9478 suspense, 9479 slotScopeIds, 9480 optimized 9481 ); 9482 if (suspense.deps === 0) { 9483 suspense.resolve(false, true); 9484 } 9485 return result; 9486 } 9487 function normalizeSuspenseChildren(vnode) { 9488 const { shapeFlag, children } = vnode; 9489 const isSlotChildren = shapeFlag & 32; 9490 vnode.ssContent = normalizeSuspenseSlot( 9491 isSlotChildren ? children.default : children 9492 ); 9493 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); 9494 } 9495 function normalizeSuspenseSlot(s) { 9496 let block; 9497 if (isFunction(s)) { 9498 const trackBlock = isBlockTreeEnabled && s._c; 9499 if (trackBlock) { 9500 s._d = false; 9501 openBlock(); 9502 } 9503 s = s(); 9504 if (trackBlock) { 9505 s._d = true; 9506 block = currentBlock; 9507 closeBlock(); 9508 } 9509 } 9510 if (isArray(s)) { 9511 const singleChild = filterSingleRoot(s); 9512 if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) { 9513 warn$1(`<Suspense> slots expect a single root node.`); 9514 } 9515 s = singleChild; 9516 } 9517 s = normalizeVNode(s); 9518 if (block && !s.dynamicChildren) { 9519 s.dynamicChildren = block.filter((c) => c !== s); 9520 } 9521 return s; 9522 } 9523 function queueEffectWithSuspense(fn, suspense) { 9524 if (suspense && suspense.pendingBranch) { 9525 if (isArray(fn)) { 9526 suspense.effects.push(...fn); 9527 } else { 9528 suspense.effects.push(fn); 9529 } 9530 } else { 9531 queuePostFlushCb(fn); 9532 } 9533 } 9534 function setActiveBranch(suspense, branch) { 9535 suspense.activeBranch = branch; 9536 const { vnode, parentComponent } = suspense; 9537 let el = branch.el; 9538 while (!el && branch.component) { 9539 branch = branch.component.subTree; 9540 el = branch.el; 9541 } 9542 vnode.el = el; 9543 if (parentComponent && parentComponent.subTree === vnode) { 9544 parentComponent.vnode.el = el; 9545 updateHOCHostEl(parentComponent, el); 9546 } 9547 } 9548 function isVNodeSuspensible(vnode) { 9549 const suspensible = vnode.props && vnode.props.suspensible; 9550 return suspensible != null && suspensible !== false; 9551 } 9552 9553 const Fragment = Symbol.for("v-fgt"); 9554 const Text = Symbol.for("v-txt"); 9555 const Comment = Symbol.for("v-cmt"); 9556 const Static = Symbol.for("v-stc"); 9557 const blockStack = []; 9558 let currentBlock = null; 9559 function openBlock(disableTracking = false) { 9560 blockStack.push(currentBlock = disableTracking ? null : []); 9561 } 9562 function closeBlock() { 9563 blockStack.pop(); 9564 currentBlock = blockStack[blockStack.length - 1] || null; 9565 } 9566 let isBlockTreeEnabled = 1; 9567 function setBlockTracking(value) { 9568 isBlockTreeEnabled += value; 9569 if (value < 0 && currentBlock) { 9570 currentBlock.hasOnce = true; 9571 } 9572 } 9573 function setupBlock(vnode) { 9574 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null; 9575 closeBlock(); 9576 if (isBlockTreeEnabled > 0 && currentBlock) { 9577 currentBlock.push(vnode); 9578 } 9579 return vnode; 9580 } 9581 function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) { 9582 return setupBlock( 9583 createBaseVNode( 9584 type, 9585 props, 9586 children, 9587 patchFlag, 9588 dynamicProps, 9589 shapeFlag, 9590 true 9591 ) 9592 ); 9593 } 9594 function createBlock(type, props, children, patchFlag, dynamicProps) { 9595 return setupBlock( 9596 createVNode( 9597 type, 9598 props, 9599 children, 9600 patchFlag, 9601 dynamicProps, 9602 true 9603 ) 9604 ); 9605 } 9606 function isVNode(value) { 9607 return value ? value.__v_isVNode === true : false; 9608 } 9609 function isSameVNodeType(n1, n2) { 9610 if (n2.shapeFlag & 6 && n1.component) { 9611 const dirtyInstances = hmrDirtyComponents.get(n2.type); 9612 if (dirtyInstances && dirtyInstances.has(n1.component)) { 9613 n1.shapeFlag &= ~256; 9614 n2.shapeFlag &= ~512; 9615 return false; 9616 } 9617 } 9618 return n1.type === n2.type && n1.key === n2.key; 9619 } 9620 let vnodeArgsTransformer; 9621 function transformVNodeArgs(transformer) { 9622 vnodeArgsTransformer = transformer; 9623 } 9624 const createVNodeWithArgsTransform = (...args) => { 9625 return _createVNode( 9626 ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args 9627 ); 9628 }; 9629 const normalizeKey = ({ key }) => key != null ? key : null; 9630 const normalizeRef = ({ 9631 ref, 9632 ref_key, 9633 ref_for 9634 }) => { 9635 if (typeof ref === "number") { 9636 ref = "" + ref; 9637 } 9638 return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null; 9639 }; 9640 function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) { 9641 const vnode = { 9642 __v_isVNode: true, 9643 __v_skip: true, 9644 type, 9645 props, 9646 key: props && normalizeKey(props), 9647 ref: props && normalizeRef(props), 9648 scopeId: currentScopeId, 9649 slotScopeIds: null, 9650 children, 9651 component: null, 9652 suspense: null, 9653 ssContent: null, 9654 ssFallback: null, 9655 dirs: null, 9656 transition: null, 9657 el: null, 9658 anchor: null, 9659 target: null, 9660 targetStart: null, 9661 targetAnchor: null, 9662 staticCount: 0, 9663 shapeFlag, 9664 patchFlag, 9665 dynamicProps, 9666 dynamicChildren: null, 9667 appContext: null, 9668 ctx: currentRenderingInstance 9669 }; 9670 if (needFullChildrenNormalization) { 9671 normalizeChildren(vnode, children); 9672 if (shapeFlag & 128) { 9673 type.normalize(vnode); 9674 } 9675 } else if (children) { 9676 vnode.shapeFlag |= isString(children) ? 8 : 16; 9677 } 9678 if (vnode.key !== vnode.key) { 9679 warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type); 9680 } 9681 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself 9682 !isBlockNode && // has current parent block 9683 currentBlock && // presence of a patch flag indicates this node needs patching on updates. 9684 // component nodes also should always be patched, because even if the 9685 // component doesn't need to update, it needs to persist the instance on to 9686 // the next vnode so that it can be properly unmounted later. 9687 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the 9688 // vnode should not be considered dynamic due to handler caching. 9689 vnode.patchFlag !== 32) { 9690 currentBlock.push(vnode); 9691 } 9692 return vnode; 9693 } 9694 const createVNode = createVNodeWithArgsTransform ; 9695 function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) { 9696 if (!type || type === NULL_DYNAMIC_COMPONENT) { 9697 if (!type) { 9698 warn$1(`Invalid vnode type when creating vnode: ${type}.`); 9699 } 9700 type = Comment; 9701 } 9702 if (isVNode(type)) { 9703 const cloned = cloneVNode( 9704 type, 9705 props, 9706 true 9707 /* mergeRef: true */ 9708 ); 9709 if (children) { 9710 normalizeChildren(cloned, children); 9711 } 9712 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) { 9713 if (cloned.shapeFlag & 6) { 9714 currentBlock[currentBlock.indexOf(type)] = cloned; 9715 } else { 9716 currentBlock.push(cloned); 9717 } 9718 } 9719 cloned.patchFlag = -2; 9720 return cloned; 9721 } 9722 if (isClassComponent(type)) { 9723 type = type.__vccOpts; 9724 } 9725 if (props) { 9726 props = guardReactiveProps(props); 9727 let { class: klass, style } = props; 9728 if (klass && !isString(klass)) { 9729 props.class = normalizeClass(klass); 9730 } 9731 if (isObject(style)) { 9732 if (isProxy(style) && !isArray(style)) { 9733 style = extend({}, style); 9734 } 9735 props.style = normalizeStyle(style); 9736 } 9737 } 9738 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0; 9739 if (shapeFlag & 4 && isProxy(type)) { 9740 type = toRaw(type); 9741 warn$1( 9742 `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\`.`, 9743 ` 9744Component that was made reactive: `, 9745 type 9746 ); 9747 } 9748 return createBaseVNode( 9749 type, 9750 props, 9751 children, 9752 patchFlag, 9753 dynamicProps, 9754 shapeFlag, 9755 isBlockNode, 9756 true 9757 ); 9758 } 9759 function guardReactiveProps(props) { 9760 if (!props) return null; 9761 return isProxy(props) || isInternalObject(props) ? extend({}, props) : props; 9762 } 9763 function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) { 9764 const { props, ref, patchFlag, children, transition } = vnode; 9765 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props; 9766 const cloned = { 9767 __v_isVNode: true, 9768 __v_skip: true, 9769 type: vnode.type, 9770 props: mergedProps, 9771 key: mergedProps && normalizeKey(mergedProps), 9772 ref: extraProps && extraProps.ref ? ( 9773 // #2078 in the case of <component :is="vnode" ref="extra"/> 9774 // if the vnode itself already has a ref, cloneVNode will need to merge 9775 // the refs so the single vnode can be set on multiple refs 9776 mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) 9777 ) : ref, 9778 scopeId: vnode.scopeId, 9779 slotScopeIds: vnode.slotScopeIds, 9780 children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children, 9781 target: vnode.target, 9782 targetStart: vnode.targetStart, 9783 targetAnchor: vnode.targetAnchor, 9784 staticCount: vnode.staticCount, 9785 shapeFlag: vnode.shapeFlag, 9786 // if the vnode is cloned with extra props, we can no longer assume its 9787 // existing patch flag to be reliable and need to add the FULL_PROPS flag. 9788 // note: preserve flag for fragments since they use the flag for children 9789 // fast paths only. 9790 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16
vendor: 4,137 bytes, lines 9790-9931
9790: patchFlag | 16 : patchFlag, 9791 dynamicProps: vnode.dynamicProps, 9792 dynamicChildren: vnode.dynamicChildren, 9793 appContext: vnode.appContext, 9794 dirs: vnode.dirs, 9795 transition, 9796 // These should technically only be non-null on mounted VNodes. However, 9797 // they *should* be copied for kept-alive vnodes. So we just always copy 9798 // them since them being non-null during a mount doesn't affect the logic as 9799 // they will simply be overwritten. 9800 component: vnode.component, 9801 suspense: vnode.suspense, 9802 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent), 9803 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback), 9804 el: vnode.el, 9805 anchor: vnode.anchor, 9806 ctx: vnode.ctx, 9807 ce: vnode.ce 9808 }; 9809 if (transition && cloneTransition) { 9810 setTransitionHooks( 9811 cloned, 9812 transition.clone(cloned) 9813 ); 9814 } 9815 return cloned; 9816 } 9817 function deepCloneVNode(vnode) { 9818 const cloned = cloneVNode(vnode); 9819 if (isArray(vnode.children)) { 9820 cloned.children = vnode.children.map(deepCloneVNode); 9821 } 9822 return cloned; 9823 } 9824 function createTextVNode(text = " ", flag = 0) { 9825 return createVNode(Text, null, text, flag); 9826 } 9827 function createStaticVNode(content, numberOfNodes) { 9828 const vnode = createVNode(Static, null, content); 9829 vnode.staticCount = numberOfNodes; 9830 return vnode; 9831 } 9832 function createCommentVNode(text = "", asBlock = false) { 9833 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text); 9834 } 9835 function normalizeVNode(child) { 9836 if (child == null || typeof child === "boolean") { 9837 return createVNode(Comment); 9838 } else if (isArray(child)) { 9839 return createVNode( 9840 Fragment, 9841 null, 9842 // #3666, avoid reference pollution when reusing vnode 9843 child.slice() 9844 ); 9845 } else if (typeof child === "object") { 9846 return cloneIfMounted(child); 9847 } else { 9848 return createVNode(Text, null, String(child)); 9849 } 9850 } 9851 function cloneIfMounted(child) { 9852 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child); 9853 } 9854 function normalizeChildren(vnode, children) { 9855 let type = 0; 9856 const { shapeFlag } = vnode; 9857 if (children == null) { 9858 children = null; 9859 } else if (isArray(children)) { 9860 type = 16; 9861 } else if (typeof children === "object") { 9862 if (shapeFlag & (1 | 64)) { 9863 const slot = children.default; 9864 if (slot) { 9865 slot._c && (slot._d = false); 9866 normalizeChildren(vnode, slot()); 9867 slot._c && (slot._d = true); 9868 } 9869 return; 9870 } else { 9871 type = 32; 9872 const slotFlag = children._; 9873 if (!slotFlag && !isInternalObject(children)) { 9874 children._ctx = currentRenderingInstance; 9875 } else if (slotFlag === 3 && currentRenderingInstance) { 9876 if (currentRenderingInstance.slots._ === 1) { 9877 children._ = 1; 9878 } else { 9879 children._ = 2; 9880 vnode.patchFlag |= 1024; 9881 } 9882 } 9883 } 9884 } else if (isFunction(children)) { 9885 children = { default: children, _ctx: currentRenderingInstance }; 9886 type = 32; 9887 } else { 9888 children = String(children); 9889 if (shapeFlag & 64) { 9890 type = 16; 9891 children = [createTextVNode(children)]; 9892 } else { 9893 type = 8; 9894 } 9895 } 9896 vnode.children = children; 9897 vnode.shapeFlag |= type; 9898 } 9899 function mergeProps(...args) { 9900 const ret = {}; 9901 for (let i = 0; i < args.length; i++) { 9902 const toMerge = args[i]; 9903 for (const key in toMerge) { 9904 if (key === "class") { 9905 if (ret.class !== toMerge.class) { 9906 ret.class = normalizeClass([ret.class, toMerge.class]); 9907 } 9908 } else if (key === "style") { 9909 ret.style = normalizeStyle([ret.style, toMerge.style]); 9910 } else if (isOn(key)) { 9911 const existing = ret[key]; 9912 const incoming = toMerge[key]; 9913 if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) { 9914 ret[key] = existing ? [].concat(existing, incoming) : incoming; 9915 } 9916 } else if (key !== "") { 9917 ret[key] = toMerge[key]; 9918 } 9919 } 9920 } 9921 return ret; 9922 } 9923 function invokeVNodeHook(hook, instance, vnode, prevVNode = null) { 9924 callWithAsyncErrorHandling(hook, instance, 7, [ 9925 vnode, 9926 prevVNode 9927 ]); 9928 } 9929 9930 const emptyAppContext = createAppContext(); 9931 let uid = 0;
vendor: 5,442 bytes, lines 9932-10125
9932 function createComponentInstance(vnode, parent, suspense) { 9933 const type = vnode.type; 9934 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext; 9935 const instance = { 9936 uid: uid++, 9937 vnode, 9938 type, 9939 parent, 9940 appContext, 9941 root: null, 9942 // to be immediately set 9943 next: null, 9944 subTree: null, 9945 // will be set synchronously right after creation 9946 effect: null, 9947 update: null, 9948 // will be set synchronously right after creation 9949 job: null, 9950 scope: new EffectScope( 9951 true 9952 /* detached */ 9953 ), 9954 render: null, 9955 proxy: null, 9956 exposed: null, 9957 exposeProxy: null, 9958 withProxy: null, 9959 provides: parent ? parent.provides : Object.create(appContext.provides), 9960 ids: parent ? parent.ids : ["", 0, 0], 9961 accessCache: null, 9962 renderCache: [], 9963 // local resolved assets 9964 components: null, 9965 directives: null, 9966 // resolved props and emits options 9967 propsOptions: normalizePropsOptions(type, appContext), 9968 emitsOptions: normalizeEmitsOptions(type, appContext), 9969 // emit 9970 emit: null, 9971 // to be set immediately 9972 emitted: null, 9973 // props default value 9974 propsDefaults: EMPTY_OBJ, 9975 // inheritAttrs 9976 inheritAttrs: type.inheritAttrs, 9977 // state 9978 ctx: EMPTY_OBJ, 9979 data: EMPTY_OBJ, 9980 props: EMPTY_OBJ, 9981 attrs: EMPTY_OBJ, 9982 slots: EMPTY_OBJ, 9983 refs: EMPTY_OBJ, 9984 setupState: EMPTY_OBJ, 9985 setupContext: null, 9986 // suspense related 9987 suspense, 9988 suspenseId: suspense ? suspense.pendingId : 0, 9989 asyncDep: null, 9990 asyncResolved: false, 9991 // lifecycle hooks 9992 // not using enums here because it results in computed properties 9993 isMounted: false, 9994 isUnmounted: false, 9995 isDeactivated: false, 9996 bc: null, 9997 c: null, 9998 bm: null, 9999 m: null, 10000 bu: null, 10001 u: null, 10002 um: null, 10003 bum: null, 10004 da: null, 10005 a: null, 10006 rtg: null, 10007 rtc: null, 10008 ec: null, 10009 sp: null 10010 }; 10011 { 10012 instance.ctx = createDevRenderContext(instance); 10013 } 10014 instance.root = parent ? parent.root : instance; 10015 instance.emit = emit.bind(null, instance); 10016 if (vnode.ce) { 10017 vnode.ce(instance); 10018 } 10019 return instance; 10020 } 10021 let currentInstance = null; 10022 const getCurrentInstance = () => currentInstance || currentRenderingInstance; 10023 let internalSetCurrentInstance; 10024 let setInSSRSetupState; 10025 { 10026 const g = getGlobalThis(); 10027 const registerGlobalSetter = (key, setter) => { 10028 let setters; 10029 if (!(setters = g[key])) setters = g[key] = []; 10030 setters.push(setter); 10031 return (v) => { 10032 if (setters.length > 1) setters.forEach((set) => set(v)); 10033 else setters[0](v); 10034 }; 10035 }; 10036 internalSetCurrentInstance = registerGlobalSetter( 10037 `__VUE_INSTANCE_SETTERS__`, 10038 (v) => currentInstance = v 10039 ); 10040 setInSSRSetupState = registerGlobalSetter( 10041 `__VUE_SSR_SETTERS__`, 10042 (v) => isInSSRComponentSetup = v 10043 ); 10044 } 10045 const setCurrentInstance = (instance) => { 10046 const prev = currentInstance; 10047 internalSetCurrentInstance(instance); 10048 instance.scope.on(); 10049 return () => { 10050 instance.scope.off(); 10051 internalSetCurrentInstance(prev); 10052 }; 10053 }; 10054 const unsetCurrentInstance = () => { 10055 currentInstance && currentInstance.scope.off(); 10056 internalSetCurrentInstance(null); 10057 }; 10058 const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component"); 10059 function validateComponentName(name, { isNativeTag }) { 10060 if (isBuiltInTag(name) || isNativeTag(name)) { 10061 warn$1( 10062 "Do not use built-in or reserved HTML elements as component id: " + name 10063 ); 10064 } 10065 } 10066 function isStatefulComponent(instance) { 10067 return instance.vnode.shapeFlag & 4; 10068 } 10069 let isInSSRComponentSetup = false; 10070 function setupComponent(instance, isSSR = false, optimized = false) { 10071 isSSR && setInSSRSetupState(isSSR); 10072 const { props, children } = instance.vnode; 10073 const isStateful = isStatefulComponent(instance); 10074 initProps(instance, props, isStateful, isSSR); 10075 initSlots(instance, children, optimized); 10076 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; 10077 isSSR && setInSSRSetupState(false); 10078 return setupResult; 10079 } 10080 function setupStatefulComponent(instance, isSSR) { 10081 var _a; 10082 const Component = instance.type; 10083 { 10084 if (Component.name) { 10085 validateComponentName(Component.name, instance.appContext.config); 10086 } 10087 if (Component.components) { 10088 const names = Object.keys(Component.components); 10089 for (let i = 0; i < names.length; i++) { 10090 validateComponentName(names[i], instance.appContext.config); 10091 } 10092 } 10093 if (Component.directives) { 10094 const names = Object.keys(Component.directives); 10095 for (let i = 0; i < names.length; i++) { 10096 validateDirectiveName(names[i]); 10097 } 10098 } 10099 if (Component.compilerOptions && isRuntimeOnly()) { 10100 warn$1( 10101 `"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.` 10102 ); 10103 } 10104 } 10105 instance.accessCache = /* @__PURE__ */ Object.create(null); 10106 instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers); 10107 { 10108 exposePropsOnRenderContext(instance); 10109 } 10110 const { setup } = Component; 10111 if (setup) { 10112 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null; 10113 const reset = setCurrentInstance(instance); 10114 pauseTracking(); 10115 const setupResult = callWithErrorHandling( 10116 setup, 10117 instance, 10118 0, 10119 [ 10120 shallowReadonly(instance.props) , 10121 setupContext 10122 ] 10123 ); 10124 resetTracking(); 10125 reset();
vendor: 30,908 bytes, lines 10126-11248
10126 if (isPromise(setupResult)) { 10127 if (!isAsyncWrapper(instance)) markAsyncBoundary(instance); 10128 setupResult.then(unsetCurrentInstance, unsetCurrentInstance); 10129 if (isSSR) { 10130 return setupResult.then((resolvedResult) => { 10131 handleSetupResult(instance, resolvedResult, isSSR); 10132 }).catch((e) => { 10133 handleError(e, instance, 0); 10134 }); 10135 } else { 10136 instance.asyncDep = setupResult; 10137 if (!instance.suspense) { 10138 const name = (_a = Component.name) != null ? _a : "Anonymous"; 10139 warn$1( 10140 `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.` 10141 ); 10142 } 10143 } 10144 } else { 10145 handleSetupResult(instance, setupResult, isSSR); 10146 } 10147 } else { 10148 finishComponentSetup(instance, isSSR); 10149 } 10150 } 10151 function handleSetupResult(instance, setupResult, isSSR) { 10152 if (isFunction(setupResult)) { 10153 if (instance.type.__ssrInlineRender) { 10154 instance.ssrRender = setupResult; 10155 } else { 10156 instance.render = setupResult; 10157 } 10158 } else if (isObject(setupResult)) { 10159 if (isVNode(setupResult)) { 10160 warn$1( 10161 `setup() should not return VNodes directly - return a render function instead.` 10162 ); 10163 } 10164 { 10165 instance.devtoolsRawSetupState = setupResult; 10166 } 10167 instance.setupState = proxyRefs(setupResult); 10168 { 10169 exposeSetupStateOnRenderContext(instance); 10170 } 10171 } else if (setupResult !== void 0) { 10172 warn$1( 10173 `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}` 10174 ); 10175 } 10176 finishComponentSetup(instance, isSSR); 10177 } 10178 let compile$1; 10179 let installWithProxy; 10180 function registerRuntimeCompiler(_compile) { 10181 compile$1 = _compile; 10182 installWithProxy = (i) => { 10183 if (i.render._rc) { 10184 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers); 10185 } 10186 }; 10187 } 10188 const isRuntimeOnly = () => !compile$1; 10189 function finishComponentSetup(instance, isSSR, skipOptions) { 10190 const Component = instance.type; 10191 if (!instance.render) { 10192 if (!isSSR && compile$1 && !Component.render) { 10193 const template = Component.template || resolveMergedOptions(instance).template; 10194 if (template) { 10195 { 10196 startMeasure(instance, `compile`); 10197 } 10198 const { isCustomElement, compilerOptions } = instance.appContext.config; 10199 const { delimiters, compilerOptions: componentCompilerOptions } = Component; 10200 const finalCompilerOptions = extend( 10201 extend( 10202 { 10203 isCustomElement, 10204 delimiters 10205 }, 10206 compilerOptions 10207 ), 10208 componentCompilerOptions 10209 ); 10210 Component.render = compile$1(template, finalCompilerOptions); 10211 { 10212 endMeasure(instance, `compile`); 10213 } 10214 } 10215 } 10216 instance.render = Component.render || NOOP; 10217 if (installWithProxy) { 10218 installWithProxy(instance); 10219 } 10220 } 10221 { 10222 const reset = setCurrentInstance(instance); 10223 pauseTracking(); 10224 try { 10225 applyOptions(instance); 10226 } finally { 10227 resetTracking(); 10228 reset(); 10229 } 10230 } 10231 if (!Component.render && instance.render === NOOP && !isSSR) { 10232 if (!compile$1 && Component.template) { 10233 warn$1( 10234 `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` ) 10235 ); 10236 } else { 10237 warn$1(`Component is missing template or render function: `, Component); 10238 } 10239 } 10240 } 10241 const attrsProxyHandlers = { 10242 get(target, key) { 10243 markAttrsAccessed(); 10244 track(target, "get", ""); 10245 return target[key]; 10246 }, 10247 set() { 10248 warn$1(`setupContext.attrs is readonly.`); 10249 return false; 10250 }, 10251 deleteProperty() { 10252 warn$1(`setupContext.attrs is readonly.`); 10253 return false; 10254 } 10255 } ; 10256 function getSlotsProxy(instance) { 10257 return new Proxy(instance.slots, { 10258 get(target, key) { 10259 track(instance, "get", "$slots"); 10260 return target[key]; 10261 } 10262 }); 10263 } 10264 function createSetupContext(instance) { 10265 const expose = (exposed) => { 10266 { 10267 if (instance.exposed) { 10268 warn$1(`expose() should be called only once per setup().`); 10269 } 10270 if (exposed != null) { 10271 let exposedType = typeof exposed; 10272 if (exposedType === "object") { 10273 if (isArray(exposed)) { 10274 exposedType = "array"; 10275 } else if (isRef(exposed)) { 10276 exposedType = "ref"; 10277 } 10278 } 10279 if (exposedType !== "object") { 10280 warn$1( 10281 `expose() should be passed a plain object, received ${exposedType}.` 10282 ); 10283 } 10284 } 10285 } 10286 instance.exposed = exposed || {}; 10287 }; 10288 { 10289 let attrsProxy; 10290 let slotsProxy; 10291 return Object.freeze({ 10292 get attrs() { 10293 return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers)); 10294 }, 10295 get slots() { 10296 return slotsProxy || (slotsProxy = getSlotsProxy(instance)); 10297 }, 10298 get emit() { 10299 return (event, ...args) => instance.emit(event, ...args); 10300 }, 10301 expose 10302 }); 10303 } 10304 } 10305 function getComponentPublicInstance(instance) { 10306 if (instance.exposed) { 10307 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), { 10308 get(target, key) { 10309 if (key in target) { 10310 return target[key]; 10311 } else if (key in publicPropertiesMap) { 10312 return publicPropertiesMap[key](instance); 10313 } 10314 }, 10315 has(target, key) { 10316 return key in target || key in publicPropertiesMap; 10317 } 10318 })); 10319 } else { 10320 return instance.proxy; 10321 } 10322 } 10323 const classifyRE = /(?:^|[-_])(\w)/g; 10324 const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, ""); 10325 function getComponentName(Component, includeInferred = true) { 10326 return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; 10327 } 10328 function formatComponentName(instance, Component, isRoot = false) { 10329 let name = getComponentName(Component); 10330 if (!name && Component.__file) { 10331 const match = Component.__file.match(/([^/\\]+)\.\w+$/); 10332 if (match) { 10333 name = match[1]; 10334 } 10335 } 10336 if (!name && instance && instance.parent) { 10337 const inferFromRegistry = (registry) => { 10338 for (const key in registry) { 10339 if (registry[key] === Component) { 10340 return key; 10341 } 10342 } 10343 }; 10344 name = inferFromRegistry( 10345 instance.components || instance.parent.type.components 10346 ) || inferFromRegistry(instance.appContext.components); 10347 } 10348 return name ? classify(name) : isRoot ? `App` : `Anonymous`; 10349 } 10350 function isClassComponent(value) { 10351 return isFunction(value) && "__vccOpts" in value; 10352 } 10353 10354 const computed = (getterOrOptions, debugOptions) => { 10355 const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); 10356 { 10357 const i = getCurrentInstance(); 10358 if (i && i.appContext.config.warnRecursiveComputed) { 10359 c._warnRecursive = true; 10360 } 10361 } 10362 return c; 10363 }; 10364 10365 function h(type, propsOrChildren, children) { 10366 const l = arguments.length; 10367 if (l === 2) { 10368 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) { 10369 if (isVNode(propsOrChildren)) { 10370 return createVNode(type, null, [propsOrChildren]); 10371 } 10372 return createVNode(type, propsOrChildren); 10373 } else { 10374 return createVNode(type, null, propsOrChildren); 10375 } 10376 } else { 10377 if (l > 3) { 10378 children = Array.prototype.slice.call(arguments, 2); 10379 } else if (l === 3 && isVNode(children)) { 10380 children = [children]; 10381 } 10382 return createVNode(type, propsOrChildren, children); 10383 } 10384 } 10385 10386 function initCustomFormatter() { 10387 if (typeof window === "undefined") { 10388 return; 10389 } 10390 const vueStyle = { style: "color:#3ba776" }; 10391 const numberStyle = { style: "color:#1677ff" }; 10392 const stringStyle = { style: "color:#f5222d" }; 10393 const keywordStyle = { style: "color:#eb2f96" }; 10394 const formatter = { 10395 __vue_custom_formatter: true, 10396 header(obj) { 10397 if (!isObject(obj)) { 10398 return null; 10399 } 10400 if (obj.__isVue) { 10401 return ["div", vueStyle, `VueInstance`]; 10402 } else if (isRef(obj)) { 10403 return [ 10404 "div", 10405 {}, 10406 ["span", vueStyle, genRefFlag(obj)], 10407 "<", 10408 // avoid debugger accessing value affecting behavior 10409 formatValue("_value" in obj ? obj._value : obj), 10410 `>` 10411 ]; 10412 } else if (isReactive(obj)) { 10413 return [ 10414 "div", 10415 {}, 10416 ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"], 10417 "<", 10418 formatValue(obj), 10419 `>${isReadonly(obj) ? ` (readonly)` : ``}` 10420 ]; 10421 } else if (isReadonly(obj)) { 10422 return [ 10423 "div", 10424 {}, 10425 ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"], 10426 "<", 10427 formatValue(obj), 10428 ">" 10429 ]; 10430 } 10431 return null; 10432 }, 10433 hasBody(obj) { 10434 return obj && obj.__isVue; 10435 }, 10436 body(obj) { 10437 if (obj && obj.__isVue) { 10438 return [ 10439 "div", 10440 {}, 10441 ...formatInstance(obj.$) 10442 ]; 10443 } 10444 } 10445 }; 10446 function formatInstance(instance) { 10447 const blocks = []; 10448 if (instance.type.props && instance.props) { 10449 blocks.push(createInstanceBlock("props", toRaw(instance.props))); 10450 } 10451 if (instance.setupState !== EMPTY_OBJ) { 10452 blocks.push(createInstanceBlock("setup", instance.setupState)); 10453 } 10454 if (instance.data !== EMPTY_OBJ) { 10455 blocks.push(createInstanceBlock("data", toRaw(instance.data))); 10456 } 10457 const computed = extractKeys(instance, "computed"); 10458 if (computed) { 10459 blocks.push(createInstanceBlock("computed", computed)); 10460 } 10461 const injected = extractKeys(instance, "inject"); 10462 if (injected) { 10463 blocks.push(createInstanceBlock("injected", injected)); 10464 } 10465 blocks.push([ 10466 "div", 10467 {}, 10468 [ 10469 "span", 10470 { 10471 style: keywordStyle.style + ";opacity:0.66" 10472 }, 10473 "$ (internal): " 10474 ], 10475 ["object", { object: instance }] 10476 ]); 10477 return blocks; 10478 } 10479 function createInstanceBlock(type, target) { 10480 target = extend({}, target); 10481 if (!Object.keys(target).length) { 10482 return ["span", {}]; 10483 } 10484 return [ 10485 "div", 10486 { style: "line-height:1.25em;margin-bottom:0.6em" }, 10487 [ 10488 "div", 10489 { 10490 style: "color:#476582" 10491 }, 10492 type 10493 ], 10494 [ 10495 "div", 10496 { 10497 style: "padding-left:1.25em" 10498 }, 10499 ...Object.keys(target).map((key) => { 10500 return [ 10501 "div", 10502 {}, 10503 ["span", keywordStyle, key + ": "], 10504 formatValue(target[key], false) 10505 ]; 10506 }) 10507 ] 10508 ]; 10509 } 10510 function formatValue(v, asRaw = true) { 10511 if (typeof v === "number") { 10512 return ["span", numberStyle, v]; 10513 } else if (typeof v === "string") { 10514 return ["span", stringStyle, JSON.stringify(v)]; 10515 } else if (typeof v === "boolean") { 10516 return ["span", keywordStyle, v]; 10517 } else if (isObject(v)) { 10518 return ["object", { object: asRaw ? toRaw(v) : v }]; 10519 } else { 10520 return ["span", stringStyle, String(v)]; 10521 } 10522 } 10523 function extractKeys(instance, type) { 10524 const Comp = instance.type; 10525 if (isFunction(Comp)) { 10526 return; 10527 } 10528 const extracted = {}; 10529 for (const key in instance.ctx) { 10530 if (isKeyOfType(Comp, key, type)) { 10531 extracted[key] = instance.ctx[key]; 10532 } 10533 } 10534 return extracted; 10535 } 10536 function isKeyOfType(Comp, key, type) { 10537 const opts = Comp[type]; 10538 if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) { 10539 return true; 10540 } 10541 if (Comp.extends && isKeyOfType(Comp.extends, key, type)) { 10542 return true; 10543 } 10544 if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) { 10545 return true; 10546 } 10547 } 10548 function genRefFlag(v) { 10549 if (isShallow(v)) { 10550 return `ShallowRef`; 10551 } 10552 if (v.effect) { 10553 return `ComputedRef`; 10554 } 10555 return `Ref`; 10556 } 10557 if (window.devtoolsFormatters) { 10558 window.devtoolsFormatters.push(formatter); 10559 } else { 10560 window.devtoolsFormatters = [formatter]; 10561 } 10562 } 10563 10564 function withMemo(memo, render, cache, index) { 10565 const cached = cache[index]; 10566 if (cached && isMemoSame(cached, memo)) { 10567 return cached; 10568 } 10569 const ret = render(); 10570 ret.memo = memo.slice(); 10571 ret.cacheIndex = index; 10572 return cache[index] = ret; 10573 } 10574 function isMemoSame(cached, memo) { 10575 const prev = cached.memo; 10576 if (prev.length != memo.length) { 10577 return false; 10578 } 10579 for (let i = 0; i < prev.length; i++) { 10580 if (hasChanged(prev[i], memo[i])) { 10581 return false; 10582 } 10583 } 10584 if (isBlockTreeEnabled > 0 && currentBlock) { 10585 currentBlock.push(cached); 10586 } 10587 return true; 10588 } 10589 10590 const version = "3.5.4"; 10591 const warn = warn$1 ; 10592 const ErrorTypeStrings = ErrorTypeStrings$1 ; 10593 const devtools = devtools$1 ; 10594 const setDevtoolsHook = setDevtoolsHook$1 ; 10595 const _ssrUtils = { 10596 createComponentInstance, 10597 setupComponent, 10598 renderComponentRoot, 10599 setCurrentRenderingInstance, 10600 isVNode: isVNode, 10601 normalizeVNode, 10602 getComponentPublicInstance, 10603 ensureValidVNode, 10604 pushWarningContext, 10605 popWarningContext 10606 }; 10607 const ssrUtils = _ssrUtils ; 10608 const resolveFilter = null; 10609 const compatUtils = null; 10610 const DeprecationTypes = null; 10611 10612 let policy = void 0; 10613 const tt = typeof window !== "undefined" && window.trustedTypes; 10614 if (tt) { 10615 try { 10616 policy = /* @__PURE__ */ tt.createPolicy("vue", { 10617 createHTML: (val) => val 10618 }); 10619 } catch (e) { 10620 warn(`Error creating trusted types policy: ${e}`); 10621 } 10622 } 10623 const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val; 10624 const svgNS = "http://www.w3.org/2000/svg"; 10625 const mathmlNS = "http://www.w3.org/1998/Math/MathML"; 10626 const doc = typeof document !== "undefined" ? document : null; 10627 const templateContainer = doc && /* @__PURE__ */ doc.createElement("template"); 10628 const nodeOps = { 10629 insert: (child, parent, anchor) => { 10630 parent.insertBefore(child, anchor || null); 10631 }, 10632 remove: (child) => { 10633 const parent = child.parentNode; 10634 if (parent) { 10635 parent.removeChild(child); 10636 } 10637 }, 10638 createElement: (tag, namespace, is, props) => { 10639 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag); 10640 if (tag === "select" && props && props.multiple != null) { 10641 el.setAttribute("multiple", props.multiple); 10642 } 10643 return el; 10644 }, 10645 createText: (text) => doc.createTextNode(text), 10646 createComment: (text) => doc.createComment(text), 10647 setText: (node, text) => { 10648 node.nodeValue = text; 10649 }, 10650 setElementText: (el, text) => { 10651 el.textContent = text; 10652 }, 10653 parentNode: (node) => node.parentNode, 10654 nextSibling: (node) => node.nextSibling, 10655 querySelector: (selector) => doc.querySelector(selector), 10656 setScopeId(el, id) { 10657 el.setAttribute(id, ""); 10658 }, 10659 // __UNSAFE__ 10660 // Reason: innerHTML. 10661 // Static content here can only come from compiled templates. 10662 // As long as the user only uses trusted templates, this is safe. 10663 insertStaticContent(content, parent, anchor, namespace, start, end) { 10664 const before = anchor ? anchor.previousSibling : parent.lastChild; 10665 if (start && (start === end || start.nextSibling)) { 10666 while (true) { 10667 parent.insertBefore(start.cloneNode(true), anchor); 10668 if (start === end || !(start = start.nextSibling)) break; 10669 } 10670 } else { 10671 templateContainer.innerHTML = unsafeToTrustedHTML( 10672 namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content 10673 ); 10674 const template = templateContainer.content; 10675 if (namespace === "svg" || namespace === "mathml") { 10676 const wrapper = template.firstChild; 10677 while (wrapper.firstChild) { 10678 template.appendChild(wrapper.firstChild); 10679 } 10680 template.removeChild(wrapper); 10681 } 10682 parent.insertBefore(template, anchor); 10683 } 10684 return [ 10685 // first 10686 before ? before.nextSibling : parent.firstChild, 10687 // last 10688 anchor ? anchor.previousSibling : parent.lastChild 10689 ]; 10690 } 10691 }; 10692 10693 const TRANSITION$1 = "transition"; 10694 const ANIMATION = "animation"; 10695 const vtcKey = Symbol("_vtc"); 10696 const DOMTransitionPropsValidators = { 10697 name: String, 10698 type: String, 10699 css: { 10700 type: Boolean, 10701 default: true 10702 }, 10703 duration: [String, Number, Object], 10704 enterFromClass: String, 10705 enterActiveClass: String, 10706 enterToClass: String, 10707 appearFromClass: String, 10708 appearActiveClass: String, 10709 appearToClass: String, 10710 leaveFromClass: String, 10711 leaveActiveClass: String, 10712 leaveToClass: String 10713 }; 10714 const TransitionPropsValidators = /* @__PURE__ */ extend( 10715 {}, 10716 BaseTransitionPropsValidators, 10717 DOMTransitionPropsValidators 10718 ); 10719 const decorate$1 = (t) => { 10720 t.displayName = "Transition"; 10721 t.props = TransitionPropsValidators; 10722 return t; 10723 }; 10724 const Transition = /* @__PURE__ */ decorate$1( 10725 (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots) 10726 ); 10727 const callHook = (hook, args = []) => { 10728 if (isArray(hook)) { 10729 hook.forEach((h2) => h2(...args)); 10730 } else if (hook) { 10731 hook(...args); 10732 } 10733 }; 10734 const hasExplicitCallback = (hook) => { 10735 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; 10736 }; 10737 function resolveTransitionProps(rawProps) { 10738 const baseProps = {}; 10739 for (const key in rawProps) { 10740 if (!(key in DOMTransitionPropsValidators)) { 10741 baseProps[key] = rawProps[key]; 10742 } 10743 } 10744 if (rawProps.css === false) { 10745 return baseProps; 10746 } 10747 const { 10748 name = "v", 10749 type, 10750 duration, 10751 enterFromClass = `${name}-enter-from`, 10752 enterActiveClass = `${name}-enter-active`, 10753 enterToClass = `${name}-enter-to`, 10754 appearFromClass = enterFromClass, 10755 appearActiveClass = enterActiveClass, 10756 appearToClass = enterToClass, 10757 leaveFromClass = `${name}-leave-from`, 10758 leaveActiveClass = `${name}-leave-active`, 10759 leaveToClass = `${name}-leave-to` 10760 } = rawProps; 10761 const durations = normalizeDuration(duration); 10762 const enterDuration = durations && durations[0]; 10763 const leaveDuration = durations && durations[1]; 10764 const { 10765 onBeforeEnter, 10766 onEnter, 10767 onEnterCancelled, 10768 onLeave, 10769 onLeaveCancelled, 10770 onBeforeAppear = onBeforeEnter, 10771 onAppear = onEnter, 10772 onAppearCancelled = onEnterCancelled 10773 } = baseProps; 10774 const finishEnter = (el, isAppear, done) => { 10775 removeTransitionClass(el, isAppear ? appearToClass : enterToClass); 10776 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass); 10777 done && done(); 10778 }; 10779 const finishLeave = (el, done) => { 10780 el._isLeaving = false; 10781 removeTransitionClass(el, leaveFromClass); 10782 removeTransitionClass(el, leaveToClass); 10783 removeTransitionClass(el, leaveActiveClass); 10784 done && done(); 10785 }; 10786 const makeEnterHook = (isAppear) => { 10787 return (el, done) => { 10788 const hook = isAppear ? onAppear : onEnter; 10789 const resolve = () => finishEnter(el, isAppear, done); 10790 callHook(hook, [el, resolve]); 10791 nextFrame(() => { 10792 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass); 10793 addTransitionClass(el, isAppear ? appearToClass : enterToClass); 10794 if (!hasExplicitCallback(hook)) { 10795 whenTransitionEnds(el, type, enterDuration, resolve); 10796 } 10797 }); 10798 }; 10799 }; 10800 return extend(baseProps, { 10801 onBeforeEnter(el) { 10802 callHook(onBeforeEnter, [el]); 10803 addTransitionClass(el, enterFromClass); 10804 addTransitionClass(el, enterActiveClass); 10805 }, 10806 onBeforeAppear(el) { 10807 callHook(onBeforeAppear, [el]); 10808 addTransitionClass(el, appearFromClass); 10809 addTransitionClass(el, appearActiveClass); 10810 }, 10811 onEnter: makeEnterHook(false), 10812 onAppear: makeEnterHook(true), 10813 onLeave(el, done) { 10814 el._isLeaving = true; 10815 const resolve = () => finishLeave(el, done); 10816 addTransitionClass(el, leaveFromClass); 10817 addTransitionClass(el, leaveActiveClass); 10818 forceReflow(); 10819 nextFrame(() => { 10820 if (!el._isLeaving) { 10821 return; 10822 } 10823 removeTransitionClass(el, leaveFromClass); 10824 addTransitionClass(el, leaveToClass); 10825 if (!hasExplicitCallback(onLeave)) { 10826 whenTransitionEnds(el, type, leaveDuration, resolve); 10827 } 10828 }); 10829 callHook(onLeave, [el, resolve]); 10830 }, 10831 onEnterCancelled(el) { 10832 finishEnter(el, false); 10833 callHook(onEnterCancelled, [el]); 10834 }, 10835 onAppearCancelled(el) { 10836 finishEnter(el, true); 10837 callHook(onAppearCancelled, [el]); 10838 }, 10839 onLeaveCancelled(el) { 10840 finishLeave(el); 10841 callHook(onLeaveCancelled, [el]); 10842 } 10843 }); 10844 } 10845 function normalizeDuration(duration) { 10846 if (duration == null) { 10847 return null; 10848 } else if (isObject(duration)) { 10849 return [NumberOf(duration.enter), NumberOf(duration.leave)]; 10850 } else { 10851 const n = NumberOf(duration); 10852 return [n, n]; 10853 } 10854 } 10855 function NumberOf(val) { 10856 const res = toNumber(val); 10857 { 10858 assertNumber(res, "<transition> explicit duration"); 10859 } 10860 return res; 10861 } 10862 function addTransitionClass(el, cls) { 10863 cls.split(/\s+/).forEach((c) => c && el.classList.add(c)); 10864 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls); 10865 } 10866 function removeTransitionClass(el, cls) { 10867 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c)); 10868 const _vtc = el[vtcKey]; 10869 if (_vtc) { 10870 _vtc.delete(cls); 10871 if (!_vtc.size) { 10872 el[vtcKey] = void 0; 10873 } 10874 } 10875 } 10876 function nextFrame(cb) { 10877 requestAnimationFrame(() => { 10878 requestAnimationFrame(cb); 10879 }); 10880 } 10881 let endId = 0; 10882 function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) { 10883 const id = el._endId = ++endId; 10884 const resolveIfNotStale = () => { 10885 if (id === el._endId) { 10886 resolve(); 10887 } 10888 }; 10889 if (explicitTimeout) { 10890 return setTimeout(resolveIfNotStale, explicitTimeout); 10891 } 10892 const { type, timeout, propCount } = getTransitionInfo(el, expectedType); 10893 if (!type) { 10894 return resolve(); 10895 } 10896 const endEvent = type + "end"; 10897 let ended = 0; 10898 const end = () => { 10899 el.removeEventListener(endEvent, onEnd); 10900 resolveIfNotStale(); 10901 }; 10902 const onEnd = (e) => { 10903 if (e.target === el && ++ended >= propCount) { 10904 end(); 10905 } 10906 }; 10907 setTimeout(() => { 10908 if (ended < propCount) { 10909 end(); 10910 } 10911 }, timeout + 1); 10912 el.addEventListener(endEvent, onEnd); 10913 } 10914 function getTransitionInfo(el, expectedType) { 10915 const styles = window.getComputedStyle(el); 10916 const getStyleProperties = (key) => (styles[key] || "").split(", "); 10917 const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`); 10918 const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`); 10919 const transitionTimeout = getTimeout(transitionDelays, transitionDurations); 10920 const animationDelays = getStyleProperties(`${ANIMATION}Delay`); 10921 const animationDurations = getStyleProperties(`${ANIMATION}Duration`); 10922 const animationTimeout = getTimeout(animationDelays, animationDurations); 10923 let type = null; 10924 let timeout = 0; 10925 let propCount = 0; 10926 if (expectedType === TRANSITION$1) { 10927 if (transitionTimeout > 0) { 10928 type = TRANSITION$1; 10929 timeout = transitionTimeout; 10930 propCount = transitionDurations.length; 10931 } 10932 } else if (expectedType === ANIMATION) { 10933 if (animationTimeout > 0) { 10934 type = ANIMATION; 10935 timeout = animationTimeout; 10936 propCount = animationDurations.length; 10937 } 10938 } else { 10939 timeout = Math.max(transitionTimeout, animationTimeout); 10940 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null; 10941 propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0; 10942 } 10943 const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test( 10944 getStyleProperties(`${TRANSITION$1}Property`).toString() 10945 ); 10946 return { 10947 type, 10948 timeout, 10949 propCount, 10950 hasTransform 10951 }; 10952 } 10953 function getTimeout(delays, durations) { 10954 while (delays.length < durations.length) { 10955 delays = delays.concat(delays); 10956 } 10957 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i]))); 10958 } 10959 function toMs(s) { 10960 if (s === "auto") return 0; 10961 return Number(s.slice(0, -1).replace(",", ".")) * 1e3; 10962 } 10963 function forceReflow() { 10964 return document.body.offsetHeight; 10965 } 10966 10967 function patchClass(el, value, isSVG) { 10968 const transitionClasses = el[vtcKey]; 10969 if (transitionClasses) { 10970 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" "); 10971 } 10972 if (value == null) { 10973 el.removeAttribute("class"); 10974 } else if (isSVG) { 10975 el.setAttribute("class", value); 10976 } else { 10977 el.className = value; 10978 } 10979 } 10980 10981 const vShowOriginalDisplay = Symbol("_vod"); 10982 const vShowHidden = Symbol("_vsh"); 10983 const vShow = { 10984 beforeMount(el, { value }, { transition }) { 10985 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display; 10986 if (transition && value) { 10987 transition.beforeEnter(el); 10988 } else { 10989 setDisplay(el, value); 10990 } 10991 }, 10992 mounted(el, { value }, { transition }) { 10993 if (transition && value) { 10994 transition.enter(el); 10995 } 10996 }, 10997 updated(el, { value, oldValue }, { transition }) { 10998 if (!value === !oldValue) return; 10999 if (transition) { 11000 if (value) { 11001 transition.beforeEnter(el); 11002 setDisplay(el, true); 11003 transition.enter(el); 11004 } else { 11005 transition.leave(el, () => { 11006 setDisplay(el, false); 11007 }); 11008 } 11009 } else { 11010 setDisplay(el, value); 11011 } 11012 }, 11013 beforeUnmount(el, { value }) { 11014 setDisplay(el, value); 11015 } 11016 }; 11017 { 11018 vShow.name = "show"; 11019 } 11020 function setDisplay(el, value) { 11021 el.style.display = value ? el[vShowOriginalDisplay] : "none"; 11022 el[vShowHidden] = !value; 11023 } 11024 function initVShowForSSR() { 11025 vShow.getSSRProps = ({ value }) => { 11026 if (!value) { 11027 return { style: { display: "none" } }; 11028 } 11029 }; 11030 } 11031 11032 const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" ); 11033 function useCssVars(getter) { 11034 const instance = getCurrentInstance(); 11035 if (!instance) { 11036 warn(`useCssVars is called without current active component instance.`); 11037 return; 11038 } 11039 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => { 11040 Array.from( 11041 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`) 11042 ).forEach((node) => setVarsOnNode(node, vars)); 11043 }; 11044 { 11045 instance.getCssVars = () => getter(instance.proxy); 11046 } 11047 const setVars = () => { 11048 const vars = getter(instance.proxy); 11049 if (instance.ce) { 11050 setVarsOnNode(instance.ce, vars); 11051 } else { 11052 setVarsOnVNode(instance.subTree, vars); 11053 } 11054 updateTeleports(vars); 11055 }; 11056 onBeforeMount(() => { 11057 watchPostEffect(setVars); 11058 }); 11059 onMounted(() => { 11060 const ob = new MutationObserver(setVars); 11061 ob.observe(instance.subTree.el.parentNode, { childList: true }); 11062 onUnmounted(() => ob.disconnect()); 11063 }); 11064 } 11065 function setVarsOnVNode(vnode, vars) { 11066 if (vnode.shapeFlag & 128) { 11067 const suspense = vnode.suspense; 11068 vnode = suspense.activeBranch; 11069 if (suspense.pendingBranch && !suspense.isHydrating) { 11070 suspense.effects.push(() => { 11071 setVarsOnVNode(suspense.activeBranch, vars); 11072 }); 11073 } 11074 } 11075 while (vnode.component) { 11076 vnode = vnode.component.subTree; 11077 } 11078 if (vnode.shapeFlag & 1 && vnode.el) { 11079 setVarsOnNode(vnode.el, vars); 11080 } else if (vnode.type === Fragment) { 11081 vnode.children.forEach((c) => setVarsOnVNode(c, vars)); 11082 } else if (vnode.type === Static) { 11083 let { el, anchor } = vnode; 11084 while (el) { 11085 setVarsOnNode(el, vars); 11086 if (el === anchor) break; 11087 el = el.nextSibling; 11088 } 11089 } 11090 } 11091 function setVarsOnNode(el, vars) { 11092 if (el.nodeType === 1) { 11093 const style = el.style; 11094 let cssText = ""; 11095 for (const key in vars) { 11096 style.setProperty(`--${key}`, vars[key]); 11097 cssText += `--${key}: ${vars[key]};`; 11098 } 11099 style[CSS_VAR_TEXT] = cssText; 11100 } 11101 } 11102 11103 const displayRE = /(^|;)\s*display\s*:/; 11104 function patchStyle(el, prev, next) { 11105 const style = el.style; 11106 const isCssString = isString(next); 11107 let hasControlledDisplay = false; 11108 if (next && !isCssString) { 11109 if (prev) { 11110 if (!isString(prev)) { 11111 for (const key in prev) { 11112 if (next[key] == null) { 11113 setStyle(style, key, ""); 11114 } 11115 } 11116 } else { 11117 for (const prevStyle of prev.split(";")) { 11118 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim(); 11119 if (next[key] == null) { 11120 setStyle(style, key, ""); 11121 } 11122 } 11123 } 11124 } 11125 for (const key in next) { 11126 if (key === "display") { 11127 hasControlledDisplay = true; 11128 } 11129 setStyle(style, key, next[key]); 11130 } 11131 } else { 11132 if (isCssString) { 11133 if (prev !== next) { 11134 const cssVarText = style[CSS_VAR_TEXT]; 11135 if (cssVarText) { 11136 next += ";" + cssVarText; 11137 } 11138 style.cssText = next; 11139 hasControlledDisplay = displayRE.test(next); 11140 } 11141 } else if (prev) { 11142 el.removeAttribute("style"); 11143 } 11144 } 11145 if (vShowOriginalDisplay in el) { 11146 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : ""; 11147 if (el[vShowHidden]) { 11148 style.display = "none"; 11149 } 11150 } 11151 } 11152 const semicolonRE = /[^\\];\s*$/; 11153 const importantRE = /\s*!important$/; 11154 function setStyle(style, name, val) { 11155 if (isArray(val)) { 11156 val.forEach((v) => setStyle(style, name, v)); 11157 } else { 11158 if (val == null) val = ""; 11159 { 11160 if (semicolonRE.test(val)) { 11161 warn( 11162 `Unexpected semicolon at the end of '${name}' style value: '${val}'` 11163 ); 11164 } 11165 } 11166 if (name.startsWith("--")) { 11167 style.setProperty(name, val); 11168 } else { 11169 const prefixed = autoPrefix(style, name); 11170 if (importantRE.test(val)) { 11171 style.setProperty( 11172 hyphenate(prefixed), 11173 val.replace(importantRE, ""), 11174 "important" 11175 ); 11176 } else { 11177 style[prefixed] = val; 11178 } 11179 } 11180 } 11181 } 11182 const prefixes = ["Webkit", "Moz", "ms"]; 11183 const prefixCache = {}; 11184 function autoPrefix(style, rawName) { 11185 const cached = prefixCache[rawName]; 11186 if (cached) { 11187 return cached; 11188 } 11189 let name = camelize(rawName); 11190 if (name !== "filter" && name in style) { 11191 return prefixCache[rawName] = name; 11192 } 11193 name = capitalize(name); 11194 for (let i = 0; i < prefixes.length; i++) { 11195 const prefixed = prefixes[i] + name; 11196 if (prefixed in style) { 11197 return prefixCache[rawName] = prefixed; 11198 } 11199 } 11200 return rawName; 11201 } 11202 11203 const xlinkNS = "http://www.w3.org/1999/xlink"; 11204 function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) { 11205 if (isSVG && key.startsWith("xlink:")) { 11206 if (value == null) { 11207 el.removeAttributeNS(xlinkNS, key.slice(6, key.length)); 11208 } else { 11209 el.setAttributeNS(xlinkNS, key, value); 11210 } 11211 } else { 11212 if (value == null || isBoolean && !includeBooleanAttr(value)) { 11213 el.removeAttribute(key); 11214 } else { 11215 el.setAttribute( 11216 key, 11217 isBoolean ? "" : isSymbol(value) ? String(value) : value 11218 ); 11219 } 11220 } 11221 } 11222 11223 function patchDOMProp(el, key, value, parentComponent) { 11224 if (key === "innerHTML" || key === "textContent") { 11225 if (value != null) { 11226 el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value; 11227 } 11228 return; 11229 } 11230 const tag = el.tagName; 11231 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally 11232 !tag.includes("-")) { 11233 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value; 11234 const newValue = value == null ? ( 11235 // #11647: value should be set as empty string for null and undefined, 11236 // but <input type="checkbox"> should be set as 'on'. 11237 el.type === "checkbox" ? "on" : "" 11238 ) : String(value); 11239 if (oldValue !== newValue || !("_value" in el)) { 11240 el.value = newValue; 11241 } 11242 if (value == null) { 11243 el.removeAttribute(key); 11244 } 11245 el._value = value; 11246 return; 11247 } 11248 let needRemove = false;
vendor: 3,115 bytes, lines 11249-11360
11249 if (value === "" || value == null) { 11250 const type = typeof el[key]; 11251 if (type === "boolean") { 11252 value = includeBooleanAttr(value); 11253 } else if (value == null && type === "string") { 11254 value = ""; 11255 needRemove = true; 11256 } else if (type === "number") { 11257 value = 0; 11258 needRemove = true; 11259 } 11260 } 11261 try { 11262 el[key] = value; 11263 } catch (e) { 11264 if (!needRemove) { 11265 warn( 11266 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`, 11267 e 11268 ); 11269 } 11270 } 11271 needRemove && el.removeAttribute(key); 11272 } 11273 11274 function addEventListener(el, event, handler, options) { 11275 el.addEventListener(event, handler, options); 11276 } 11277 function removeEventListener(el, event, handler, options) { 11278 el.removeEventListener(event, handler, options); 11279 } 11280 const veiKey = Symbol("_vei"); 11281 function patchEvent(el, rawName, prevValue, nextValue, instance = null) { 11282 const invokers = el[veiKey] || (el[veiKey] = {}); 11283 const existingInvoker = invokers[rawName]; 11284 if (nextValue && existingInvoker) { 11285 existingInvoker.value = sanitizeEventValue(nextValue, rawName) ; 11286 } else { 11287 const [name, options] = parseName(rawName); 11288 if (nextValue) { 11289 const invoker = invokers[rawName] = createInvoker( 11290 sanitizeEventValue(nextValue, rawName) , 11291 instance 11292 ); 11293 addEventListener(el, name, invoker, options); 11294 } else if (existingInvoker) { 11295 removeEventListener(el, name, existingInvoker, options); 11296 invokers[rawName] = void 0; 11297 } 11298 } 11299 } 11300 const optionsModifierRE = /(?:Once|Passive|Capture)$/; 11301 function parseName(name) { 11302 let options; 11303 if (optionsModifierRE.test(name)) { 11304 options = {}; 11305 let m; 11306 while (m = name.match(optionsModifierRE)) { 11307 name = name.slice(0, name.length - m[0].length); 11308 options[m[0].toLowerCase()] = true; 11309 } 11310 } 11311 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)); 11312 return [event, options]; 11313 } 11314 let cachedNow = 0; 11315 const p = /* @__PURE__ */ Promise.resolve(); 11316 const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now()); 11317 function createInvoker(initialValue, instance) { 11318 const invoker = (e) => { 11319 if (!e._vts) { 11320 e._vts = Date.now(); 11321 } else if (e._vts <= invoker.attached) { 11322 return; 11323 } 11324 callWithAsyncErrorHandling( 11325 patchStopImmediatePropagation(e, invoker.value), 11326 instance, 11327 5, 11328 [e] 11329 ); 11330 }; 11331 invoker.value = initialValue; 11332 invoker.attached = getNow(); 11333 return invoker; 11334 } 11335 function sanitizeEventValue(value, propName) { 11336 if (isFunction(value) || isArray(value)) { 11337 return value; 11338 } 11339 warn( 11340 `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop? 11341Expected function or array of functions, received type ${typeof value}.` 11342 ); 11343 return NOOP; 11344 } 11345 function patchStopImmediatePropagation(e, value) { 11346 if (isArray(value)) { 11347 const originalStop = e.stopImmediatePropagation; 11348 e.stopImmediatePropagation = () => { 11349 originalStop.call(e); 11350 e._stopped = true; 11351 }; 11352 return value.map( 11353 (fn) => (e2) => !e2._stopped && fn && fn(e2) 11354 ); 11355 } else { 11356 return value; 11357 } 11358 } 11359 11360 const isNativeOn = (key) =>
vendor: 31,051 bytes, lines 11360-12445
11360 key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter 11361 key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; 11362 const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => { 11363 const isSVG = namespace === "svg"; 11364 if (key === "class") { 11365 patchClass(el, nextValue, isSVG); 11366 } else if (key === "style") { 11367 patchStyle(el, prevValue, nextValue); 11368 } else if (isOn(key)) { 11369 if (!isModelListener(key)) { 11370 patchEvent(el, key, prevValue, nextValue, parentComponent); 11371 } 11372 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) { 11373 patchDOMProp(el, key, nextValue); 11374 if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) { 11375 patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value"); 11376 } 11377 } else { 11378 if (key === "true-value") { 11379 el._trueValue = nextValue; 11380 } else if (key === "false-value") { 11381 el._falseValue = nextValue; 11382 } 11383 patchAttr(el, key, nextValue, isSVG); 11384 } 11385 }; 11386 function shouldSetAsProp(el, key, value, isSVG) { 11387 if (isSVG) { 11388 if (key === "innerHTML" || key === "textContent") { 11389 return true; 11390 } 11391 if (key in el && isNativeOn(key) && isFunction(value)) { 11392 return true; 11393 } 11394 return false; 11395 } 11396 if (key === "spellcheck" || key === "draggable" || key === "translate") { 11397 return false; 11398 } 11399 if (key === "form") { 11400 return false; 11401 } 11402 if (key === "list" && el.tagName === "INPUT") { 11403 return false; 11404 } 11405 if (key === "type" && el.tagName === "TEXTAREA") { 11406 return false; 11407 } 11408 if (key === "width" || key === "height") { 11409 const tag = el.tagName; 11410 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") { 11411 return false; 11412 } 11413 } 11414 if (isNativeOn(key) && isString(value)) { 11415 return false; 11416 } 11417 if (key in el) { 11418 return true; 11419 } 11420 if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) { 11421 return true; 11422 } 11423 return false; 11424 } 11425 11426 const REMOVAL = {}; 11427 /*! #__NO_SIDE_EFFECTS__ */ 11428 // @__NO_SIDE_EFFECTS__ 11429 function defineCustomElement(options, extraOptions, _createApp) { 11430 const Comp = defineComponent(options, extraOptions); 11431 if (isPlainObject(Comp)) extend(Comp, extraOptions); 11432 class VueCustomElement extends VueElement { 11433 constructor(initialProps) { 11434 super(Comp, initialProps, _createApp); 11435 } 11436 } 11437 VueCustomElement.def = Comp; 11438 return VueCustomElement; 11439 } 11440 /*! #__NO_SIDE_EFFECTS__ */ 11441 const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => { 11442 return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp); 11443 }; 11444 const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class { 11445 }; 11446 class VueElement extends BaseClass { 11447 constructor(_def, _props = {}, _createApp = createApp) { 11448 super(); 11449 this._def = _def; 11450 this._props = _props; 11451 this._createApp = _createApp; 11452 this._isVueCE = true; 11453 /** 11454 * @internal 11455 */ 11456 this._instance = null; 11457 /** 11458 * @internal 11459 */ 11460 this._app = null; 11461 /** 11462 * @internal 11463 */ 11464 this._nonce = this._def.nonce; 11465 this._connected = false; 11466 this._resolved = false; 11467 this._numberProps = null; 11468 this._styleChildren = /* @__PURE__ */ new WeakSet(); 11469 this._ob = null; 11470 if (this.shadowRoot && _createApp !== createApp) { 11471 this._root = this.shadowRoot; 11472 } else { 11473 if (this.shadowRoot) { 11474 warn( 11475 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.` 11476 ); 11477 } 11478 if (_def.shadowRoot !== false) { 11479 this.attachShadow({ mode: "open" }); 11480 this._root = this.shadowRoot; 11481 } else { 11482 this._root = this; 11483 } 11484 } 11485 if (!this._def.__asyncLoader) { 11486 this._resolveProps(this._def); 11487 } 11488 } 11489 connectedCallback() { 11490 if (!this.shadowRoot) { 11491 this._parseSlots(); 11492 } 11493 this._connected = true; 11494 let parent = this; 11495 while (parent = parent && (parent.parentNode || parent.host)) { 11496 if (parent instanceof VueElement) { 11497 this._parent = parent; 11498 break; 11499 } 11500 } 11501 if (!this._instance) { 11502 if (this._resolved) { 11503 this._setParent(); 11504 this._update(); 11505 } else { 11506 if (parent && parent._pendingResolve) { 11507 this._pendingResolve = parent._pendingResolve.then(() => { 11508 this._pendingResolve = void 0; 11509 this._resolveDef(); 11510 }); 11511 } else { 11512 this._resolveDef(); 11513 } 11514 } 11515 } 11516 } 11517 _setParent(parent = this._parent) { 11518 if (parent) { 11519 this._instance.parent = parent._instance; 11520 this._instance.provides = parent._instance.provides; 11521 } 11522 } 11523 disconnectedCallback() { 11524 this._connected = false; 11525 nextTick(() => { 11526 if (!this._connected) { 11527 if (this._ob) { 11528 this._ob.disconnect(); 11529 this._ob = null; 11530 } 11531 this._app && this._app.unmount(); 11532 this._instance.ce = void 0; 11533 this._app = this._instance = null; 11534 } 11535 }); 11536 } 11537 /** 11538 * resolve inner component definition (handle possible async component) 11539 */ 11540 _resolveDef() { 11541 if (this._pendingResolve) { 11542 return; 11543 } 11544 for (let i = 0; i < this.attributes.length; i++) { 11545 this._setAttr(this.attributes[i].name); 11546 } 11547 this._ob = new MutationObserver((mutations) => { 11548 for (const m of mutations) { 11549 this._setAttr(m.attributeName); 11550 } 11551 }); 11552 this._ob.observe(this, { attributes: true }); 11553 const resolve = (def, isAsync = false) => { 11554 this._resolved = true; 11555 this._pendingResolve = void 0; 11556 const { props, styles } = def; 11557 let numberProps; 11558 if (props && !isArray(props)) { 11559 for (const key in props) { 11560 const opt = props[key]; 11561 if (opt === Number || opt && opt.type === Number) { 11562 if (key in this._props) { 11563 this._props[key] = toNumber(this._props[key]); 11564 } 11565 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true; 11566 } 11567 } 11568 } 11569 this._numberProps = numberProps; 11570 if (isAsync) { 11571 this._resolveProps(def); 11572 } 11573 if (this.shadowRoot) { 11574 this._applyStyles(styles); 11575 } else if (styles) { 11576 warn( 11577 "Custom element style injection is not supported when using shadowRoot: false" 11578 ); 11579 } 11580 this._mount(def); 11581 }; 11582 const asyncDef = this._def.__asyncLoader; 11583 if (asyncDef) { 11584 this._pendingResolve = asyncDef().then( 11585 (def) => resolve(this._def = def, true) 11586 ); 11587 } else { 11588 resolve(this._def); 11589 } 11590 } 11591 _mount(def) { 11592 if (!def.name) { 11593 def.name = "VueElement"; 11594 } 11595 this._app = this._createApp(def); 11596 if (def.configureApp) { 11597 def.configureApp(this._app); 11598 } 11599 this._app._ceVNode = this._createVNode(); 11600 this._app.mount(this._root); 11601 const exposed = this._instance && this._instance.exposed; 11602 if (!exposed) return; 11603 for (const key in exposed) { 11604 if (!hasOwn(this, key)) { 11605 Object.defineProperty(this, key, { 11606 // unwrap ref to be consistent with public instance behavior 11607 get: () => unref(exposed[key]) 11608 }); 11609 } else { 11610 warn(`Exposed property "${key}" already exists on custom element.`); 11611 } 11612 } 11613 } 11614 _resolveProps(def) { 11615 const { props } = def; 11616 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {}); 11617 for (const key of Object.keys(this)) { 11618 if (key[0] !== "_" && declaredPropKeys.includes(key)) { 11619 this._setProp(key, this[key]); 11620 } 11621 } 11622 for (const key of declaredPropKeys.map(camelize)) { 11623 Object.defineProperty(this, key, { 11624 get() { 11625 return this._getProp(key); 11626 }, 11627 set(val) { 11628 this._setProp(key, val, true, true); 11629 } 11630 }); 11631 } 11632 } 11633 _setAttr(key) { 11634 if (key.startsWith("data-v-")) return; 11635 const has = this.hasAttribute(key); 11636 let value = has ? this.getAttribute(key) : REMOVAL; 11637 const camelKey = camelize(key); 11638 if (has && this._numberProps && this._numberProps[camelKey]) { 11639 value = toNumber(value); 11640 } 11641 this._setProp(camelKey, value, false, true); 11642 } 11643 /** 11644 * @internal 11645 */ 11646 _getProp(key) { 11647 return this._props[key]; 11648 } 11649 /** 11650 * @internal 11651 */ 11652 _setProp(key, val, shouldReflect = true, shouldUpdate = false) { 11653 if (val !== this._props[key]) { 11654 if (val === REMOVAL) { 11655 delete this._props[key]; 11656 } else { 11657 this._props[key] = val; 11658 if (key === "key" && this._app) { 11659 this._app._ceVNode.key = val; 11660 } 11661 } 11662 if (shouldUpdate && this._instance) { 11663 this._update(); 11664 } 11665 if (shouldReflect) { 11666 if (val === true) { 11667 this.setAttribute(hyphenate(key), ""); 11668 } else if (typeof val === "string" || typeof val === "number") { 11669 this.setAttribute(hyphenate(key), val + ""); 11670 } else if (!val) { 11671 this.removeAttribute(hyphenate(key)); 11672 } 11673 } 11674 } 11675 } 11676 _update() { 11677 render(this._createVNode(), this._root); 11678 } 11679 _createVNode() { 11680 const baseProps = {}; 11681 if (!this.shadowRoot) { 11682 baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this); 11683 } 11684 const vnode = createVNode(this._def, extend(baseProps, this._props)); 11685 if (!this._instance) { 11686 vnode.ce = (instance) => { 11687 this._instance = instance; 11688 instance.ce = this; 11689 instance.isCE = true; 11690 { 11691 instance.ceReload = (newStyles) => { 11692 if (this._styles) { 11693 this._styles.forEach((s) => this._root.removeChild(s)); 11694 this._styles.length = 0; 11695 } 11696 this._applyStyles(newStyles); 11697 this._instance = null; 11698 this._update(); 11699 }; 11700 } 11701 const dispatch = (event, args) => { 11702 this.dispatchEvent( 11703 new CustomEvent( 11704 event, 11705 isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args } 11706 ) 11707 ); 11708 }; 11709 instance.emit = (event, ...args) => { 11710 dispatch(event, args); 11711 if (hyphenate(event) !== event) { 11712 dispatch(hyphenate(event), args); 11713 } 11714 }; 11715 this._setParent(); 11716 }; 11717 } 11718 return vnode; 11719 } 11720 _applyStyles(styles, owner) { 11721 if (!styles) return; 11722 if (owner) { 11723 if (owner === this._def || this._styleChildren.has(owner)) { 11724 return; 11725 } 11726 this._styleChildren.add(owner); 11727 } 11728 const nonce = this._nonce; 11729 for (let i = styles.length - 1; i >= 0; i--) { 11730 const s = document.createElement("style"); 11731 if (nonce) s.setAttribute("nonce", nonce); 11732 s.textContent = styles[i]; 11733 this.shadowRoot.prepend(s); 11734 { 11735 if (owner) { 11736 if (owner.__hmrId) { 11737 if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map(); 11738 let entry = this._childStyles.get(owner.__hmrId); 11739 if (!entry) { 11740 this._childStyles.set(owner.__hmrId, entry = []); 11741 } 11742 entry.push(s); 11743 } 11744 } else { 11745 (this._styles || (this._styles = [])).push(s); 11746 } 11747 } 11748 } 11749 } 11750 /** 11751 * Only called when shaddowRoot is false 11752 */ 11753 _parseSlots() { 11754 const slots = this._slots = {}; 11755 let n; 11756 while (n = this.firstChild) { 11757 const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default"; 11758 (slots[slotName] || (slots[slotName] = [])).push(n); 11759 this.removeChild(n); 11760 } 11761 } 11762 /** 11763 * Only called when shaddowRoot is false 11764 */ 11765 _renderSlots() { 11766 const outlets = this.querySelectorAll("slot"); 11767 const scopeId = this._instance.type.__scopeId; 11768 for (let i = 0; i < outlets.length; i++) { 11769 const o = outlets[i]; 11770 const slotName = o.getAttribute("name") || "default"; 11771 const content = this._slots[slotName]; 11772 const parent = o.parentNode; 11773 if (content) { 11774 for (const n of content) { 11775 if (scopeId && n.nodeType === 1) { 11776 const id = scopeId + "-s"; 11777 const walker = document.createTreeWalker(n, 1); 11778 n.setAttribute(id, ""); 11779 let child; 11780 while (child = walker.nextNode()) { 11781 child.setAttribute(id, ""); 11782 } 11783 } 11784 parent.insertBefore(n, o); 11785 } 11786 } else { 11787 while (o.firstChild) parent.insertBefore(o.firstChild, o); 11788 } 11789 parent.removeChild(o); 11790 } 11791 } 11792 /** 11793 * @internal 11794 */ 11795 _injectChildStyle(comp) { 11796 this._applyStyles(comp.styles, comp); 11797 } 11798 /** 11799 * @internal 11800 */ 11801 _removeChildStyle(comp) { 11802 { 11803 this._styleChildren.delete(comp); 11804 if (this._childStyles && comp.__hmrId) { 11805 const oldStyles = this._childStyles.get(comp.__hmrId); 11806 if (oldStyles) { 11807 oldStyles.forEach((s) => this._root.removeChild(s)); 11808 oldStyles.length = 0; 11809 } 11810 } 11811 } 11812 } 11813 } 11814 function useHost(caller) { 11815 const instance = getCurrentInstance(); 11816 const el = instance && instance.ce; 11817 if (el) { 11818 return el; 11819 } else { 11820 if (!instance) { 11821 warn( 11822 `${caller || "useHost"} called without an active component instance.` 11823 ); 11824 } else { 11825 warn( 11826 `${caller || "useHost"} can only be used in components defined via defineCustomElement.` 11827 ); 11828 } 11829 } 11830 return null; 11831 } 11832 function useShadowRoot() { 11833 const el = useHost("useShadowRoot") ; 11834 return el && el.shadowRoot; 11835 } 11836 11837 function useCssModule(name = "$style") { 11838 { 11839 const instance = getCurrentInstance(); 11840 if (!instance) { 11841 warn(`useCssModule must be called inside setup()`); 11842 return EMPTY_OBJ; 11843 } 11844 const modules = instance.type.__cssModules; 11845 if (!modules) { 11846 warn(`Current instance does not have CSS modules injected.`); 11847 return EMPTY_OBJ; 11848 } 11849 const mod = modules[name]; 11850 if (!mod) { 11851 warn(`Current instance does not have CSS module named "${name}".`); 11852 return EMPTY_OBJ; 11853 } 11854 return mod; 11855 } 11856 } 11857 11858 const positionMap = /* @__PURE__ */ new WeakMap(); 11859 const newPositionMap = /* @__PURE__ */ new WeakMap(); 11860 const moveCbKey = Symbol("_moveCb"); 11861 const enterCbKey = Symbol("_enterCb"); 11862 const decorate = (t) => { 11863 delete t.props.mode; 11864 return t; 11865 }; 11866 const TransitionGroupImpl = /* @__PURE__ */ decorate({ 11867 name: "TransitionGroup", 11868 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, { 11869 tag: String, 11870 moveClass: String 11871 }), 11872 setup(props, { slots }) { 11873 const instance = getCurrentInstance(); 11874 const state = useTransitionState(); 11875 let prevChildren; 11876 let children; 11877 onUpdated(() => { 11878 if (!prevChildren.length) { 11879 return; 11880 } 11881 const moveClass = props.moveClass || `${props.name || "v"}-move`; 11882 if (!hasCSSTransform( 11883 prevChildren[0].el, 11884 instance.vnode.el, 11885 moveClass 11886 )) { 11887 return; 11888 } 11889 prevChildren.forEach(callPendingCbs); 11890 prevChildren.forEach(recordPosition); 11891 const movedChildren = prevChildren.filter(applyTranslation); 11892 forceReflow(); 11893 movedChildren.forEach((c) => { 11894 const el = c.el; 11895 const style = el.style; 11896 addTransitionClass(el, moveClass); 11897 style.transform = style.webkitTransform = style.transitionDuration = ""; 11898 const cb = el[moveCbKey] = (e) => { 11899 if (e && e.target !== el) { 11900 return; 11901 } 11902 if (!e || /transform$/.test(e.propertyName)) { 11903 el.removeEventListener("transitionend", cb); 11904 el[moveCbKey] = null; 11905 removeTransitionClass(el, moveClass); 11906 } 11907 }; 11908 el.addEventListener("transitionend", cb); 11909 }); 11910 }); 11911 return () => { 11912 const rawProps = toRaw(props); 11913 const cssTransitionProps = resolveTransitionProps(rawProps); 11914 let tag = rawProps.tag || Fragment; 11915 prevChildren = []; 11916 if (children) { 11917 for (let i = 0; i < children.length; i++) { 11918 const child = children[i]; 11919 if (child.el && child.el instanceof Element) { 11920 prevChildren.push(child); 11921 setTransitionHooks( 11922 child, 11923 resolveTransitionHooks( 11924 child, 11925 cssTransitionProps, 11926 state, 11927 instance 11928 ) 11929 ); 11930 positionMap.set( 11931 child, 11932 child.el.getBoundingClientRect() 11933 ); 11934 } 11935 } 11936 } 11937 children = slots.default ? getTransitionRawChildren(slots.default()) : []; 11938 for (let i = 0; i < children.length; i++) { 11939 const child = children[i]; 11940 if (child.key != null) { 11941 setTransitionHooks( 11942 child, 11943 resolveTransitionHooks(child, cssTransitionProps, state, instance) 11944 ); 11945 } else { 11946 warn(`<TransitionGroup> children must be keyed.`); 11947 } 11948 } 11949 return createVNode(tag, null, children); 11950 }; 11951 } 11952 }); 11953 const TransitionGroup = TransitionGroupImpl; 11954 function callPendingCbs(c) { 11955 const el = c.el; 11956 if (el[moveCbKey]) { 11957 el[moveCbKey](); 11958 } 11959 if (el[enterCbKey]) { 11960 el[enterCbKey](); 11961 } 11962 } 11963 function recordPosition(c) { 11964 newPositionMap.set(c, c.el.getBoundingClientRect()); 11965 } 11966 function applyTranslation(c) { 11967 const oldPos = positionMap.get(c); 11968 const newPos = newPositionMap.get(c); 11969 const dx = oldPos.left - newPos.left; 11970 const dy = oldPos.top - newPos.top; 11971 if (dx || dy) { 11972 const s = c.el.style; 11973 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`; 11974 s.transitionDuration = "0s"; 11975 return c; 11976 } 11977 } 11978 function hasCSSTransform(el, root, moveClass) { 11979 const clone = el.cloneNode(); 11980 const _vtc = el[vtcKey]; 11981 if (_vtc) { 11982 _vtc.forEach((cls) => { 11983 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c)); 11984 }); 11985 } 11986 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c)); 11987 clone.style.display = "none"; 11988 const container = root.nodeType === 1 ? root : root.parentNode; 11989 container.appendChild(clone); 11990 const { hasTransform } = getTransitionInfo(clone); 11991 container.removeChild(clone); 11992 return hasTransform; 11993 } 11994 11995 const getModelAssigner = (vnode) => { 11996 const fn = vnode.props["onUpdate:modelValue"] || false; 11997 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn; 11998 }; 11999 function onCompositionStart(e) { 12000 e.target.composing = true; 12001 } 12002 function onCompositionEnd(e) { 12003 const target = e.target; 12004 if (target.composing) { 12005 target.composing = false; 12006 target.dispatchEvent(new Event("input")); 12007 } 12008 } 12009 const assignKey = Symbol("_assign"); 12010 const vModelText = { 12011 created(el, { modifiers: { lazy, trim, number } }, vnode) { 12012 el[assignKey] = getModelAssigner(vnode); 12013 const castToNumber = number || vnode.props && vnode.props.type === "number"; 12014 addEventListener(el, lazy ? "change" : "input", (e) => { 12015 if (e.target.composing) return; 12016 let domValue = el.value; 12017 if (trim) { 12018 domValue = domValue.trim(); 12019 } 12020 if (castToNumber) { 12021 domValue = looseToNumber(domValue); 12022 } 12023 el[assignKey](domValue); 12024 }); 12025 if (trim) { 12026 addEventListener(el, "change", () => { 12027 el.value = el.value.trim(); 12028 }); 12029 } 12030 if (!lazy) { 12031 addEventListener(el, "compositionstart", onCompositionStart); 12032 addEventListener(el, "compositionend", onCompositionEnd); 12033 addEventListener(el, "change", onCompositionEnd); 12034 } 12035 }, 12036 // set value on mounted so it's after min/max for type="range" 12037 mounted(el, { value }) { 12038 el.value = value == null ? "" : value; 12039 }, 12040 beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) { 12041 el[assignKey] = getModelAssigner(vnode); 12042 if (el.composing) return; 12043 const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value; 12044 const newValue = value == null ? "" : value; 12045 if (elValue === newValue) { 12046 return; 12047 } 12048 if (document.activeElement === el && el.type !== "range") { 12049 if (lazy && value === oldValue) { 12050 return; 12051 } 12052 if (trim && el.value.trim() === newValue) { 12053 return; 12054 } 12055 } 12056 el.value = newValue; 12057 } 12058 }; 12059 const vModelCheckbox = { 12060 // #4096 array checkboxes need to be deep traversed 12061 deep: true, 12062 created(el, _, vnode) { 12063 el[assignKey] = getModelAssigner(vnode); 12064 addEventListener(el, "change", () => { 12065 const modelValue = el._modelValue; 12066 const elementValue = getValue(el); 12067 const checked = el.checked; 12068 const assign = el[assignKey]; 12069 if (isArray(modelValue)) { 12070 const index = looseIndexOf(modelValue, elementValue); 12071 const found = index !== -1; 12072 if (checked && !found) { 12073 assign(modelValue.concat(elementValue)); 12074 } else if (!checked && found) { 12075 const filtered = [...modelValue]; 12076 filtered.splice(index, 1); 12077 assign(filtered); 12078 } 12079 } else if (isSet(modelValue)) { 12080 const cloned = new Set(modelValue); 12081 if (checked) { 12082 cloned.add(elementValue); 12083 } else { 12084 cloned.delete(elementValue); 12085 } 12086 assign(cloned); 12087 } else { 12088 assign(getCheckboxValue(el, checked)); 12089 } 12090 }); 12091 }, 12092 // set initial checked on mount to wait for true-value/false-value 12093 mounted: setChecked, 12094 beforeUpdate(el, binding, vnode) { 12095 el[assignKey] = getModelAssigner(vnode); 12096 setChecked(el, binding, vnode); 12097 } 12098 }; 12099 function setChecked(el, { value, oldValue }, vnode) { 12100 el._modelValue = value; 12101 let checked; 12102 if (isArray(value)) { 12103 checked = looseIndexOf(value, vnode.props.value) > -1; 12104 } else if (isSet(value)) { 12105 checked = value.has(vnode.props.value); 12106 } else { 12107 checked = looseEqual(value, getCheckboxValue(el, true)); 12108 } 12109 if (el.checked !== checked) { 12110 el.checked = checked; 12111 } 12112 } 12113 const vModelRadio = { 12114 created(el, { value }, vnode) { 12115 el.checked = looseEqual(value, vnode.props.value); 12116 el[assignKey] = getModelAssigner(vnode); 12117 addEventListener(el, "change", () => { 12118 el[assignKey](getValue(el)); 12119 }); 12120 }, 12121 beforeUpdate(el, { value, oldValue }, vnode) { 12122 el[assignKey] = getModelAssigner(vnode); 12123 if (value !== oldValue) { 12124 el.checked = looseEqual(value, vnode.props.value); 12125 } 12126 } 12127 }; 12128 const vModelSelect = { 12129 // <select multiple> value need to be deep traversed 12130 deep: true, 12131 created(el, { value, modifiers: { number } }, vnode) { 12132 const isSetModel = isSet(value); 12133 addEventListener(el, "change", () => { 12134 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map( 12135 (o) => number ? looseToNumber(getValue(o)) : getValue(o) 12136 ); 12137 el[assignKey]( 12138 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0] 12139 ); 12140 el._assigning = true; 12141 nextTick(() => { 12142 el._assigning = false; 12143 }); 12144 }); 12145 el[assignKey] = getModelAssigner(vnode); 12146 }, 12147 // set value in mounted & updated because <select> relies on its children 12148 // <option>s. 12149 mounted(el, { value, modifiers: { number } }) { 12150 setSelected(el, value); 12151 }, 12152 beforeUpdate(el, _binding, vnode) { 12153 el[assignKey] = getModelAssigner(vnode); 12154 }, 12155 updated(el, { value, modifiers: { number } }) { 12156 if (!el._assigning) { 12157 setSelected(el, value); 12158 } 12159 } 12160 }; 12161 function setSelected(el, value, number) { 12162 const isMultiple = el.multiple; 12163 const isArrayValue = isArray(value); 12164 if (isMultiple && !isArrayValue && !isSet(value)) { 12165 warn( 12166 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.` 12167 ); 12168 return; 12169 } 12170 for (let i = 0, l = el.options.length; i < l; i++) { 12171 const option = el.options[i]; 12172 const optionValue = getValue(option); 12173 if (isMultiple) { 12174 if (isArrayValue) { 12175 const optionType = typeof optionValue; 12176 if (optionType === "string" || optionType === "number") { 12177 option.selected = value.some((v) => String(v) === String(optionValue)); 12178 } else { 12179 option.selected = looseIndexOf(value, optionValue) > -1; 12180 } 12181 } else { 12182 option.selected = value.has(optionValue); 12183 } 12184 } else if (looseEqual(getValue(option), value)) { 12185 if (el.selectedIndex !== i) el.selectedIndex = i; 12186 return; 12187 } 12188 } 12189 if (!isMultiple && el.selectedIndex !== -1) { 12190 el.selectedIndex = -1; 12191 } 12192 } 12193 function getValue(el) { 12194 return "_value" in el ? el._value : el.value; 12195 } 12196 function getCheckboxValue(el, checked) { 12197 const key = checked ? "_trueValue" : "_falseValue"; 12198 return key in el ? el[key] : checked; 12199 } 12200 const vModelDynamic = { 12201 created(el, binding, vnode) { 12202 callModelHook(el, binding, vnode, null, "created"); 12203 }, 12204 mounted(el, binding, vnode) { 12205 callModelHook(el, binding, vnode, null, "mounted"); 12206 }, 12207 beforeUpdate(el, binding, vnode, prevVNode) { 12208 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate"); 12209 }, 12210 updated(el, binding, vnode, prevVNode) { 12211 callModelHook(el, binding, vnode, prevVNode, "updated"); 12212 } 12213 }; 12214 function resolveDynamicModel(tagName, type) { 12215 switch (tagName) { 12216 case "SELECT": 12217 return vModelSelect; 12218 case "TEXTAREA": 12219 return vModelText; 12220 default: 12221 switch (type) { 12222 case "checkbox": 12223 return vModelCheckbox; 12224 case "radio": 12225 return vModelRadio; 12226 default: 12227 return vModelText; 12228 } 12229 } 12230 } 12231 function callModelHook(el, binding, vnode, prevVNode, hook) { 12232 const modelToUse = resolveDynamicModel( 12233 el.tagName, 12234 vnode.props && vnode.props.type 12235 ); 12236 const fn = modelToUse[hook]; 12237 fn && fn(el, binding, vnode, prevVNode); 12238 } 12239 function initVModelForSSR() { 12240 vModelText.getSSRProps = ({ value }) => ({ value }); 12241 vModelRadio.getSSRProps = ({ value }, vnode) => { 12242 if (vnode.props && looseEqual(vnode.props.value, value)) { 12243 return { checked: true }; 12244 } 12245 }; 12246 vModelCheckbox.getSSRProps = ({ value }, vnode) => { 12247 if (isArray(value)) { 12248 if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) { 12249 return { checked: true }; 12250 } 12251 } else if (isSet(value)) { 12252 if (vnode.props && value.has(vnode.props.value)) { 12253 return { checked: true }; 12254 } 12255 } else if (value) { 12256 return { checked: true }; 12257 } 12258 }; 12259 vModelDynamic.getSSRProps = (binding, vnode) => { 12260 if (typeof vnode.type !== "string") { 12261 return; 12262 } 12263 const modelToUse = resolveDynamicModel( 12264 // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase 12265 vnode.type.toUpperCase(), 12266 vnode.props && vnode.props.type 12267 ); 12268 if (modelToUse.getSSRProps) { 12269 return modelToUse.getSSRProps(binding, vnode); 12270 } 12271 }; 12272 } 12273 12274 const systemModifiers = ["ctrl", "shift", "alt", "meta"]; 12275 const modifierGuards = { 12276 stop: (e) => e.stopPropagation(), 12277 prevent: (e) => e.preventDefault(), 12278 self: (e) => e.target !== e.currentTarget, 12279 ctrl: (e) => !e.ctrlKey, 12280 shift: (e) => !e.shiftKey, 12281 alt: (e) => !e.altKey, 12282 meta: (e) => !e.metaKey, 12283 left: (e) => "button" in e && e.button !== 0, 12284 middle: (e) => "button" in e && e.button !== 1, 12285 right: (e) => "button" in e && e.button !== 2, 12286 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m)) 12287 }; 12288 const withModifiers = (fn, modifiers) => { 12289 const cache = fn._withMods || (fn._withMods = {}); 12290 const cacheKey = modifiers.join("."); 12291 return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => { 12292 for (let i = 0; i < modifiers.length; i++) { 12293 const guard = modifierGuards[modifiers[i]]; 12294 if (guard && guard(event, modifiers)) return; 12295 } 12296 return fn(event, ...args); 12297 }); 12298 }; 12299 const keyNames = { 12300 esc: "escape", 12301 space: " ", 12302 up: "arrow-up", 12303 left: "arrow-left", 12304 right: "arrow-right", 12305 down: "arrow-down", 12306 delete: "backspace" 12307 }; 12308 const withKeys = (fn, modifiers) => { 12309 const cache = fn._withKeys || (fn._withKeys = {}); 12310 const cacheKey = modifiers.join("."); 12311 return cache[cacheKey] || (cache[cacheKey] = (event) => { 12312 if (!("key" in event)) { 12313 return; 12314 } 12315 const eventKey = hyphenate(event.key); 12316 if (modifiers.some( 12317 (k) => k === eventKey || keyNames[k] === eventKey 12318 )) { 12319 return fn(event); 12320 } 12321 }); 12322 }; 12323 12324 const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps); 12325 let renderer; 12326 let enabledHydration = false; 12327 function ensureRenderer() { 12328 return renderer || (renderer = createRenderer(rendererOptions)); 12329 } 12330 function ensureHydrationRenderer() { 12331 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions); 12332 enabledHydration = true; 12333 return renderer; 12334 } 12335 const render = (...args) => { 12336 ensureRenderer().render(...args); 12337 }; 12338 const hydrate = (...args) => { 12339 ensureHydrationRenderer().hydrate(...args); 12340 }; 12341 const createApp = (...args) => { 12342 const app = ensureRenderer().createApp(...args); 12343 { 12344 injectNativeTagCheck(app); 12345 injectCompilerOptionsCheck(app); 12346 } 12347 const { mount } = app; 12348 app.mount = (containerOrSelector) => { 12349 const container = normalizeContainer(containerOrSelector); 12350 if (!container) return; 12351 const component = app._component; 12352 if (!isFunction(component) && !component.render && !component.template) { 12353 component.template = container.innerHTML; 12354 } 12355 if (container.nodeType === 1) { 12356 container.textContent = ""; 12357 } 12358 const proxy = mount(container, false, resolveRootNamespace(container)); 12359 if (container instanceof Element) { 12360 container.removeAttribute("v-cloak"); 12361 container.setAttribute("data-v-app", ""); 12362 } 12363 return proxy; 12364 }; 12365 return app; 12366 }; 12367 const createSSRApp = (...args) => { 12368 const app = ensureHydrationRenderer().createApp(...args); 12369 { 12370 injectNativeTagCheck(app); 12371 injectCompilerOptionsCheck(app); 12372 } 12373 const { mount } = app; 12374 app.mount = (containerOrSelector) => { 12375 const container = normalizeContainer(containerOrSelector); 12376 if (container) { 12377 return mount(container, true, resolveRootNamespace(container)); 12378 } 12379 }; 12380 return app; 12381 }; 12382 function resolveRootNamespace(container) { 12383 if (container instanceof SVGElement) { 12384 return "svg"; 12385 } 12386 if (typeof MathMLElement === "function" && container instanceof MathMLElement) { 12387 return "mathml"; 12388 } 12389 } 12390 function injectNativeTagCheck(app) { 12391 Object.defineProperty(app.config, "isNativeTag", { 12392 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 12393 writable: false 12394 }); 12395 } 12396 function injectCompilerOptionsCheck(app) { 12397 if (isRuntimeOnly()) { 12398 const isCustomElement = app.config.isCustomElement; 12399 Object.defineProperty(app.config, "isCustomElement", { 12400 get() { 12401 return isCustomElement; 12402 }, 12403 set() { 12404 warn( 12405 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.` 12406 ); 12407 } 12408 }); 12409 const compilerOptions = app.config.compilerOptions; 12410 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. 12411- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option. 12412- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader 12413- 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`; 12414 Object.defineProperty(app.config, "compilerOptions", { 12415 get() { 12416 warn(msg); 12417 return compilerOptions; 12418 }, 12419 set() { 12420 warn(msg); 12421 } 12422 }); 12423 } 12424 } 12425 function normalizeContainer(container) { 12426 if (isString(container)) { 12427 const res = document.querySelector(container); 12428 if (!res) { 12429 warn( 12430 `Failed to mount app: mount target selector "${container}" returned null.` 12431 ); 12432 } 12433 return res; 12434 } 12435 if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") { 12436 warn( 12437 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs` 12438 ); 12439 } 12440 return container; 12441 } 12442 let ssrDirectiveInitialized = false; 12443 const initDirectivesForSSR = () => { 12444 if (!ssrDirectiveInitialized) { 12445 ssrDirectiveInitialized = true;
12446 initVModelForSSR(); 12447 initVShowForSSR(); 12448 } 12449 } ; 12450 12451 var runtimeDom = /*#__PURE__*/Object.freeze({ 12452 __proto__: null, 12453 BaseTransition: BaseTransition, 12454 BaseTransitionPropsValidators: BaseTransitionPropsValidators, 12455 Comment: Comment, 12456 DeprecationTypes: DeprecationTypes, 12457 EffectScope: EffectScope, 12458 ErrorCodes: ErrorCodes, 12459 ErrorTypeStrings: ErrorTypeStrings, 12460 Fragment: Fragment, 12461 KeepAlive: KeepAlive, 12462 ReactiveEffect: ReactiveEffect, 12463 Static: Static, 12464 Suspense: Suspense, 12465 Teleport: Teleport, 12466 Text: Text, 12467 TrackOpTypes: TrackOpTypes, 12468 Transition: Transition, 12469 TransitionGroup: TransitionGroup, 12470 TriggerOpTypes: TriggerOpTypes, 12471 VueElement: VueElement, 12472 assertNumber: assertNumber, 12473 callWithAsyncErrorHandling: callWithAsyncErrorHandling, 12474 callWithErrorHandling: callWithErrorHandling, 12475 camelize: camelize, 12476 capitalize: capitalize, 12477 cloneVNode: cloneVNode, 12478 compatUtils: compatUtils, 12479 computed: computed, 12480 createApp: createApp, 12481 createBlock: createBlock, 12482 createCommentVNode: createCommentVNode, 12483 createElementBlock: createElementBlock, 12484 createElementVNode: createBaseVNode, 12485 createHydrationRenderer: createHydrationRenderer, 12486 createPropsRestProxy: createPropsRestProxy, 12487 createRenderer: createRenderer, 12488 createSSRApp: createSSRApp, 12489 createSlots: createSlots, 12490 createStaticVNode: createStaticVNode, 12491 createTextVNode: createTextVNode, 12492 createVNode: createVNode, 12493 customRef: customRef, 12494 defineAsyncComponent: defineAsyncComponent, 12495 defineComponent: defineComponent, 12496 defineCustomElement: defineCustomElement, 12497 defineEmits: defineEmits, 12498 defineExpose: defineExpose, 12499 defineModel: defineModel, 12500 defineOptions: defineOptions, 12501 defineProps: defineProps, 12502 defineSSRCustomElement: defineSSRCustomElement, 12503 defineSlots: defineSlots, 12504 devtools: devtools, 12505 effect: effect, 12506 effectScope: effectScope, 12507 getCurrentInstance: getCurrentInstance, 12508 getCurrentScope: getCurrentScope, 12509 getCurrentWatcher: getCurrentWatcher, 12510 getTransitionRawChildren: getTransitionRawChildren, 12511 guardReactiveProps: guardReactiveProps, 12512 h: h, 12513 handleError: handleError, 12514 hasInjectionContext: hasInjectionContext, 12515 hydrate: hydrate, 12516 hydrateOnIdle: hydrateOnIdle, 12517 hydrateOnInteraction: hydrateOnInteraction, 12518 hydrateOnMediaQuery: hydrateOnMediaQuery, 12519 hydrateOnVisible: hydrateOnVisible, 12520 initCustomFormatter: initCustomFormatter, 12521 initDirectivesForSSR: initDirectivesForSSR, 12522 inject: inject, 12523 isMemoSame: isMemoSame, 12524 isProxy: isProxy, 12525 isReactive: isReactive, 12526 isReadonly: isReadonly, 12527 isRef: isRef, 12528 isRuntimeOnly: isRuntimeOnly, 12529 isShallow: isShallow, 12530 isVNode: isVNode, 12531 markRaw: markRaw, 12532 mergeDefaults: mergeDefaults, 12533 mergeModels: mergeModels, 12534 mergeProps: mergeProps, 12535 nextTick: nextTick, 12536 normalizeClass: normalizeClass, 12537 normalizeProps: normalizeProps, 12538 normalizeStyle: normalizeStyle, 12539 onActivated: onActivated, 12540 onBeforeMount: onBeforeMount, 12541 onBeforeUnmount: onBeforeUnmount, 12542 onBeforeUpdate: onBeforeUpdate, 12543 onDeactivated: onDeactivated, 12544 onErrorCaptured: onErrorCaptured, 12545 onMounted: onMounted, 12546 onRenderTracked: onRenderTracked, 12547 onRenderTriggered: onRenderTriggered, 12548 onScopeDispose: onScopeDispose, 12549 onServerPrefetch: onServerPrefetch, 12550 onUnmounted: onUnmounted, 12551 onUpdated: onUpdated, 12552 onWatcherCleanup: onWatcherCleanup, 12553 openBlock: openBlock, 12554 popScopeId: popScopeId, 12555 provide: provide, 12556 proxyRefs: proxyRefs, 12557 pushScopeId: pushScopeId, 12558 queuePostFlushCb: queuePostFlushCb, 12559 reactive: reactive, 12560 readonly: readonly, 12561 ref: ref, 12562 registerRuntimeCompiler: registerRuntimeCompiler, 12563 render: render, 12564 renderList: renderList, 12565 renderSlot: renderSlot, 12566 resolveComponent: resolveComponent, 12567 resolveDirective: resolveDirective, 12568 resolveDynamicComponent: resolveDynamicComponent, 12569 resolveFilter: resolveFilter, 12570 resolveTransitionHooks: resolveTransitionHooks, 12571 setBlockTracking: setBlockTracking, 12572 setDevtoolsHook: setDevtoolsHook, 12573 setTransitionHooks: setTransitionHooks, 12574 shallowReactive: shallowReactive, 12575 shallowReadonly: shallowReadonly, 12576 shallowRef: shallowRef, 12577 ssrContextKey: ssrContextKey, 12578 ssrUtils: ssrUtils, 12579 stop: stop, 12580 toDisplayString: toDisplayString, 12581 toHandlerKey: toHandlerKey, 12582 toHandlers: toHandlers, 12583 toRaw: toRaw, 12584 toRef: toRef, 12585 toRefs: toRefs, 12586 toValue: toValue, 12587 transformVNodeArgs: transformVNodeArgs, 12588 triggerRef: triggerRef, 12589 unref: unref, 12590 useAttrs: useAttrs, 12591 useCssModule: useCssModule, 12592 useCssVars: useCssVars, 12593 useHost: useHost, 12594 useId: useId, 12595 useModel: useModel, 12596 useSSRContext: useSSRContext, 12597 useShadowRoot: useShadowRoot, 12598 useSlots: useSlots, 12599 useTemplateRef: useTemplateRef, 12600 useTransitionState: useTransitionState, 12601 vModelCheckbox: vModelCheckbox, 12602 vModelDynamic: vModelDynamic, 12603 vModelRadio: vModelRadio, 12604 vModelSelect: vModelSelect, 12605 vModelText: vModelText, 12606 vShow: vShow, 12607 version: version, 12608 warn: warn, 12609 watch: watch, 12610 watchEffect: watchEffect, 12611 watchPostEffect: watchPostEffect, 12612 watchSyncEffect: watchSyncEffect, 12613 withAsyncContext: withAsyncContext, 12614 withCtx: withCtx, 12615 withDefaults: withDefaults, 12616 withDirectives: withDirectives, 12617 withKeys: withKeys, 12618 withMemo: withMemo, 12619 withModifiers: withModifiers,
vendor: 37,313 bytes, lines 12620-13972
12620 withScopeId: withScopeId 12621 }); 12622 12623 function initDev() { 12624 { 12625 { 12626 console.info( 12627 `You are running a development build of Vue. 12628Make sure to use the production build (*.prod.js) when deploying for production.` 12629 ); 12630 } 12631 initCustomFormatter(); 12632 } 12633 } 12634 12635 const FRAGMENT = Symbol(`Fragment` ); 12636 const TELEPORT = Symbol(`Teleport` ); 12637 const SUSPENSE = Symbol(`Suspense` ); 12638 const KEEP_ALIVE = Symbol(`KeepAlive` ); 12639 const BASE_TRANSITION = Symbol( 12640 `BaseTransition` 12641 ); 12642 const OPEN_BLOCK = Symbol(`openBlock` ); 12643 const CREATE_BLOCK = Symbol(`createBlock` ); 12644 const CREATE_ELEMENT_BLOCK = Symbol( 12645 `createElementBlock` 12646 ); 12647 const CREATE_VNODE = Symbol(`createVNode` ); 12648 const CREATE_ELEMENT_VNODE = Symbol( 12649 `createElementVNode` 12650 ); 12651 const CREATE_COMMENT = Symbol( 12652 `createCommentVNode` 12653 ); 12654 const CREATE_TEXT = Symbol( 12655 `createTextVNode` 12656 ); 12657 const CREATE_STATIC = Symbol( 12658 `createStaticVNode` 12659 ); 12660 const RESOLVE_COMPONENT = Symbol( 12661 `resolveComponent` 12662 ); 12663 const RESOLVE_DYNAMIC_COMPONENT = Symbol( 12664 `resolveDynamicComponent` 12665 ); 12666 const RESOLVE_DIRECTIVE = Symbol( 12667 `resolveDirective` 12668 ); 12669 const RESOLVE_FILTER = Symbol( 12670 `resolveFilter` 12671 ); 12672 const WITH_DIRECTIVES = Symbol( 12673 `withDirectives` 12674 ); 12675 const RENDER_LIST = Symbol(`renderList` ); 12676 const RENDER_SLOT = Symbol(`renderSlot` ); 12677 const CREATE_SLOTS = Symbol(`createSlots` ); 12678 const TO_DISPLAY_STRING = Symbol( 12679 `toDisplayString` 12680 ); 12681 const MERGE_PROPS = Symbol(`mergeProps` ); 12682 const NORMALIZE_CLASS = Symbol( 12683 `normalizeClass` 12684 ); 12685 const NORMALIZE_STYLE = Symbol( 12686 `normalizeStyle` 12687 ); 12688 const NORMALIZE_PROPS = Symbol( 12689 `normalizeProps` 12690 ); 12691 const GUARD_REACTIVE_PROPS = Symbol( 12692 `guardReactiveProps` 12693 ); 12694 const TO_HANDLERS = Symbol(`toHandlers` ); 12695 const CAMELIZE = Symbol(`camelize` ); 12696 const CAPITALIZE = Symbol(`capitalize` ); 12697 const TO_HANDLER_KEY = Symbol( 12698 `toHandlerKey` 12699 ); 12700 const SET_BLOCK_TRACKING = Symbol( 12701 `setBlockTracking` 12702 ); 12703 const PUSH_SCOPE_ID = Symbol(`pushScopeId` ); 12704 const POP_SCOPE_ID = Symbol(`popScopeId` ); 12705 const WITH_CTX = Symbol(`withCtx` ); 12706 const UNREF = Symbol(`unref` ); 12707 const IS_REF = Symbol(`isRef` ); 12708 const WITH_MEMO = Symbol(`withMemo` ); 12709 const IS_MEMO_SAME = Symbol(`isMemoSame` ); 12710 const helperNameMap = { 12711 [FRAGMENT]: `Fragment`, 12712 [TELEPORT]: `Teleport`, 12713 [SUSPENSE]: `Suspense`, 12714 [KEEP_ALIVE]: `KeepAlive`, 12715 [BASE_TRANSITION]: `BaseTransition`, 12716 [OPEN_BLOCK]: `openBlock`, 12717 [CREATE_BLOCK]: `createBlock`, 12718 [CREATE_ELEMENT_BLOCK]: `createElementBlock`, 12719 [CREATE_VNODE]: `createVNode`, 12720 [CREATE_ELEMENT_VNODE]: `createElementVNode`, 12721 [CREATE_COMMENT]: `createCommentVNode`, 12722 [CREATE_TEXT]: `createTextVNode`, 12723 [CREATE_STATIC]: `createStaticVNode`, 12724 [RESOLVE_COMPONENT]: `resolveComponent`, 12725 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`, 12726 [RESOLVE_DIRECTIVE]: `resolveDirective`, 12727 [RESOLVE_FILTER]: `resolveFilter`, 12728 [WITH_DIRECTIVES]: `withDirectives`, 12729 [RENDER_LIST]: `renderList`, 12730 [RENDER_SLOT]: `renderSlot`, 12731 [CREATE_SLOTS]: `createSlots`, 12732 [TO_DISPLAY_STRING]: `toDisplayString`, 12733 [MERGE_PROPS]: `mergeProps`, 12734 [NORMALIZE_CLASS]: `normalizeClass`, 12735 [NORMALIZE_STYLE]: `normalizeStyle`, 12736 [NORMALIZE_PROPS]: `normalizeProps`, 12737 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`, 12738 [TO_HANDLERS]: `toHandlers`, 12739 [CAMELIZE]: `camelize`, 12740 [CAPITALIZE]: `capitalize`, 12741 [TO_HANDLER_KEY]: `toHandlerKey`, 12742 [SET_BLOCK_TRACKING]: `setBlockTracking`, 12743 [PUSH_SCOPE_ID]: `pushScopeId`, 12744 [POP_SCOPE_ID]: `popScopeId`, 12745 [WITH_CTX]: `withCtx`, 12746 [UNREF]: `unref`, 12747 [IS_REF]: `isRef`, 12748 [WITH_MEMO]: `withMemo`, 12749 [IS_MEMO_SAME]: `isMemoSame` 12750 }; 12751 function registerRuntimeHelpers(helpers) { 12752 Object.getOwnPropertySymbols(helpers).forEach((s) => { 12753 helperNameMap[s] = helpers[s]; 12754 }); 12755 } 12756 12757 const locStub = { 12758 start: { line: 1, column: 1, offset: 0 }, 12759 end: { line: 1, column: 1, offset: 0 }, 12760 source: "" 12761 }; 12762 function createRoot(children, source = "") { 12763 return { 12764 type: 0, 12765 source, 12766 children, 12767 helpers: /* @__PURE__ */ new Set(), 12768 components: [], 12769 directives: [], 12770 hoists: [], 12771 imports: [], 12772 cached: [], 12773 temps: 0, 12774 codegenNode: void 0, 12775 loc: locStub 12776 }; 12777 } 12778 function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) { 12779 if (context) { 12780 if (isBlock) { 12781 context.helper(OPEN_BLOCK); 12782 context.helper(getVNodeBlockHelper(context.inSSR, isComponent)); 12783 } else { 12784 context.helper(getVNodeHelper(context.inSSR, isComponent)); 12785 } 12786 if (directives) { 12787 context.helper(WITH_DIRECTIVES); 12788 } 12789 } 12790 return { 12791 type: 13, 12792 tag, 12793 props, 12794 children, 12795 patchFlag, 12796 dynamicProps, 12797 directives, 12798 isBlock, 12799 disableTracking, 12800 isComponent, 12801 loc 12802 }; 12803 } 12804 function createArrayExpression(elements, loc = locStub) { 12805 return { 12806 type: 17, 12807 loc, 12808 elements 12809 }; 12810 } 12811 function createObjectExpression(properties, loc = locStub) { 12812 return { 12813 type: 15, 12814 loc, 12815 properties 12816 }; 12817 } 12818 function createObjectProperty(key, value) { 12819 return { 12820 type: 16, 12821 loc: locStub, 12822 key: isString(key) ? createSimpleExpression(key, true) : key, 12823 value 12824 }; 12825 } 12826 function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) { 12827 return { 12828 type: 4, 12829 loc, 12830 content, 12831 isStatic, 12832 constType: isStatic ? 3 : constType 12833 }; 12834 } 12835 function createCompoundExpression(children, loc = locStub) { 12836 return { 12837 type: 8, 12838 loc, 12839 children 12840 }; 12841 } 12842 function createCallExpression(callee, args = [], loc = locStub) { 12843 return { 12844 type: 14, 12845 loc, 12846 callee, 12847 arguments: args 12848 }; 12849 } 12850 function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) { 12851 return { 12852 type: 18, 12853 params, 12854 returns, 12855 newline, 12856 isSlot, 12857 loc 12858 }; 12859 } 12860 function createConditionalExpression(test, consequent, alternate, newline = true) { 12861 return { 12862 type: 19, 12863 test, 12864 consequent, 12865 alternate, 12866 newline, 12867 loc: locStub 12868 }; 12869 } 12870 function createCacheExpression(index, value, needPauseTracking = false) { 12871 return { 12872 type: 20, 12873 index, 12874 value, 12875 needPauseTracking, 12876 needArraySpread: false, 12877 loc: locStub 12878 }; 12879 } 12880 function createBlockStatement(body) { 12881 return { 12882 type: 21, 12883 body, 12884 loc: locStub 12885 }; 12886 } 12887 function getVNodeHelper(ssr, isComponent) { 12888 return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE; 12889 } 12890 function getVNodeBlockHelper(ssr, isComponent) { 12891 return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK; 12892 } 12893 function convertToBlock(node, { helper, removeHelper, inSSR }) { 12894 if (!node.isBlock) { 12895 node.isBlock = true; 12896 removeHelper(getVNodeHelper(inSSR, node.isComponent)); 12897 helper(OPEN_BLOCK); 12898 helper(getVNodeBlockHelper(inSSR, node.isComponent)); 12899 } 12900 } 12901 12902 const defaultDelimitersOpen = new Uint8Array([123, 123]); 12903 const defaultDelimitersClose = new Uint8Array([125, 125]); 12904 function isTagStartChar(c) { 12905 return c >= 97 && c <= 122 || c >= 65 && c <= 90; 12906 } 12907 function isWhitespace(c) { 12908 return c === 32 || c === 10 || c === 9 || c === 12 || c === 13; 12909 } 12910 function isEndOfTagSection(c) { 12911 return c === 47 || c === 62 || isWhitespace(c); 12912 } 12913 function toCharCodes(str) { 12914 const ret = new Uint8Array(str.length); 12915 for (let i = 0; i < str.length; i++) { 12916 ret[i] = str.charCodeAt(i); 12917 } 12918 return ret; 12919 } 12920 const Sequences = { 12921 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]), 12922 // CDATA[ 12923 CdataEnd: new Uint8Array([93, 93, 62]), 12924 // ]]> 12925 CommentEnd: new Uint8Array([45, 45, 62]), 12926 // `-->` 12927 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]), 12928 // `<\/script` 12929 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]), 12930 // `</style` 12931 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]), 12932 // `</title` 12933 TextareaEnd: new Uint8Array([ 12934 60, 12935 47, 12936 116, 12937 101, 12938 120, 12939 116, 12940 97, 12941 114, 12942 101, 12943 97 12944 ]) 12945 // `</textarea 12946 }; 12947 class Tokenizer { 12948 constructor(stack, cbs) { 12949 this.stack = stack; 12950 this.cbs = cbs; 12951 /** The current state the tokenizer is in. */ 12952 this.state = 1; 12953 /** The read buffer. */ 12954 this.buffer = ""; 12955 /** The beginning of the section that is currently being read. */ 12956 this.sectionStart = 0; 12957 /** The index within the buffer that we are currently looking at. */ 12958 this.index = 0; 12959 /** The start of the last entity. */ 12960 this.entityStart = 0; 12961 /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */ 12962 this.baseState = 1; 12963 /** For special parsing behavior inside of script and style tags. */ 12964 this.inRCDATA = false; 12965 /** For disabling RCDATA tags handling */ 12966 this.inXML = false; 12967 /** For disabling interpolation parsing in v-pre */ 12968 this.inVPre = false; 12969 /** Record newline positions for fast line / column calculation */ 12970 this.newlines = []; 12971 this.mode = 0; 12972 this.delimiterOpen = defaultDelimitersOpen; 12973 this.delimiterClose = defaultDelimitersClose; 12974 this.delimiterIndex = -1; 12975 this.currentSequence = void 0; 12976 this.sequenceIndex = 0; 12977 } 12978 get inSFCRoot() { 12979 return this.mode === 2 && this.stack.length === 0; 12980 } 12981 reset() { 12982 this.state = 1; 12983 this.mode = 0; 12984 this.buffer = ""; 12985 this.sectionStart = 0; 12986 this.index = 0; 12987 this.baseState = 1; 12988 this.inRCDATA = false; 12989 this.currentSequence = void 0; 12990 this.newlines.length = 0; 12991 this.delimiterOpen = defaultDelimitersOpen; 12992 this.delimiterClose = defaultDelimitersClose; 12993 } 12994 /** 12995 * Generate Position object with line / column information using recorded 12996 * newline positions. We know the index is always going to be an already 12997 * processed index, so all the newlines up to this index should have been 12998 * recorded. 12999 */ 13000 getPos(index) { 13001 let line = 1; 13002 let column = index + 1; 13003 for (let i = this.newlines.length - 1; i >= 0; i--) { 13004 const newlineIndex = this.newlines[i]; 13005 if (index > newlineIndex) { 13006 line = i + 2; 13007 column = index - newlineIndex; 13008 break; 13009 } 13010 } 13011 return { 13012 column, 13013 line, 13014 offset: index 13015 }; 13016 } 13017 peek() { 13018 return this.buffer.charCodeAt(this.index + 1); 13019 } 13020 stateText(c) { 13021 if (c === 60) { 13022 if (this.index > this.sectionStart) { 13023 this.cbs.ontext(this.sectionStart, this.index); 13024 } 13025 this.state = 5; 13026 this.sectionStart = this.index; 13027 } else if (!this.inVPre && c === this.delimiterOpen[0]) { 13028 this.state = 2; 13029 this.delimiterIndex = 0; 13030 this.stateInterpolationOpen(c); 13031 } 13032 } 13033 stateInterpolationOpen(c) { 13034 if (c === this.delimiterOpen[this.delimiterIndex]) { 13035 if (this.delimiterIndex === this.delimiterOpen.length - 1) { 13036 const start = this.index + 1 - this.delimiterOpen.length; 13037 if (start > this.sectionStart) { 13038 this.cbs.ontext(this.sectionStart, start); 13039 } 13040 this.state = 3; 13041 this.sectionStart = start; 13042 } else { 13043 this.delimiterIndex++; 13044 } 13045 } else if (this.inRCDATA) { 13046 this.state = 32; 13047 this.stateInRCDATA(c); 13048 } else { 13049 this.state = 1; 13050 this.stateText(c); 13051 } 13052 } 13053 stateInterpolation(c) { 13054 if (c === this.delimiterClose[0]) { 13055 this.state = 4; 13056 this.delimiterIndex = 0; 13057 this.stateInterpolationClose(c); 13058 } 13059 } 13060 stateInterpolationClose(c) { 13061 if (c === this.delimiterClose[this.delimiterIndex]) { 13062 if (this.delimiterIndex === this.delimiterClose.length - 1) { 13063 this.cbs.oninterpolation(this.sectionStart, this.index + 1); 13064 if (this.inRCDATA) { 13065 this.state = 32; 13066 } else { 13067 this.state = 1; 13068 } 13069 this.sectionStart = this.index + 1; 13070 } else { 13071 this.delimiterIndex++; 13072 } 13073 } else { 13074 this.state = 3; 13075 this.stateInterpolation(c); 13076 } 13077 } 13078 stateSpecialStartSequence(c) { 13079 const isEnd = this.sequenceIndex === this.currentSequence.length; 13080 const isMatch = isEnd ? ( 13081 // If we are at the end of the sequence, make sure the tag name has ended 13082 isEndOfTagSection(c) 13083 ) : ( 13084 // Otherwise, do a case-insensitive comparison 13085 (c | 32) === this.currentSequence[this.sequenceIndex] 13086 ); 13087 if (!isMatch) { 13088 this.inRCDATA = false; 13089 } else if (!isEnd) { 13090 this.sequenceIndex++; 13091 return; 13092 } 13093 this.sequenceIndex = 0; 13094 this.state = 6; 13095 this.stateInTagName(c); 13096 } 13097 /** Look for an end tag. For <title> and <textarea>, also decode entities. */ 13098 stateInRCDATA(c) { 13099 if (this.sequenceIndex === this.currentSequence.length) { 13100 if (c === 62 || isWhitespace(c)) { 13101 const endOfText = this.index - this.currentSequence.length; 13102 if (this.sectionStart < endOfText) { 13103 const actualIndex = this.index; 13104 this.index = endOfText; 13105 this.cbs.ontext(this.sectionStart, endOfText); 13106 this.index = actualIndex; 13107 } 13108 this.sectionStart = endOfText + 2; 13109 this.stateInClosingTagName(c); 13110 this.inRCDATA = false; 13111 return; 13112 } 13113 this.sequenceIndex = 0; 13114 } 13115 if ((c | 32) === this.currentSequence[this.sequenceIndex]) { 13116 this.sequenceIndex += 1; 13117 } else if (this.sequenceIndex === 0) { 13118 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) { 13119 if (c === this.delimiterOpen[0]) { 13120 this.state = 2; 13121 this.delimiterIndex = 0; 13122 this.stateInterpolationOpen(c); 13123 } 13124 } else if (this.fastForwardTo(60)) { 13125 this.sequenceIndex = 1; 13126 } 13127 } else { 13128 this.sequenceIndex = Number(c === 60); 13129 } 13130 } 13131 stateCDATASequence(c) { 13132 if (c === Sequences.Cdata[this.sequenceIndex]) { 13133 if (++this.sequenceIndex === Sequences.Cdata.length) { 13134 this.state = 28; 13135 this.currentSequence = Sequences.CdataEnd; 13136 this.sequenceIndex = 0; 13137 this.sectionStart = this.index + 1; 13138 } 13139 } else { 13140 this.sequenceIndex = 0; 13141 this.state = 23; 13142 this.stateInDeclaration(c); 13143 } 13144 } 13145 /** 13146 * When we wait for one specific character, we can speed things up 13147 * by skipping through the buffer until we find it. 13148 * 13149 * @returns Whether the character was found. 13150 */ 13151 fastForwardTo(c) { 13152 while (++this.index < this.buffer.length) { 13153 const cc = this.buffer.charCodeAt(this.index); 13154 if (cc === 10) { 13155 this.newlines.push(this.index); 13156 } 13157 if (cc === c) { 13158 return true; 13159 } 13160 } 13161 this.index = this.buffer.length - 1; 13162 return false; 13163 } 13164 /** 13165 * Comments and CDATA end with `-->` and `]]>`. 13166 * 13167 * Their common qualities are: 13168 * - Their end sequences have a distinct character they start with. 13169 * - That character is then repeated, so we have to check multiple repeats. 13170 * - All characters but the start character of the sequence can be skipped. 13171 */ 13172 stateInCommentLike(c) { 13173 if (c === this.currentSequence[this.sequenceIndex]) { 13174 if (++this.sequenceIndex === this.currentSequence.length) { 13175 if (this.currentSequence === Sequences.CdataEnd) { 13176 this.cbs.oncdata(this.sectionStart, this.index - 2); 13177 } else { 13178 this.cbs.oncomment(this.sectionStart, this.index - 2); 13179 } 13180 this.sequenceIndex = 0; 13181 this.sectionStart = this.index + 1; 13182 this.state = 1; 13183 } 13184 } else if (this.sequenceIndex === 0) { 13185 if (this.fastForwardTo(this.currentSequence[0])) { 13186 this.sequenceIndex = 1; 13187 } 13188 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) { 13189 this.sequenceIndex = 0; 13190 } 13191 } 13192 startSpecial(sequence, offset) { 13193 this.enterRCDATA(sequence, offset); 13194 this.state = 31; 13195 } 13196 enterRCDATA(sequence, offset) { 13197 this.inRCDATA = true; 13198 this.currentSequence = sequence; 13199 this.sequenceIndex = offset; 13200 } 13201 stateBeforeTagName(c) { 13202 if (c === 33) { 13203 this.state = 22; 13204 this.sectionStart = this.index + 1; 13205 } else if (c === 63) { 13206 this.state = 24; 13207 this.sectionStart = this.index + 1; 13208 } else if (isTagStartChar(c)) { 13209 this.sectionStart = this.index; 13210 if (this.mode === 0) { 13211 this.state = 6; 13212 } else if (this.inSFCRoot) { 13213 this.state = 34; 13214 } else if (!this.inXML) { 13215 if (c === 116) { 13216 this.state = 30; 13217 } else { 13218 this.state = c === 115 ? 29 : 6; 13219 } 13220 } else { 13221 this.state = 6; 13222 } 13223 } else if (c === 47) { 13224 this.state = 8; 13225 } else { 13226 this.state = 1; 13227 this.stateText(c); 13228 } 13229 } 13230 stateInTagName(c) { 13231 if (isEndOfTagSection(c)) { 13232 this.handleTagName(c); 13233 } 13234 } 13235 stateInSFCRootTagName(c) { 13236 if (isEndOfTagSection(c)) { 13237 const tag = this.buffer.slice(this.sectionStart, this.index); 13238 if (tag !== "template") { 13239 this.enterRCDATA(toCharCodes(`</` + tag), 0); 13240 } 13241 this.handleTagName(c); 13242 } 13243 } 13244 handleTagName(c) { 13245 this.cbs.onopentagname(this.sectionStart, this.index); 13246 this.sectionStart = -1; 13247 this.state = 11; 13248 this.stateBeforeAttrName(c); 13249 } 13250 stateBeforeClosingTagName(c) { 13251 if (isWhitespace(c)) ; else if (c === 62) { 13252 { 13253 this.cbs.onerr(14, this.index); 13254 } 13255 this.state = 1; 13256 this.sectionStart = this.index + 1; 13257 } else { 13258 this.state = isTagStartChar(c) ? 9 : 27; 13259 this.sectionStart = this.index; 13260 } 13261 } 13262 stateInClosingTagName(c) { 13263 if (c === 62 || isWhitespace(c)) { 13264 this.cbs.onclosetag(this.sectionStart, this.index); 13265 this.sectionStart = -1; 13266 this.state = 10; 13267 this.stateAfterClosingTagName(c); 13268 } 13269 } 13270 stateAfterClosingTagName(c) { 13271 if (c === 62) { 13272 this.state = 1; 13273 this.sectionStart = this.index + 1; 13274 } 13275 } 13276 stateBeforeAttrName(c) { 13277 if (c === 62) { 13278 this.cbs.onopentagend(this.index); 13279 if (this.inRCDATA) { 13280 this.state = 32; 13281 } else { 13282 this.state = 1; 13283 } 13284 this.sectionStart = this.index + 1; 13285 } else if (c === 47) { 13286 this.state = 7; 13287 if (this.peek() !== 62) { 13288 this.cbs.onerr(22, this.index); 13289 } 13290 } else if (c === 60 && this.peek() === 47) { 13291 this.cbs.onopentagend(this.index); 13292 this.state = 5; 13293 this.sectionStart = this.index; 13294 } else if (!isWhitespace(c)) { 13295 if (c === 61) { 13296 this.cbs.onerr( 13297 19, 13298 this.index 13299 ); 13300 } 13301 this.handleAttrStart(c); 13302 } 13303 } 13304 handleAttrStart(c) { 13305 if (c === 118 && this.peek() === 45) { 13306 this.state = 13; 13307 this.sectionStart = this.index; 13308 } else if (c === 46 || c === 58 || c === 64 || c === 35) { 13309 this.cbs.ondirname(this.index, this.index + 1); 13310 this.state = 14; 13311 this.sectionStart = this.index + 1; 13312 } else { 13313 this.state = 12; 13314 this.sectionStart = this.index; 13315 } 13316 } 13317 stateInSelfClosingTag(c) { 13318 if (c === 62) { 13319 this.cbs.onselfclosingtag(this.index); 13320 this.state = 1; 13321 this.sectionStart = this.index + 1; 13322 this.inRCDATA = false; 13323 } else if (!isWhitespace(c)) { 13324 this.state = 11; 13325 this.stateBeforeAttrName(c); 13326 } 13327 } 13328 stateInAttrName(c) { 13329 if (c === 61 || isEndOfTagSection(c)) { 13330 this.cbs.onattribname(this.sectionStart, this.index); 13331 this.handleAttrNameEnd(c); 13332 } else if (c === 34 || c === 39 || c === 60) { 13333 this.cbs.onerr( 13334 17, 13335 this.index 13336 ); 13337 } 13338 } 13339 stateInDirName(c) { 13340 if (c === 61 || isEndOfTagSection(c)) { 13341 this.cbs.ondirname(this.sectionStart, this.index); 13342 this.handleAttrNameEnd(c); 13343 } else if (c === 58) { 13344 this.cbs.ondirname(this.sectionStart, this.index); 13345 this.state = 14; 13346 this.sectionStart = this.index + 1; 13347 } else if (c === 46) { 13348 this.cbs.ondirname(this.sectionStart, this.index); 13349 this.state = 16; 13350 this.sectionStart = this.index + 1; 13351 } 13352 } 13353 stateInDirArg(c) { 13354 if (c === 61 || isEndOfTagSection(c)) { 13355 this.cbs.ondirarg(this.sectionStart, this.index); 13356 this.handleAttrNameEnd(c); 13357 } else if (c === 91) { 13358 this.state = 15; 13359 } else if (c === 46) { 13360 this.cbs.ondirarg(this.sectionStart, this.index); 13361 this.state = 16; 13362 this.sectionStart = this.index + 1; 13363 } 13364 } 13365 stateInDynamicDirArg(c) { 13366 if (c === 93) { 13367 this.state = 14; 13368 } else if (c === 61 || isEndOfTagSection(c)) { 13369 this.cbs.ondirarg(this.sectionStart, this.index + 1); 13370 this.handleAttrNameEnd(c); 13371 { 13372 this.cbs.onerr( 13373 27, 13374 this.index 13375 ); 13376 } 13377 } 13378 } 13379 stateInDirModifier(c) { 13380 if (c === 61 || isEndOfTagSection(c)) { 13381 this.cbs.ondirmodifier(this.sectionStart, this.index); 13382 this.handleAttrNameEnd(c); 13383 } else if (c === 46) { 13384 this.cbs.ondirmodifier(this.sectionStart, this.index); 13385 this.sectionStart = this.index + 1; 13386 } 13387 } 13388 handleAttrNameEnd(c) { 13389 this.sectionStart = this.index; 13390 this.state = 17; 13391 this.cbs.onattribnameend(this.index); 13392 this.stateAfterAttrName(c); 13393 } 13394 stateAfterAttrName(c) { 13395 if (c === 61) { 13396 this.state = 18; 13397 } else if (c === 47 || c === 62) { 13398 this.cbs.onattribend(0, this.sectionStart); 13399 this.sectionStart = -1; 13400 this.state = 11; 13401 this.stateBeforeAttrName(c); 13402 } else if (!isWhitespace(c)) { 13403 this.cbs.onattribend(0, this.sectionStart); 13404 this.handleAttrStart(c); 13405 } 13406 } 13407 stateBeforeAttrValue(c) { 13408 if (c === 34) { 13409 this.state = 19; 13410 this.sectionStart = this.index + 1; 13411 } else if (c === 39) { 13412 this.state = 20; 13413 this.sectionStart = this.index + 1; 13414 } else if (!isWhitespace(c)) { 13415 this.sectionStart = this.index; 13416 this.state = 21; 13417 this.stateInAttrValueNoQuotes(c); 13418 } 13419 } 13420 handleInAttrValue(c, quote) { 13421 if (c === quote || this.fastForwardTo(quote)) { 13422 this.cbs.onattribdata(this.sectionStart, this.index); 13423 this.sectionStart = -1; 13424 this.cbs.onattribend( 13425 quote === 34 ? 3 : 2, 13426 this.index + 1 13427 ); 13428 this.state = 11; 13429 } 13430 } 13431 stateInAttrValueDoubleQuotes(c) { 13432 this.handleInAttrValue(c, 34); 13433 } 13434 stateInAttrValueSingleQuotes(c) { 13435 this.handleInAttrValue(c, 39); 13436 } 13437 stateInAttrValueNoQuotes(c) { 13438 if (isWhitespace(c) || c === 62) { 13439 this.cbs.onattribdata(this.sectionStart, this.index); 13440 this.sectionStart = -1; 13441 this.cbs.onattribend(1, this.index); 13442 this.state = 11; 13443 this.stateBeforeAttrName(c); 13444 } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) { 13445 this.cbs.onerr( 13446 18, 13447 this.index 13448 ); 13449 } 13450 } 13451 stateBeforeDeclaration(c) { 13452 if (c === 91) { 13453 this.state = 26; 13454 this.sequenceIndex = 0; 13455 } else { 13456 this.state = c === 45 ? 25 : 23; 13457 } 13458 } 13459 stateInDeclaration(c) { 13460 if (c === 62 || this.fastForwardTo(62)) { 13461 this.state = 1; 13462 this.sectionStart = this.index + 1; 13463 } 13464 } 13465 stateInProcessingInstruction(c) { 13466 if (c === 62 || this.fastForwardTo(62)) { 13467 this.cbs.onprocessinginstruction(this.sectionStart, this.index); 13468 this.state = 1; 13469 this.sectionStart = this.index + 1; 13470 } 13471 } 13472 stateBeforeComment(c) { 13473 if (c === 45) { 13474 this.state = 28; 13475 this.currentSequence = Sequences.CommentEnd; 13476 this.sequenceIndex = 2; 13477 this.sectionStart = this.index + 1; 13478 } else { 13479 this.state = 23; 13480 } 13481 } 13482 stateInSpecialComment(c) { 13483 if (c === 62 || this.fastForwardTo(62)) { 13484 this.cbs.oncomment(this.sectionStart, this.index); 13485 this.state = 1; 13486 this.sectionStart = this.index + 1; 13487 } 13488 } 13489 stateBeforeSpecialS(c) { 13490 if (c === Sequences.ScriptEnd[3]) { 13491 this.startSpecial(Sequences.ScriptEnd, 4); 13492 } else if (c === Sequences.StyleEnd[3]) { 13493 this.startSpecial(Sequences.StyleEnd, 4); 13494 } else { 13495 this.state = 6; 13496 this.stateInTagName(c); 13497 } 13498 } 13499 stateBeforeSpecialT(c) { 13500 if (c === Sequences.TitleEnd[3]) { 13501 this.startSpecial(Sequences.TitleEnd, 4); 13502 } else if (c === Sequences.TextareaEnd[3]) { 13503 this.startSpecial(Sequences.TextareaEnd, 4); 13504 } else { 13505 this.state = 6; 13506 this.stateInTagName(c); 13507 } 13508 } 13509 startEntity() { 13510 } 13511 stateInEntity() { 13512 } 13513 /** 13514 * Iterates through the buffer, calling the function corresponding to the current state. 13515 * 13516 * States that are more likely to be hit are higher up, as a performance improvement. 13517 */ 13518 parse(input) { 13519 this.buffer = input; 13520 while (this.index < this.buffer.length) { 13521 const c = this.buffer.charCodeAt(this.index); 13522 if (c === 10) { 13523 this.newlines.push(this.index); 13524 } 13525 switch (this.state) { 13526 case 1: { 13527 this.stateText(c); 13528 break; 13529 } 13530 case 2: { 13531 this.stateInterpolationOpen(c); 13532 break; 13533 } 13534 case 3: { 13535 this.stateInterpolation(c); 13536 break; 13537 } 13538 case 4: { 13539 this.stateInterpolationClose(c); 13540 break; 13541 } 13542 case 31: { 13543 this.stateSpecialStartSequence(c); 13544 break; 13545 } 13546 case 32: { 13547 this.stateInRCDATA(c); 13548 break; 13549 } 13550 case 26: { 13551 this.stateCDATASequence(c); 13552 break; 13553 } 13554 case 19: { 13555 this.stateInAttrValueDoubleQuotes(c); 13556 break; 13557 } 13558 case 12: { 13559 this.stateInAttrName(c); 13560 break; 13561 } 13562 case 13: { 13563 this.stateInDirName(c); 13564 break; 13565 } 13566 case 14: { 13567 this.stateInDirArg(c); 13568 break; 13569 } 13570 case 15: { 13571 this.stateInDynamicDirArg(c); 13572 break; 13573 } 13574 case 16: { 13575 this.stateInDirModifier(c); 13576 break; 13577 } 13578 case 28: { 13579 this.stateInCommentLike(c); 13580 break; 13581 } 13582 case 27: { 13583 this.stateInSpecialComment(c); 13584 break; 13585 } 13586 case 11: { 13587 this.stateBeforeAttrName(c); 13588 break; 13589 } 13590 case 6: { 13591 this.stateInTagName(c); 13592 break; 13593 } 13594 case 34: { 13595 this.stateInSFCRootTagName(c); 13596 break; 13597 } 13598 case 9: { 13599 this.stateInClosingTagName(c); 13600 break; 13601 } 13602 case 5: { 13603 this.stateBeforeTagName(c); 13604 break; 13605 } 13606 case 17: { 13607 this.stateAfterAttrName(c); 13608 break; 13609 } 13610 case 20: { 13611 this.stateInAttrValueSingleQuotes(c); 13612 break; 13613 } 13614 case 18: { 13615 this.stateBeforeAttrValue(c); 13616 break; 13617 } 13618 case 8: { 13619 this.stateBeforeClosingTagName(c); 13620 break; 13621 } 13622 case 10: { 13623 this.stateAfterClosingTagName(c); 13624 break; 13625 } 13626 case 29: { 13627 this.stateBeforeSpecialS(c); 13628 break; 13629 } 13630 case 30: { 13631 this.stateBeforeSpecialT(c); 13632 break; 13633 } 13634 case 21: { 13635 this.stateInAttrValueNoQuotes(c); 13636 break; 13637 } 13638 case 7: { 13639 this.stateInSelfClosingTag(c); 13640 break; 13641 } 13642 case 23: { 13643 this.stateInDeclaration(c); 13644 break; 13645 } 13646 case 22: { 13647 this.stateBeforeDeclaration(c); 13648 break; 13649 } 13650 case 25: { 13651 this.stateBeforeComment(c); 13652 break; 13653 } 13654 case 24: { 13655 this.stateInProcessingInstruction(c); 13656 break; 13657 } 13658 case 33: { 13659 this.stateInEntity(); 13660 break; 13661 } 13662 } 13663 this.index++; 13664 } 13665 this.cleanup(); 13666 this.finish(); 13667 } 13668 /** 13669 * Remove data that has already been consumed from the buffer. 13670 */ 13671 cleanup() { 13672 if (this.sectionStart !== this.index) { 13673 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) { 13674 this.cbs.ontext(this.sectionStart, this.index); 13675 this.sectionStart = this.index; 13676 } else if (this.state === 19 || this.state === 20 || this.state === 21) { 13677 this.cbs.onattribdata(this.sectionStart, this.index); 13678 this.sectionStart = this.index; 13679 } 13680 } 13681 } 13682 finish() { 13683 this.handleTrailingData(); 13684 this.cbs.onend(); 13685 } 13686 /** Handle any trailing data. */ 13687 handleTrailingData() { 13688 const endIndex = this.buffer.length; 13689 if (this.sectionStart >= endIndex) { 13690 return; 13691 } 13692 if (this.state === 28) { 13693 if (this.currentSequence === Sequences.CdataEnd) { 13694 this.cbs.oncdata(this.sectionStart, endIndex); 13695 } else { 13696 this.cbs.oncomment(this.sectionStart, endIndex); 13697 } 13698 } 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 { 13699 this.cbs.ontext(this.sectionStart, endIndex); 13700 } 13701 } 13702 emitCodePoint(cp, consumed) { 13703 } 13704 } 13705 13706 function defaultOnError(error) { 13707 throw error; 13708 } 13709 function defaultOnWarn(msg) { 13710 console.warn(`[Vue warn] ${msg.message}`); 13711 } 13712 function createCompilerError(code, loc, messages, additionalMessage) { 13713 const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ; 13714 const error = new SyntaxError(String(msg)); 13715 error.code = code; 13716 error.loc = loc; 13717 return error; 13718 } 13719 const errorMessages = { 13720 // parse errors 13721 [0]: "Illegal comment.", 13722 [1]: "CDATA section is allowed only in XML context.", 13723 [2]: "Duplicate attribute.", 13724 [3]: "End tag cannot have attributes.", 13725 [4]: "Illegal '/' in tags.", 13726 [5]: "Unexpected EOF in tag.", 13727 [6]: "Unexpected EOF in CDATA section.", 13728 [7]: "Unexpected EOF in comment.", 13729 [8]: "Unexpected EOF in script.", 13730 [9]: "Unexpected EOF in tag.", 13731 [10]: "Incorrectly closed comment.", 13732 [11]: "Incorrectly opened comment.", 13733 [12]: "Illegal tag name. Use '<' to print '<'.", 13734 [13]: "Attribute value was expected.", 13735 [14]: "End tag name was expected.", 13736 [15]: "Whitespace was expected.", 13737 [16]: "Unexpected '<!--' in comment.", 13738 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`, 13739 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).", 13740 [19]: "Attribute name cannot start with '='.", 13741 [21]: "'<?' is allowed only in XML context.", 13742 [20]: `Unexpected null character.`, 13743 [22]: "Illegal '/' in tags.", 13744 // Vue-specific parse errors 13745 [23]: "Invalid end tag.", 13746 [24]: "Element is missing end tag.", 13747 [25]: "Interpolation end sign was not found.", 13748 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.", 13749 [26]: "Legal directive name was expected.", 13750 // transform errors 13751 [28]: `v-if/v-else-if is missing expression.`, 13752 [29]: `v-if/else branches must use unique keys.`, 13753 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`, 13754 [31]: `v-for is missing expression.`, 13755 [32]: `v-for has invalid expression.`, 13756 [33]: `<template v-for> key should be placed on the <template> tag.`, 13757 [34]: `v-bind is missing expression.`, 13758 [52]: `v-bind with same-name shorthand only allows static argument.`, 13759 [35]: `v-on is missing expression.`, 13760 [36]: `Unexpected custom directive on <slot> outlet.`, 13761 [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.`, 13762 [38]: `Duplicate slot names found. `, 13763 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`, 13764 [40]: `v-slot can only be used on components or <template> tags.`, 13765 [41]: `v-model is missing expression.`, 13766 [42]: `v-model value must be a valid JavaScript member expression.`, 13767 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`, 13768 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable. 13769Use a v-bind binding combined with a v-on listener that emits update:x event instead.`, 13770 [45]: `Error parsing JavaScript expression: `, 13771 [46]: `<KeepAlive> expects exactly one child component.`, 13772 [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.`, 13773 // generic errors 13774 [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`, 13775 [48]: `ES module mode is not supported in this build of compiler.`, 13776 [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`, 13777 [50]: `"scopeId" option is only supported in module mode.`, 13778 // just to fulfill types 13779 [53]: `` 13780 }; 13781 13782 const isStaticExp = (p) => p.type === 4 && p.isStatic; 13783 function isCoreComponent(tag) { 13784 switch (tag) { 13785 case "Teleport": 13786 case "teleport": 13787 return TELEPORT; 13788 case "Suspense": 13789 case "suspense": 13790 return SUSPENSE; 13791 case "KeepAlive": 13792 case "keep-alive": 13793 return KEEP_ALIVE; 13794 case "BaseTransition": 13795 case "base-transition": 13796 return BASE_TRANSITION; 13797 } 13798 } 13799 const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/; 13800 const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name); 13801 const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/; 13802 const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/; 13803 const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g; 13804 const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source; 13805 const isMemberExpressionBrowser = (exp) => { 13806 const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim()); 13807 let state = 0 /* inMemberExp */; 13808 let stateStack = []; 13809 let currentOpenBracketCount = 0; 13810 let currentOpenParensCount = 0; 13811 let currentStringType = null; 13812 for (let i = 0; i < path.length; i++) { 13813 const char = path.charAt(i); 13814 switch (state) { 13815 case 0 /* inMemberExp */: 13816 if (char === "[") { 13817 stateStack.push(state); 13818 state = 1 /* inBrackets */; 13819 currentOpenBracketCount++; 13820 } else if (char === "(") { 13821 stateStack.push(state); 13822 state = 2 /* inParens */; 13823 currentOpenParensCount++; 13824 } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) { 13825 return false; 13826 } 13827 break; 13828 case 1 /* inBrackets */: 13829 if (char === `'` || char === `"` || char === "`") { 13830 stateStack.push(state); 13831 state = 3 /* inString */; 13832 currentStringType = char; 13833 } else if (char === `[`) { 13834 currentOpenBracketCount++; 13835 } else if (char === `]`) { 13836 if (!--currentOpenBracketCount) { 13837 state = stateStack.pop(); 13838 } 13839 } 13840 break; 13841 case 2 /* inParens */: 13842 if (char === `'` || char === `"` || char === "`") { 13843 stateStack.push(state); 13844 state = 3 /* inString */; 13845 currentStringType = char; 13846 } else if (char === `(`) { 13847 currentOpenParensCount++; 13848 } else if (char === `)`) { 13849 if (i === path.length - 1) { 13850 return false; 13851 } 13852 if (!--currentOpenParensCount) { 13853 state = stateStack.pop(); 13854 } 13855 } 13856 break; 13857 case 3 /* inString */: 13858 if (char === currentStringType) { 13859 state = stateStack.pop(); 13860 currentStringType = null; 13861 } 13862 break; 13863 } 13864 } 13865 return !currentOpenBracketCount && !currentOpenParensCount; 13866 }; 13867 const isMemberExpression = isMemberExpressionBrowser ; 13868 const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/; 13869 const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp)); 13870 const isFnExpression = isFnExpressionBrowser ; 13871 function assert(condition, msg) { 13872 if (!condition) { 13873 throw new Error(msg || `unexpected compiler condition`); 13874 } 13875 } 13876 function findDir(node, name, allowEmpty = false) { 13877 for (let i = 0; i < node.props.length; i++) { 13878 const p = node.props[i]; 13879 if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) { 13880 return p; 13881 } 13882 } 13883 } 13884 function findProp(node, name, dynamicOnly = false, allowEmpty = false) { 13885 for (let i = 0; i < node.props.length; i++) { 13886 const p = node.props[i]; 13887 if (p.type === 6) { 13888 if (dynamicOnly) continue; 13889 if (p.name === name && (p.value || allowEmpty)) { 13890 return p; 13891 } 13892 } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) { 13893 return p; 13894 } 13895 } 13896 } 13897 function isStaticArgOf(arg, name) { 13898 return !!(arg && isStaticExp(arg) && arg.content === name); 13899 } 13900 function hasDynamicKeyVBind(node) { 13901 return node.props.some( 13902 (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj" 13903 p.arg.type !== 4 || // v-bind:[_ctx.foo] 13904 !p.arg.isStatic) 13905 // v-bind:[foo] 13906 ); 13907 } 13908 function isText$1(node) { 13909 return node.type === 5 || node.type === 2; 13910 } 13911 function isVSlot(p) { 13912 return p.type === 7 && p.name === "slot"; 13913 } 13914 function isTemplateNode(node) { 13915 return node.type === 1 && node.tagType === 3; 13916 } 13917 function isSlotOutlet(node) { 13918 return node.type === 1 && node.tagType === 2; 13919 } 13920 const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]); 13921 function getUnnormalizedProps(props, callPath = []) { 13922 if (props && !isString(props) && props.type === 14) { 13923 const callee = props.callee; 13924 if (!isString(callee) && propsHelperSet.has(callee)) { 13925 return getUnnormalizedProps( 13926 props.arguments[0], 13927 callPath.concat(props) 13928 ); 13929 } 13930 } 13931 return [props, callPath]; 13932 } 13933 function injectProp(node, prop, context) { 13934 let propsWithInjection; 13935 let props = node.type === 13 ? node.props : node.arguments[2]; 13936 let callPath = []; 13937 let parentCall; 13938 if (props && !isString(props) && props.type === 14) { 13939 const ret = getUnnormalizedProps(props); 13940 props = ret[0]; 13941 callPath = ret[1]; 13942 parentCall = callPath[callPath.length - 1]; 13943 } 13944 if (props == null || isString(props)) { 13945 propsWithInjection = createObjectExpression([prop]); 13946 } else if (props.type === 14) { 13947 const first = props.arguments[0]; 13948 if (!isString(first) && first.type === 15) { 13949 if (!hasProp(prop, first)) { 13950 first.properties.unshift(prop); 13951 } 13952 } else { 13953 if (props.callee === TO_HANDLERS) { 13954 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 13955 createObjectExpression([prop]), 13956 props 13957 ]); 13958 } else { 13959 props.arguments.unshift(createObjectExpression([prop])); 13960 } 13961 } 13962 !propsWithInjection && (propsWithInjection = props); 13963 } else if (props.type === 15) { 13964 if (!hasProp(prop, props)) { 13965 props.properties.unshift(prop); 13966 } 13967 propsWithInjection = props; 13968 } else { 13969 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 13970 createObjectExpression([prop]), 13971 props 13972 ]);
vendor: 5,507 bytes, lines 13973-14189
13973 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) { 13974 parentCall = callPath[callPath.length - 2]; 13975 } 13976 } 13977 if (node.type === 13) { 13978 if (parentCall) { 13979 parentCall.arguments[0] = propsWithInjection; 13980 } else { 13981 node.props = propsWithInjection; 13982 } 13983 } else { 13984 if (parentCall) { 13985 parentCall.arguments[0] = propsWithInjection; 13986 } else { 13987 node.arguments[2] = propsWithInjection; 13988 } 13989 } 13990 } 13991 function hasProp(prop, props) { 13992 let result = false; 13993 if (prop.key.type === 4) { 13994 const propKeyName = prop.key.content; 13995 result = props.properties.some( 13996 (p) => p.key.type === 4 && p.key.content === propKeyName 13997 ); 13998 } 13999 return result; 14000 } 14001 function toValidAssetId(name, type) { 14002 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => { 14003 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString(); 14004 })}`; 14005 } 14006 function getMemoedVNodeCall(node) { 14007 if (node.type === 14 && node.callee === WITH_MEMO) { 14008 return node.arguments[1].returns; 14009 } else { 14010 return node; 14011 } 14012 } 14013 const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/; 14014 14015 const defaultParserOptions = { 14016 parseMode: "base", 14017 ns: 0, 14018 delimiters: [`{{`, `}}`], 14019 getNamespace: () => 0, 14020 isVoidTag: NO, 14021 isPreTag: NO, 14022 isCustomElement: NO, 14023 onError: defaultOnError, 14024 onWarn: defaultOnWarn, 14025 comments: true, 14026 prefixIdentifiers: false 14027 }; 14028 let currentOptions = defaultParserOptions; 14029 let currentRoot = null; 14030 let currentInput = ""; 14031 let currentOpenTag = null; 14032 let currentProp = null; 14033 let currentAttrValue = ""; 14034 let currentAttrStartIndex = -1; 14035 let currentAttrEndIndex = -1; 14036 let inPre = 0; 14037 let inVPre = false; 14038 let currentVPreBoundary = null; 14039 const stack = []; 14040 const tokenizer = new Tokenizer(stack, { 14041 onerr: emitError, 14042 ontext(start, end) { 14043 onText(getSlice(start, end), start, end); 14044 }, 14045 ontextentity(char, start, end) { 14046 onText(char, start, end); 14047 }, 14048 oninterpolation(start, end) { 14049 if (inVPre) { 14050 return onText(getSlice(start, end), start, end); 14051 } 14052 let innerStart = start + tokenizer.delimiterOpen.length; 14053 let innerEnd = end - tokenizer.delimiterClose.length; 14054 while (isWhitespace(currentInput.charCodeAt(innerStart))) { 14055 innerStart++; 14056 } 14057 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) { 14058 innerEnd--; 14059 } 14060 let exp = getSlice(innerStart, innerEnd); 14061 if (exp.includes("&")) { 14062 { 14063 exp = currentOptions.decodeEntities(exp, false); 14064 } 14065 } 14066 addNode({ 14067 type: 5, 14068 content: createExp(exp, false, getLoc(innerStart, innerEnd)), 14069 loc: getLoc(start, end) 14070 }); 14071 }, 14072 onopentagname(start, end) { 14073 const name = getSlice(start, end); 14074 currentOpenTag = { 14075 type: 1, 14076 tag: name, 14077 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns), 14078 tagType: 0, 14079 // will be refined on tag close 14080 props: [], 14081 children: [], 14082 loc: getLoc(start - 1, end), 14083 codegenNode: void 0 14084 }; 14085 }, 14086 onopentagend(end) { 14087 endOpenTag(end); 14088 }, 14089 onclosetag(start, end) { 14090 const name = getSlice(start, end); 14091 if (!currentOptions.isVoidTag(name)) { 14092 let found = false; 14093 for (let i = 0; i < stack.length; i++) { 14094 const e = stack[i]; 14095 if (e.tag.toLowerCase() === name.toLowerCase()) { 14096 found = true; 14097 if (i > 0) { 14098 emitError(24, stack[0].loc.start.offset); 14099 } 14100 for (let j = 0; j <= i; j++) { 14101 const el = stack.shift(); 14102 onCloseTag(el, end, j < i); 14103 } 14104 break; 14105 } 14106 } 14107 if (!found) { 14108 emitError(23, backTrack(start, 60)); 14109 } 14110 } 14111 }, 14112 onselfclosingtag(end) { 14113 const name = currentOpenTag.tag; 14114 currentOpenTag.isSelfClosing = true; 14115 endOpenTag(end); 14116 if (stack[0] && stack[0].tag === name) { 14117 onCloseTag(stack.shift(), end); 14118 } 14119 }, 14120 onattribname(start, end) { 14121 currentProp = { 14122 type: 6, 14123 name: getSlice(start, end), 14124 nameLoc: getLoc(start, end), 14125 value: void 0, 14126 loc: getLoc(start) 14127 }; 14128 }, 14129 ondirname(start, end) { 14130 const raw = getSlice(start, end); 14131 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2); 14132 if (!inVPre && name === "") { 14133 emitError(26, start); 14134 } 14135 if (inVPre || name === "") { 14136 currentProp = { 14137 type: 6, 14138 name: raw, 14139 nameLoc: getLoc(start, end), 14140 value: void 0, 14141 loc: getLoc(start) 14142 }; 14143 } else { 14144 currentProp = { 14145 type: 7, 14146 name, 14147 rawName: raw, 14148 exp: void 0, 14149 arg: void 0, 14150 modifiers: raw === "." ? [createSimpleExpression("prop")] : [], 14151 loc: getLoc(start) 14152 }; 14153 if (name === "pre") { 14154 inVPre = tokenizer.inVPre = true; 14155 currentVPreBoundary = currentOpenTag; 14156 const props = currentOpenTag.props; 14157 for (let i = 0; i < props.length; i++) { 14158 if (props[i].type === 7) { 14159 props[i] = dirToAttr(props[i]); 14160 } 14161 } 14162 } 14163 } 14164 }, 14165 ondirarg(start, end) { 14166 if (start === end) return; 14167 const arg = getSlice(start, end); 14168 if (inVPre) { 14169 currentProp.name += arg; 14170 setLocEnd(currentProp.nameLoc, end); 14171 } else { 14172 const isStatic = arg[0] !== `[`; 14173 currentProp.arg = createExp( 14174 isStatic ? arg : arg.slice(1, -1), 14175 isStatic, 14176 getLoc(start, end), 14177 isStatic ? 3 : 0 14178 ); 14179 } 14180 }, 14181 ondirmodifier(start, end) { 14182 const mod = getSlice(start, end); 14183 if (inVPre) { 14184 currentProp.name += "." + mod; 14185 setLocEnd(currentProp.nameLoc, end); 14186 } else if (currentProp.name === "slot") { 14187 const arg = currentProp.arg; 14188 if (arg) { 14189 arg.content += "." + mod;
vendor: 16,643 bytes, lines 14190-14779
14190 setLocEnd(arg.loc, end); 14191 } 14192 } else { 14193 const exp = createSimpleExpression(mod, true, getLoc(start, end)); 14194 currentProp.modifiers.push(exp); 14195 } 14196 }, 14197 onattribdata(start, end) { 14198 currentAttrValue += getSlice(start, end); 14199 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 14200 currentAttrEndIndex = end; 14201 }, 14202 onattribentity(char, start, end) { 14203 currentAttrValue += char; 14204 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 14205 currentAttrEndIndex = end; 14206 }, 14207 onattribnameend(end) { 14208 const start = currentProp.loc.start.offset; 14209 const name = getSlice(start, end); 14210 if (currentProp.type === 7) { 14211 currentProp.rawName = name; 14212 } 14213 if (currentOpenTag.props.some( 14214 (p) => (p.type === 7 ? p.rawName : p.name) === name 14215 )) { 14216 emitError(2, start); 14217 } 14218 }, 14219 onattribend(quote, end) { 14220 if (currentOpenTag && currentProp) { 14221 setLocEnd(currentProp.loc, end); 14222 if (quote !== 0) { 14223 if (currentAttrValue.includes("&")) { 14224 currentAttrValue = currentOptions.decodeEntities( 14225 currentAttrValue, 14226 true 14227 ); 14228 } 14229 if (currentProp.type === 6) { 14230 if (currentProp.name === "class") { 14231 currentAttrValue = condense(currentAttrValue).trim(); 14232 } 14233 if (quote === 1 && !currentAttrValue) { 14234 emitError(13, end); 14235 } 14236 currentProp.value = { 14237 type: 2, 14238 content: currentAttrValue, 14239 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1) 14240 }; 14241 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") { 14242 tokenizer.enterRCDATA(toCharCodes(`</template`), 0); 14243 } 14244 } else { 14245 let expParseMode = 0 /* Normal */; 14246 currentProp.exp = createExp( 14247 currentAttrValue, 14248 false, 14249 getLoc(currentAttrStartIndex, currentAttrEndIndex), 14250 0, 14251 expParseMode 14252 ); 14253 if (currentProp.name === "for") { 14254 currentProp.forParseResult = parseForExpression(currentProp.exp); 14255 } 14256 } 14257 } 14258 if (currentProp.type !== 7 || currentProp.name !== "pre") { 14259 currentOpenTag.props.push(currentProp); 14260 } 14261 } 14262 currentAttrValue = ""; 14263 currentAttrStartIndex = currentAttrEndIndex = -1; 14264 }, 14265 oncomment(start, end) { 14266 if (currentOptions.comments) { 14267 addNode({ 14268 type: 3, 14269 content: getSlice(start, end), 14270 loc: getLoc(start - 4, end + 3) 14271 }); 14272 } 14273 }, 14274 onend() { 14275 const end = currentInput.length; 14276 if (tokenizer.state !== 1) { 14277 switch (tokenizer.state) { 14278 case 5: 14279 case 8: 14280 emitError(5, end); 14281 break; 14282 case 3: 14283 case 4: 14284 emitError( 14285 25, 14286 tokenizer.sectionStart 14287 ); 14288 break; 14289 case 28: 14290 if (tokenizer.currentSequence === Sequences.CdataEnd) { 14291 emitError(6, end); 14292 } else { 14293 emitError(7, end); 14294 } 14295 break; 14296 case 6: 14297 case 7: 14298 case 9: 14299 case 11: 14300 case 12: 14301 case 13: 14302 case 14: 14303 case 15: 14304 case 16: 14305 case 17: 14306 case 18: 14307 case 19: 14308 // " 14309 case 20: 14310 // ' 14311 case 21: 14312 emitError(9, end); 14313 break; 14314 } 14315 } 14316 for (let index = 0; index < stack.length; index++) { 14317 onCloseTag(stack[index], end - 1); 14318 emitError(24, stack[index].loc.start.offset); 14319 } 14320 }, 14321 oncdata(start, end) { 14322 if (stack[0].ns !== 0) { 14323 onText(getSlice(start, end), start, end); 14324 } else { 14325 emitError(1, start - 9); 14326 } 14327 }, 14328 onprocessinginstruction(start) { 14329 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 14330 emitError( 14331 21, 14332 start - 1 14333 ); 14334 } 14335 } 14336 }); 14337 const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 14338 const stripParensRE = /^\(|\)$/g; 14339 function parseForExpression(input) { 14340 const loc = input.loc; 14341 const exp = input.content; 14342 const inMatch = exp.match(forAliasRE); 14343 if (!inMatch) return; 14344 const [, LHS, RHS] = inMatch; 14345 const createAliasExpression = (content, offset, asParam = false) => { 14346 const start = loc.start.offset + offset; 14347 const end = start + content.length; 14348 return createExp( 14349 content, 14350 false, 14351 getLoc(start, end), 14352 0, 14353 asParam ? 1 /* Params */ : 0 /* Normal */ 14354 ); 14355 }; 14356 const result = { 14357 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)), 14358 value: void 0, 14359 key: void 0, 14360 index: void 0, 14361 finalized: false 14362 }; 14363 let valueContent = LHS.trim().replace(stripParensRE, "").trim(); 14364 const trimmedOffset = LHS.indexOf(valueContent); 14365 const iteratorMatch = valueContent.match(forIteratorRE); 14366 if (iteratorMatch) { 14367 valueContent = valueContent.replace(forIteratorRE, "").trim(); 14368 const keyContent = iteratorMatch[1].trim(); 14369 let keyOffset; 14370 if (keyContent) { 14371 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length); 14372 result.key = createAliasExpression(keyContent, keyOffset, true); 14373 } 14374 if (iteratorMatch[2]) { 14375 const indexContent = iteratorMatch[2].trim(); 14376 if (indexContent) { 14377 result.index = createAliasExpression( 14378 indexContent, 14379 exp.indexOf( 14380 indexContent, 14381 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length 14382 ), 14383 true 14384 ); 14385 } 14386 } 14387 } 14388 if (valueContent) { 14389 result.value = createAliasExpression(valueContent, trimmedOffset, true); 14390 } 14391 return result; 14392 } 14393 function getSlice(start, end) { 14394 return currentInput.slice(start, end); 14395 } 14396 function endOpenTag(end) { 14397 if (tokenizer.inSFCRoot) { 14398 currentOpenTag.innerLoc = getLoc(end + 1, end + 1); 14399 } 14400 addNode(currentOpenTag); 14401 const { tag, ns } = currentOpenTag; 14402 if (ns === 0 && currentOptions.isPreTag(tag)) { 14403 inPre++; 14404 } 14405 if (currentOptions.isVoidTag(tag)) { 14406 onCloseTag(currentOpenTag, end); 14407 } else { 14408 stack.unshift(currentOpenTag); 14409 if (ns === 1 || ns === 2) { 14410 tokenizer.inXML = true; 14411 } 14412 } 14413 currentOpenTag = null; 14414 } 14415 function onText(content, start, end) { 14416 { 14417 const tag = stack[0] && stack[0].tag; 14418 if (tag !== "script" && tag !== "style" && content.includes("&")) { 14419 content = currentOptions.decodeEntities(content, false); 14420 } 14421 } 14422 const parent = stack[0] || currentRoot; 14423 const lastNode = parent.children[parent.children.length - 1]; 14424 if (lastNode && lastNode.type === 2) { 14425 lastNode.content += content; 14426 setLocEnd(lastNode.loc, end); 14427 } else { 14428 parent.children.push({ 14429 type: 2, 14430 content, 14431 loc: getLoc(start, end) 14432 }); 14433 } 14434 } 14435 function onCloseTag(el, end, isImplied = false) { 14436 if (isImplied) { 14437 setLocEnd(el.loc, backTrack(end, 60)); 14438 } else { 14439 setLocEnd(el.loc, lookAhead(end, 62) + 1); 14440 } 14441 if (tokenizer.inSFCRoot) { 14442 if (el.children.length) { 14443 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end); 14444 } else { 14445 el.innerLoc.end = extend({}, el.innerLoc.start); 14446 } 14447 el.innerLoc.source = getSlice( 14448 el.innerLoc.start.offset, 14449 el.innerLoc.end.offset 14450 ); 14451 } 14452 const { tag, ns } = el; 14453 if (!inVPre) { 14454 if (tag === "slot") { 14455 el.tagType = 2; 14456 } else if (isFragmentTemplate(el)) { 14457 el.tagType = 3; 14458 } else if (isComponent(el)) { 14459 el.tagType = 1; 14460 } 14461 } 14462 if (!tokenizer.inRCDATA) { 14463 el.children = condenseWhitespace(el.children, el.tag); 14464 } 14465 if (ns === 0 && currentOptions.isPreTag(tag)) { 14466 inPre--; 14467 } 14468 if (currentVPreBoundary === el) { 14469 inVPre = tokenizer.inVPre = false; 14470 currentVPreBoundary = null; 14471 } 14472 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 14473 tokenizer.inXML = false; 14474 } 14475 } 14476 function lookAhead(index, c) { 14477 let i = index; 14478 while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++; 14479 return i; 14480 } 14481 function backTrack(index, c) { 14482 let i = index; 14483 while (currentInput.charCodeAt(i) !== c && i >= 0) i--; 14484 return i; 14485 } 14486 const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]); 14487 function isFragmentTemplate({ tag, props }) { 14488 if (tag === "template") { 14489 for (let i = 0; i < props.length; i++) { 14490 if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) { 14491 return true; 14492 } 14493 } 14494 } 14495 return false; 14496 } 14497 function isComponent({ tag, props }) { 14498 if (currentOptions.isCustomElement(tag)) { 14499 return false; 14500 } 14501 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) { 14502 return true; 14503 } 14504 for (let i = 0; i < props.length; i++) { 14505 const p = props[i]; 14506 if (p.type === 6) { 14507 if (p.name === "is" && p.value) { 14508 if (p.value.content.startsWith("vue:")) { 14509 return true; 14510 } 14511 } 14512 } 14513 } 14514 return false; 14515 } 14516 function isUpperCase(c) { 14517 return c > 64 && c < 91; 14518 } 14519 const windowsNewlineRE = /\r\n/g; 14520 function condenseWhitespace(nodes, tag) { 14521 const shouldCondense = currentOptions.whitespace !== "preserve"; 14522 let removedWhitespace = false; 14523 for (let i = 0; i < nodes.length; i++) { 14524 const node = nodes[i]; 14525 if (node.type === 2) { 14526 if (!inPre) { 14527 if (isAllWhitespace(node.content)) { 14528 const prev = nodes[i - 1] && nodes[i - 1].type; 14529 const next = nodes[i + 1] && nodes[i + 1].type; 14530 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) { 14531 removedWhitespace = true; 14532 nodes[i] = null; 14533 } else { 14534 node.content = " "; 14535 } 14536 } else if (shouldCondense) { 14537 node.content = condense(node.content); 14538 } 14539 } else { 14540 node.content = node.content.replace(windowsNewlineRE, "\n"); 14541 } 14542 } 14543 } 14544 if (inPre && tag && currentOptions.isPreTag(tag)) { 14545 const first = nodes[0]; 14546 if (first && first.type === 2) { 14547 first.content = first.content.replace(/^\r?\n/, ""); 14548 } 14549 } 14550 return removedWhitespace ? nodes.filter(Boolean) : nodes; 14551 } 14552 function isAllWhitespace(str) { 14553 for (let i = 0; i < str.length; i++) { 14554 if (!isWhitespace(str.charCodeAt(i))) { 14555 return false; 14556 } 14557 } 14558 return true; 14559 } 14560 function hasNewlineChar(str) { 14561 for (let i = 0; i < str.length; i++) { 14562 const c = str.charCodeAt(i); 14563 if (c === 10 || c === 13) { 14564 return true; 14565 } 14566 } 14567 return false; 14568 } 14569 function condense(str) { 14570 let ret = ""; 14571 let prevCharIsWhitespace = false; 14572 for (let i = 0; i < str.length; i++) { 14573 if (isWhitespace(str.charCodeAt(i))) { 14574 if (!prevCharIsWhitespace) { 14575 ret += " "; 14576 prevCharIsWhitespace = true; 14577 } 14578 } else { 14579 ret += str[i]; 14580 prevCharIsWhitespace = false; 14581 } 14582 } 14583 return ret; 14584 } 14585 function addNode(node) { 14586 (stack[0] || currentRoot).children.push(node); 14587 } 14588 function getLoc(start, end) { 14589 return { 14590 start: tokenizer.getPos(start), 14591 // @ts-expect-error allow late attachment 14592 end: end == null ? end : tokenizer.getPos(end), 14593 // @ts-expect-error allow late attachment 14594 source: end == null ? end : getSlice(start, end) 14595 }; 14596 } 14597 function setLocEnd(loc, end) { 14598 loc.end = tokenizer.getPos(end); 14599 loc.source = getSlice(loc.start.offset, end); 14600 } 14601 function dirToAttr(dir) { 14602 const attr = { 14603 type: 6, 14604 name: dir.rawName, 14605 nameLoc: getLoc( 14606 dir.loc.start.offset, 14607 dir.loc.start.offset + dir.rawName.length 14608 ), 14609 value: void 0, 14610 loc: dir.loc 14611 }; 14612 if (dir.exp) { 14613 const loc = dir.exp.loc; 14614 if (loc.end.offset < dir.loc.end.offset) { 14615 loc.start.offset--; 14616 loc.start.column--; 14617 loc.end.offset++; 14618 loc.end.column++; 14619 } 14620 attr.value = { 14621 type: 2, 14622 content: dir.exp.content, 14623 loc 14624 }; 14625 } 14626 return attr; 14627 } 14628 function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) { 14629 const exp = createSimpleExpression(content, isStatic, loc, constType); 14630 return exp; 14631 } 14632 function emitError(code, index, message) { 14633 currentOptions.onError( 14634 createCompilerError(code, getLoc(index, index), void 0, message) 14635 ); 14636 } 14637 function reset() { 14638 tokenizer.reset(); 14639 currentOpenTag = null; 14640 currentProp = null; 14641 currentAttrValue = ""; 14642 currentAttrStartIndex = -1; 14643 currentAttrEndIndex = -1; 14644 stack.length = 0; 14645 } 14646 function baseParse(input, options) { 14647 reset(); 14648 currentInput = input; 14649 currentOptions = extend({}, defaultParserOptions); 14650 if (options) { 14651 let key; 14652 for (key in options) { 14653 if (options[key] != null) { 14654 currentOptions[key] = options[key]; 14655 } 14656 } 14657 } 14658 { 14659 if (!currentOptions.decodeEntities) { 14660 throw new Error( 14661 `[@vue/compiler-core] decodeEntities option is required in browser builds.` 14662 ); 14663 } 14664 } 14665 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0; 14666 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2; 14667 const delimiters = options && options.delimiters; 14668 if (delimiters) { 14669 tokenizer.delimiterOpen = toCharCodes(delimiters[0]); 14670 tokenizer.delimiterClose = toCharCodes(delimiters[1]); 14671 } 14672 const root = currentRoot = createRoot([], input); 14673 tokenizer.parse(currentInput); 14674 root.loc = getLoc(0, input.length); 14675 root.children = condenseWhitespace(root.children); 14676 currentRoot = null; 14677 return root; 14678 } 14679 14680 function cacheStatic(root, context) { 14681 walk( 14682 root, 14683 void 0, 14684 context, 14685 // Root node is unfortunately non-hoistable due to potential parent 14686 // fallthrough attributes. 14687 isSingleElementRoot(root, root.children[0]) 14688 ); 14689 } 14690 function isSingleElementRoot(root, child) { 14691 const { children } = root; 14692 return children.length === 1 && child.type === 1 && !isSlotOutlet(child); 14693 } 14694 function walk(node, parent, context, doNotHoistNode = false, inFor = false) { 14695 const { children } = node; 14696 const toCache = []; 14697 for (let i = 0; i < children.length; i++) { 14698 const child = children[i]; 14699 if (child.type === 1 && child.tagType === 0) { 14700 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 14701 if (constantType > 0) { 14702 if (constantType >= 2) { 14703 child.codegenNode.patchFlag = -1; 14704 toCache.push(child); 14705 continue; 14706 } 14707 } else { 14708 const codegenNode = child.codegenNode; 14709 if (codegenNode.type === 13) { 14710 const flag = codegenNode.patchFlag; 14711 if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) { 14712 const props = getNodeProps(child); 14713 if (props) { 14714 codegenNode.props = context.hoist(props); 14715 } 14716 } 14717 if (codegenNode.dynamicProps) { 14718 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps); 14719 } 14720 } 14721 } 14722 } else if (child.type === 12) { 14723 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 14724 if (constantType >= 2) { 14725 toCache.push(child); 14726 continue; 14727 } 14728 } 14729 if (child.type === 1) { 14730 const isComponent = child.tagType === 1; 14731 if (isComponent) { 14732 context.scopes.vSlot++; 14733 } 14734 walk(child, node, context, false, inFor); 14735 if (isComponent) { 14736 context.scopes.vSlot--; 14737 } 14738 } else if (child.type === 11) { 14739 walk(child, node, context, child.children.length === 1, true); 14740 } else if (child.type === 9) { 14741 for (let i2 = 0; i2 < child.branches.length; i2++) { 14742 walk( 14743 child.branches[i2], 14744 node, 14745 context, 14746 child.branches[i2].children.length === 1, 14747 inFor 14748 ); 14749 } 14750 } 14751 } 14752 let cachedAsArray = false; 14753 if (toCache.length === children.length && node.type === 1) { 14754 if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) { 14755 node.codegenNode.children = getCacheExpression( 14756 createArrayExpression(node.codegenNode.children) 14757 ); 14758 cachedAsArray = true; 14759 } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) { 14760 const slot = getSlotNode(node.codegenNode, "default"); 14761 if (slot) { 14762 slot.returns = getCacheExpression( 14763 createArrayExpression(slot.returns) 14764 ); 14765 cachedAsArray = true; 14766 } 14767 } 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) { 14768 const slotName = findDir(node, "slot", true); 14769 const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); 14770 if (slot) { 14771 slot.returns = getCacheExpression( 14772 createArrayExpression(slot.returns) 14773 ); 14774 cachedAsArray = true; 14775 } 14776 } 14777 } 14778 if (!cachedAsArray) { 14779 for (const child of toCache) {
vendor: 4,208 bytes, lines 14780-14932
14780 child.codegenNode = context.cache(child.codegenNode); 14781 } 14782 } 14783 function getCacheExpression(value) { 14784 const exp = context.cache(value); 14785 if (inFor && context.hmr) { 14786 exp.needArraySpread = true; 14787 } 14788 return exp; 14789 } 14790 function getSlotNode(node2, name) { 14791 if (node2.children && !isArray(node2.children) && node2.children.type === 15) { 14792 const slot = node2.children.properties.find( 14793 (p) => p.key === name || p.key.content === name 14794 ); 14795 return slot && slot.value; 14796 } 14797 } 14798 if (toCache.length && context.transformHoist) { 14799 context.transformHoist(children, context, node); 14800 } 14801 } 14802 function getConstantType(node, context) { 14803 const { constantCache } = context; 14804 switch (node.type) { 14805 case 1: 14806 if (node.tagType !== 0) { 14807 return 0; 14808 } 14809 const cached = constantCache.get(node); 14810 if (cached !== void 0) { 14811 return cached; 14812 } 14813 const codegenNode = node.codegenNode; 14814 if (codegenNode.type !== 13) { 14815 return 0; 14816 } 14817 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") { 14818 return 0; 14819 } 14820 if (codegenNode.patchFlag === void 0) { 14821 let returnType2 = 3; 14822 const generatedPropsType = getGeneratedPropsConstantType(node, context); 14823 if (generatedPropsType === 0) { 14824 constantCache.set(node, 0); 14825 return 0; 14826 } 14827 if (generatedPropsType < returnType2) { 14828 returnType2 = generatedPropsType; 14829 } 14830 for (let i = 0; i < node.children.length; i++) { 14831 const childType = getConstantType(node.children[i], context); 14832 if (childType === 0) { 14833 constantCache.set(node, 0); 14834 return 0; 14835 } 14836 if (childType < returnType2) { 14837 returnType2 = childType; 14838 } 14839 } 14840 if (returnType2 > 1) { 14841 for (let i = 0; i < node.props.length; i++) { 14842 const p = node.props[i]; 14843 if (p.type === 7 && p.name === "bind" && p.exp) { 14844 const expType = getConstantType(p.exp, context); 14845 if (expType === 0) { 14846 constantCache.set(node, 0); 14847 return 0; 14848 } 14849 if (expType < returnType2) { 14850 returnType2 = expType; 14851 } 14852 } 14853 } 14854 } 14855 if (codegenNode.isBlock) { 14856 for (let i = 0; i < node.props.length; i++) { 14857 const p = node.props[i]; 14858 if (p.type === 7) { 14859 constantCache.set(node, 0); 14860 return 0; 14861 } 14862 } 14863 context.removeHelper(OPEN_BLOCK); 14864 context.removeHelper( 14865 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent) 14866 ); 14867 codegenNode.isBlock = false; 14868 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent)); 14869 } 14870 constantCache.set(node, returnType2); 14871 return returnType2; 14872 } else { 14873 constantCache.set(node, 0); 14874 return 0; 14875 } 14876 case 2: 14877 case 3: 14878 return 3; 14879 case 9: 14880 case 11: 14881 case 10: 14882 return 0; 14883 case 5: 14884 case 12: 14885 return getConstantType(node.content, context); 14886 case 4: 14887 return node.constType; 14888 case 8: 14889 let returnType = 3; 14890 for (let i = 0; i < node.children.length; i++) { 14891 const child = node.children[i]; 14892 if (isString(child) || isSymbol(child)) { 14893 continue; 14894 } 14895 const childType = getConstantType(child, context); 14896 if (childType === 0) { 14897 return 0; 14898 } else if (childType < returnType) { 14899 returnType = childType; 14900 } 14901 } 14902 return returnType; 14903 case 20: 14904 return 2; 14905 default: 14906 return 0; 14907 } 14908 } 14909 const allowHoistedHelperSet = /* @__PURE__ */ new Set([ 14910 NORMALIZE_CLASS, 14911 NORMALIZE_STYLE, 14912 NORMALIZE_PROPS, 14913 GUARD_REACTIVE_PROPS 14914 ]); 14915 function getConstantTypeOfHelperCall(value, context) { 14916 if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) { 14917 const arg = value.arguments[0]; 14918 if (arg.type === 4) { 14919 return getConstantType(arg, context); 14920 } else if (arg.type === 14) { 14921 return getConstantTypeOfHelperCall(arg, context); 14922 } 14923 } 14924 return 0; 14925 } 14926 function getGeneratedPropsConstantType(node, context) { 14927 let returnType = 3; 14928 const props = getNodeProps(node); 14929 if (props && props.type === 15) { 14930 const { properties } = props; 14931 for (let i = 0; i < properties.length; i++) { 14932 const { key, value } = properties[i];
vendor: 25,764 bytes, lines 14933-15975
14933 const keyType = getConstantType(key, context); 14934 if (keyType === 0) { 14935 return keyType; 14936 } 14937 if (keyType < returnType) { 14938 returnType = keyType; 14939 } 14940 let valueType; 14941 if (value.type === 4) { 14942 valueType = getConstantType(value, context); 14943 } else if (value.type === 14) { 14944 valueType = getConstantTypeOfHelperCall(value, context); 14945 } else { 14946 valueType = 0; 14947 } 14948 if (valueType === 0) { 14949 return valueType; 14950 } 14951 if (valueType < returnType) { 14952 returnType = valueType; 14953 } 14954 } 14955 } 14956 return returnType; 14957 } 14958 function getNodeProps(node) { 14959 const codegenNode = node.codegenNode; 14960 if (codegenNode.type === 13) { 14961 return codegenNode.props; 14962 } 14963 } 14964 14965 function createTransformContext(root, { 14966 filename = "", 14967 prefixIdentifiers = false, 14968 hoistStatic = false, 14969 hmr = false, 14970 cacheHandlers = false, 14971 nodeTransforms = [], 14972 directiveTransforms = {}, 14973 transformHoist = null, 14974 isBuiltInComponent = NOOP, 14975 isCustomElement = NOOP, 14976 expressionPlugins = [], 14977 scopeId = null, 14978 slotted = true, 14979 ssr = false, 14980 inSSR = false, 14981 ssrCssVars = ``, 14982 bindingMetadata = EMPTY_OBJ, 14983 inline = false, 14984 isTS = false, 14985 onError = defaultOnError, 14986 onWarn = defaultOnWarn, 14987 compatConfig 14988 }) { 14989 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/); 14990 const context = { 14991 // options 14992 filename, 14993 selfName: nameMatch && capitalize(camelize(nameMatch[1])), 14994 prefixIdentifiers, 14995 hoistStatic, 14996 hmr, 14997 cacheHandlers, 14998 nodeTransforms, 14999 directiveTransforms, 15000 transformHoist, 15001 isBuiltInComponent, 15002 isCustomElement, 15003 expressionPlugins, 15004 scopeId, 15005 slotted, 15006 ssr, 15007 inSSR, 15008 ssrCssVars, 15009 bindingMetadata, 15010 inline, 15011 isTS, 15012 onError, 15013 onWarn, 15014 compatConfig, 15015 // state 15016 root, 15017 helpers: /* @__PURE__ */ new Map(), 15018 components: /* @__PURE__ */ new Set(), 15019 directives: /* @__PURE__ */ new Set(), 15020 hoists: [], 15021 imports: [], 15022 cached: [], 15023 constantCache: /* @__PURE__ */ new WeakMap(), 15024 temps: 0, 15025 identifiers: /* @__PURE__ */ Object.create(null), 15026 scopes: { 15027 vFor: 0, 15028 vSlot: 0, 15029 vPre: 0, 15030 vOnce: 0 15031 }, 15032 parent: null, 15033 grandParent: null, 15034 currentNode: root, 15035 childIndex: 0, 15036 inVOnce: false, 15037 // methods 15038 helper(name) { 15039 const count = context.helpers.get(name) || 0; 15040 context.helpers.set(name, count + 1); 15041 return name; 15042 }, 15043 removeHelper(name) { 15044 const count = context.helpers.get(name); 15045 if (count) { 15046 const currentCount = count - 1; 15047 if (!currentCount) { 15048 context.helpers.delete(name); 15049 } else { 15050 context.helpers.set(name, currentCount); 15051 } 15052 } 15053 }, 15054 helperString(name) { 15055 return `_${helperNameMap[context.helper(name)]}`; 15056 }, 15057 replaceNode(node) { 15058 { 15059 if (!context.currentNode) { 15060 throw new Error(`Node being replaced is already removed.`); 15061 } 15062 if (!context.parent) { 15063 throw new Error(`Cannot replace root node.`); 15064 } 15065 } 15066 context.parent.children[context.childIndex] = context.currentNode = node; 15067 }, 15068 removeNode(node) { 15069 if (!context.parent) { 15070 throw new Error(`Cannot remove root node.`); 15071 } 15072 const list = context.parent.children; 15073 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1; 15074 if (removalIndex < 0) { 15075 throw new Error(`node being removed is not a child of current parent`); 15076 } 15077 if (!node || node === context.currentNode) { 15078 context.currentNode = null; 15079 context.onNodeRemoved(); 15080 } else { 15081 if (context.childIndex > removalIndex) { 15082 context.childIndex--; 15083 context.onNodeRemoved(); 15084 } 15085 } 15086 context.parent.children.splice(removalIndex, 1); 15087 }, 15088 onNodeRemoved: NOOP, 15089 addIdentifiers(exp) { 15090 }, 15091 removeIdentifiers(exp) { 15092 }, 15093 hoist(exp) { 15094 if (isString(exp)) exp = createSimpleExpression(exp); 15095 context.hoists.push(exp); 15096 const identifier = createSimpleExpression( 15097 `_hoisted_${context.hoists.length}`, 15098 false, 15099 exp.loc, 15100 2 15101 ); 15102 identifier.hoisted = exp; 15103 return identifier; 15104 }, 15105 cache(exp, isVNode = false) { 15106 const cacheExp = createCacheExpression( 15107 context.cached.length, 15108 exp, 15109 isVNode 15110 ); 15111 context.cached.push(cacheExp); 15112 return cacheExp; 15113 } 15114 }; 15115 return context; 15116 } 15117 function transform(root, options) { 15118 const context = createTransformContext(root, options); 15119 traverseNode(root, context); 15120 if (options.hoistStatic) { 15121 cacheStatic(root, context); 15122 } 15123 if (!options.ssr) { 15124 createRootCodegen(root, context); 15125 } 15126 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]); 15127 root.components = [...context.components]; 15128 root.directives = [...context.directives]; 15129 root.imports = context.imports; 15130 root.hoists = context.hoists; 15131 root.temps = context.temps; 15132 root.cached = context.cached; 15133 root.transformed = true; 15134 } 15135 function createRootCodegen(root, context) { 15136 const { helper } = context; 15137 const { children } = root; 15138 if (children.length === 1) { 15139 const child = children[0]; 15140 if (isSingleElementRoot(root, child) && child.codegenNode) { 15141 const codegenNode = child.codegenNode; 15142 if (codegenNode.type === 13) { 15143 convertToBlock(codegenNode, context); 15144 } 15145 root.codegenNode = codegenNode; 15146 } else { 15147 root.codegenNode = child; 15148 } 15149 } else if (children.length > 1) { 15150 let patchFlag = 64; 15151 if (children.filter((c) => c.type !== 3).length === 1) { 15152 patchFlag |= 2048; 15153 } 15154 root.codegenNode = createVNodeCall( 15155 context, 15156 helper(FRAGMENT), 15157 void 0, 15158 root.children, 15159 patchFlag, 15160 void 0, 15161 void 0, 15162 true, 15163 void 0, 15164 false 15165 ); 15166 } 15167 } 15168 function traverseChildren(parent, context) { 15169 let i = 0; 15170 const nodeRemoved = () => { 15171 i--; 15172 }; 15173 for (; i < parent.children.length; i++) { 15174 const child = parent.children[i]; 15175 if (isString(child)) continue; 15176 context.grandParent = context.parent; 15177 context.parent = parent; 15178 context.childIndex = i; 15179 context.onNodeRemoved = nodeRemoved; 15180 traverseNode(child, context); 15181 } 15182 } 15183 function traverseNode(node, context) { 15184 context.currentNode = node; 15185 const { nodeTransforms } = context; 15186 const exitFns = []; 15187 for (let i2 = 0; i2 < nodeTransforms.length; i2++) { 15188 const onExit = nodeTransforms[i2](node, context); 15189 if (onExit) { 15190 if (isArray(onExit)) { 15191 exitFns.push(...onExit); 15192 } else { 15193 exitFns.push(onExit); 15194 } 15195 } 15196 if (!context.currentNode) { 15197 return; 15198 } else { 15199 node = context.currentNode; 15200 } 15201 } 15202 switch (node.type) { 15203 case 3: 15204 if (!context.ssr) { 15205 context.helper(CREATE_COMMENT); 15206 } 15207 break; 15208 case 5: 15209 if (!context.ssr) { 15210 context.helper(TO_DISPLAY_STRING); 15211 } 15212 break; 15213 // for container types, further traverse downwards 15214 case 9: 15215 for (let i2 = 0; i2 < node.branches.length; i2++) { 15216 traverseNode(node.branches[i2], context); 15217 } 15218 break; 15219 case 10: 15220 case 11: 15221 case 1: 15222 case 0: 15223 traverseChildren(node, context); 15224 break; 15225 } 15226 context.currentNode = node; 15227 let i = exitFns.length; 15228 while (i--) { 15229 exitFns[i](); 15230 } 15231 } 15232 function createStructuralDirectiveTransform(name, fn) { 15233 const matches = isString(name) ? (n) => n === name : (n) => name.test(n); 15234 return (node, context) => { 15235 if (node.type === 1) { 15236 const { props } = node; 15237 if (node.tagType === 3 && props.some(isVSlot)) { 15238 return; 15239 } 15240 const exitFns = []; 15241 for (let i = 0; i < props.length; i++) { 15242 const prop = props[i]; 15243 if (prop.type === 7 && matches(prop.name)) { 15244 props.splice(i, 1); 15245 i--; 15246 const onExit = fn(node, prop, context); 15247 if (onExit) exitFns.push(onExit); 15248 } 15249 } 15250 return exitFns; 15251 } 15252 }; 15253 } 15254 15255 const PURE_ANNOTATION = `/*@__PURE__*/`; 15256 const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`; 15257 function createCodegenContext(ast, { 15258 mode = "function", 15259 prefixIdentifiers = mode === "module", 15260 sourceMap = false, 15261 filename = `template.vue.html`, 15262 scopeId = null, 15263 optimizeImports = false, 15264 runtimeGlobalName = `Vue`, 15265 runtimeModuleName = `vue`, 15266 ssrRuntimeModuleName = "vue/server-renderer", 15267 ssr = false, 15268 isTS = false, 15269 inSSR = false 15270 }) { 15271 const context = { 15272 mode, 15273 prefixIdentifiers, 15274 sourceMap, 15275 filename, 15276 scopeId, 15277 optimizeImports, 15278 runtimeGlobalName, 15279 runtimeModuleName, 15280 ssrRuntimeModuleName, 15281 ssr, 15282 isTS, 15283 inSSR, 15284 source: ast.source, 15285 code: ``, 15286 column: 1, 15287 line: 1, 15288 offset: 0, 15289 indentLevel: 0, 15290 pure: false, 15291 map: void 0, 15292 helper(key) { 15293 return `_${helperNameMap[key]}`; 15294 }, 15295 push(code, newlineIndex = -2 /* None */, node) { 15296 context.code += code; 15297 }, 15298 indent() { 15299 newline(++context.indentLevel); 15300 }, 15301 deindent(withoutNewLine = false) { 15302 if (withoutNewLine) { 15303 --context.indentLevel; 15304 } else { 15305 newline(--context.indentLevel); 15306 } 15307 }, 15308 newline() { 15309 newline(context.indentLevel); 15310 } 15311 }; 15312 function newline(n) { 15313 context.push("\n" + ` `.repeat(n), 0 /* Start */); 15314 } 15315 return context; 15316 } 15317 function generate(ast, options = {}) { 15318 const context = createCodegenContext(ast, options); 15319 if (options.onContextCreated) options.onContextCreated(context); 15320 const { 15321 mode, 15322 push, 15323 prefixIdentifiers, 15324 indent, 15325 deindent, 15326 newline, 15327 scopeId, 15328 ssr 15329 } = context; 15330 const helpers = Array.from(ast.helpers); 15331 const hasHelpers = helpers.length > 0; 15332 const useWithBlock = !prefixIdentifiers && mode !== "module"; 15333 const preambleContext = context; 15334 { 15335 genFunctionPreamble(ast, preambleContext); 15336 } 15337 const functionName = ssr ? `ssrRender` : `render`; 15338 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"]; 15339 const signature = args.join(", "); 15340 { 15341 push(`function ${functionName}(${signature}) {`); 15342 } 15343 indent(); 15344 if (useWithBlock) { 15345 push(`with (_ctx) {`); 15346 indent(); 15347 if (hasHelpers) { 15348 push( 15349 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue 15350`, 15351 -1 /* End */ 15352 ); 15353 newline(); 15354 } 15355 } 15356 if (ast.components.length) { 15357 genAssets(ast.components, "component", context); 15358 if (ast.directives.length || ast.temps > 0) { 15359 newline(); 15360 } 15361 } 15362 if (ast.directives.length) { 15363 genAssets(ast.directives, "directive", context); 15364 if (ast.temps > 0) { 15365 newline(); 15366 } 15367 } 15368 if (ast.temps > 0) { 15369 push(`let `); 15370 for (let i = 0; i < ast.temps; i++) { 15371 push(`${i > 0 ? `, ` : ``}_temp${i}`); 15372 } 15373 } 15374 if (ast.components.length || ast.directives.length || ast.temps) { 15375 push(` 15376`, 0 /* Start */); 15377 newline(); 15378 } 15379 if (!ssr) { 15380 push(`return `); 15381 } 15382 if (ast.codegenNode) { 15383 genNode(ast.codegenNode, context); 15384 } else { 15385 push(`null`); 15386 } 15387 if (useWithBlock) { 15388 deindent(); 15389 push(`}`); 15390 } 15391 deindent(); 15392 push(`}`); 15393 return { 15394 ast, 15395 code: context.code, 15396 preamble: ``, 15397 map: context.map ? context.map.toJSON() : void 0 15398 }; 15399 } 15400 function genFunctionPreamble(ast, context) { 15401 const { 15402 ssr, 15403 prefixIdentifiers, 15404 push, 15405 newline, 15406 runtimeModuleName, 15407 runtimeGlobalName, 15408 ssrRuntimeModuleName 15409 } = context; 15410 const VueBinding = runtimeGlobalName; 15411 const helpers = Array.from(ast.helpers); 15412 if (helpers.length > 0) { 15413 { 15414 push(`const _Vue = ${VueBinding} 15415`, -1 /* End */); 15416 if (ast.hoists.length) { 15417 const staticHelpers = [ 15418 CREATE_VNODE, 15419 CREATE_ELEMENT_VNODE, 15420 CREATE_COMMENT, 15421 CREATE_TEXT, 15422 CREATE_STATIC 15423 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", "); 15424 push(`const { ${staticHelpers} } = _Vue 15425`, -1 /* End */); 15426 } 15427 } 15428 } 15429 genHoists(ast.hoists, context); 15430 newline(); 15431 push(`return `); 15432 } 15433 function genAssets(assets, type, { helper, push, newline, isTS }) { 15434 const resolver = helper( 15435 type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE 15436 ); 15437 for (let i = 0; i < assets.length; i++) { 15438 let id = assets[i]; 15439 const maybeSelfReference = id.endsWith("__self"); 15440 if (maybeSelfReference) { 15441 id = id.slice(0, -6); 15442 } 15443 push( 15444 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}` 15445 ); 15446 if (i < assets.length - 1) { 15447 newline(); 15448 } 15449 } 15450 } 15451 function genHoists(hoists, context) { 15452 if (!hoists.length) { 15453 return; 15454 } 15455 context.pure = true; 15456 const { push, newline } = context; 15457 newline(); 15458 for (let i = 0; i < hoists.length; i++) { 15459 const exp = hoists[i]; 15460 if (exp) { 15461 push(`const _hoisted_${i + 1} = `); 15462 genNode(exp, context); 15463 newline(); 15464 } 15465 } 15466 context.pure = false; 15467 } 15468 function isText(n) { 15469 return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8; 15470 } 15471 function genNodeListAsArray(nodes, context) { 15472 const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n)); 15473 context.push(`[`); 15474 multilines && context.indent(); 15475 genNodeList(nodes, context, multilines); 15476 multilines && context.deindent(); 15477 context.push(`]`); 15478 } 15479 function genNodeList(nodes, context, multilines = false, comma = true) { 15480 const { push, newline } = context; 15481 for (let i = 0; i < nodes.length; i++) { 15482 const node = nodes[i]; 15483 if (isString(node)) { 15484 push(node, -3 /* Unknown */); 15485 } else if (isArray(node)) { 15486 genNodeListAsArray(node, context); 15487 } else { 15488 genNode(node, context); 15489 } 15490 if (i < nodes.length - 1) { 15491 if (multilines) { 15492 comma && push(","); 15493 newline(); 15494 } else { 15495 comma && push(", "); 15496 } 15497 } 15498 } 15499 } 15500 function genNode(node, context) { 15501 if (isString(node)) { 15502 context.push(node, -3 /* Unknown */); 15503 return; 15504 } 15505 if (isSymbol(node)) { 15506 context.push(context.helper(node)); 15507 return; 15508 } 15509 switch (node.type) { 15510 case 1: 15511 case 9: 15512 case 11: 15513 assert( 15514 node.codegenNode != null, 15515 `Codegen node is missing for element/if/for node. Apply appropriate transforms first.` 15516 ); 15517 genNode(node.codegenNode, context); 15518 break; 15519 case 2: 15520 genText(node, context); 15521 break; 15522 case 4: 15523 genExpression(node, context); 15524 break; 15525 case 5: 15526 genInterpolation(node, context); 15527 break; 15528 case 12: 15529 genNode(node.codegenNode, context); 15530 break; 15531 case 8: 15532 genCompoundExpression(node, context); 15533 break; 15534 case 3: 15535 genComment(node, context); 15536 break; 15537 case 13: 15538 genVNodeCall(node, context); 15539 break; 15540 case 14: 15541 genCallExpression(node, context); 15542 break; 15543 case 15: 15544 genObjectExpression(node, context); 15545 break; 15546 case 17: 15547 genArrayExpression(node, context); 15548 break; 15549 case 18: 15550 genFunctionExpression(node, context); 15551 break; 15552 case 19: 15553 genConditionalExpression(node, context); 15554 break; 15555 case 20: 15556 genCacheExpression(node, context); 15557 break; 15558 case 21: 15559 genNodeList(node.body, context, true, false); 15560 break; 15561 // SSR only types 15562 case 22: 15563 break; 15564 case 23: 15565 break; 15566 case 24: 15567 break; 15568 case 25: 15569 break; 15570 case 26: 15571 break; 15572 /* v8 ignore start */ 15573 case 10: 15574 break; 15575 default: 15576 { 15577 assert(false, `unhandled codegen node type: ${node.type}`); 15578 const exhaustiveCheck = node; 15579 return exhaustiveCheck; 15580 } 15581 } 15582 } 15583 function genText(node, context) { 15584 context.push(JSON.stringify(node.content), -3 /* Unknown */, node); 15585 } 15586 function genExpression(node, context) { 15587 const { content, isStatic } = node; 15588 context.push( 15589 isStatic ? JSON.stringify(content) : content, 15590 -3 /* Unknown */, 15591 node 15592 ); 15593 } 15594 function genInterpolation(node, context) { 15595 const { push, helper, pure } = context; 15596 if (pure) push(PURE_ANNOTATION); 15597 push(`${helper(TO_DISPLAY_STRING)}(`); 15598 genNode(node.content, context); 15599 push(`)`); 15600 } 15601 function genCompoundExpression(node, context) { 15602 for (let i = 0; i < node.children.length; i++) { 15603 const child = node.children[i]; 15604 if (isString(child)) { 15605 context.push(child, -3 /* Unknown */); 15606 } else { 15607 genNode(child, context); 15608 } 15609 } 15610 } 15611 function genExpressionAsPropertyKey(node, context) { 15612 const { push } = context; 15613 if (node.type === 8) { 15614 push(`[`); 15615 genCompoundExpression(node, context); 15616 push(`]`); 15617 } else if (node.isStatic) { 15618 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content); 15619 push(text, -2 /* None */, node); 15620 } else { 15621 push(`[${node.content}]`, -3 /* Unknown */, node); 15622 } 15623 } 15624 function genComment(node, context) { 15625 const { push, helper, pure } = context; 15626 if (pure) { 15627 push(PURE_ANNOTATION); 15628 } 15629 push( 15630 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, 15631 -3 /* Unknown */, 15632 node 15633 ); 15634 } 15635 function genVNodeCall(node, context) { 15636 const { push, helper, pure } = context; 15637 const { 15638 tag, 15639 props, 15640 children, 15641 patchFlag, 15642 dynamicProps, 15643 directives, 15644 isBlock, 15645 disableTracking, 15646 isComponent 15647 } = node; 15648 let patchFlagString; 15649 if (patchFlag) { 15650 { 15651 if (patchFlag < 0) { 15652 patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`; 15653 } else { 15654 const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `); 15655 patchFlagString = patchFlag + ` /* ${flagNames} */`; 15656 } 15657 } 15658 } 15659 if (directives) { 15660 push(helper(WITH_DIRECTIVES) + `(`); 15661 } 15662 if (isBlock) { 15663 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `); 15664 } 15665 if (pure) { 15666 push(PURE_ANNOTATION); 15667 } 15668 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent); 15669 push(helper(callHelper) + `(`, -2 /* None */, node); 15670 genNodeList( 15671 genNullableArgs([tag, props, children, patchFlagString, dynamicProps]), 15672 context 15673 ); 15674 push(`)`); 15675 if (isBlock) { 15676 push(`)`); 15677 } 15678 if (directives) { 15679 push(`, `); 15680 genNode(directives, context); 15681 push(`)`); 15682 } 15683 } 15684 function genNullableArgs(args) { 15685 let i = args.length; 15686 while (i--) { 15687 if (args[i] != null) break; 15688 } 15689 return args.slice(0, i + 1).map((arg) => arg || `null`); 15690 } 15691 function genCallExpression(node, context) { 15692 const { push, helper, pure } = context; 15693 const callee = isString(node.callee) ? node.callee : helper(node.callee); 15694 if (pure) { 15695 push(PURE_ANNOTATION); 15696 } 15697 push(callee + `(`, -2 /* None */, node); 15698 genNodeList(node.arguments, context); 15699 push(`)`); 15700 } 15701 function genObjectExpression(node, context) { 15702 const { push, indent, deindent, newline } = context; 15703 const { properties } = node; 15704 if (!properties.length) { 15705 push(`{}`, -2 /* None */, node); 15706 return; 15707 } 15708 const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4); 15709 push(multilines ? `{` : `{ `); 15710 multilines && indent(); 15711 for (let i = 0; i < properties.length; i++) { 15712 const { key, value } = properties[i]; 15713 genExpressionAsPropertyKey(key, context); 15714 push(`: `); 15715 genNode(value, context); 15716 if (i < properties.length - 1) { 15717 push(`,`); 15718 newline(); 15719 } 15720 } 15721 multilines && deindent(); 15722 push(multilines ? `}` : ` }`); 15723 } 15724 function genArrayExpression(node, context) { 15725 genNodeListAsArray(node.elements, context); 15726 } 15727 function genFunctionExpression(node, context) { 15728 const { push, indent, deindent } = context; 15729 const { params, returns, body, newline, isSlot } = node; 15730 if (isSlot) { 15731 push(`_${helperNameMap[WITH_CTX]}(`); 15732 } 15733 push(`(`, -2 /* None */, node); 15734 if (isArray(params)) { 15735 genNodeList(params, context); 15736 } else if (params) { 15737 genNode(params, context); 15738 } 15739 push(`) => `); 15740 if (newline || body) { 15741 push(`{`); 15742 indent(); 15743 } 15744 if (returns) { 15745 if (newline) { 15746 push(`return `); 15747 } 15748 if (isArray(returns)) { 15749 genNodeListAsArray(returns, context); 15750 } else { 15751 genNode(returns, context); 15752 } 15753 } else if (body) { 15754 genNode(body, context); 15755 } 15756 if (newline || body) { 15757 deindent(); 15758 push(`}`); 15759 } 15760 if (isSlot) { 15761 push(`)`); 15762 } 15763 } 15764 function genConditionalExpression(node, context) { 15765 const { test, consequent, alternate, newline: needNewline } = node; 15766 const { push, indent, deindent, newline } = context; 15767 if (test.type === 4) { 15768 const needsParens = !isSimpleIdentifier(test.content); 15769 needsParens && push(`(`); 15770 genExpression(test, context); 15771 needsParens && push(`)`); 15772 } else { 15773 push(`(`); 15774 genNode(test, context); 15775 push(`)`); 15776 } 15777 needNewline && indent(); 15778 context.indentLevel++; 15779 needNewline || push(` `); 15780 push(`? `); 15781 genNode(consequent, context); 15782 context.indentLevel--; 15783 needNewline && newline(); 15784 needNewline || push(` `); 15785 push(`: `); 15786 const isNested = alternate.type === 19; 15787 if (!isNested) { 15788 context.indentLevel++; 15789 } 15790 genNode(alternate, context); 15791 if (!isNested) { 15792 context.indentLevel--; 15793 } 15794 needNewline && deindent( 15795 true 15796 /* without newline */ 15797 ); 15798 } 15799 function genCacheExpression(node, context) { 15800 const { push, helper, indent, deindent, newline } = context; 15801 const { needPauseTracking, needArraySpread } = node; 15802 if (needArraySpread) { 15803 push(`[...(`); 15804 } 15805 push(`_cache[${node.index}] || (`); 15806 if (needPauseTracking) { 15807 indent(); 15808 push(`${helper(SET_BLOCK_TRACKING)}(-1),`); 15809 newline(); 15810 push(`(`); 15811 } 15812 push(`_cache[${node.index}] = `); 15813 genNode(node.value, context); 15814 if (needPauseTracking) { 15815 push(`).cacheIndex = ${node.index},`); 15816 newline(); 15817 push(`${helper(SET_BLOCK_TRACKING)}(1),`); 15818 newline(); 15819 push(`_cache[${node.index}]`); 15820 deindent(); 15821 } 15822 push(`)`); 15823 if (needArraySpread) { 15824 push(`)]`); 15825 } 15826 } 15827 15828 const prohibitedKeywordRE = new RegExp( 15829 "\\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" 15830 ); 15831 const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; 15832 function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) { 15833 const exp = node.content; 15834 if (!exp.trim()) { 15835 return; 15836 } 15837 try { 15838 new Function( 15839 asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}` 15840 ); 15841 } catch (e) { 15842 let message = e.message; 15843 const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE); 15844 if (keywordMatch) { 15845 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`; 15846 } 15847 context.onError( 15848 createCompilerError( 15849 45, 15850 node.loc, 15851 void 0, 15852 message 15853 ) 15854 ); 15855 } 15856 } 15857 15858 const transformExpression = (node, context) => { 15859 if (node.type === 5) { 15860 node.content = processExpression( 15861 node.content, 15862 context 15863 ); 15864 } else if (node.type === 1) { 15865 for (let i = 0; i < node.props.length; i++) { 15866 const dir = node.props[i]; 15867 if (dir.type === 7 && dir.name !== "for") { 15868 const exp = dir.exp; 15869 const arg = dir.arg; 15870 if (exp && exp.type === 4 && !(dir.name === "on" && arg)) { 15871 dir.exp = processExpression( 15872 exp, 15873 context, 15874 // slot args must be processed as function params 15875 dir.name === "slot" 15876 ); 15877 } 15878 if (arg && arg.type === 4 && !arg.isStatic) { 15879 dir.arg = processExpression(arg, context); 15880 } 15881 } 15882 } 15883 } 15884 }; 15885 function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) { 15886 { 15887 { 15888 validateBrowserExpression(node, context, asParams, asRawStatements); 15889 } 15890 return node; 15891 } 15892 } 15893 15894 const transformIf = createStructuralDirectiveTransform( 15895 /^(if|else|else-if)$/, 15896 (node, dir, context) => { 15897 return processIf(node, dir, context, (ifNode, branch, isRoot) => { 15898 const siblings = context.parent.children; 15899 let i = siblings.indexOf(ifNode); 15900 let key = 0; 15901 while (i-- >= 0) { 15902 const sibling = siblings[i]; 15903 if (sibling && sibling.type === 9) { 15904 key += sibling.branches.length; 15905 } 15906 } 15907 return () => { 15908 if (isRoot) { 15909 ifNode.codegenNode = createCodegenNodeForBranch( 15910 branch, 15911 key, 15912 context 15913 ); 15914 } else { 15915 const parentCondition = getParentCondition(ifNode.codegenNode); 15916 parentCondition.alternate = createCodegenNodeForBranch( 15917 branch, 15918 key + ifNode.branches.length - 1, 15919 context 15920 ); 15921 } 15922 }; 15923 }); 15924 } 15925 ); 15926 function processIf(node, dir, context, processCodegen) { 15927 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) { 15928 const loc = dir.exp ? dir.exp.loc : node.loc; 15929 context.onError( 15930 createCompilerError(28, dir.loc) 15931 ); 15932 dir.exp = createSimpleExpression(`true`, false, loc); 15933 } 15934 if (dir.exp) { 15935 validateBrowserExpression(dir.exp, context); 15936 } 15937 if (dir.name === "if") { 15938 const branch = createIfBranch(node, dir); 15939 const ifNode = { 15940 type: 9, 15941 loc: node.loc, 15942 branches: [branch] 15943 }; 15944 context.replaceNode(ifNode); 15945 if (processCodegen) { 15946 return processCodegen(ifNode, branch, true); 15947 } 15948 } else { 15949 const siblings = context.parent.children; 15950 const comments = []; 15951 let i = siblings.indexOf(node); 15952 while (i-- >= -1) { 15953 const sibling = siblings[i]; 15954 if (sibling && sibling.type === 3) { 15955 context.removeNode(sibling); 15956 comments.unshift(sibling); 15957 continue; 15958 } 15959 if (sibling && sibling.type === 2 && !sibling.content.trim().length) { 15960 context.removeNode(sibling); 15961 continue; 15962 } 15963 if (sibling && sibling.type === 9) { 15964 if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) { 15965 context.onError( 15966 createCompilerError(30, node.loc) 15967 ); 15968 } 15969 context.removeNode(); 15970 const branch = createIfBranch(node, dir); 15971 if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition> 15972 !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) { 15973 branch.children = [...comments, ...branch.children]; 15974 } 15975 {
vendor: 5,262 bytes, lines 15976-16190
15976 const key = branch.userKey; 15977 if (key) { 15978 sibling.branches.forEach(({ userKey }) => { 15979 if (isSameKey(userKey, key)) { 15980 context.onError( 15981 createCompilerError( 15982 29, 15983 branch.userKey.loc 15984 ) 15985 ); 15986 } 15987 }); 15988 } 15989 } 15990 sibling.branches.push(branch); 15991 const onExit = processCodegen && processCodegen(sibling, branch, false); 15992 traverseNode(branch, context); 15993 if (onExit) onExit(); 15994 context.currentNode = null; 15995 } else { 15996 context.onError( 15997 createCompilerError(30, node.loc) 15998 ); 15999 } 16000 break; 16001 } 16002 } 16003 } 16004 function createIfBranch(node, dir) { 16005 const isTemplateIf = node.tagType === 3; 16006 return { 16007 type: 10, 16008 loc: node.loc, 16009 condition: dir.name === "else" ? void 0 : dir.exp, 16010 children: isTemplateIf && !findDir(node, "for") ? node.children : [node], 16011 userKey: findProp(node, `key`), 16012 isTemplateIf 16013 }; 16014 } 16015 function createCodegenNodeForBranch(branch, keyIndex, context) { 16016 if (branch.condition) { 16017 return createConditionalExpression( 16018 branch.condition, 16019 createChildrenCodegenNode(branch, keyIndex, context), 16020 // make sure to pass in asBlock: true so that the comment node call 16021 // closes the current block. 16022 createCallExpression(context.helper(CREATE_COMMENT), [ 16023 '"v-if"' , 16024 "true" 16025 ]) 16026 ); 16027 } else { 16028 return createChildrenCodegenNode(branch, keyIndex, context); 16029 } 16030 } 16031 function createChildrenCodegenNode(branch, keyIndex, context) { 16032 const { helper } = context; 16033 const keyProperty = createObjectProperty( 16034 `key`, 16035 createSimpleExpression( 16036 `${keyIndex}`, 16037 false, 16038 locStub, 16039 2 16040 ) 16041 ); 16042 const { children } = branch; 16043 const firstChild = children[0]; 16044 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1; 16045 if (needFragmentWrapper) { 16046 if (children.length === 1 && firstChild.type === 11) { 16047 const vnodeCall = firstChild.codegenNode; 16048 injectProp(vnodeCall, keyProperty, context); 16049 return vnodeCall; 16050 } else { 16051 let patchFlag = 64; 16052 if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) { 16053 patchFlag |= 2048; 16054 } 16055 return createVNodeCall( 16056 context, 16057 helper(FRAGMENT), 16058 createObjectExpression([keyProperty]), 16059 children, 16060 patchFlag, 16061 void 0, 16062 void 0, 16063 true, 16064 false, 16065 false, 16066 branch.loc 16067 ); 16068 } 16069 } else { 16070 const ret = firstChild.codegenNode; 16071 const vnodeCall = getMemoedVNodeCall(ret); 16072 if (vnodeCall.type === 13) { 16073 convertToBlock(vnodeCall, context); 16074 } 16075 injectProp(vnodeCall, keyProperty, context); 16076 return ret; 16077 } 16078 } 16079 function isSameKey(a, b) { 16080 if (!a || a.type !== b.type) { 16081 return false; 16082 } 16083 if (a.type === 6) { 16084 if (a.value.content !== b.value.content) { 16085 return false; 16086 } 16087 } else { 16088 const exp = a.exp; 16089 const branchExp = b.exp; 16090 if (exp.type !== branchExp.type) { 16091 return false; 16092 } 16093 if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) { 16094 return false; 16095 } 16096 } 16097 return true; 16098 } 16099 function getParentCondition(node) { 16100 while (true) { 16101 if (node.type === 19) { 16102 if (node.alternate.type === 19) { 16103 node = node.alternate; 16104 } else { 16105 return node; 16106 } 16107 } else if (node.type === 20) { 16108 node = node.value; 16109 } 16110 } 16111 } 16112 16113 const transformBind = (dir, _node, context) => { 16114 const { modifiers, loc } = dir; 16115 const arg = dir.arg; 16116 let { exp } = dir; 16117 if (exp && exp.type === 4 && !exp.content.trim()) { 16118 { 16119 exp = void 0; 16120 } 16121 } 16122 if (!exp) { 16123 if (arg.type !== 4 || !arg.isStatic) { 16124 context.onError( 16125 createCompilerError( 16126 52, 16127 arg.loc 16128 ) 16129 ); 16130 return { 16131 props: [ 16132 createObjectProperty(arg, createSimpleExpression("", true, loc)) 16133 ] 16134 }; 16135 } 16136 transformBindShorthand(dir); 16137 exp = dir.exp; 16138 } 16139 if (arg.type !== 4) { 16140 arg.children.unshift(`(`); 16141 arg.children.push(`) || ""`); 16142 } else if (!arg.isStatic) { 16143 arg.content = `${arg.content} || ""`; 16144 } 16145 if (modifiers.some((mod) => mod.content === "camel")) { 16146 if (arg.type === 4) { 16147 if (arg.isStatic) { 16148 arg.content = camelize(arg.content); 16149 } else { 16150 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`; 16151 } 16152 } else { 16153 arg.children.unshift(`${context.helperString(CAMELIZE)}(`); 16154 arg.children.push(`)`); 16155 } 16156 } 16157 if (!context.inSSR) { 16158 if (modifiers.some((mod) => mod.content === "prop")) { 16159 injectPrefix(arg, "."); 16160 } 16161 if (modifiers.some((mod) => mod.content === "attr")) { 16162 injectPrefix(arg, "^"); 16163 } 16164 } 16165 return { 16166 props: [createObjectProperty(arg, exp)] 16167 }; 16168 }; 16169 const transformBindShorthand = (dir, context) => { 16170 const arg = dir.arg; 16171 const propName = camelize(arg.content); 16172 dir.exp = createSimpleExpression(propName, false, arg.loc); 16173 }; 16174 const injectPrefix = (arg, prefix) => { 16175 if (arg.type === 4) { 16176 if (arg.isStatic) { 16177 arg.content = prefix + arg.content; 16178 } else { 16179 arg.content = `\`${prefix}\${${arg.content}}\``; 16180 } 16181 } else { 16182 arg.children.unshift(`'${prefix}' + (`); 16183 arg.children.push(`)`); 16184 } 16185 }; 16186 16187 const transformFor = createStructuralDirectiveTransform( 16188 "for", 16189 (node, dir, context) => { 16190 const { helper, removeHelper } = context;
vendor: 44,083 bytes, lines 16191-17772
16191 return processFor(node, dir, context, (forNode) => { 16192 const renderExp = createCallExpression(helper(RENDER_LIST), [ 16193 forNode.source 16194 ]); 16195 const isTemplate = isTemplateNode(node); 16196 const memo = findDir(node, "memo"); 16197 const keyProp = findProp(node, `key`, false, true); 16198 if (keyProp && keyProp.type === 7 && !keyProp.exp) { 16199 transformBindShorthand(keyProp); 16200 } 16201 const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp); 16202 const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null; 16203 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0; 16204 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256; 16205 forNode.codegenNode = createVNodeCall( 16206 context, 16207 helper(FRAGMENT), 16208 void 0, 16209 renderExp, 16210 fragmentFlag, 16211 void 0, 16212 void 0, 16213 true, 16214 !isStableFragment, 16215 false, 16216 node.loc 16217 ); 16218 return () => { 16219 let childBlock; 16220 const { children } = forNode; 16221 if (isTemplate) { 16222 node.children.some((c) => { 16223 if (c.type === 1) { 16224 const key = findProp(c, "key"); 16225 if (key) { 16226 context.onError( 16227 createCompilerError( 16228 33, 16229 key.loc 16230 ) 16231 ); 16232 return true; 16233 } 16234 } 16235 }); 16236 } 16237 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1; 16238 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null; 16239 if (slotOutlet) { 16240 childBlock = slotOutlet.codegenNode; 16241 if (isTemplate && keyProperty) { 16242 injectProp(childBlock, keyProperty, context); 16243 } 16244 } else if (needFragmentWrapper) { 16245 childBlock = createVNodeCall( 16246 context, 16247 helper(FRAGMENT), 16248 keyProperty ? createObjectExpression([keyProperty]) : void 0, 16249 node.children, 16250 64, 16251 void 0, 16252 void 0, 16253 true, 16254 void 0, 16255 false 16256 ); 16257 } else { 16258 childBlock = children[0].codegenNode; 16259 if (isTemplate && keyProperty) { 16260 injectProp(childBlock, keyProperty, context); 16261 } 16262 if (childBlock.isBlock !== !isStableFragment) { 16263 if (childBlock.isBlock) { 16264 removeHelper(OPEN_BLOCK); 16265 removeHelper( 16266 getVNodeBlockHelper(context.inSSR, childBlock.isComponent) 16267 ); 16268 } else { 16269 removeHelper( 16270 getVNodeHelper(context.inSSR, childBlock.isComponent) 16271 ); 16272 } 16273 } 16274 childBlock.isBlock = !isStableFragment; 16275 if (childBlock.isBlock) { 16276 helper(OPEN_BLOCK); 16277 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent)); 16278 } else { 16279 helper(getVNodeHelper(context.inSSR, childBlock.isComponent)); 16280 } 16281 } 16282 if (memo) { 16283 const loop = createFunctionExpression( 16284 createForLoopParams(forNode.parseResult, [ 16285 createSimpleExpression(`_cached`) 16286 ]) 16287 ); 16288 loop.body = createBlockStatement([ 16289 createCompoundExpression([`const _memo = (`, memo.exp, `)`]), 16290 createCompoundExpression([ 16291 `if (_cached`, 16292 ...keyExp ? [` && _cached.key === `, keyExp] : [], 16293 ` && ${context.helperString( 16294 IS_MEMO_SAME 16295 )}(_cached, _memo)) return _cached` 16296 ]), 16297 createCompoundExpression([`const _item = `, childBlock]), 16298 createSimpleExpression(`_item.memo = _memo`), 16299 createSimpleExpression(`return _item`) 16300 ]); 16301 renderExp.arguments.push( 16302 loop, 16303 createSimpleExpression(`_cache`), 16304 createSimpleExpression(String(context.cached.length)) 16305 ); 16306 context.cached.push(null); 16307 } else { 16308 renderExp.arguments.push( 16309 createFunctionExpression( 16310 createForLoopParams(forNode.parseResult), 16311 childBlock, 16312 true 16313 ) 16314 ); 16315 } 16316 }; 16317 }); 16318 } 16319 ); 16320 function processFor(node, dir, context, processCodegen) { 16321 if (!dir.exp) { 16322 context.onError( 16323 createCompilerError(31, dir.loc) 16324 ); 16325 return; 16326 } 16327 const parseResult = dir.forParseResult; 16328 if (!parseResult) { 16329 context.onError( 16330 createCompilerError(32, dir.loc) 16331 ); 16332 return; 16333 } 16334 finalizeForParseResult(parseResult, context); 16335 const { addIdentifiers, removeIdentifiers, scopes } = context; 16336 const { source, value, key, index } = parseResult; 16337 const forNode = { 16338 type: 11, 16339 loc: dir.loc, 16340 source, 16341 valueAlias: value, 16342 keyAlias: key, 16343 objectIndexAlias: index, 16344 parseResult, 16345 children: isTemplateNode(node) ? node.children : [node] 16346 }; 16347 context.replaceNode(forNode); 16348 scopes.vFor++; 16349 const onExit = processCodegen && processCodegen(forNode); 16350 return () => { 16351 scopes.vFor--; 16352 if (onExit) onExit(); 16353 }; 16354 } 16355 function finalizeForParseResult(result, context) { 16356 if (result.finalized) return; 16357 { 16358 validateBrowserExpression(result.source, context); 16359 if (result.key) { 16360 validateBrowserExpression( 16361 result.key, 16362 context, 16363 true 16364 ); 16365 } 16366 if (result.index) { 16367 validateBrowserExpression( 16368 result.index, 16369 context, 16370 true 16371 ); 16372 } 16373 if (result.value) { 16374 validateBrowserExpression( 16375 result.value, 16376 context, 16377 true 16378 ); 16379 } 16380 } 16381 result.finalized = true; 16382 } 16383 function createForLoopParams({ value, key, index }, memoArgs = []) { 16384 return createParamsList([value, key, index, ...memoArgs]); 16385 } 16386 function createParamsList(args) { 16387 let i = args.length; 16388 while (i--) { 16389 if (args[i]) break; 16390 } 16391 return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false)); 16392 } 16393 16394 const defaultFallback = createSimpleExpression(`undefined`, false); 16395 const trackSlotScopes = (node, context) => { 16396 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) { 16397 const vSlot = findDir(node, "slot"); 16398 if (vSlot) { 16399 vSlot.exp; 16400 context.scopes.vSlot++; 16401 return () => { 16402 context.scopes.vSlot--; 16403 }; 16404 } 16405 } 16406 }; 16407 const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression( 16408 props, 16409 children, 16410 false, 16411 true, 16412 children.length ? children[0].loc : loc 16413 ); 16414 function buildSlots(node, context, buildSlotFn = buildClientSlotFn) { 16415 context.helper(WITH_CTX); 16416 const { children, loc } = node; 16417 const slotsProperties = []; 16418 const dynamicSlots = []; 16419 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0; 16420 const onComponentSlot = findDir(node, "slot", true); 16421 if (onComponentSlot) { 16422 const { arg, exp } = onComponentSlot; 16423 if (arg && !isStaticExp(arg)) { 16424 hasDynamicSlots = true; 16425 } 16426 slotsProperties.push( 16427 createObjectProperty( 16428 arg || createSimpleExpression("default", true), 16429 buildSlotFn(exp, void 0, children, loc) 16430 ) 16431 ); 16432 } 16433 let hasTemplateSlots = false; 16434 let hasNamedDefaultSlot = false; 16435 const implicitDefaultChildren = []; 16436 const seenSlotNames = /* @__PURE__ */ new Set(); 16437 let conditionalBranchIndex = 0; 16438 for (let i = 0; i < children.length; i++) { 16439 const slotElement = children[i]; 16440 let slotDir; 16441 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) { 16442 if (slotElement.type !== 3) { 16443 implicitDefaultChildren.push(slotElement); 16444 } 16445 continue; 16446 } 16447 if (onComponentSlot) { 16448 context.onError( 16449 createCompilerError(37, slotDir.loc) 16450 ); 16451 break; 16452 } 16453 hasTemplateSlots = true; 16454 const { children: slotChildren, loc: slotLoc } = slotElement; 16455 const { 16456 arg: slotName = createSimpleExpression(`default`, true), 16457 exp: slotProps, 16458 loc: dirLoc 16459 } = slotDir; 16460 let staticSlotName; 16461 if (isStaticExp(slotName)) { 16462 staticSlotName = slotName ? slotName.content : `default`; 16463 } else { 16464 hasDynamicSlots = true; 16465 } 16466 const vFor = findDir(slotElement, "for"); 16467 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc); 16468 let vIf; 16469 let vElse; 16470 if (vIf = findDir(slotElement, "if")) { 16471 hasDynamicSlots = true; 16472 dynamicSlots.push( 16473 createConditionalExpression( 16474 vIf.exp, 16475 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), 16476 defaultFallback 16477 ) 16478 ); 16479 } else if (vElse = findDir( 16480 slotElement, 16481 /^else(-if)?$/, 16482 true 16483 /* allowEmpty */ 16484 )) { 16485 let j = i; 16486 let prev; 16487 while (j--) { 16488 prev = children[j]; 16489 if (prev.type !== 3) { 16490 break; 16491 } 16492 } 16493 if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) { 16494 let conditional = dynamicSlots[dynamicSlots.length - 1]; 16495 while (conditional.alternate.type === 19) { 16496 conditional = conditional.alternate; 16497 } 16498 conditional.alternate = vElse.exp ? createConditionalExpression( 16499 vElse.exp, 16500 buildDynamicSlot( 16501 slotName, 16502 slotFunction, 16503 conditionalBranchIndex++ 16504 ), 16505 defaultFallback 16506 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++); 16507 } else { 16508 context.onError( 16509 createCompilerError(30, vElse.loc) 16510 ); 16511 } 16512 } else if (vFor) { 16513 hasDynamicSlots = true; 16514 const parseResult = vFor.forParseResult; 16515 if (parseResult) { 16516 finalizeForParseResult(parseResult, context); 16517 dynamicSlots.push( 16518 createCallExpression(context.helper(RENDER_LIST), [ 16519 parseResult.source, 16520 createFunctionExpression( 16521 createForLoopParams(parseResult), 16522 buildDynamicSlot(slotName, slotFunction), 16523 true 16524 ) 16525 ]) 16526 ); 16527 } else { 16528 context.onError( 16529 createCompilerError( 16530 32, 16531 vFor.loc 16532 ) 16533 ); 16534 } 16535 } else { 16536 if (staticSlotName) { 16537 if (seenSlotNames.has(staticSlotName)) { 16538 context.onError( 16539 createCompilerError( 16540 38, 16541 dirLoc 16542 ) 16543 ); 16544 continue; 16545 } 16546 seenSlotNames.add(staticSlotName); 16547 if (staticSlotName === "default") { 16548 hasNamedDefaultSlot = true; 16549 } 16550 } 16551 slotsProperties.push(createObjectProperty(slotName, slotFunction)); 16552 } 16553 } 16554 if (!onComponentSlot) { 16555 const buildDefaultSlotProperty = (props, children2) => { 16556 const fn = buildSlotFn(props, void 0, children2, loc); 16557 return createObjectProperty(`default`, fn); 16558 }; 16559 if (!hasTemplateSlots) { 16560 slotsProperties.push(buildDefaultSlotProperty(void 0, children)); 16561 } else if (implicitDefaultChildren.length && // #3766 16562 // with whitespace: 'preserve', whitespaces between slots will end up in 16563 // implicitDefaultChildren. Ignore if all implicit children are whitespaces. 16564 implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) { 16565 if (hasNamedDefaultSlot) { 16566 context.onError( 16567 createCompilerError( 16568 39, 16569 implicitDefaultChildren[0].loc 16570 ) 16571 ); 16572 } else { 16573 slotsProperties.push( 16574 buildDefaultSlotProperty(void 0, implicitDefaultChildren) 16575 ); 16576 } 16577 } 16578 } 16579 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1; 16580 let slots = createObjectExpression( 16581 slotsProperties.concat( 16582 createObjectProperty( 16583 `_`, 16584 // 2 = compiled but dynamic = can skip normalization, but must run diff 16585 // 1 = compiled and static = can skip normalization AND diff as optimized 16586 createSimpleExpression( 16587 slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ), 16588 false 16589 ) 16590 ) 16591 ), 16592 loc 16593 ); 16594 if (dynamicSlots.length) { 16595 slots = createCallExpression(context.helper(CREATE_SLOTS), [ 16596 slots, 16597 createArrayExpression(dynamicSlots) 16598 ]); 16599 } 16600 return { 16601 slots, 16602 hasDynamicSlots 16603 }; 16604 } 16605 function buildDynamicSlot(name, fn, index) { 16606 const props = [ 16607 createObjectProperty(`name`, name), 16608 createObjectProperty(`fn`, fn) 16609 ]; 16610 if (index != null) { 16611 props.push( 16612 createObjectProperty(`key`, createSimpleExpression(String(index), true)) 16613 ); 16614 } 16615 return createObjectExpression(props); 16616 } 16617 function hasForwardedSlots(children) { 16618 for (let i = 0; i < children.length; i++) { 16619 const child = children[i]; 16620 switch (child.type) { 16621 case 1: 16622 if (child.tagType === 2 || hasForwardedSlots(child.children)) { 16623 return true; 16624 } 16625 break; 16626 case 9: 16627 if (hasForwardedSlots(child.branches)) return true; 16628 break; 16629 case 10: 16630 case 11: 16631 if (hasForwardedSlots(child.children)) return true; 16632 break; 16633 } 16634 } 16635 return false; 16636 } 16637 function isNonWhitespaceContent(node) { 16638 if (node.type !== 2 && node.type !== 12) 16639 return true; 16640 return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content); 16641 } 16642 16643 const directiveImportMap = /* @__PURE__ */ new WeakMap(); 16644 const transformElement = (node, context) => { 16645 return function postTransformElement() { 16646 node = context.currentNode; 16647 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) { 16648 return; 16649 } 16650 const { tag, props } = node; 16651 const isComponent = node.tagType === 1; 16652 let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`; 16653 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT; 16654 let vnodeProps; 16655 let vnodeChildren; 16656 let patchFlag = 0; 16657 let vnodeDynamicProps; 16658 let dynamicPropNames; 16659 let vnodeDirectives; 16660 let shouldUseBlock = ( 16661 // dynamic component may resolve to plain elements 16662 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block 16663 // updates inside get proper isSVG flag at runtime. (#639, #643) 16664 // This is technically web-specific, but splitting the logic out of core 16665 // leads to too much unnecessary complexity. 16666 (tag === "svg" || tag === "foreignObject" || tag === "math") 16667 ); 16668 if (props.length > 0) { 16669 const propsBuildResult = buildProps( 16670 node, 16671 context, 16672 void 0, 16673 isComponent, 16674 isDynamicComponent 16675 ); 16676 vnodeProps = propsBuildResult.props; 16677 patchFlag = propsBuildResult.patchFlag; 16678 dynamicPropNames = propsBuildResult.dynamicPropNames; 16679 const directives = propsBuildResult.directives; 16680 vnodeDirectives = directives && directives.length ? createArrayExpression( 16681 directives.map((dir) => buildDirectiveArgs(dir, context)) 16682 ) : void 0; 16683 if (propsBuildResult.shouldUseBlock) { 16684 shouldUseBlock = true; 16685 } 16686 } 16687 if (node.children.length > 0) { 16688 if (vnodeTag === KEEP_ALIVE) { 16689 shouldUseBlock = true; 16690 patchFlag |= 1024; 16691 if (node.children.length > 1) { 16692 context.onError( 16693 createCompilerError(46, { 16694 start: node.children[0].loc.start, 16695 end: node.children[node.children.length - 1].loc.end, 16696 source: "" 16697 }) 16698 ); 16699 } 16700 } 16701 const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling 16702 vnodeTag !== TELEPORT && // explained above. 16703 vnodeTag !== KEEP_ALIVE; 16704 if (shouldBuildAsSlots) { 16705 const { slots, hasDynamicSlots } = buildSlots(node, context); 16706 vnodeChildren = slots; 16707 if (hasDynamicSlots) { 16708 patchFlag |= 1024; 16709 } 16710 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) { 16711 const child = node.children[0]; 16712 const type = child.type; 16713 const hasDynamicTextChild = type === 5 || type === 8; 16714 if (hasDynamicTextChild && getConstantType(child, context) === 0) { 16715 patchFlag |= 1; 16716 } 16717 if (hasDynamicTextChild || type === 2) { 16718 vnodeChildren = child; 16719 } else { 16720 vnodeChildren = node.children; 16721 } 16722 } else { 16723 vnodeChildren = node.children; 16724 } 16725 } 16726 if (dynamicPropNames && dynamicPropNames.length) { 16727 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames); 16728 } 16729 node.codegenNode = createVNodeCall( 16730 context, 16731 vnodeTag, 16732 vnodeProps, 16733 vnodeChildren, 16734 patchFlag === 0 ? void 0 : patchFlag, 16735 vnodeDynamicProps, 16736 vnodeDirectives, 16737 !!shouldUseBlock, 16738 false, 16739 isComponent, 16740 node.loc 16741 ); 16742 }; 16743 }; 16744 function resolveComponentType(node, context, ssr = false) { 16745 let { tag } = node; 16746 const isExplicitDynamic = isComponentTag(tag); 16747 const isProp = findProp( 16748 node, 16749 "is", 16750 false, 16751 true 16752 /* allow empty */ 16753 ); 16754 if (isProp) { 16755 if (isExplicitDynamic || false) { 16756 let exp; 16757 if (isProp.type === 6) { 16758 exp = isProp.value && createSimpleExpression(isProp.value.content, true); 16759 } else { 16760 exp = isProp.exp; 16761 if (!exp) { 16762 exp = createSimpleExpression(`is`, false, isProp.arg.loc); 16763 } 16764 } 16765 if (exp) { 16766 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [ 16767 exp 16768 ]); 16769 } 16770 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) { 16771 tag = isProp.value.content.slice(4); 16772 } 16773 } 16774 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag); 16775 if (builtIn) { 16776 if (!ssr) context.helper(builtIn); 16777 return builtIn; 16778 } 16779 context.helper(RESOLVE_COMPONENT); 16780 context.components.add(tag); 16781 return toValidAssetId(tag, `component`); 16782 } 16783 function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) { 16784 const { tag, loc: elementLoc, children } = node; 16785 let properties = []; 16786 const mergeArgs = []; 16787 const runtimeDirectives = []; 16788 const hasChildren = children.length > 0; 16789 let shouldUseBlock = false; 16790 let patchFlag = 0; 16791 let hasRef = false; 16792 let hasClassBinding = false; 16793 let hasStyleBinding = false; 16794 let hasHydrationEventBinding = false; 16795 let hasDynamicKeys = false; 16796 let hasVnodeHook = false; 16797 const dynamicPropNames = []; 16798 const pushMergeArg = (arg) => { 16799 if (properties.length) { 16800 mergeArgs.push( 16801 createObjectExpression(dedupeProperties(properties), elementLoc) 16802 ); 16803 properties = []; 16804 } 16805 if (arg) mergeArgs.push(arg); 16806 }; 16807 const pushRefVForMarker = () => { 16808 if (context.scopes.vFor > 0) { 16809 properties.push( 16810 createObjectProperty( 16811 createSimpleExpression("ref_for", true), 16812 createSimpleExpression("true") 16813 ) 16814 ); 16815 } 16816 }; 16817 const analyzePatchFlag = ({ key, value }) => { 16818 if (isStaticExp(key)) { 16819 const name = key.content; 16820 const isEventHandler = isOn(name); 16821 if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click 16822 // dedicated fast path. 16823 name.toLowerCase() !== "onclick" && // omit v-model handlers 16824 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks 16825 !isReservedProp(name)) { 16826 hasHydrationEventBinding = true; 16827 } 16828 if (isEventHandler && isReservedProp(name)) { 16829 hasVnodeHook = true; 16830 } 16831 if (isEventHandler && value.type === 14) { 16832 value = value.arguments[0]; 16833 } 16834 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) { 16835 return; 16836 } 16837 if (name === "ref") { 16838 hasRef = true; 16839 } else if (name === "class") { 16840 hasClassBinding = true; 16841 } else if (name === "style") { 16842 hasStyleBinding = true; 16843 } else if (name !== "key" && !dynamicPropNames.includes(name)) { 16844 dynamicPropNames.push(name); 16845 } 16846 if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) { 16847 dynamicPropNames.push(name); 16848 } 16849 } else { 16850 hasDynamicKeys = true; 16851 } 16852 }; 16853 for (let i = 0; i < props.length; i++) { 16854 const prop = props[i]; 16855 if (prop.type === 6) { 16856 const { loc, name, nameLoc, value } = prop; 16857 let isStatic = true; 16858 if (name === "ref") { 16859 hasRef = true; 16860 pushRefVForMarker(); 16861 } 16862 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) { 16863 continue; 16864 } 16865 properties.push( 16866 createObjectProperty( 16867 createSimpleExpression(name, true, nameLoc), 16868 createSimpleExpression( 16869 value ? value.content : "", 16870 isStatic, 16871 value ? value.loc : loc 16872 ) 16873 ) 16874 ); 16875 } else { 16876 const { name, arg, exp, loc, modifiers } = prop; 16877 const isVBind = name === "bind"; 16878 const isVOn = name === "on"; 16879 if (name === "slot") { 16880 if (!isComponent) { 16881 context.onError( 16882 createCompilerError(40, loc) 16883 ); 16884 } 16885 continue; 16886 } 16887 if (name === "once" || name === "memo") { 16888 continue; 16889 } 16890 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) { 16891 continue; 16892 } 16893 if (isVOn && ssr) { 16894 continue; 16895 } 16896 if ( 16897 // #938: elements with dynamic keys should be forced into blocks 16898 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked 16899 // before children 16900 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update") 16901 ) { 16902 shouldUseBlock = true; 16903 } 16904 if (isVBind && isStaticArgOf(arg, "ref")) { 16905 pushRefVForMarker(); 16906 } 16907 if (!arg && (isVBind || isVOn)) { 16908 hasDynamicKeys = true; 16909 if (exp) { 16910 if (isVBind) { 16911 pushRefVForMarker(); 16912 pushMergeArg(); 16913 mergeArgs.push(exp); 16914 } else { 16915 pushMergeArg({ 16916 type: 14, 16917 loc, 16918 callee: context.helper(TO_HANDLERS), 16919 arguments: isComponent ? [exp] : [exp, `true`] 16920 }); 16921 } 16922 } else { 16923 context.onError( 16924 createCompilerError( 16925 isVBind ? 34 : 35, 16926 loc 16927 ) 16928 ); 16929 } 16930 continue; 16931 } 16932 if (isVBind && modifiers.some((mod) => mod.content === "prop")) { 16933 patchFlag |= 32; 16934 } 16935 const directiveTransform = context.directiveTransforms[name]; 16936 if (directiveTransform) { 16937 const { props: props2, needRuntime } = directiveTransform(prop, node, context); 16938 !ssr && props2.forEach(analyzePatchFlag); 16939 if (isVOn && arg && !isStaticExp(arg)) { 16940 pushMergeArg(createObjectExpression(props2, elementLoc)); 16941 } else { 16942 properties.push(...props2); 16943 } 16944 if (needRuntime) { 16945 runtimeDirectives.push(prop); 16946 if (isSymbol(needRuntime)) { 16947 directiveImportMap.set(prop, needRuntime); 16948 } 16949 } 16950 } else if (!isBuiltInDirective(name)) { 16951 runtimeDirectives.push(prop); 16952 if (hasChildren) { 16953 shouldUseBlock = true; 16954 } 16955 } 16956 } 16957 } 16958 let propsExpression = void 0; 16959 if (mergeArgs.length) { 16960 pushMergeArg(); 16961 if (mergeArgs.length > 1) { 16962 propsExpression = createCallExpression( 16963 context.helper(MERGE_PROPS), 16964 mergeArgs, 16965 elementLoc 16966 ); 16967 } else { 16968 propsExpression = mergeArgs[0]; 16969 } 16970 } else if (properties.length) { 16971 propsExpression = createObjectExpression( 16972 dedupeProperties(properties), 16973 elementLoc 16974 ); 16975 } 16976 if (hasDynamicKeys) { 16977 patchFlag |= 16; 16978 } else { 16979 if (hasClassBinding && !isComponent) { 16980 patchFlag |= 2; 16981 } 16982 if (hasStyleBinding && !isComponent) { 16983 patchFlag |= 4; 16984 } 16985 if (dynamicPropNames.length) { 16986 patchFlag |= 8; 16987 } 16988 if (hasHydrationEventBinding) { 16989 patchFlag |= 32; 16990 } 16991 } 16992 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) { 16993 patchFlag |= 512; 16994 } 16995 if (!context.inSSR && propsExpression) { 16996 switch (propsExpression.type) { 16997 case 15: 16998 let classKeyIndex = -1; 16999 let styleKeyIndex = -1; 17000 let hasDynamicKey = false; 17001 for (let i = 0; i < propsExpression.properties.length; i++) { 17002 const key = propsExpression.properties[i].key; 17003 if (isStaticExp(key)) { 17004 if (key.content === "class") { 17005 classKeyIndex = i; 17006 } else if (key.content === "style") { 17007 styleKeyIndex = i; 17008 } 17009 } else if (!key.isHandlerKey) { 17010 hasDynamicKey = true; 17011 } 17012 } 17013 const classProp = propsExpression.properties[classKeyIndex]; 17014 const styleProp = propsExpression.properties[styleKeyIndex]; 17015 if (!hasDynamicKey) { 17016 if (classProp && !isStaticExp(classProp.value)) { 17017 classProp.value = createCallExpression( 17018 context.helper(NORMALIZE_CLASS), 17019 [classProp.value] 17020 ); 17021 } 17022 if (styleProp && // the static style is compiled into an object, 17023 // so use `hasStyleBinding` to ensure that it is a dynamic style binding 17024 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist, 17025 // v-bind:style with static literal object 17026 styleProp.value.type === 17)) { 17027 styleProp.value = createCallExpression( 17028 context.helper(NORMALIZE_STYLE), 17029 [styleProp.value] 17030 ); 17031 } 17032 } else { 17033 propsExpression = createCallExpression( 17034 context.helper(NORMALIZE_PROPS), 17035 [propsExpression] 17036 ); 17037 } 17038 break; 17039 case 14: 17040 break; 17041 default: 17042 propsExpression = createCallExpression( 17043 context.helper(NORMALIZE_PROPS), 17044 [ 17045 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [ 17046 propsExpression 17047 ]) 17048 ] 17049 ); 17050 break; 17051 } 17052 } 17053 return { 17054 props: propsExpression, 17055 directives: runtimeDirectives, 17056 patchFlag, 17057 dynamicPropNames, 17058 shouldUseBlock 17059 }; 17060 } 17061 function dedupeProperties(properties) { 17062 const knownProps = /* @__PURE__ */ new Map(); 17063 const deduped = []; 17064 for (let i = 0; i < properties.length; i++) { 17065 const prop = properties[i]; 17066 if (prop.key.type === 8 || !prop.key.isStatic) { 17067 deduped.push(prop); 17068 continue; 17069 } 17070 const name = prop.key.content; 17071 const existing = knownProps.get(name); 17072 if (existing) { 17073 if (name === "style" || name === "class" || isOn(name)) { 17074 mergeAsArray(existing, prop); 17075 } 17076 } else { 17077 knownProps.set(name, prop); 17078 deduped.push(prop); 17079 } 17080 } 17081 return deduped; 17082 } 17083 function mergeAsArray(existing, incoming) { 17084 if (existing.value.type === 17) { 17085 existing.value.elements.push(incoming.value); 17086 } else { 17087 existing.value = createArrayExpression( 17088 [existing.value, incoming.value], 17089 existing.loc 17090 ); 17091 } 17092 } 17093 function buildDirectiveArgs(dir, context) { 17094 const dirArgs = []; 17095 const runtime = directiveImportMap.get(dir); 17096 if (runtime) { 17097 dirArgs.push(context.helperString(runtime)); 17098 } else { 17099 { 17100 context.helper(RESOLVE_DIRECTIVE); 17101 context.directives.add(dir.name); 17102 dirArgs.push(toValidAssetId(dir.name, `directive`)); 17103 } 17104 } 17105 const { loc } = dir; 17106 if (dir.exp) dirArgs.push(dir.exp); 17107 if (dir.arg) { 17108 if (!dir.exp) { 17109 dirArgs.push(`void 0`); 17110 } 17111 dirArgs.push(dir.arg); 17112 } 17113 if (Object.keys(dir.modifiers).length) { 17114 if (!dir.arg) { 17115 if (!dir.exp) { 17116 dirArgs.push(`void 0`); 17117 } 17118 dirArgs.push(`void 0`); 17119 } 17120 const trueExpression = createSimpleExpression(`true`, false, loc); 17121 dirArgs.push( 17122 createObjectExpression( 17123 dir.modifiers.map( 17124 (modifier) => createObjectProperty(modifier, trueExpression) 17125 ), 17126 loc 17127 ) 17128 ); 17129 } 17130 return createArrayExpression(dirArgs, dir.loc); 17131 } 17132 function stringifyDynamicPropNames(props) { 17133 let propsNamesString = `[`; 17134 for (let i = 0, l = props.length; i < l; i++) { 17135 propsNamesString += JSON.stringify(props[i]); 17136 if (i < l - 1) propsNamesString += ", "; 17137 } 17138 return propsNamesString + `]`; 17139 } 17140 function isComponentTag(tag) { 17141 return tag === "component" || tag === "Component"; 17142 } 17143 17144 const transformSlotOutlet = (node, context) => { 17145 if (isSlotOutlet(node)) { 17146 const { children, loc } = node; 17147 const { slotName, slotProps } = processSlotOutlet(node, context); 17148 const slotArgs = [ 17149 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`, 17150 slotName, 17151 "{}", 17152 "undefined", 17153 "true" 17154 ]; 17155 let expectedLen = 2; 17156 if (slotProps) { 17157 slotArgs[2] = slotProps; 17158 expectedLen = 3; 17159 } 17160 if (children.length) { 17161 slotArgs[3] = createFunctionExpression([], children, false, false, loc); 17162 expectedLen = 4; 17163 } 17164 if (context.scopeId && !context.slotted) { 17165 expectedLen = 5; 17166 } 17167 slotArgs.splice(expectedLen); 17168 node.codegenNode = createCallExpression( 17169 context.helper(RENDER_SLOT), 17170 slotArgs, 17171 loc 17172 ); 17173 } 17174 }; 17175 function processSlotOutlet(node, context) { 17176 let slotName = `"default"`; 17177 let slotProps = void 0; 17178 const nonNameProps = []; 17179 for (let i = 0; i < node.props.length; i++) { 17180 const p = node.props[i]; 17181 if (p.type === 6) { 17182 if (p.value) { 17183 if (p.name === "name") { 17184 slotName = JSON.stringify(p.value.content); 17185 } else { 17186 p.name = camelize(p.name); 17187 nonNameProps.push(p); 17188 } 17189 } 17190 } else { 17191 if (p.name === "bind" && isStaticArgOf(p.arg, "name")) { 17192 if (p.exp) { 17193 slotName = p.exp; 17194 } else if (p.arg && p.arg.type === 4) { 17195 const name = camelize(p.arg.content); 17196 slotName = p.exp = createSimpleExpression(name, false, p.arg.loc); 17197 } 17198 } else { 17199 if (p.name === "bind" && p.arg && isStaticExp(p.arg)) { 17200 p.arg.content = camelize(p.arg.content); 17201 } 17202 nonNameProps.push(p); 17203 } 17204 } 17205 } 17206 if (nonNameProps.length > 0) { 17207 const { props, directives } = buildProps( 17208 node, 17209 context, 17210 nonNameProps, 17211 false, 17212 false 17213 ); 17214 slotProps = props; 17215 if (directives.length) { 17216 context.onError( 17217 createCompilerError( 17218 36, 17219 directives[0].loc 17220 ) 17221 ); 17222 } 17223 } 17224 return { 17225 slotName, 17226 slotProps 17227 }; 17228 } 17229 17230 const transformOn$1 = (dir, node, context, augmentor) => { 17231 const { loc, modifiers, arg } = dir; 17232 if (!dir.exp && !modifiers.length) { 17233 context.onError(createCompilerError(35, loc)); 17234 } 17235 let eventName; 17236 if (arg.type === 4) { 17237 if (arg.isStatic) { 17238 let rawName = arg.content; 17239 if (rawName.startsWith("vnode")) { 17240 context.onError(createCompilerError(51, arg.loc)); 17241 } 17242 if (rawName.startsWith("vue:")) { 17243 rawName = `vnode-${rawName.slice(4)}`; 17244 } 17245 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? ( 17246 // for non-element and vnode lifecycle event listeners, auto convert 17247 // it to camelCase. See issue #2249 17248 toHandlerKey(camelize(rawName)) 17249 ) : ( 17250 // preserve case for plain element listeners that have uppercase 17251 // letters, as these may be custom elements' custom events 17252 `on:${rawName}` 17253 ); 17254 eventName = createSimpleExpression(eventString, true, arg.loc); 17255 } else { 17256 eventName = createCompoundExpression([ 17257 `${context.helperString(TO_HANDLER_KEY)}(`, 17258 arg, 17259 `)` 17260 ]); 17261 } 17262 } else { 17263 eventName = arg; 17264 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`); 17265 eventName.children.push(`)`); 17266 } 17267 let exp = dir.exp; 17268 if (exp && !exp.content.trim()) { 17269 exp = void 0; 17270 } 17271 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce; 17272 if (exp) { 17273 const isMemberExp = isMemberExpression(exp); 17274 const isInlineStatement = !(isMemberExp || isFnExpression(exp)); 17275 const hasMultipleStatements = exp.content.includes(`;`); 17276 { 17277 validateBrowserExpression( 17278 exp, 17279 context, 17280 false, 17281 hasMultipleStatements 17282 ); 17283 } 17284 if (isInlineStatement || shouldCache && isMemberExp) { 17285 exp = createCompoundExpression([ 17286 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`, 17287 exp, 17288 hasMultipleStatements ? `}` : `)` 17289 ]); 17290 } 17291 } 17292 let ret = { 17293 props: [ 17294 createObjectProperty( 17295 eventName, 17296 exp || createSimpleExpression(`() => {}`, false, loc) 17297 ) 17298 ] 17299 }; 17300 if (augmentor) { 17301 ret = augmentor(ret); 17302 } 17303 if (shouldCache) { 17304 ret.props[0].value = context.cache(ret.props[0].value); 17305 } 17306 ret.props.forEach((p) => p.key.isHandlerKey = true); 17307 return ret; 17308 }; 17309 17310 const transformText = (node, context) => { 17311 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) { 17312 return () => { 17313 const children = node.children; 17314 let currentContainer = void 0; 17315 let hasText = false; 17316 for (let i = 0; i < children.length; i++) { 17317 const child = children[i]; 17318 if (isText$1(child)) { 17319 hasText = true; 17320 for (let j = i + 1; j < children.length; j++) { 17321 const next = children[j]; 17322 if (isText$1(next)) { 17323 if (!currentContainer) { 17324 currentContainer = children[i] = createCompoundExpression( 17325 [child], 17326 child.loc 17327 ); 17328 } 17329 currentContainer.children.push(` + `, next); 17330 children.splice(j, 1); 17331 j--; 17332 } else { 17333 currentContainer = void 0; 17334 break; 17335 } 17336 } 17337 } 17338 } 17339 if (!hasText || // if this is a plain element with a single text child, leave it 17340 // as-is since the runtime has dedicated fast path for this by directly 17341 // setting textContent of the element. 17342 // for component root it's always normalized anyway. 17343 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756 17344 // custom directives can potentially add DOM elements arbitrarily, 17345 // we need to avoid setting textContent of the element at runtime 17346 // to avoid accidentally overwriting the DOM elements added 17347 // by the user through custom directives. 17348 !node.props.find( 17349 (p) => p.type === 7 && !context.directiveTransforms[p.name] 17350 ) && // in compat mode, <template> tags with no special directives 17351 // will be rendered as a fragment so its children must be 17352 // converted into vnodes. 17353 true)) { 17354 return; 17355 } 17356 for (let i = 0; i < children.length; i++) { 17357 const child = children[i]; 17358 if (isText$1(child) || child.type === 8) { 17359 const callArgs = []; 17360 if (child.type !== 2 || child.content !== " ") { 17361 callArgs.push(child); 17362 } 17363 if (!context.ssr && getConstantType(child, context) === 0) { 17364 callArgs.push( 17365 1 + (` /* ${PatchFlagNames[1]} */` ) 17366 ); 17367 } 17368 children[i] = { 17369 type: 12, 17370 content: child, 17371 loc: child.loc, 17372 codegenNode: createCallExpression( 17373 context.helper(CREATE_TEXT), 17374 callArgs 17375 ) 17376 }; 17377 } 17378 } 17379 }; 17380 } 17381 }; 17382 17383 const seen$1 = /* @__PURE__ */ new WeakSet(); 17384 const transformOnce = (node, context) => { 17385 if (node.type === 1 && findDir(node, "once", true)) { 17386 if (seen$1.has(node) || context.inVOnce || context.inSSR) { 17387 return; 17388 } 17389 seen$1.add(node); 17390 context.inVOnce = true; 17391 context.helper(SET_BLOCK_TRACKING); 17392 return () => { 17393 context.inVOnce = false; 17394 const cur = context.currentNode; 17395 if (cur.codegenNode) { 17396 cur.codegenNode = context.cache( 17397 cur.codegenNode, 17398 true 17399 /* isVNode */ 17400 ); 17401 } 17402 }; 17403 } 17404 }; 17405 17406 const transformModel$1 = (dir, node, context) => { 17407 const { exp, arg } = dir; 17408 if (!exp) { 17409 context.onError( 17410 createCompilerError(41, dir.loc) 17411 ); 17412 return createTransformProps(); 17413 } 17414 const rawExp = exp.loc.source; 17415 const expString = exp.type === 4 ? exp.content : rawExp; 17416 const bindingType = context.bindingMetadata[rawExp]; 17417 if (bindingType === "props" || bindingType === "props-aliased") { 17418 context.onError(createCompilerError(44, exp.loc)); 17419 return createTransformProps(); 17420 } 17421 const maybeRef = false; 17422 if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) { 17423 context.onError( 17424 createCompilerError(42, exp.loc) 17425 ); 17426 return createTransformProps(); 17427 } 17428 const propName = arg ? arg : createSimpleExpression("modelValue", true); 17429 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`; 17430 let assignmentExp; 17431 const eventArg = context.isTS ? `($event: any)` : `$event`; 17432 { 17433 assignmentExp = createCompoundExpression([ 17434 `${eventArg} => ((`, 17435 exp, 17436 `) = $event)` 17437 ]); 17438 } 17439 const props = [ 17440 // modelValue: foo 17441 createObjectProperty(propName, dir.exp), 17442 // "onUpdate:modelValue": $event => (foo = $event) 17443 createObjectProperty(eventName, assignmentExp) 17444 ]; 17445 if (dir.modifiers.length && node.tagType === 1) { 17446 const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `); 17447 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`; 17448 props.push( 17449 createObjectProperty( 17450 modifiersKey, 17451 createSimpleExpression( 17452 `{ ${modifiers} }`, 17453 false, 17454 dir.loc, 17455 2 17456 ) 17457 ) 17458 ); 17459 } 17460 return createTransformProps(props); 17461 }; 17462 function createTransformProps(props = []) { 17463 return { props }; 17464 } 17465 17466 const seen = /* @__PURE__ */ new WeakSet(); 17467 const transformMemo = (node, context) => { 17468 if (node.type === 1) { 17469 const dir = findDir(node, "memo"); 17470 if (!dir || seen.has(node)) { 17471 return; 17472 } 17473 seen.add(node); 17474 return () => { 17475 const codegenNode = node.codegenNode || context.currentNode.codegenNode; 17476 if (codegenNode && codegenNode.type === 13) { 17477 if (node.tagType !== 1) { 17478 convertToBlock(codegenNode, context); 17479 } 17480 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [ 17481 dir.exp, 17482 createFunctionExpression(void 0, codegenNode), 17483 `_cache`, 17484 String(context.cached.length) 17485 ]); 17486 context.cached.push(null); 17487 } 17488 }; 17489 } 17490 }; 17491 17492 function getBaseTransformPreset(prefixIdentifiers) { 17493 return [ 17494 [ 17495 transformOnce, 17496 transformIf, 17497 transformMemo, 17498 transformFor, 17499 ...[], 17500 ...[transformExpression] , 17501 transformSlotOutlet, 17502 transformElement, 17503 trackSlotScopes, 17504 transformText 17505 ], 17506 { 17507 on: transformOn$1, 17508 bind: transformBind, 17509 model: transformModel$1 17510 } 17511 ]; 17512 } 17513 function baseCompile(source, options = {}) { 17514 const onError = options.onError || defaultOnError; 17515 const isModuleMode = options.mode === "module"; 17516 { 17517 if (options.prefixIdentifiers === true) { 17518 onError(createCompilerError(47)); 17519 } else if (isModuleMode) { 17520 onError(createCompilerError(48)); 17521 } 17522 } 17523 const prefixIdentifiers = false; 17524 if (options.cacheHandlers) { 17525 onError(createCompilerError(49)); 17526 } 17527 if (options.scopeId && !isModuleMode) { 17528 onError(createCompilerError(50)); 17529 } 17530 const resolvedOptions = extend({}, options, { 17531 prefixIdentifiers 17532 }); 17533 const ast = isString(source) ? baseParse(source, resolvedOptions) : source; 17534 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(); 17535 transform( 17536 ast, 17537 extend({}, resolvedOptions, { 17538 nodeTransforms: [ 17539 ...nodeTransforms, 17540 ...options.nodeTransforms || [] 17541 // user transforms 17542 ], 17543 directiveTransforms: extend( 17544 {}, 17545 directiveTransforms, 17546 options.directiveTransforms || {} 17547 // user transforms 17548 ) 17549 }) 17550 ); 17551 return generate(ast, resolvedOptions); 17552 } 17553 17554 const noopDirectiveTransform = () => ({ props: [] }); 17555 17556 const V_MODEL_RADIO = Symbol(`vModelRadio` ); 17557 const V_MODEL_CHECKBOX = Symbol( 17558 `vModelCheckbox` 17559 ); 17560 const V_MODEL_TEXT = Symbol(`vModelText` ); 17561 const V_MODEL_SELECT = Symbol( 17562 `vModelSelect` 17563 ); 17564 const V_MODEL_DYNAMIC = Symbol( 17565 `vModelDynamic` 17566 ); 17567 const V_ON_WITH_MODIFIERS = Symbol( 17568 `vOnModifiersGuard` 17569 ); 17570 const V_ON_WITH_KEYS = Symbol( 17571 `vOnKeysGuard` 17572 ); 17573 const V_SHOW = Symbol(`vShow` ); 17574 const TRANSITION = Symbol(`Transition` ); 17575 const TRANSITION_GROUP = Symbol( 17576 `TransitionGroup` 17577 ); 17578 registerRuntimeHelpers({ 17579 [V_MODEL_RADIO]: `vModelRadio`, 17580 [V_MODEL_CHECKBOX]: `vModelCheckbox`, 17581 [V_MODEL_TEXT]: `vModelText`, 17582 [V_MODEL_SELECT]: `vModelSelect`, 17583 [V_MODEL_DYNAMIC]: `vModelDynamic`, 17584 [V_ON_WITH_MODIFIERS]: `withModifiers`, 17585 [V_ON_WITH_KEYS]: `withKeys`, 17586 [V_SHOW]: `vShow`, 17587 [TRANSITION]: `Transition`, 17588 [TRANSITION_GROUP]: `TransitionGroup` 17589 }); 17590 17591 let decoder; 17592 function decodeHtmlBrowser(raw, asAttr = false) { 17593 if (!decoder) { 17594 decoder = document.createElement("div"); 17595 } 17596 if (asAttr) { 17597 decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`; 17598 return decoder.children[0].getAttribute("foo"); 17599 } else { 17600 decoder.innerHTML = raw; 17601 return decoder.textContent; 17602 } 17603 } 17604 17605 const parserOptions = { 17606 parseMode: "html", 17607 isVoidTag, 17608 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 17609 isPreTag: (tag) => tag === "pre", 17610 decodeEntities: decodeHtmlBrowser , 17611 isBuiltInComponent: (tag) => { 17612 if (tag === "Transition" || tag === "transition") { 17613 return TRANSITION; 17614 } else if (tag === "TransitionGroup" || tag === "transition-group") { 17615 return TRANSITION_GROUP; 17616 } 17617 }, 17618 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher 17619 getNamespace(tag, parent, rootNamespace) { 17620 let ns = parent ? parent.ns : rootNamespace; 17621 if (parent && ns === 2) { 17622 if (parent.tag === "annotation-xml") { 17623 if (tag === "svg") { 17624 return 1; 17625 } 17626 if (parent.props.some( 17627 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml") 17628 )) { 17629 ns = 0; 17630 } 17631 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") { 17632 ns = 0; 17633 } 17634 } else if (parent && ns === 1) { 17635 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") { 17636 ns = 0; 17637 } 17638 } 17639 if (ns === 0) { 17640 if (tag === "svg") { 17641 return 1; 17642 } 17643 if (tag === "math") { 17644 return 2; 17645 } 17646 } 17647 return ns; 17648 } 17649 }; 17650 17651 const transformStyle = (node) => { 17652 if (node.type === 1) { 17653 node.props.forEach((p, i) => { 17654 if (p.type === 6 && p.name === "style" && p.value) { 17655 node.props[i] = { 17656 type: 7, 17657 name: `bind`, 17658 arg: createSimpleExpression(`style`, true, p.loc), 17659 exp: parseInlineCSS(p.value.content, p.loc), 17660 modifiers: [], 17661 loc: p.loc 17662 }; 17663 } 17664 }); 17665 } 17666 }; 17667 const parseInlineCSS = (cssText, loc) => { 17668 const normalized = parseStringStyle(cssText); 17669 return createSimpleExpression( 17670 JSON.stringify(normalized), 17671 false, 17672 loc, 17673 3 17674 ); 17675 }; 17676 17677 function createDOMCompilerError(code, loc) { 17678 return createCompilerError( 17679 code, 17680 loc, 17681 DOMErrorMessages 17682 ); 17683 } 17684 const DOMErrorMessages = { 17685 [53]: `v-html is missing expression.`, 17686 [54]: `v-html will override element children.`, 17687 [55]: `v-text is missing expression.`, 17688 [56]: `v-text will override element children.`, 17689 [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`, 17690 [58]: `v-model argument is not supported on plain elements.`, 17691 [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`, 17692 [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`, 17693 [61]: `v-show is missing expression.`, 17694 [62]: `<Transition> expects exactly one child element or component.`, 17695 [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.` 17696 }; 17697 17698 const transformVHtml = (dir, node, context) => { 17699 const { exp, loc } = dir; 17700 if (!exp) { 17701 context.onError( 17702 createDOMCompilerError(53, loc) 17703 ); 17704 } 17705 if (node.children.length) { 17706 context.onError( 17707 createDOMCompilerError(54, loc) 17708 ); 17709 node.children.length = 0; 17710 } 17711 return { 17712 props: [ 17713 createObjectProperty( 17714 createSimpleExpression(`innerHTML`, true, loc), 17715 exp || createSimpleExpression("", true) 17716 ) 17717 ] 17718 }; 17719 }; 17720 17721 const transformVText = (dir, node, context) => { 17722 const { exp, loc } = dir; 17723 if (!exp) { 17724 context.onError( 17725 createDOMCompilerError(55, loc) 17726 ); 17727 } 17728 if (node.children.length) { 17729 context.onError( 17730 createDOMCompilerError(56, loc) 17731 ); 17732 node.children.length = 0; 17733 } 17734 return { 17735 props: [ 17736 createObjectProperty( 17737 createSimpleExpression(`textContent`, true), 17738 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression( 17739 context.helperString(TO_DISPLAY_STRING), 17740 [exp], 17741 loc 17742 ) : createSimpleExpression("", true) 17743 ) 17744 ] 17745 }; 17746 }; 17747 17748 const transformModel = (dir, node, context) => { 17749 const baseResult = transformModel$1(dir, node, context); 17750 if (!baseResult.props.length || node.tagType === 1) { 17751 return baseResult; 17752 } 17753 if (dir.arg) { 17754 context.onError( 17755 createDOMCompilerError( 17756 58, 17757 dir.arg.loc 17758 ) 17759 ); 17760 } 17761 function checkDuplicatedValue() { 17762 const value = findDir(node, "bind"); 17763 if (value && isStaticArgOf(value.arg, "value")) { 17764 context.onError( 17765 createDOMCompilerError( 17766 60, 17767 value.loc 17768 ) 17769 ); 17770 } 17771 } 17772 const { tag } = node;
vendor: 4,731 bytes, lines 17773-17932
17773 const isCustomElement = context.isCustomElement(tag); 17774 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) { 17775 let directiveToUse = V_MODEL_TEXT; 17776 let isInvalidType = false; 17777 if (tag === "input" || isCustomElement) { 17778 const type = findProp(node, `type`); 17779 if (type) { 17780 if (type.type === 7) { 17781 directiveToUse = V_MODEL_DYNAMIC; 17782 } else if (type.value) { 17783 switch (type.value.content) { 17784 case "radio": 17785 directiveToUse = V_MODEL_RADIO; 17786 break; 17787 case "checkbox": 17788 directiveToUse = V_MODEL_CHECKBOX; 17789 break; 17790 case "file": 17791 isInvalidType = true; 17792 context.onError( 17793 createDOMCompilerError( 17794 59, 17795 dir.loc 17796 ) 17797 ); 17798 break; 17799 default: 17800 checkDuplicatedValue(); 17801 break; 17802 } 17803 } 17804 } else if (hasDynamicKeyVBind(node)) { 17805 directiveToUse = V_MODEL_DYNAMIC; 17806 } else { 17807 checkDuplicatedValue(); 17808 } 17809 } else if (tag === "select") { 17810 directiveToUse = V_MODEL_SELECT; 17811 } else { 17812 checkDuplicatedValue(); 17813 } 17814 if (!isInvalidType) { 17815 baseResult.needRuntime = context.helper(directiveToUse); 17816 } 17817 } else { 17818 context.onError( 17819 createDOMCompilerError( 17820 57, 17821 dir.loc 17822 ) 17823 ); 17824 } 17825 baseResult.props = baseResult.props.filter( 17826 (p) => !(p.key.type === 4 && p.key.content === "modelValue") 17827 ); 17828 return baseResult; 17829 }; 17830 17831 const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`); 17832 const isNonKeyModifier = /* @__PURE__ */ makeMap( 17833 // event propagation management 17834 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle` 17835 ); 17836 const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right"); 17837 const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`); 17838 const resolveModifiers = (key, modifiers, context, loc) => { 17839 const keyModifiers = []; 17840 const nonKeyModifiers = []; 17841 const eventOptionModifiers = []; 17842 for (let i = 0; i < modifiers.length; i++) { 17843 const modifier = modifiers[i].content; 17844 if (isEventOptionModifier(modifier)) { 17845 eventOptionModifiers.push(modifier); 17846 } else { 17847 if (maybeKeyModifier(modifier)) { 17848 if (isStaticExp(key)) { 17849 if (isKeyboardEvent(key.content.toLowerCase())) { 17850 keyModifiers.push(modifier); 17851 } else { 17852 nonKeyModifiers.push(modifier); 17853 } 17854 } else { 17855 keyModifiers.push(modifier); 17856 nonKeyModifiers.push(modifier); 17857 } 17858 } else { 17859 if (isNonKeyModifier(modifier)) { 17860 nonKeyModifiers.push(modifier); 17861 } else { 17862 keyModifiers.push(modifier); 17863 } 17864 } 17865 } 17866 } 17867 return { 17868 keyModifiers, 17869 nonKeyModifiers, 17870 eventOptionModifiers 17871 }; 17872 }; 17873 const transformClick = (key, event) => { 17874 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick"; 17875 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([ 17876 `(`, 17877 key, 17878 `) === "onClick" ? "${event}" : (`, 17879 key, 17880 `)` 17881 ]) : key; 17882 }; 17883 const transformOn = (dir, node, context) => { 17884 return transformOn$1(dir, node, context, (baseResult) => { 17885 const { modifiers } = dir; 17886 if (!modifiers.length) return baseResult; 17887 let { key, value: handlerExp } = baseResult.props[0]; 17888 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc); 17889 if (nonKeyModifiers.includes("right")) { 17890 key = transformClick(key, `onContextmenu`); 17891 } 17892 if (nonKeyModifiers.includes("middle")) { 17893 key = transformClick(key, `onMouseup`); 17894 } 17895 if (nonKeyModifiers.length) { 17896 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [ 17897 handlerExp, 17898 JSON.stringify(nonKeyModifiers) 17899 ]); 17900 } 17901 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard 17902 (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) { 17903 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [ 17904 handlerExp, 17905 JSON.stringify(keyModifiers) 17906 ]); 17907 } 17908 if (eventOptionModifiers.length) { 17909 const modifierPostfix = eventOptionModifiers.map(capitalize).join(""); 17910 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]); 17911 } 17912 return { 17913 props: [createObjectProperty(key, handlerExp)] 17914 }; 17915 }); 17916 }; 17917 17918 const transformShow = (dir, node, context) => { 17919 const { exp, loc } = dir; 17920 if (!exp) { 17921 context.onError( 17922 createDOMCompilerError(61, loc) 17923 ); 17924 } 17925 return { 17926 props: [], 17927 needRuntime: context.helper(V_SHOW) 17928 }; 17929 }; 17930 17931 const transformTransition = (node, context) => { 17932 if (node.type === 1 && node.tagType === 1) {
vendor: 6,719 bytes, lines 17933-18213
17933 const component = context.isBuiltInComponent(node.tag); 17934 if (component === TRANSITION) { 17935 return () => { 17936 if (!node.children.length) { 17937 return; 17938 } 17939 if (hasMultipleChildren(node)) { 17940 context.onError( 17941 createDOMCompilerError( 17942 62, 17943 { 17944 start: node.children[0].loc.start, 17945 end: node.children[node.children.length - 1].loc.end, 17946 source: "" 17947 } 17948 ) 17949 ); 17950 } 17951 const child = node.children[0]; 17952 if (child.type === 1) { 17953 for (const p of child.props) { 17954 if (p.type === 7 && p.name === "show") { 17955 node.props.push({ 17956 type: 6, 17957 name: "persisted", 17958 nameLoc: node.loc, 17959 value: void 0, 17960 loc: node.loc 17961 }); 17962 } 17963 } 17964 } 17965 }; 17966 } 17967 } 17968 }; 17969 function hasMultipleChildren(node) { 17970 const children = node.children = node.children.filter( 17971 (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim()) 17972 ); 17973 const child = children[0]; 17974 return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren); 17975 } 17976 17977 const ignoreSideEffectTags = (node, context) => { 17978 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) { 17979 context.onError( 17980 createDOMCompilerError( 17981 63, 17982 node.loc 17983 ) 17984 ); 17985 context.removeNode(); 17986 } 17987 }; 17988 17989 function isValidHTMLNesting(parent, child) { 17990 if (parent in onlyValidChildren) { 17991 return onlyValidChildren[parent].has(child); 17992 } 17993 if (child in onlyValidParents) { 17994 return onlyValidParents[child].has(parent); 17995 } 17996 if (parent in knownInvalidChildren) { 17997 if (knownInvalidChildren[parent].has(child)) return false; 17998 } 17999 if (child in knownInvalidParents) { 18000 if (knownInvalidParents[child].has(parent)) return false; 18001 } 18002 return true; 18003 } 18004 const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]); 18005 const emptySet = /* @__PURE__ */ new Set([]); 18006 const onlyValidChildren = { 18007 head: /* @__PURE__ */ new Set([ 18008 "base", 18009 "basefront", 18010 "bgsound", 18011 "link", 18012 "meta", 18013 "title", 18014 "noscript", 18015 "noframes", 18016 "style", 18017 "script", 18018 "template" 18019 ]), 18020 optgroup: /* @__PURE__ */ new Set(["option"]), 18021 select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]), 18022 // table 18023 table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]), 18024 tr: /* @__PURE__ */ new Set(["td", "th"]), 18025 colgroup: /* @__PURE__ */ new Set(["col"]), 18026 tbody: /* @__PURE__ */ new Set(["tr"]), 18027 thead: /* @__PURE__ */ new Set(["tr"]), 18028 tfoot: /* @__PURE__ */ new Set(["tr"]), 18029 // these elements can not have any children elements 18030 script: emptySet, 18031 iframe: emptySet, 18032 option: emptySet, 18033 textarea: emptySet, 18034 style: emptySet, 18035 title: emptySet 18036 }; 18037 const onlyValidParents = { 18038 // sections 18039 html: emptySet, 18040 body: /* @__PURE__ */ new Set(["html"]), 18041 head: /* @__PURE__ */ new Set(["html"]), 18042 // table 18043 td: /* @__PURE__ */ new Set(["tr"]), 18044 colgroup: /* @__PURE__ */ new Set(["table"]), 18045 caption: /* @__PURE__ */ new Set(["table"]), 18046 tbody: /* @__PURE__ */ new Set(["table"]), 18047 tfoot: /* @__PURE__ */ new Set(["table"]), 18048 col: /* @__PURE__ */ new Set(["colgroup"]), 18049 th: /* @__PURE__ */ new Set(["tr"]), 18050 thead: /* @__PURE__ */ new Set(["table"]), 18051 tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]), 18052 // data list 18053 dd: /* @__PURE__ */ new Set(["dl", "div"]), 18054 dt: /* @__PURE__ */ new Set(["dl", "div"]), 18055 // other 18056 figcaption: /* @__PURE__ */ new Set(["figure"]), 18057 // li: new Set(["ul", "ol"]), 18058 summary: /* @__PURE__ */ new Set(["details"]), 18059 area: /* @__PURE__ */ new Set(["map"]) 18060 }; 18061 const knownInvalidChildren = { 18062 p: /* @__PURE__ */ new Set([ 18063 "address", 18064 "article", 18065 "aside", 18066 "blockquote", 18067 "center", 18068 "details", 18069 "dialog", 18070 "dir", 18071 "div", 18072 "dl", 18073 "fieldset", 18074 "figure", 18075 "footer", 18076 "form", 18077 "h1", 18078 "h2", 18079 "h3", 18080 "h4", 18081 "h5", 18082 "h6", 18083 "header", 18084 "hgroup", 18085 "hr", 18086 "li", 18087 "main", 18088 "nav", 18089 "menu", 18090 "ol", 18091 "p", 18092 "pre", 18093 "section", 18094 "table", 18095 "ul" 18096 ]), 18097 svg: /* @__PURE__ */ new Set([ 18098 "b", 18099 "blockquote", 18100 "br", 18101 "code", 18102 "dd", 18103 "div", 18104 "dl", 18105 "dt", 18106 "em", 18107 "embed", 18108 "h1", 18109 "h2", 18110 "h3", 18111 "h4", 18112 "h5", 18113 "h6", 18114 "hr", 18115 "i", 18116 "img", 18117 "li", 18118 "menu", 18119 "meta", 18120 "ol", 18121 "p", 18122 "pre", 18123 "ruby", 18124 "s", 18125 "small", 18126 "span", 18127 "strong", 18128 "sub", 18129 "sup", 18130 "table", 18131 "u", 18132 "ul", 18133 "var" 18134 ]) 18135 }; 18136 const knownInvalidParents = { 18137 a: /* @__PURE__ */ new Set(["a"]), 18138 button: /* @__PURE__ */ new Set(["button"]), 18139 dd: /* @__PURE__ */ new Set(["dd", "dt"]), 18140 dt: /* @__PURE__ */ new Set(["dd", "dt"]), 18141 form: /* @__PURE__ */ new Set(["form"]), 18142 li: /* @__PURE__ */ new Set(["li"]), 18143 h1: headings, 18144 h2: headings, 18145 h3: headings, 18146 h4: headings, 18147 h5: headings, 18148 h6: headings 18149 }; 18150 18151 const validateHtmlNesting = (node, context) => { 18152 if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) { 18153 const error = new SyntaxError( 18154 `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.` 18155 ); 18156 error.loc = node.loc; 18157 context.onWarn(error); 18158 } 18159 }; 18160 18161 const DOMNodeTransforms = [ 18162 transformStyle, 18163 ...[transformTransition, validateHtmlNesting] 18164 ]; 18165 const DOMDirectiveTransforms = { 18166 cloak: noopDirectiveTransform, 18167 html: transformVHtml, 18168 text: transformVText, 18169 model: transformModel, 18170 // override compiler-core 18171 on: transformOn, 18172 // override compiler-core 18173 show: transformShow 18174 }; 18175 function compile(src, options = {}) { 18176 return baseCompile( 18177 src, 18178 extend({}, parserOptions, options, { 18179 nodeTransforms: [ 18180 // ignore <script> and <tag> 18181 // this is not put inside DOMNodeTransforms because that list is used 18182 // by compiler-ssr to generate vnode fallback branches 18183 ignoreSideEffectTags, 18184 ...DOMNodeTransforms, 18185 ...options.nodeTransforms || [] 18186 ], 18187 directiveTransforms: extend( 18188 {}, 18189 DOMDirectiveTransforms, 18190 options.directiveTransforms || {} 18191 ), 18192 transformHoist: null 18193 }) 18194 ); 18195 } 18196 18197 { 18198 initDev(); 18199 } 18200 const compileCache = /* @__PURE__ */ new WeakMap(); 18201 function getCache(options) { 18202 let c = compileCache.get(options != null ? options : EMPTY_OBJ); 18203 if (!c) { 18204 c = /* @__PURE__ */ Object.create(null); 18205 compileCache.set(options != null ? options : EMPTY_OBJ, c); 18206 } 18207 return c; 18208 } 18209 function compileToFunction(template, options) { 18210 if (!isString(template)) { 18211 if (template.nodeType) { 18212 template = template.innerHTML; 18213 } else {
18214 warn(`invalid template option: `, template); 18215 return NOOP; 18216 } 18217 } 18218 const key = template; 18219 const cache = getCache(options); 18220 const cached = cache[key]; 18221 if (cached) { 18222 return cached; 18223 } 18224 if (template[0] === "#") { 18225 const el = document.querySelector(template); 18226 if (!el) { 18227 warn(`Template element not found or is empty: ${template}`); 18228 } 18229 template = el ? el.innerHTML : ``; 18230 } 18231 const opts = extend( 18232 { 18233 hoistStatic: true, 18234 onError: onError , 18235 onWarn: (e) => onError(e, true) 18236 }, 18237 options 18238 ); 18239 if (!opts.isCustomElement && typeof customElements !== "undefined") { 18240 opts.isCustomElement = (tag) => !!customElements.get(tag); 18241 } 18242 const { code } = compile(template, opts); 18243 function onError(err, asWarning = false) { 18244 const message = asWarning ? err.message : `Template compilation error: ${err.message}`; 18245 const codeFrame = err.loc && generateCodeFrame( 18246 template, 18247 err.loc.start.offset, 18248 err.loc.end.offset 18249 ); 18250 warn(codeFrame ? `${message} 18251${codeFrame}` : message); 18252 } 18253 const render = new Function("Vue", code)(runtimeDom); 18254 render._rc = true; 18255 return cache[key] = render; 18256 } 18257 registerRuntimeCompiler(compileToFunction); 18258 // origin-end 18259 18260 exports.DevToolsConnector = DevToolsConnector; 18261 exports.BaseTransition = BaseTransition; 18262 exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators; 18263 exports.Comment = Comment; 18264 exports.DeprecationTypes = DeprecationTypes; 18265 exports.EffectScope = EffectScope; 18266 exports.ErrorCodes = ErrorCodes; 18267 exports.ErrorTypeStrings = ErrorTypeStrings; 18268 exports.Fragment = Fragment; 18269 exports.KeepAlive = KeepAlive; 18270 exports.ReactiveEffect = ReactiveEffect; 18271 exports.Static = Static; 18272 exports.Suspense = Suspense; 18273 exports.Teleport = Teleport; 18274 exports.Text = Text; 18275 exports.TrackOpTypes = TrackOpTypes; 18276 exports.Transition = Transition; 18277 exports.TransitionGroup = TransitionGroup; 18278 exports.TriggerOpTypes = TriggerOpTypes; 18279 exports.VueElement = VueElement; 18280 exports.assertNumber = assertNumber; 18281 exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling; 18282 exports.callWithErrorHandling = callWithErrorHandling; 18283 exports.camelize = camelize; 18284 exports.capitalize = capitalize; 18285 exports.cloneVNode = cloneVNode; 18286 exports.compatUtils = compatUtils; 18287 exports.compile = compileToFunction; 18288 exports.computed = computed; 18289 exports.createApp = createApp; 18290 exports.createBlock = createBlock; 18291 exports.createCommentVNode = createCommentVNode; 18292 exports.createElementBlock = createElementBlock; 18293 exports.createElementVNode = createBaseVNode; 18294 exports.createHydrationRenderer = createHydrationRenderer; 18295 exports.createPropsRestProxy = createPropsRestProxy; 18296 exports.createRenderer = createRenderer; 18297 exports.createSSRApp = createSSRApp; 18298 exports.createSlots = createSlots; 18299 exports.createStaticVNode = createStaticVNode; 18300 exports.createTextVNode = createTextVNode; 18301 exports.createVNode = createVNode; 18302 exports.customRef = customRef; 18303 exports.defineAsyncComponent = defineAsyncComponent; 18304 exports.defineComponent = defineComponent; 18305 exports.defineCustomElement = defineCustomElement; 18306 exports.defineEmits = defineEmits; 18307 exports.defineExpose = defineExpose; 18308 exports.defineModel = defineModel; 18309 exports.defineOptions = defineOptions; 18310 exports.defineProps = defineProps; 18311 exports.defineSSRCustomElement = defineSSRCustomElement; 18312 exports.defineSlots = defineSlots; 18313 exports.devtools = devtools; 18314 exports.effect = effect; 18315 exports.effectScope = effectScope; 18316 exports.getCurrentInstance = getCurrentInstance; 18317 exports.getCurrentScope = getCurrentScope; 18318 exports.getCurrentWatcher = getCurrentWatcher; 18319 exports.getTransitionRawChildren = getTransitionRawChildren; 18320 exports.guardReactiveProps = guardReactiveProps; 18321 exports.h = h; 18322 exports.handleError = handleError; 18323 exports.hasInjectionContext = hasInjectionContext; 18324 exports.hydrate = hydrate; 18325 exports.hydrateOnIdle = hydrateOnIdle; 18326 exports.hydrateOnInteraction = hydrateOnInteraction; 18327 exports.hydrateOnMediaQuery = hydrateOnMediaQuery; 18328 exports.hydrateOnVisible = hydrateOnVisible; 18329 exports.initCustomFormatter = initCustomFormatter; 18330 exports.initDirectivesForSSR = initDirectivesForSSR; 18331 exports.inject = inject; 18332 exports.isMemoSame = isMemoSame; 18333 exports.isProxy = isProxy; 18334 exports.isReactive = isReactive; 18335 exports.isReadonly = isReadonly; 18336 exports.isRef = isRef; 18337 exports.isRuntimeOnly = isRuntimeOnly; 18338 exports.isShallow = isShallow; 18339 exports.isVNode = isVNode;
18340 exports.markRaw = markRaw; 18341 exports.mergeDefaults = mergeDefaults; 18342 exports.mergeModels = mergeModels; 18343 exports.mergeProps = mergeProps; 18344 exports.nextTick = nextTick; 18345 exports.normalizeClass = normalizeClass; 18346 exports.normalizeProps = normalizeProps; 18347 exports.normalizeStyle = normalizeStyle; 18348 exports.onActivated = onActivated; 18349 exports.onBeforeMount = onBeforeMount; 18350 exports.onBeforeUnmount = onBeforeUnmount; 18351 exports.onBeforeUpdate = onBeforeUpdate; 18352 exports.onDeactivated = onDeactivated; 18353 exports.onErrorCaptured = onErrorCaptured; 18354 exports.onMounted = onMounted; 18355 exports.onRenderTracked = onRenderTracked; 18356 exports.onRenderTriggered = onRenderTriggered; 18357 exports.onScopeDispose = onScopeDispose; 18358 exports.onServerPrefetch = onServerPrefetch; 18359 exports.onUnmounted = onUnmounted; 18360 exports.onUpdated = onUpdated; 18361 exports.onWatcherCleanup = onWatcherCleanup; 18362 exports.openBlock = openBlock; 18363 exports.popScopeId = popScopeId; 18364 exports.provide = provide; 18365 exports.proxyRefs = proxyRefs; 18366 exports.pushScopeId = pushScopeId; 18367 exports.queuePostFlushCb = queuePostFlushCb; 18368 exports.reactive = reactive; 18369 exports.readonly = readonly; 18370 exports.ref = ref; 18371 exports.registerRuntimeCompiler = registerRuntimeCompiler; 18372 exports.render = render; 18373 exports.renderList = renderList; 18374 exports.renderSlot = renderSlot; 18375 exports.resolveComponent = resolveComponent; 18376 exports.resolveDirective = resolveDirective; 18377 exports.resolveDynamicComponent = resolveDynamicComponent; 18378 exports.resolveFilter = resolveFilter; 18379 exports.resolveTransitionHooks = resolveTransitionHooks; 18380 exports.setBlockTracking = setBlockTracking; 18381 exports.setDevtoolsHook = setDevtoolsHook; 18382 exports.setTransitionHooks = setTransitionHooks; 18383 exports.shallowReactive = shallowReactive; 18384 exports.shallowReadonly = shallowReadonly; 18385 exports.shallowRef = shallowRef; 18386 exports.ssrContextKey = ssrContextKey; 18387 exports.ssrUtils = ssrUtils; 18388 exports.stop = stop; 18389 exports.toDisplayString = toDisplayString; 18390 exports.toHandlerKey = toHandlerKey; 18391 exports.toHandlers = toHandlers; 18392 exports.toRaw = toRaw; 18393 exports.toRef = toRef; 18394 exports.toRefs = toRefs; 18395 exports.toValue = toValue; 18396 exports.transformVNodeArgs = transformVNodeArgs; 18397 exports.triggerRef = triggerRef; 18398 exports.unref = unref; 18399 exports.useAttrs = useAttrs; 18400 exports.useCssModule = useCssModule; 18401 exports.useCssVars = useCssVars; 18402 exports.useHost = useHost; 18403 exports.useId = useId; 18404 exports.useModel = useModel; 18405 exports.useSSRContext = useSSRContext; 18406 exports.useShadowRoot = useShadowRoot; 18407 exports.useSlots = useSlots; 18408 exports.useTemplateRef = useTemplateRef; 18409 exports.useTransitionState = useTransitionState; 18410 exports.vModelCheckbox = vModelCheckbox; 18411 exports.vModelDynamic = vModelDynamic; 18412 exports.vModelRadio = vModelRadio; 18413 exports.vModelSelect = vModelSelect; 18414 exports.vModelText = vModelText; 18415 exports.vShow = vShow; 18416 exports.version = version; 18417 exports.warn = warn; 18418 exports.watch = watch; 18419 exports.watchEffect = watchEffect; 18420 exports.watchPostEffect = watchPostEffect; 18421 exports.watchSyncEffect = watchSyncEffect; 18422 exports.withAsyncContext = withAsyncContext; 18423 exports.withCtx = withCtx; 18424 exports.withDefaults = withDefaults; 18425 exports.withDirectives = withDirectives; 18426 exports.withKeys = withKeys; 18427 exports.withMemo = withMemo; 18428 exports.withModifiers = withModifiers; 18429 exports.withScopeId = withScopeId; 18430 18431}((this.BX.Vue3 = this.BX.Vue3 || {}),BX.Vue3)); 18432 18433 18434 18435})(); 18436//# sourceMappingURL=vue.bundle.js.map
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.