Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

shared.cjs.js 22KB

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