source: node_modules/@vue/shared/dist/shared.cjs.prod.js@ a70b5a4

Last change on this file since a70b5a4 was 57e58a3, checked in by ste08 <sjovanoska@…>, 4 months ago

Initial commit

  • Property mode set to 100644
File size: 23.6 KB
Line 
1/**
2* @vue/shared v3.5.13
3* (c) 2018-present Yuxi (Evan) You and Vue contributors
4* @license MIT
5**/
6'use strict';
7
8Object.defineProperty(exports, '__esModule', { value: true });
9
10/*! #__NO_SIDE_EFFECTS__ */
11// @__NO_SIDE_EFFECTS__
12function makeMap(str) {
13 const map = /* @__PURE__ */ Object.create(null);
14 for (const key of str.split(",")) map[key] = 1;
15 return (val) => val in map;
16}
17
18const EMPTY_OBJ = {};
19const EMPTY_ARR = [];
20const NOOP = () => {
21};
22const NO = () => false;
23const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
24(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
25const isModelListener = (key) => key.startsWith("onUpdate:");
26const extend = Object.assign;
27const remove = (arr, el) => {
28 const i = arr.indexOf(el);
29 if (i > -1) {
30 arr.splice(i, 1);
31 }
32};
33const hasOwnProperty = Object.prototype.hasOwnProperty;
34const hasOwn = (val, key) => hasOwnProperty.call(val, key);
35const isArray = Array.isArray;
36const isMap = (val) => toTypeString(val) === "[object Map]";
37const isSet = (val) => toTypeString(val) === "[object Set]";
38const isDate = (val) => toTypeString(val) === "[object Date]";
39const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
40const isFunction = (val) => typeof val === "function";
41const isString = (val) => typeof val === "string";
42const isSymbol = (val) => typeof val === "symbol";
43const isObject = (val) => val !== null && typeof val === "object";
44const isPromise = (val) => {
45 return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
46};
47const objectToString = Object.prototype.toString;
48const toTypeString = (value) => objectToString.call(value);
49const toRawType = (value) => {
50 return toTypeString(value).slice(8, -1);
51};
52const isPlainObject = (val) => toTypeString(val) === "[object Object]";
53const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
54const isReservedProp = /* @__PURE__ */ makeMap(
55 // the leading comma is intentional so empty string "" is also included
56 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
57);
58const isBuiltInDirective = /* @__PURE__ */ makeMap(
59 "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
60);
61const cacheStringFunction = (fn) => {
62 const cache = /* @__PURE__ */ Object.create(null);
63 return (str) => {
64 const hit = cache[str];
65 return hit || (cache[str] = fn(str));
66 };
67};
68const camelizeRE = /-(\w)/g;
69const camelize = cacheStringFunction(
70 (str) => {
71 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
72 }
73);
74const hyphenateRE = /\B([A-Z])/g;
75const hyphenate = cacheStringFunction(
76 (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
77);
78const capitalize = cacheStringFunction((str) => {
79 return str.charAt(0).toUpperCase() + str.slice(1);
80});
81const toHandlerKey = cacheStringFunction(
82 (str) => {
83 const s = str ? `on${capitalize(str)}` : ``;
84 return s;
85 }
86);
87const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
88const invokeArrayFns = (fns, ...arg) => {
89 for (let i = 0; i < fns.length; i++) {
90 fns[i](...arg);
91 }
92};
93const def = (obj, key, value, writable = false) => {
94 Object.defineProperty(obj, key, {
95 configurable: true,
96 enumerable: false,
97 writable,
98 value
99 });
100};
101const looseToNumber = (val) => {
102 const n = parseFloat(val);
103 return isNaN(n) ? val : n;
104};
105const toNumber = (val) => {
106 const n = isString(val) ? Number(val) : NaN;
107 return isNaN(n) ? val : n;
108};
109let _globalThis;
110const getGlobalThis = () => {
111 return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
112};
113const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
114function genPropsAccessExp(name) {
115 return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
116}
117function genCacheKey(source, options) {
118 return source + JSON.stringify(
119 options,
120 (_, val) => typeof val === "function" ? val.toString() : val
121 );
122}
123
124const PatchFlags = {
125 "TEXT": 1,
126 "1": "TEXT",
127 "CLASS": 2,
128 "2": "CLASS",
129 "STYLE": 4,
130 "4": "STYLE",
131 "PROPS": 8,
132 "8": "PROPS",
133 "FULL_PROPS": 16,
134 "16": "FULL_PROPS",
135 "NEED_HYDRATION": 32,
136 "32": "NEED_HYDRATION",
137 "STABLE_FRAGMENT": 64,
138 "64": "STABLE_FRAGMENT",
139 "KEYED_FRAGMENT": 128,
140 "128": "KEYED_FRAGMENT",
141 "UNKEYED_FRAGMENT": 256,
142 "256": "UNKEYED_FRAGMENT",
143 "NEED_PATCH": 512,
144 "512": "NEED_PATCH",
145 "DYNAMIC_SLOTS": 1024,
146 "1024": "DYNAMIC_SLOTS",
147 "DEV_ROOT_FRAGMENT": 2048,
148 "2048": "DEV_ROOT_FRAGMENT",
149 "CACHED": -1,
150 "-1": "CACHED",
151 "BAIL": -2,
152 "-2": "BAIL"
153};
154const PatchFlagNames = {
155 [1]: `TEXT`,
156 [2]: `CLASS`,
157 [4]: `STYLE`,
158 [8]: `PROPS`,
159 [16]: `FULL_PROPS`,
160 [32]: `NEED_HYDRATION`,
161 [64]: `STABLE_FRAGMENT`,
162 [128]: `KEYED_FRAGMENT`,
163 [256]: `UNKEYED_FRAGMENT`,
164 [512]: `NEED_PATCH`,
165 [1024]: `DYNAMIC_SLOTS`,
166 [2048]: `DEV_ROOT_FRAGMENT`,
167 [-1]: `HOISTED`,
168 [-2]: `BAIL`
169};
170
171const ShapeFlags = {
172 "ELEMENT": 1,
173 "1": "ELEMENT",
174 "FUNCTIONAL_COMPONENT": 2,
175 "2": "FUNCTIONAL_COMPONENT",
176 "STATEFUL_COMPONENT": 4,
177 "4": "STATEFUL_COMPONENT",
178 "TEXT_CHILDREN": 8,
179 "8": "TEXT_CHILDREN",
180 "ARRAY_CHILDREN": 16,
181 "16": "ARRAY_CHILDREN",
182 "SLOTS_CHILDREN": 32,
183 "32": "SLOTS_CHILDREN",
184 "TELEPORT": 64,
185 "64": "TELEPORT",
186 "SUSPENSE": 128,
187 "128": "SUSPENSE",
188 "COMPONENT_SHOULD_KEEP_ALIVE": 256,
189 "256": "COMPONENT_SHOULD_KEEP_ALIVE",
190 "COMPONENT_KEPT_ALIVE": 512,
191 "512": "COMPONENT_KEPT_ALIVE",
192 "COMPONENT": 6,
193 "6": "COMPONENT"
194};
195
196const SlotFlags = {
197 "STABLE": 1,
198 "1": "STABLE",
199 "DYNAMIC": 2,
200 "2": "DYNAMIC",
201 "FORWARDED": 3,
202 "3": "FORWARDED"
203};
204const slotFlagsText = {
205 [1]: "STABLE",
206 [2]: "DYNAMIC",
207 [3]: "FORWARDED"
208};
209
210const 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";
211const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
212const isGloballyWhitelisted = isGloballyAllowed;
213
214const range = 2;
215function generateCodeFrame(source, start = 0, end = source.length) {
216 start = Math.max(0, Math.min(start, source.length));
217 end = Math.max(0, Math.min(end, source.length));
218 if (start > end) return "";
219 let lines = source.split(/(\r?\n)/);
220 const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
221 lines = lines.filter((_, idx) => idx % 2 === 0);
222 let count = 0;
223 const res = [];
224 for (let i = 0; i < lines.length; i++) {
225 count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
226 if (count >= start) {
227 for (let j = i - range; j <= i + range || end > count; j++) {
228 if (j < 0 || j >= lines.length) continue;
229 const line = j + 1;
230 res.push(
231 `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
232 );
233 const lineLength = lines[j].length;
234 const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
235 if (j === i) {
236 const pad = start - (count - (lineLength + newLineSeqLength));
237 const length = Math.max(
238 1,
239 end > count ? lineLength - pad : end - start
240 );
241 res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
242 } else if (j > i) {
243 if (end > count) {
244 const length = Math.max(Math.min(end - count, lineLength), 1);
245 res.push(` | ` + "^".repeat(length));
246 }
247 count += lineLength + newLineSeqLength;
248 }
249 }
250 break;
251 }
252 }
253 return res.join("\n");
254}
255
256function normalizeStyle(value) {
257 if (isArray(value)) {
258 const res = {};
259 for (let i = 0; i < value.length; i++) {
260 const item = value[i];
261 const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
262 if (normalized) {
263 for (const key in normalized) {
264 res[key] = normalized[key];
265 }
266 }
267 }
268 return res;
269 } else if (isString(value) || isObject(value)) {
270 return value;
271 }
272}
273const listDelimiterRE = /;(?![^(]*\))/g;
274const propertyDelimiterRE = /:([^]+)/;
275const styleCommentRE = /\/\*[^]*?\*\//g;
276function parseStringStyle(cssText) {
277 const ret = {};
278 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
279 if (item) {
280 const tmp = item.split(propertyDelimiterRE);
281 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
282 }
283 });
284 return ret;
285}
286function stringifyStyle(styles) {
287 if (!styles) return "";
288 if (isString(styles)) return styles;
289 let ret = "";
290 for (const key in styles) {
291 const value = styles[key];
292 if (isString(value) || typeof value === "number") {
293 const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
294 ret += `${normalizedKey}:${value};`;
295 }
296 }
297 return ret;
298}
299function normalizeClass(value) {
300 let res = "";
301 if (isString(value)) {
302 res = value;
303 } else if (isArray(value)) {
304 for (let i = 0; i < value.length; i++) {
305 const normalized = normalizeClass(value[i]);
306 if (normalized) {
307 res += normalized + " ";
308 }
309 }
310 } else if (isObject(value)) {
311 for (const name in value) {
312 if (value[name]) {
313 res += name + " ";
314 }
315 }
316 }
317 return res.trim();
318}
319function normalizeProps(props) {
320 if (!props) return null;
321 let { class: klass, style } = props;
322 if (klass && !isString(klass)) {
323 props.class = normalizeClass(klass);
324 }
325 if (style) {
326 props.style = normalizeStyle(style);
327 }
328 return props;
329}
330
331const 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";
332const 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";
333const 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";
334const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
335const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
336const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
337const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
338const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
339
340const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
341const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
342const isBooleanAttr = /* @__PURE__ */ makeMap(
343 specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
344);
345function includeBooleanAttr(value) {
346 return !!value || value === "";
347}
348const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
349const attrValidationCache = {};
350function isSSRSafeAttrName(name) {
351 if (attrValidationCache.hasOwnProperty(name)) {
352 return attrValidationCache[name];
353 }
354 const isUnsafe = unsafeAttrCharRE.test(name);
355 if (isUnsafe) {
356 console.error(`unsafe attribute name: ${name}`);
357 }
358 return attrValidationCache[name] = !isUnsafe;
359}
360const propsToAttrMap = {
361 acceptCharset: "accept-charset",
362 className: "class",
363 htmlFor: "for",
364 httpEquiv: "http-equiv"
365};
366const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
367 `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
368);
369const isKnownSvgAttr = /* @__PURE__ */ makeMap(
370 `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
371);
372const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
373 `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`
374);
375function isRenderableAttrValue(value) {
376 if (value == null) {
377 return false;
378 }
379 const type = typeof value;
380 return type === "string" || type === "number" || type === "boolean";
381}
382
383const escapeRE = /["'&<>]/;
384function escapeHtml(string) {
385 const str = "" + string;
386 const match = escapeRE.exec(str);
387 if (!match) {
388 return str;
389 }
390 let html = "";
391 let escaped;
392 let index;
393 let lastIndex = 0;
394 for (index = match.index; index < str.length; index++) {
395 switch (str.charCodeAt(index)) {
396 case 34:
397 escaped = "&quot;";
398 break;
399 case 38:
400 escaped = "&amp;";
401 break;
402 case 39:
403 escaped = "&#39;";
404 break;
405 case 60:
406 escaped = "&lt;";
407 break;
408 case 62:
409 escaped = "&gt;";
410 break;
411 default:
412 continue;
413 }
414 if (lastIndex !== index) {
415 html += str.slice(lastIndex, index);
416 }
417 lastIndex = index + 1;
418 html += escaped;
419 }
420 return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
421}
422const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
423function escapeHtmlComment(src) {
424 return src.replace(commentStripRE, "");
425}
426const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
427function getEscapedCssVarName(key, doubleEscape) {
428 return key.replace(
429 cssVarNameEscapeSymbolsRE,
430 (s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}`
431 );
432}
433
434function looseCompareArrays(a, b) {
435 if (a.length !== b.length) return false;
436 let equal = true;
437 for (let i = 0; equal && i < a.length; i++) {
438 equal = looseEqual(a[i], b[i]);
439 }
440 return equal;
441}
442function looseEqual(a, b) {
443 if (a === b) return true;
444 let aValidType = isDate(a);
445 let bValidType = isDate(b);
446 if (aValidType || bValidType) {
447 return aValidType && bValidType ? a.getTime() === b.getTime() : false;
448 }
449 aValidType = isSymbol(a);
450 bValidType = isSymbol(b);
451 if (aValidType || bValidType) {
452 return a === b;
453 }
454 aValidType = isArray(a);
455 bValidType = isArray(b);
456 if (aValidType || bValidType) {
457 return aValidType && bValidType ? looseCompareArrays(a, b) : false;
458 }
459 aValidType = isObject(a);
460 bValidType = isObject(b);
461 if (aValidType || bValidType) {
462 if (!aValidType || !bValidType) {
463 return false;
464 }
465 const aKeysCount = Object.keys(a).length;
466 const bKeysCount = Object.keys(b).length;
467 if (aKeysCount !== bKeysCount) {
468 return false;
469 }
470 for (const key in a) {
471 const aHasKey = a.hasOwnProperty(key);
472 const bHasKey = b.hasOwnProperty(key);
473 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
474 return false;
475 }
476 }
477 }
478 return String(a) === String(b);
479}
480function looseIndexOf(arr, val) {
481 return arr.findIndex((item) => looseEqual(item, val));
482}
483
484const isRef = (val) => {
485 return !!(val && val["__v_isRef"] === true);
486};
487const toDisplayString = (val) => {
488 return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
489};
490const replacer = (_key, val) => {
491 if (isRef(val)) {
492 return replacer(_key, val.value);
493 } else if (isMap(val)) {
494 return {
495 [`Map(${val.size})`]: [...val.entries()].reduce(
496 (entries, [key, val2], i) => {
497 entries[stringifySymbol(key, i) + " =>"] = val2;
498 return entries;
499 },
500 {}
501 )
502 };
503 } else if (isSet(val)) {
504 return {
505 [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
506 };
507 } else if (isSymbol(val)) {
508 return stringifySymbol(val);
509 } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
510 return String(val);
511 }
512 return val;
513};
514const stringifySymbol = (v, i = "") => {
515 var _a;
516 return (
517 // Symbol.description in es2019+ so we need to cast here to pass
518 // the lib: es2016 check
519 isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
520 );
521};
522
523exports.EMPTY_ARR = EMPTY_ARR;
524exports.EMPTY_OBJ = EMPTY_OBJ;
525exports.NO = NO;
526exports.NOOP = NOOP;
527exports.PatchFlagNames = PatchFlagNames;
528exports.PatchFlags = PatchFlags;
529exports.ShapeFlags = ShapeFlags;
530exports.SlotFlags = SlotFlags;
531exports.camelize = camelize;
532exports.capitalize = capitalize;
533exports.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
534exports.def = def;
535exports.escapeHtml = escapeHtml;
536exports.escapeHtmlComment = escapeHtmlComment;
537exports.extend = extend;
538exports.genCacheKey = genCacheKey;
539exports.genPropsAccessExp = genPropsAccessExp;
540exports.generateCodeFrame = generateCodeFrame;
541exports.getEscapedCssVarName = getEscapedCssVarName;
542exports.getGlobalThis = getGlobalThis;
543exports.hasChanged = hasChanged;
544exports.hasOwn = hasOwn;
545exports.hyphenate = hyphenate;
546exports.includeBooleanAttr = includeBooleanAttr;
547exports.invokeArrayFns = invokeArrayFns;
548exports.isArray = isArray;
549exports.isBooleanAttr = isBooleanAttr;
550exports.isBuiltInDirective = isBuiltInDirective;
551exports.isDate = isDate;
552exports.isFunction = isFunction;
553exports.isGloballyAllowed = isGloballyAllowed;
554exports.isGloballyWhitelisted = isGloballyWhitelisted;
555exports.isHTMLTag = isHTMLTag;
556exports.isIntegerKey = isIntegerKey;
557exports.isKnownHtmlAttr = isKnownHtmlAttr;
558exports.isKnownMathMLAttr = isKnownMathMLAttr;
559exports.isKnownSvgAttr = isKnownSvgAttr;
560exports.isMap = isMap;
561exports.isMathMLTag = isMathMLTag;
562exports.isModelListener = isModelListener;
563exports.isObject = isObject;
564exports.isOn = isOn;
565exports.isPlainObject = isPlainObject;
566exports.isPromise = isPromise;
567exports.isRegExp = isRegExp;
568exports.isRenderableAttrValue = isRenderableAttrValue;
569exports.isReservedProp = isReservedProp;
570exports.isSSRSafeAttrName = isSSRSafeAttrName;
571exports.isSVGTag = isSVGTag;
572exports.isSet = isSet;
573exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
574exports.isString = isString;
575exports.isSymbol = isSymbol;
576exports.isVoidTag = isVoidTag;
577exports.looseEqual = looseEqual;
578exports.looseIndexOf = looseIndexOf;
579exports.looseToNumber = looseToNumber;
580exports.makeMap = makeMap;
581exports.normalizeClass = normalizeClass;
582exports.normalizeProps = normalizeProps;
583exports.normalizeStyle = normalizeStyle;
584exports.objectToString = objectToString;
585exports.parseStringStyle = parseStringStyle;
586exports.propsToAttrMap = propsToAttrMap;
587exports.remove = remove;
588exports.slotFlagsText = slotFlagsText;
589exports.stringifyStyle = stringifyStyle;
590exports.toDisplayString = toDisplayString;
591exports.toHandlerKey = toHandlerKey;
592exports.toNumber = toNumber;
593exports.toRawType = toRawType;
594exports.toTypeString = toTypeString;
Note: See TracBrowser for help on using the repository browser.