shared.esm-bundler.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. /**
  2. * @vue/shared v3.5.22
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. // @__NO_SIDE_EFFECTS__
  7. function makeMap(str) {
  8. const map = /* @__PURE__ */ Object.create(null);
  9. for (const key of str.split(",")) map[key] = 1;
  10. return (val) => val in map;
  11. }
  12. const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
  13. const EMPTY_ARR = !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
  14. const NOOP = () => {
  15. };
  16. const NO = () => false;
  17. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  18. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  19. const isModelListener = (key) => key.startsWith("onUpdate:");
  20. const extend = Object.assign;
  21. const remove = (arr, el) => {
  22. const i = arr.indexOf(el);
  23. if (i > -1) {
  24. arr.splice(i, 1);
  25. }
  26. };
  27. const hasOwnProperty = Object.prototype.hasOwnProperty;
  28. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  29. const isArray = Array.isArray;
  30. const isMap = (val) => toTypeString(val) === "[object Map]";
  31. const isSet = (val) => toTypeString(val) === "[object Set]";
  32. const isDate = (val) => toTypeString(val) === "[object Date]";
  33. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  34. const isFunction = (val) => typeof val === "function";
  35. const isString = (val) => typeof val === "string";
  36. const isSymbol = (val) => typeof val === "symbol";
  37. const isObject = (val) => val !== null && typeof val === "object";
  38. const isPromise = (val) => {
  39. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  40. };
  41. const objectToString = Object.prototype.toString;
  42. const toTypeString = (value) => objectToString.call(value);
  43. const toRawType = (value) => {
  44. return toTypeString(value).slice(8, -1);
  45. };
  46. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  47. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  48. const isReservedProp = /* @__PURE__ */ makeMap(
  49. // the leading comma is intentional so empty string "" is also included
  50. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  51. );
  52. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  53. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  54. );
  55. const cacheStringFunction = (fn) => {
  56. const cache = /* @__PURE__ */ Object.create(null);
  57. return ((str) => {
  58. const hit = cache[str];
  59. return hit || (cache[str] = fn(str));
  60. });
  61. };
  62. const camelizeRE = /-\w/g;
  63. const camelize = cacheStringFunction(
  64. (str) => {
  65. return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
  66. }
  67. );
  68. const hyphenateRE = /\B([A-Z])/g;
  69. const hyphenate = cacheStringFunction(
  70. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  71. );
  72. const capitalize = cacheStringFunction((str) => {
  73. return str.charAt(0).toUpperCase() + str.slice(1);
  74. });
  75. const toHandlerKey = cacheStringFunction(
  76. (str) => {
  77. const s = str ? `on${capitalize(str)}` : ``;
  78. return s;
  79. }
  80. );
  81. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  82. const invokeArrayFns = (fns, ...arg) => {
  83. for (let i = 0; i < fns.length; i++) {
  84. fns[i](...arg);
  85. }
  86. };
  87. const def = (obj, key, value, writable = false) => {
  88. Object.defineProperty(obj, key, {
  89. configurable: true,
  90. enumerable: false,
  91. writable,
  92. value
  93. });
  94. };
  95. const looseToNumber = (val) => {
  96. const n = parseFloat(val);
  97. return isNaN(n) ? val : n;
  98. };
  99. const toNumber = (val) => {
  100. const n = isString(val) ? Number(val) : NaN;
  101. return isNaN(n) ? val : n;
  102. };
  103. let _globalThis;
  104. const getGlobalThis = () => {
  105. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  106. };
  107. const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
  108. function genPropsAccessExp(name) {
  109. return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
  110. }
  111. function genCacheKey(source, options) {
  112. return source + JSON.stringify(
  113. options,
  114. (_, val) => typeof val === "function" ? val.toString() : val
  115. );
  116. }
  117. const PatchFlags = {
  118. "TEXT": 1,
  119. "1": "TEXT",
  120. "CLASS": 2,
  121. "2": "CLASS",
  122. "STYLE": 4,
  123. "4": "STYLE",
  124. "PROPS": 8,
  125. "8": "PROPS",
  126. "FULL_PROPS": 16,
  127. "16": "FULL_PROPS",
  128. "NEED_HYDRATION": 32,
  129. "32": "NEED_HYDRATION",
  130. "STABLE_FRAGMENT": 64,
  131. "64": "STABLE_FRAGMENT",
  132. "KEYED_FRAGMENT": 128,
  133. "128": "KEYED_FRAGMENT",
  134. "UNKEYED_FRAGMENT": 256,
  135. "256": "UNKEYED_FRAGMENT",
  136. "NEED_PATCH": 512,
  137. "512": "NEED_PATCH",
  138. "DYNAMIC_SLOTS": 1024,
  139. "1024": "DYNAMIC_SLOTS",
  140. "DEV_ROOT_FRAGMENT": 2048,
  141. "2048": "DEV_ROOT_FRAGMENT",
  142. "CACHED": -1,
  143. "-1": "CACHED",
  144. "BAIL": -2,
  145. "-2": "BAIL"
  146. };
  147. const PatchFlagNames = {
  148. [1]: `TEXT`,
  149. [2]: `CLASS`,
  150. [4]: `STYLE`,
  151. [8]: `PROPS`,
  152. [16]: `FULL_PROPS`,
  153. [32]: `NEED_HYDRATION`,
  154. [64]: `STABLE_FRAGMENT`,
  155. [128]: `KEYED_FRAGMENT`,
  156. [256]: `UNKEYED_FRAGMENT`,
  157. [512]: `NEED_PATCH`,
  158. [1024]: `DYNAMIC_SLOTS`,
  159. [2048]: `DEV_ROOT_FRAGMENT`,
  160. [-1]: `CACHED`,
  161. [-2]: `BAIL`
  162. };
  163. const ShapeFlags = {
  164. "ELEMENT": 1,
  165. "1": "ELEMENT",
  166. "FUNCTIONAL_COMPONENT": 2,
  167. "2": "FUNCTIONAL_COMPONENT",
  168. "STATEFUL_COMPONENT": 4,
  169. "4": "STATEFUL_COMPONENT",
  170. "TEXT_CHILDREN": 8,
  171. "8": "TEXT_CHILDREN",
  172. "ARRAY_CHILDREN": 16,
  173. "16": "ARRAY_CHILDREN",
  174. "SLOTS_CHILDREN": 32,
  175. "32": "SLOTS_CHILDREN",
  176. "TELEPORT": 64,
  177. "64": "TELEPORT",
  178. "SUSPENSE": 128,
  179. "128": "SUSPENSE",
  180. "COMPONENT_SHOULD_KEEP_ALIVE": 256,
  181. "256": "COMPONENT_SHOULD_KEEP_ALIVE",
  182. "COMPONENT_KEPT_ALIVE": 512,
  183. "512": "COMPONENT_KEPT_ALIVE",
  184. "COMPONENT": 6,
  185. "6": "COMPONENT"
  186. };
  187. const SlotFlags = {
  188. "STABLE": 1,
  189. "1": "STABLE",
  190. "DYNAMIC": 2,
  191. "2": "DYNAMIC",
  192. "FORWARDED": 3,
  193. "3": "FORWARDED"
  194. };
  195. const slotFlagsText = {
  196. [1]: "STABLE",
  197. [2]: "DYNAMIC",
  198. [3]: "FORWARDED"
  199. };
  200. 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";
  201. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  202. const isGloballyWhitelisted = isGloballyAllowed;
  203. const range = 2;
  204. function generateCodeFrame(source, start = 0, end = source.length) {
  205. start = Math.max(0, Math.min(start, source.length));
  206. end = Math.max(0, Math.min(end, source.length));
  207. if (start > end) return "";
  208. let lines = source.split(/(\r?\n)/);
  209. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  210. lines = lines.filter((_, idx) => idx % 2 === 0);
  211. let count = 0;
  212. const res = [];
  213. for (let i = 0; i < lines.length; i++) {
  214. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  215. if (count >= start) {
  216. for (let j = i - range; j <= i + range || end > count; j++) {
  217. if (j < 0 || j >= lines.length) continue;
  218. const line = j + 1;
  219. res.push(
  220. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  221. );
  222. const lineLength = lines[j].length;
  223. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  224. if (j === i) {
  225. const pad = start - (count - (lineLength + newLineSeqLength));
  226. const length = Math.max(
  227. 1,
  228. end > count ? lineLength - pad : end - start
  229. );
  230. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  231. } else if (j > i) {
  232. if (end > count) {
  233. const length = Math.max(Math.min(end - count, lineLength), 1);
  234. res.push(` | ` + "^".repeat(length));
  235. }
  236. count += lineLength + newLineSeqLength;
  237. }
  238. }
  239. break;
  240. }
  241. }
  242. return res.join("\n");
  243. }
  244. function normalizeStyle(value) {
  245. if (isArray(value)) {
  246. const res = {};
  247. for (let i = 0; i < value.length; i++) {
  248. const item = value[i];
  249. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  250. if (normalized) {
  251. for (const key in normalized) {
  252. res[key] = normalized[key];
  253. }
  254. }
  255. }
  256. return res;
  257. } else if (isString(value) || isObject(value)) {
  258. return value;
  259. }
  260. }
  261. const listDelimiterRE = /;(?![^(]*\))/g;
  262. const propertyDelimiterRE = /:([^]+)/;
  263. const styleCommentRE = /\/\*[^]*?\*\//g;
  264. function parseStringStyle(cssText) {
  265. const ret = {};
  266. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  267. if (item) {
  268. const tmp = item.split(propertyDelimiterRE);
  269. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  270. }
  271. });
  272. return ret;
  273. }
  274. function stringifyStyle(styles) {
  275. if (!styles) return "";
  276. if (isString(styles)) return styles;
  277. let ret = "";
  278. for (const key in styles) {
  279. const value = styles[key];
  280. if (isString(value) || typeof value === "number") {
  281. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  282. ret += `${normalizedKey}:${value};`;
  283. }
  284. }
  285. return ret;
  286. }
  287. function normalizeClass(value) {
  288. let res = "";
  289. if (isString(value)) {
  290. res = value;
  291. } else if (isArray(value)) {
  292. for (let i = 0; i < value.length; i++) {
  293. const normalized = normalizeClass(value[i]);
  294. if (normalized) {
  295. res += normalized + " ";
  296. }
  297. }
  298. } else if (isObject(value)) {
  299. for (const name in value) {
  300. if (value[name]) {
  301. res += name + " ";
  302. }
  303. }
  304. }
  305. return res.trim();
  306. }
  307. function normalizeProps(props) {
  308. if (!props) return null;
  309. let { class: klass, style } = props;
  310. if (klass && !isString(klass)) {
  311. props.class = normalizeClass(klass);
  312. }
  313. if (style) {
  314. props.style = normalizeStyle(style);
  315. }
  316. return props;
  317. }
  318. 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";
  319. 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";
  320. 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";
  321. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  322. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  323. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  324. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  325. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  326. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  327. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  328. const isBooleanAttr = /* @__PURE__ */ makeMap(
  329. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  330. );
  331. function includeBooleanAttr(value) {
  332. return !!value || value === "";
  333. }
  334. const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
  335. const attrValidationCache = {};
  336. function isSSRSafeAttrName(name) {
  337. if (attrValidationCache.hasOwnProperty(name)) {
  338. return attrValidationCache[name];
  339. }
  340. const isUnsafe = unsafeAttrCharRE.test(name);
  341. if (isUnsafe) {
  342. console.error(`unsafe attribute name: ${name}`);
  343. }
  344. return attrValidationCache[name] = !isUnsafe;
  345. }
  346. const propsToAttrMap = {
  347. acceptCharset: "accept-charset",
  348. className: "class",
  349. htmlFor: "for",
  350. httpEquiv: "http-equiv"
  351. };
  352. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  353. `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`
  354. );
  355. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  356. `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`
  357. );
  358. const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
  359. `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`
  360. );
  361. function isRenderableAttrValue(value) {
  362. if (value == null) {
  363. return false;
  364. }
  365. const type = typeof value;
  366. return type === "string" || type === "number" || type === "boolean";
  367. }
  368. const escapeRE = /["'&<>]/;
  369. function escapeHtml(string) {
  370. const str = "" + string;
  371. const match = escapeRE.exec(str);
  372. if (!match) {
  373. return str;
  374. }
  375. let html = "";
  376. let escaped;
  377. let index;
  378. let lastIndex = 0;
  379. for (index = match.index; index < str.length; index++) {
  380. switch (str.charCodeAt(index)) {
  381. case 34:
  382. escaped = "&quot;";
  383. break;
  384. case 38:
  385. escaped = "&amp;";
  386. break;
  387. case 39:
  388. escaped = "&#39;";
  389. break;
  390. case 60:
  391. escaped = "&lt;";
  392. break;
  393. case 62:
  394. escaped = "&gt;";
  395. break;
  396. default:
  397. continue;
  398. }
  399. if (lastIndex !== index) {
  400. html += str.slice(lastIndex, index);
  401. }
  402. lastIndex = index + 1;
  403. html += escaped;
  404. }
  405. return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
  406. }
  407. const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
  408. function escapeHtmlComment(src) {
  409. return src.replace(commentStripRE, "");
  410. }
  411. const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
  412. function getEscapedCssVarName(key, doubleEscape) {
  413. return key.replace(
  414. cssVarNameEscapeSymbolsRE,
  415. (s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}`
  416. );
  417. }
  418. function looseCompareArrays(a, b) {
  419. if (a.length !== b.length) return false;
  420. let equal = true;
  421. for (let i = 0; equal && i < a.length; i++) {
  422. equal = looseEqual(a[i], b[i]);
  423. }
  424. return equal;
  425. }
  426. function looseEqual(a, b) {
  427. if (a === b) return true;
  428. let aValidType = isDate(a);
  429. let bValidType = isDate(b);
  430. if (aValidType || bValidType) {
  431. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  432. }
  433. aValidType = isSymbol(a);
  434. bValidType = isSymbol(b);
  435. if (aValidType || bValidType) {
  436. return a === b;
  437. }
  438. aValidType = isArray(a);
  439. bValidType = isArray(b);
  440. if (aValidType || bValidType) {
  441. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  442. }
  443. aValidType = isObject(a);
  444. bValidType = isObject(b);
  445. if (aValidType || bValidType) {
  446. if (!aValidType || !bValidType) {
  447. return false;
  448. }
  449. const aKeysCount = Object.keys(a).length;
  450. const bKeysCount = Object.keys(b).length;
  451. if (aKeysCount !== bKeysCount) {
  452. return false;
  453. }
  454. for (const key in a) {
  455. const aHasKey = a.hasOwnProperty(key);
  456. const bHasKey = b.hasOwnProperty(key);
  457. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  458. return false;
  459. }
  460. }
  461. }
  462. return String(a) === String(b);
  463. }
  464. function looseIndexOf(arr, val) {
  465. return arr.findIndex((item) => looseEqual(item, val));
  466. }
  467. const isRef = (val) => {
  468. return !!(val && val["__v_isRef"] === true);
  469. };
  470. const toDisplayString = (val) => {
  471. 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);
  472. };
  473. const replacer = (_key, val) => {
  474. if (isRef(val)) {
  475. return replacer(_key, val.value);
  476. } else if (isMap(val)) {
  477. return {
  478. [`Map(${val.size})`]: [...val.entries()].reduce(
  479. (entries, [key, val2], i) => {
  480. entries[stringifySymbol(key, i) + " =>"] = val2;
  481. return entries;
  482. },
  483. {}
  484. )
  485. };
  486. } else if (isSet(val)) {
  487. return {
  488. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  489. };
  490. } else if (isSymbol(val)) {
  491. return stringifySymbol(val);
  492. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  493. return String(val);
  494. }
  495. return val;
  496. };
  497. const stringifySymbol = (v, i = "") => {
  498. var _a;
  499. return (
  500. // Symbol.description in es2019+ so we need to cast here to pass
  501. // the lib: es2016 check
  502. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  503. );
  504. };
  505. function normalizeCssVarValue(value) {
  506. if (value == null) {
  507. return "initial";
  508. }
  509. if (typeof value === "string") {
  510. return value === "" ? " " : value;
  511. }
  512. if (typeof value !== "number" || !Number.isFinite(value)) {
  513. if (!!(process.env.NODE_ENV !== "production")) {
  514. console.warn(
  515. "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
  516. value
  517. );
  518. }
  519. }
  520. return String(value);
  521. }
  522. export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };