UNPKG

sure-ui

Version:

A Component Library for Vue 3

1 lines 503 kB
{"version":3,"file":"index.full.min.mjs","sources":["../../../packages/constants/key.ts","../../../packages/sure-ui/version.ts","../../../packages/sure-ui/make-installer.ts","../../../node_modules/.pnpm/@vue+shared@3.2.37/node_modules/@vue/shared/dist/shared.esm-bundler.js","../../../packages/utils/vue/install.ts","../../../packages/utils/vue/runtime.ts","../../../node_modules/.pnpm/sure-utils@1.1.4/node_modules/sure-utils/dist/index.mjs","../../../packages/utils/dom/style.ts","../../../node_modules/.pnpm/@vue+reactivity@3.2.37/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js","../../../node_modules/.pnpm/@vue+runtime-core@3.2.37/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js","../../../packages/components/icon/src/icon.ts","../../../packages/components/icon/src/icon.vue","../../../packages/components/icon/index.ts","../../../packages/sure-ui/component.ts","../../../packages/sure-ui/defaults.ts","../../../node_modules/.pnpm/@vueuse+shared@8.6.0_vue@3.2.37/node_modules/@vueuse/shared/index.mjs","../../../packages/directives/click-outside/index.ts","../../../packages/hooks/use-focus/index.ts","../../../node_modules/.pnpm/dayjs@1.11.5/node_modules/dayjs/dayjs.min.js","../../../packages/sure-ui/index.ts"],"sourcesContent":["export const INSTALLED_KEY = Symbol('INSTALLED_KEY')\n","export const version = '0.0.0-dev.1'\n","import { INSTALLED_KEY } from '@sure-ui/constants'\nimport type { App, Plugin } from '@vue/runtime-core'\nimport { version } from './version'\n\n// interface SureApp extends App {\n// [INSTALLED_KEY]: boolean\n// }\n\nexport const makeInstaller = (components: Plugin[] = []) => {\n const install = (app: App) => {\n if (app[INSTALLED_KEY]) {\n return\n }\n app[INSTALLED_KEY] = true\n components.forEach(c => app.use(c))\n }\n return {\n version,\n install\n }\n}\n","/**\r\n * Make a map and return a function for checking if a key\r\n * is in that map.\r\n * IMPORTANT: all calls of this function must be prefixed with\r\n * \\/\\*#\\_\\_PURE\\_\\_\\*\\/\r\n * So that rollup can tree-shake them if necessary.\r\n */\r\nfunction makeMap(str, expectsLowerCase) {\r\n const map = Object.create(null);\r\n const list = str.split(',');\r\n for (let i = 0; i < list.length; i++) {\r\n map[list[i]] = true;\r\n }\r\n return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];\r\n}\n\n/**\r\n * dev only flag -> name mapping\r\n */\r\nconst PatchFlagNames = {\r\n [1 /* TEXT */]: `TEXT`,\r\n [2 /* CLASS */]: `CLASS`,\r\n [4 /* STYLE */]: `STYLE`,\r\n [8 /* PROPS */]: `PROPS`,\r\n [16 /* FULL_PROPS */]: `FULL_PROPS`,\r\n [32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,\r\n [64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,\r\n [128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,\r\n [256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,\r\n [512 /* NEED_PATCH */]: `NEED_PATCH`,\r\n [1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,\r\n [2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,\r\n [-1 /* HOISTED */]: `HOISTED`,\r\n [-2 /* BAIL */]: `BAIL`\r\n};\n\n/**\r\n * Dev only\r\n */\r\nconst slotFlagsText = {\r\n [1 /* STABLE */]: 'STABLE',\r\n [2 /* DYNAMIC */]: 'DYNAMIC',\r\n [3 /* FORWARDED */]: 'FORWARDED'\r\n};\n\nconst GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +\r\n 'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +\r\n 'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';\r\nconst isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);\n\nconst range = 2;\r\nfunction generateCodeFrame(source, start = 0, end = source.length) {\r\n // Split the content into individual lines but capture the newline sequence\r\n // that separated each line. This is important because the actual sequence is\r\n // needed to properly take into account the full line length for offset\r\n // comparison\r\n let lines = source.split(/(\\r?\\n)/);\r\n // Separate the lines and newline sequences into separate arrays for easier referencing\r\n const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);\r\n lines = lines.filter((_, idx) => idx % 2 === 0);\r\n let count = 0;\r\n const res = [];\r\n for (let i = 0; i < lines.length; i++) {\r\n count +=\r\n lines[i].length +\r\n ((newlineSequences[i] && newlineSequences[i].length) || 0);\r\n if (count >= start) {\r\n for (let j = i - range; j <= i + range || end > count; j++) {\r\n if (j < 0 || j >= lines.length)\r\n continue;\r\n const line = j + 1;\r\n res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);\r\n const lineLength = lines[j].length;\r\n const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;\r\n if (j === i) {\r\n // push underline\r\n const pad = start - (count - (lineLength + newLineSeqLength));\r\n const length = Math.max(1, end > count ? lineLength - pad : end - start);\r\n res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));\r\n }\r\n else if (j > i) {\r\n if (end > count) {\r\n const length = Math.max(Math.min(end - count, lineLength), 1);\r\n res.push(` | ` + '^'.repeat(length));\r\n }\r\n count += lineLength + newLineSeqLength;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return res.join('\\n');\r\n}\n\n/**\r\n * On the client we only need to offer special cases for boolean attributes that\r\n * have different names from their corresponding dom properties:\r\n * - itemscope -> N/A\r\n * - allowfullscreen -> allowFullscreen\r\n * - formnovalidate -> formNoValidate\r\n * - ismap -> isMap\r\n * - nomodule -> noModule\r\n * - novalidate -> noValidate\r\n * - readonly -> readOnly\r\n */\r\nconst specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;\r\nconst isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);\r\n/**\r\n * The full list is needed during SSR to produce the correct initial markup.\r\n */\r\nconst isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +\r\n `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +\r\n `loop,open,required,reversed,scoped,seamless,` +\r\n `checked,muted,multiple,selected`);\r\n/**\r\n * Boolean attributes should be included if the value is truthy or ''.\r\n * e.g. `<select multiple>` compiles to `{ multiple: '' }`\r\n */\r\nfunction includeBooleanAttr(value) {\r\n return !!value || value === '';\r\n}\r\nconst unsafeAttrCharRE = /[>/=\"'\\u0009\\u000a\\u000c\\u0020]/;\r\nconst attrValidationCache = {};\r\nfunction isSSRSafeAttrName(name) {\r\n if (attrValidationCache.hasOwnProperty(name)) {\r\n return attrValidationCache[name];\r\n }\r\n const isUnsafe = unsafeAttrCharRE.test(name);\r\n if (isUnsafe) {\r\n console.error(`unsafe attribute name: ${name}`);\r\n }\r\n return (attrValidationCache[name] = !isUnsafe);\r\n}\r\nconst propsToAttrMap = {\r\n acceptCharset: 'accept-charset',\r\n className: 'class',\r\n htmlFor: 'for',\r\n httpEquiv: 'http-equiv'\r\n};\r\n/**\r\n * CSS properties that accept plain numbers\r\n */\r\nconst isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +\r\n `border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +\r\n `columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +\r\n `grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +\r\n `grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +\r\n `line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +\r\n // SVG\r\n `fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +\r\n `stroke-miterlimit,stroke-opacity,stroke-width`);\r\n/**\r\n * Known attributes, this is used for stringification of runtime static nodes\r\n * so that we don't stringify bindings that cannot be set from HTML.\r\n * Don't also forget to allow `data-*` and `aria-*`!\r\n * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes\r\n */\r\nconst isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +\r\n `autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +\r\n `border,buffered,capture,challenge,charset,checked,cite,class,code,` +\r\n `codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +\r\n `coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +\r\n `disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +\r\n `formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +\r\n `height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +\r\n `ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +\r\n `manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +\r\n `open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +\r\n `referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +\r\n `selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +\r\n `start,step,style,summary,tabindex,target,title,translate,type,usemap,` +\r\n `value,width,wrap`);\r\n/**\r\n * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute\r\n */\r\nconst isKnownSvgAttr = /*#__PURE__*/ makeMap(`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,` +\r\n `arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,` +\r\n `baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,` +\r\n `clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,` +\r\n `color-interpolation-filters,color-profile,color-rendering,` +\r\n `contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,` +\r\n `descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,` +\r\n `dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,` +\r\n `fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,` +\r\n `font-family,font-size,font-size-adjust,font-stretch,font-style,` +\r\n `font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,` +\r\n `glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,` +\r\n `gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,` +\r\n `horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,` +\r\n `k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,` +\r\n `lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,` +\r\n `marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,` +\r\n `mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,` +\r\n `name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,` +\r\n `overflow,overline-position,overline-thickness,panose-1,paint-order,path,` +\r\n `pathLength,patternContentUnits,patternTransform,patternUnits,ping,` +\r\n `pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,` +\r\n `preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,` +\r\n `rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,` +\r\n `restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,` +\r\n `specularConstant,specularExponent,speed,spreadMethod,startOffset,` +\r\n `stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,` +\r\n `strikethrough-position,strikethrough-thickness,string,stroke,` +\r\n `stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,` +\r\n `stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,` +\r\n `systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,` +\r\n `text-decoration,text-rendering,textLength,to,transform,transform-origin,` +\r\n `type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,` +\r\n `unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,` +\r\n `v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,` +\r\n `vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,` +\r\n `writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,` +\r\n `xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,` +\r\n `xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`);\n\nfunction normalizeStyle(value) {\r\n if (isArray(value)) {\r\n const res = {};\r\n for (let i = 0; i < value.length; i++) {\r\n const item = value[i];\r\n const normalized = isString(item)\r\n ? parseStringStyle(item)\r\n : normalizeStyle(item);\r\n if (normalized) {\r\n for (const key in normalized) {\r\n res[key] = normalized[key];\r\n }\r\n }\r\n }\r\n return res;\r\n }\r\n else if (isString(value)) {\r\n return value;\r\n }\r\n else if (isObject(value)) {\r\n return value;\r\n }\r\n}\r\nconst listDelimiterRE = /;(?![^(]*\\))/g;\r\nconst propertyDelimiterRE = /:(.+)/;\r\nfunction parseStringStyle(cssText) {\r\n const ret = {};\r\n cssText.split(listDelimiterRE).forEach(item => {\r\n if (item) {\r\n const tmp = item.split(propertyDelimiterRE);\r\n tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());\r\n }\r\n });\r\n return ret;\r\n}\r\nfunction stringifyStyle(styles) {\r\n let ret = '';\r\n if (!styles || isString(styles)) {\r\n return ret;\r\n }\r\n for (const key in styles) {\r\n const value = styles[key];\r\n const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);\r\n if (isString(value) ||\r\n (typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))) {\r\n // only render valid values\r\n ret += `${normalizedKey}:${value};`;\r\n }\r\n }\r\n return ret;\r\n}\r\nfunction normalizeClass(value) {\r\n let res = '';\r\n if (isString(value)) {\r\n res = value;\r\n }\r\n else if (isArray(value)) {\r\n for (let i = 0; i < value.length; i++) {\r\n const normalized = normalizeClass(value[i]);\r\n if (normalized) {\r\n res += normalized + ' ';\r\n }\r\n }\r\n }\r\n else if (isObject(value)) {\r\n for (const name in value) {\r\n if (value[name]) {\r\n res += name + ' ';\r\n }\r\n }\r\n }\r\n return res.trim();\r\n}\r\nfunction normalizeProps(props) {\r\n if (!props)\r\n return null;\r\n let { class: klass, style } = props;\r\n if (klass && !isString(klass)) {\r\n props.class = normalizeClass(klass);\r\n }\r\n if (style) {\r\n props.style = normalizeStyle(style);\r\n }\r\n return props;\r\n}\n\n// These tag configs are shared between compiler-dom and runtime-dom, so they\r\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Element\r\nconst HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +\r\n 'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +\r\n 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +\r\n 'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +\r\n 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +\r\n 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +\r\n 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +\r\n 'option,output,progress,select,textarea,details,dialog,menu,' +\r\n 'summary,template,blockquote,iframe,tfoot';\r\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element\r\nconst SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +\r\n 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +\r\n 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +\r\n 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +\r\n 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +\r\n 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +\r\n 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +\r\n 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +\r\n 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +\r\n 'text,textPath,title,tspan,unknown,use,view';\r\nconst VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';\r\n/**\r\n * Compiler only.\r\n * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.\r\n */\r\nconst isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);\r\n/**\r\n * Compiler only.\r\n * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.\r\n */\r\nconst isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);\r\n/**\r\n * Compiler only.\r\n * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.\r\n */\r\nconst isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);\n\nconst escapeRE = /[\"'&<>]/;\r\nfunction escapeHtml(string) {\r\n const str = '' + string;\r\n const match = escapeRE.exec(str);\r\n if (!match) {\r\n return str;\r\n }\r\n let html = '';\r\n let escaped;\r\n let index;\r\n let lastIndex = 0;\r\n for (index = match.index; index < str.length; index++) {\r\n switch (str.charCodeAt(index)) {\r\n case 34: // \"\r\n escaped = '&quot;';\r\n break;\r\n case 38: // &\r\n escaped = '&amp;';\r\n break;\r\n case 39: // '\r\n escaped = '&#39;';\r\n break;\r\n case 60: // <\r\n escaped = '&lt;';\r\n break;\r\n case 62: // >\r\n escaped = '&gt;';\r\n break;\r\n default:\r\n continue;\r\n }\r\n if (lastIndex !== index) {\r\n html += str.slice(lastIndex, index);\r\n }\r\n lastIndex = index + 1;\r\n html += escaped;\r\n }\r\n return lastIndex !== index ? html + str.slice(lastIndex, index) : html;\r\n}\r\n// https://www.w3.org/TR/html52/syntax.html#comments\r\nconst commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;\r\nfunction escapeHtmlComment(src) {\r\n return src.replace(commentStripRE, '');\r\n}\n\nfunction looseCompareArrays(a, b) {\r\n if (a.length !== b.length)\r\n return false;\r\n let equal = true;\r\n for (let i = 0; equal && i < a.length; i++) {\r\n equal = looseEqual(a[i], b[i]);\r\n }\r\n return equal;\r\n}\r\nfunction looseEqual(a, b) {\r\n if (a === b)\r\n return true;\r\n let aValidType = isDate(a);\r\n let bValidType = isDate(b);\r\n if (aValidType || bValidType) {\r\n return aValidType && bValidType ? a.getTime() === b.getTime() : false;\r\n }\r\n aValidType = isSymbol(a);\r\n bValidType = isSymbol(b);\r\n if (aValidType || bValidType) {\r\n return a === b;\r\n }\r\n aValidType = isArray(a);\r\n bValidType = isArray(b);\r\n if (aValidType || bValidType) {\r\n return aValidType && bValidType ? looseCompareArrays(a, b) : false;\r\n }\r\n aValidType = isObject(a);\r\n bValidType = isObject(b);\r\n if (aValidType || bValidType) {\r\n /* istanbul ignore if: this if will probably never be called */\r\n if (!aValidType || !bValidType) {\r\n return false;\r\n }\r\n const aKeysCount = Object.keys(a).length;\r\n const bKeysCount = Object.keys(b).length;\r\n if (aKeysCount !== bKeysCount) {\r\n return false;\r\n }\r\n for (const key in a) {\r\n const aHasKey = a.hasOwnProperty(key);\r\n const bHasKey = b.hasOwnProperty(key);\r\n if ((aHasKey && !bHasKey) ||\r\n (!aHasKey && bHasKey) ||\r\n !looseEqual(a[key], b[key])) {\r\n return false;\r\n }\r\n }\r\n }\r\n return String(a) === String(b);\r\n}\r\nfunction looseIndexOf(arr, val) {\r\n return arr.findIndex(item => looseEqual(item, val));\r\n}\n\n/**\r\n * For converting {{ interpolation }} values to displayed strings.\r\n * @private\r\n */\r\nconst toDisplayString = (val) => {\r\n return isString(val)\r\n ? val\r\n : val == null\r\n ? ''\r\n : isArray(val) ||\r\n (isObject(val) &&\r\n (val.toString === objectToString || !isFunction(val.toString)))\r\n ? JSON.stringify(val, replacer, 2)\r\n : String(val);\r\n};\r\nconst replacer = (_key, val) => {\r\n // can't use isRef here since @vue/shared has no deps\r\n if (val && val.__v_isRef) {\r\n return replacer(_key, val.value);\r\n }\r\n else if (isMap(val)) {\r\n return {\r\n [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {\r\n entries[`${key} =>`] = val;\r\n return entries;\r\n }, {})\r\n };\r\n }\r\n else if (isSet(val)) {\r\n return {\r\n [`Set(${val.size})`]: [...val.values()]\r\n };\r\n }\r\n else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {\r\n return String(val);\r\n }\r\n return val;\r\n};\n\nconst EMPTY_OBJ = (process.env.NODE_ENV !== 'production')\r\n ? Object.freeze({})\r\n : {};\r\nconst EMPTY_ARR = (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];\r\nconst NOOP = () => { };\r\n/**\r\n * Always return false.\r\n */\r\nconst NO = () => false;\r\nconst onRE = /^on[^a-z]/;\r\nconst isOn = (key) => onRE.test(key);\r\nconst isModelListener = (key) => key.startsWith('onUpdate:');\r\nconst extend = Object.assign;\r\nconst remove = (arr, el) => {\r\n const i = arr.indexOf(el);\r\n if (i > -1) {\r\n arr.splice(i, 1);\r\n }\r\n};\r\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\r\nconst hasOwn = (val, key) => hasOwnProperty.call(val, key);\r\nconst isArray = Array.isArray;\r\nconst isMap = (val) => toTypeString(val) === '[object Map]';\r\nconst isSet = (val) => toTypeString(val) === '[object Set]';\r\nconst isDate = (val) => toTypeString(val) === '[object Date]';\r\nconst isFunction = (val) => typeof val === 'function';\r\nconst isString = (val) => typeof val === 'string';\r\nconst isSymbol = (val) => typeof val === 'symbol';\r\nconst isObject = (val) => val !== null && typeof val === 'object';\r\nconst isPromise = (val) => {\r\n return isObject(val) && isFunction(val.then) && isFunction(val.catch);\r\n};\r\nconst objectToString = Object.prototype.toString;\r\nconst toTypeString = (value) => objectToString.call(value);\r\nconst toRawType = (value) => {\r\n // extract \"RawType\" from strings like \"[object RawType]\"\r\n return toTypeString(value).slice(8, -1);\r\n};\r\nconst isPlainObject = (val) => toTypeString(val) === '[object Object]';\r\nconst isIntegerKey = (key) => isString(key) &&\r\n key !== 'NaN' &&\r\n key[0] !== '-' &&\r\n '' + parseInt(key, 10) === key;\r\nconst isReservedProp = /*#__PURE__*/ makeMap(\r\n// the leading comma is intentional so empty string \"\" is also included\r\n',key,ref,ref_for,ref_key,' +\r\n 'onVnodeBeforeMount,onVnodeMounted,' +\r\n 'onVnodeBeforeUpdate,onVnodeUpdated,' +\r\n 'onVnodeBeforeUnmount,onVnodeUnmounted');\r\nconst isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');\r\nconst cacheStringFunction = (fn) => {\r\n const cache = Object.create(null);\r\n return ((str) => {\r\n const hit = cache[str];\r\n return hit || (cache[str] = fn(str));\r\n });\r\n};\r\nconst camelizeRE = /-(\\w)/g;\r\n/**\r\n * @private\r\n */\r\nconst camelize = cacheStringFunction((str) => {\r\n return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));\r\n});\r\nconst hyphenateRE = /\\B([A-Z])/g;\r\n/**\r\n * @private\r\n */\r\nconst hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());\r\n/**\r\n * @private\r\n */\r\nconst capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));\r\n/**\r\n * @private\r\n */\r\nconst toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);\r\n// compare whether a value has changed, accounting for NaN.\r\nconst hasChanged = (value, oldValue) => !Object.is(value, oldValue);\r\nconst invokeArrayFns = (fns, arg) => {\r\n for (let i = 0; i < fns.length; i++) {\r\n fns[i](arg);\r\n }\r\n};\r\nconst def = (obj, key, value) => {\r\n Object.defineProperty(obj, key, {\r\n configurable: true,\r\n enumerable: false,\r\n value\r\n });\r\n};\r\nconst toNumber = (val) => {\r\n const n = parseFloat(val);\r\n return isNaN(n) ? val : n;\r\n};\r\nlet _globalThis;\r\nconst getGlobalThis = () => {\r\n return (_globalThis ||\r\n (_globalThis =\r\n typeof globalThis !== 'undefined'\r\n ? globalThis\r\n : typeof self !== 'undefined'\r\n ? self\r\n : typeof window !== 'undefined'\r\n ? window\r\n : typeof global !== 'undefined'\r\n ? global\r\n : {}));\r\n};\r\nconst identRE = /^[_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*$/;\r\nfunction genPropsAccessExp(name) {\r\n return identRE.test(name)\r\n ? `__props.${name}`\r\n : `__props[${JSON.stringify(name)}]`;\r\n}\n\nexport { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isNoUnitNumericStyleProp, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };\n","import { NOOP } from '@vue/shared'\nimport type { SFCWithInstall } from './typescript'\n\nexport const withInstall = <T, E extends Record<string, any>>(\n main: T,\n extra?: E\n) => {\n (main as SFCWithInstall<T>).install = (app): void => {\n for (const comp of [main, ...Object.values(extra ?? {})]) {\n app.component(comp.name, comp)\n }\n }\n\n if (extra) {\n for (const [key, comp] of Object.entries(extra)) {\n (main as any)[key] = comp\n }\n }\n return main as SFCWithInstall<T> & E\n}\n\nexport const withNoopInstall = <T>(component: T) => {\n (component as SFCWithInstall<T>).install = NOOP\n\n return component as SFCWithInstall<T>\n}\n","import type { PropType } from 'vue'\n\nexport const definePropType = <T>(val: any): PropType<T> => val\n","const removeArrayItem = (arr, el) => {\n const i = arr.indexOf(el);\n if (i > -1) {\n arr.splice(i, 1);\n }\n};\nconst uniqArray = (arr) => {\n if (!arr || !arr.length) {\n return [];\n }\n return Array.from(new Set(arr));\n};\n\nconst isNull = (val) => val === null;\n\nconst isUndefined = (val) => val === void 0 || typeof val === \"undefined\";\n\nconst isString = (val) => typeof val === \"string\";\n\nconst isNumber = (val) => typeof val === \"number\";\n\nconst isSymbol = (val) => typeof val === \"symbol\";\n\nconst isFunction = (val) => typeof val === \"function\";\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\nconst getPrototypeOf = Object.getPrototypeOf;\nconst objectToString = Object.prototype.toString;\nconst toTypeString = (val) => objectToString.call(val);\n\nconst ARRAY_TAG = \"[object Array]\";\nconst DATE_TAG = \"[object Date]\";\nconst MAP_TAG = \"[object Map]\";\nconst OBJECT_TAG = \"[object Object]\";\nconst SET_TAG = \"[object Set]\";\nconst randomLetters = [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\"\n];\n\nconst isObject = (val) => {\n return typeof val === \"object\" && !isNull(val);\n};\n\nconst isArray = (val) => {\n if (Array.isArray) {\n return Array.isArray(val);\n }\n return isObject(val) && toTypeString(val) === ARRAY_TAG;\n};\n\nconst getPrototype = (val) => getPrototypeOf(val);\n\nconst isPlainObject = (val) => {\n if (!isObject(val) || toTypeString(val) !== OBJECT_TAG) {\n return false;\n }\n if (getPrototype(val) === null) {\n return true;\n }\n let proto = val;\n while (getPrototype(proto) !== null) {\n proto = getPrototype(proto);\n }\n return getPrototype(val) === proto;\n};\n\nconst isMap = (val) => {\n return isObject(val) && toTypeString(val) === MAP_TAG;\n};\n\nconst isSet = (val) => {\n return isObject(val) && toTypeString(val) === SET_TAG;\n};\n\nconst isDate = (val) => {\n return isObject(val) && toTypeString(val) === DATE_TAG;\n};\n\nconst isPromise = (val) => {\n return isObject(val) && isFunction(val.then) && isFunction(val.catch);\n};\n\nconst isElement = (el) => {\n if (isUndefined(Element)) {\n return false;\n }\n return el instanceof Element;\n};\n\nconst oneDayMilliseconds = 864e5;\nconst isValidDate = (val) => {\n if (!isDate(val)) {\n val = new Date(val);\n }\n return !Number.isNaN(val.valueOf());\n};\nconst getTwoDaysDiffMS = (d1, d2) => Math.ceil(Math.abs(d1.getTime() - d2.getTime()) / oneDayMilliseconds);\nconst getDayOfYear = (date) => ~~((date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / oneDayMilliseconds);\nconst getTimeFromDate = (date) => date.toTimeString().slice(0, 8);\nconst getNowTimeStr = () => new Date().toLocaleString().replaceAll(\"/\", \"-\");\n\nconst formatMemoryToMB = (val) => `${(val / 1024 / 1024).toFixed(2)}MB`;\nconst formatMsToSecordsStr = (val) => `${~~(val / 1e3)}s`;\nconst getBrowserInfo = () => {\n return new Promise((resolve) => {\n const browserInfos = {};\n if (document) {\n const { domain, URL, title, referrer } = document;\n browserInfos.domain = domain || \"\";\n browserInfos.url = URL || \"\";\n browserInfos.title = title || \"\";\n browserInfos.referrer = referrer || \"\";\n }\n if (window?.screen) {\n const { height, width, colorDepth } = window.screen;\n browserInfos.screenHeight = height || 0;\n browserInfos.screenWidth = width || 0;\n browserInfos.color = colorDepth || 0;\n }\n if (navigator) {\n const { language, userAgent } = navigator;\n browserInfos.lang = language || \"\";\n browserInfos.ua = userAgent.toLowerCase();\n }\n if (window?.performance) {\n browserInfos.memory = formatMemoryToMB(window.performance?.memory?.usedJSHeapSize);\n const timing = window.performance?.timing || {};\n browserInfos.connectTime = formatMsToSecordsStr(timing.connectEnd - timing.connectStart);\n browserInfos.responseTime = formatMsToSecordsStr(timing.responseEnd - timing.responseStart);\n browserInfos.renderTime = formatMsToSecordsStr(timing.domComplete - timing.domLoading);\n }\n browserInfos.watchTime = getNowTimeStr();\n resolve(browserInfos);\n });\n};\n\nconst sohuIpAddressUrl = \"http://pv.sohu.com/cityjson?ie=utf-8\";\nconst getUserIp = () => {\n return new Promise((resolve, reject) => {\n const scriptElement = document.createElement(\"script\");\n scriptElement.src = sohuIpAddressUrl;\n document.body.appendChild(scriptElement);\n scriptElement.onload = () => {\n try {\n document.body.removeChild(scriptElement);\n resolve(window.returnCitySN);\n } catch (e) {\n reject(e);\n }\n };\n });\n};\n\nconst copyToClipboard = (text) => navigator.clipboard.writeText(text);\nconst getSelectedText = () => window.getSelection()?.toString();\nconst isDarkMode = window?.matchMedia(\"(prefers-color-scheme: dark)\").matches;\nconst isAppleDevice = /Mac|iPhone|iPad|iPod/ig.test(navigator.userAgent);\n\nconst getRandomNum = (min = 0, max = 100) => {\n return ~~(Math.random() * (max - min) + min);\n};\nconst getAverage = (...args) => {\n const len = args.length;\n if (len === 0) {\n return 0;\n }\n return Number(args.reduce((prev, next) => prev + next, 0).toFixed(2));\n};\n\nconst RegEx_Email = /^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/;\nconst RegEx_Domain = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\\.?/;\nconst RegEx_Password = /^[a-zA-Z]\\w{5,17}$/;\nconst RegEx_StrongPassword = /^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{8,16}$/;\nconst RegEx_PhoneNumber = /^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\\d{8}$/;\n\nconst isDomainName = (val) => RegEx_Domain.test(val);\nconst isEmail = (val) => RegEx_Email.test(val);\nconst isPhoneNumber = (val) => RegEx_PhoneNumber.test(val);\n\nconst capitalizeStr = (str) => `${str.charAt(0).toUpperCase()}${str.slice(1)}`;\n\nconst reverseStr = (str) => str.split(\"\").reverse().join(\"\");\n\nconst generateRandomStr = (randomStrLen = 10, letters) => {\n if (!letters || !isArray(letters)) {\n letters = randomLetters;\n }\n const len = letters.length;\n let res = \"\";\n for (let i = 0; i < randomStrLen; i++) {\n res += letters[getRandomNum(0, len)];\n }\n return res;\n};\n\nconst truncateStr = (str, len) => {\n if (len === void 0) {\n return str;\n }\n return str.length < len ? str : `${str.slice(0, len - 3)}...`;\n};\n\nconst stripHtmlEl = (htmlStr) => new DOMParser().parseFromString(htmlStr, \"text/html\").body.textContent || \"\";\n\nconst convertRgbToHex = (r, g, b) => {\n if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) {\n throw new Error(\"s\");\n }\n return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`;\n};\n\nconst generateRandomHex = () => `#${(~~(Math.random() * 16777215)).toString(16).padEnd(6, \"0\")}`;\n\nconst toString = (val) => {\n if (isNull(val) || isUndefined(val)) {\n return \"\";\n }\n if (isString(val)) {\n return val;\n }\n if (isSymbol(val)) {\n return val.toString();\n }\n if (isArray(val)) {\n return `${val.map((item) => item === null ? item : toString(item))}`;\n }\n const result = `${val}`;\n return result === \"0\" && 1 / Number(val) === -Infinity ? \"-0\" : result;\n};\n\nconst hasOwnProp = (val, key) => hasOwnProperty.call(val, key);\nconst hasChanged = (value, oldValue) => !Object.is(value, oldValue);\n\nconst color = {\n white: \"#FFFFFF\",\n black: \"#000000\",\n cyan: \"#51C4D3\",\n red: \"#C02C38\",\n green: \"#42C02E\",\n yellow: \"#F1CA17\",\n blue: \"#15559A\"\n};\nconst SPLIT_TAG = \"__styles__\";\nconst leftPaddingStyle = \"padding: 2px 1px; border-radius: 3px 0 0 3px;\";\nconst rightPaddingStyle = \"padding: 2px 1px; border-radius: 0 3px 3px 0;\";\nconst sureUtilsPrefix = `sure-utils${SPLIT_TAG}${leftPaddingStyle}background: ${color.blue}; font-weight: bold; color: ${color.white};`;\nconst tipPrefix = `tip${SPLIT_TAG}${rightPaddingStyle} background: ${color.green}; font-weight: bold; color: ${color.white};`;\nconst warnPrefix = `warn${SPLIT_TAG}${rightPaddingStyle} background: ${color.yellow}; font-weight: bold; color: ${color.white};`;\nconst errorPrefix = `error${SPLIT_TAG}${rightPaddingStyle} background: ${color.red}; font-weight: bold; color: ${color.white};`;\n\nconst _console = console;\nconst addStyle = (str, styles) => {\n const strArr = str.split(SPLIT_TAG);\n strArr[1] = strArr[1] ? `${strArr[1]}${styles};` : styles;\n return strArr.join(SPLIT_TAG);\n};\nconst colorUtils = {\n bold: (str) => {\n return addStyle(str, \"font-weight: bold;\");\n },\n white: (str) => {\n return addStyle(str, `color: ${color.white};`);\n },\n black: (str) => {\n return addStyle(str, `color: ${color.black};`);\n },\n cyan: (str) => {\n return addStyle(str, `color: ${color.cyan};`);\n },\n red: (str) => {\n return addStyle(str, `color: ${color.red};`);\n },\n green: (str) => {\n return addStyle(str, `color: ${color.green};`);\n },\n blue: (str) => {\n return addStyle(str, `color: ${color.blue};`);\n },\n bgWhite: (str) => {\n return addStyle(str, `background: ${color.white};`);\n },\n bgBlack: (str) => {\n return addStyle(str, `background: ${color.black};`);\n },\n bgCyan: (str) => {\n return addStyle(str, `background: ${color.cyan};`);\n },\n bgRed: (str) => {\n return addStyle(str, `background: ${color.red};`);\n },\n bgGreen: (str) => {\n return addStyle(str, `background: ${color.green};`);\n },\n bgBlue: (str) => {\n return addStyle(str, `background: ${color.blue};`);\n }\n};\nconst generateLogMsg = (...msgs) => {\n let msgRes = \"\";\n const stylesRes = [];\n for (const item of msgs) {\n const [msg, style] = item.split(SPLIT_TAG);\n msgRes += `%c ${msg} `;\n stylesRes.push(style);\n }\n return [msgRes, ...stylesRes];\n};\nconst tipLog = (...args) => {\n const msgs = generateLogMsg(sureUtilsPrefix, tipPrefix, ...args);\n _console.log(...msgs);\n};\nconst warnLog = (...args) => {\n const msgs = generateLogMsg(sureUtilsPrefix, warnPrefix, ...args);\n _console.warn(...msgs);\n};\nconst errorLog = (...args) => {\n const msgs = generateLogMsg(sureUtilsPrefix, errorPrefix, ...args);\n _console.error(...msgs);\n};\n\nfunction debounce(func, waitMilliseconds = 50, options = {}) {\n let timerId;\n const isImmediate = options.isImmediate ?? false;\n const callback = options.callback ?? false;\n const maxWait = options.maxWait;\n let lastInvokeTime = Date.now();\n let promises = [];\n function nextInvokeTimeout() {\n if (maxWait !== void 0) {\n const timeSinceLastInvocation = Date.now() - lastInvokeTime;\n if (timeSinceLastInvocation + waitMilliseconds >= maxWait) {\n return maxWait - timeSinceLastInvocation;\n }\n }\n return waitMilliseconds;\n }\n const debouncedFunction = function(...args) {\n const context = this;\n return new Promise((resolve, reject) => {\n const invokeFunction = function() {\n timerId = null;\n lastInvokeTime = Date.now();\n if (!isImmediate) {\n const result = func.apply(context, args);\n callback && callback(result);\n promises.forEach(({ resolve: resolve2 }) => resolve2(result));\n promises = [];\n }\n };\n const shouldCallNow = isImmediate && timerId === null;\n if (timerId !== null) {\n clearTimeout(timerId);\n }\n timerId = setTimeout(invokeFunction, nextInvokeTimeout());\n if (shouldCallNow) {\n const result = func.apply(context, args);\n callback && callback(result);\n return resolve(result);\n }\n promises.push({ resolve, reject });\n });\n };\n debouncedFunction.cancel = function(reason) {\n if (timerId !== null) {\n clearTimeout(timerId);\n }\n promises.forEach(({ reject }) => reject(reason));\n promises = [];\n };\n return debouncedFunction;\n}\n\nfunction throttle(callback, delay, options = {}) {\n const {\n noTrailing = false,\n noLeading = false,\n debounceMode = void 0\n } = options;\n let timerId = null;\n let cancelled = false;\n let lastExec = 0;\n function clearExistingTimeout() {\n if (timerId) {\n clearTimeout(timerId);\n timerId = null;\n }\n }\n function cancel(options2 = {}) {\n const { upcomingOnly = false } = options2;\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n function wrapper(...args) {\n const self = this;\n const elapsed = Date.now() - lastExec;\n if (cancelled) {\n return;\n }\n function exec() {\n lastExec = Date.now();\n callback.apply(self, args);\n }\n function clear() {\n timerId = null;\n }\n if (!noLeading && debounceMode && !timerId) {\n exec();\n }\n clearExistingTimeout();\n if (debounceMode === void 0 && elapsed > delay) {\n if (noLeading) {\n lastExec = Date.now();\n if (!noTrailing) {\n timerId = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n exec();\n }\n } else if (noTrailing !== true) {\n timerId = setTimeout(debounceMode ? clear : exec, debounceMode === void 0 ? delay - elapsed : delay);\n }\n }\n wrapper.cancel = cancel;\n return wrapper;\n}\n\nexport { RegEx_Domain, RegEx_Email, RegEx_Password, RegEx_PhoneNumber, RegEx_StrongPassword, capitalizeStr, colorUtils as chalk, convertRgbToHex, copyToClipboard, debounce, errorLog, formatMemoryToMB, formatMsToSecordsStr, generateRandomHex, generateRandomStr, getAverage, getBrowserInfo, getDayOfYear, getNowTimeStr, getPrototype, getPrototypeOf, getRandomNum, getSelectedText, getTimeFromDate, getTwoDaysDiffMS, getUserIp, hasChanged, hasOwnProp, hasOwnProperty, isAppleDevice, isArray, isDarkMode, isDate, isDomainName, isElement, isEmail, isFunction, isMap, isNull, isNumber, isObject, isPhoneNumber, isPlainObject, isPromise, isSet, isString, isSymbol, isUndefined, isValidDate, objectToString, removeArrayItem, reverseStr, stripHtmlEl, throttle, tipLog, toString, toTypeString, truncateStr, uniqArray, warnLog };\n","import { isNumber, isString } from 'sure-utils'\nimport { debugWarn } from '../error'\n\nconst SCOPE = 'utils/dom/style'\n\n/**\n * Add unit func\n * @param value\n * @param defaultUnit\n * @returns\n */\nexport function addUnit(value?: string | number, defaultUnit = 'px') {\n if (!value) {\n return ''\n }\n if (isString(value)) {\n return value\n } else if (isNumber(value)) {\n return `${value}${defaultUnit}`\n }\n debugWarn(SCOPE, 'binding value must be a string or number')\n}\n","import { extend, isArray, isMap, isIntegerKey, hasOwn, isSymbol, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';\n\nfunction warn(msg, ...args) {\r\n console.warn(`[Vue warn] ${msg}`, ...args);\r\n}\n\nlet activeEffectScope;\r\nclass EffectScope {\r\n constructor(detached = false) {\r\n /**\r\n * @internal\r\n */\r\n this.active = true;\r\n /**\r\n * @internal\r\n */\r\n this.effects = [];\r\n /**\r\n * @internal\r\n */\r\n this.cleanups = [];\r\n if (!detached && activeEffectScope) {\r\n this.parent = activeEffectScope;\r\n this.index =\r\n (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;\r\n }\r\n }\r\n run(fn) {\r\n if (this.active) {\r\n const currentEffectScope = activeEffectScope;\r\n try {\r\n activeEffectScope = this;\r\n return fn();\r\n }\r\n finally {\r\n activeEffectScope = currentEffectScope;\r\n }\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn(`cannot run an inactive effect scope.`);\r\n }\r\n }\r\n /**\r\n * This should only be called on non-detached scopes\r\n * @internal\r\n */\r\n on() {\r\n activeEffectScope = this;\r\n }\r\n /**\r\n * This should only be called on non-detached scopes\r\n * @internal\r\n */\r\n off() {\r\n activeEffectScope = this.parent;\r\n }\r\n stop(fromParent) {\r\n if (this.active) {\r\n let i, l;\r\n for (i = 0, l = this.effects.length; i < l; i++) {\r\n this.effects[i].stop();\r\n }\r\n for (i = 0, l = this.cleanups.length; i < l; i++) {\r\n this.cleanups[i]();\r\n }\r\n if (this.scopes) {\r\n for (i = 0, l = this.scopes.length; i < l; i++) {\r\n this.scopes[i].stop(true);\r\n }\r\n }\r\n // nested scope, dereference from parent to avoid memory leaks\r\n if (this.parent && !fromParent) {\r\n // optimized O(1) removal\r\n const last = this.parent.scopes.pop();\r\n if (last && last !== this) {\r\n this.parent.scopes[this.index] = last;\r\n last.index = this.index;\r\n }\r\n }\r\n this.active = false;\r\n }\r\n }\r\n}\r\nfunction effectScope(detached) {\r\n return new EffectScope(detached);\r\n}\r\nfunction recordEffectScope(effect, scope = activeEffectScope) {\r\n if (scope && scope.active) {\r\n scope.effects.push(effect);\r\n }\r\n}\r\nfunction getCurrentScope() {\r\n return activeEffectScope;\r\n}\r\nfunction onScopeDispose(fn) {\r\n if (activeEffectScope) {\r\n activeEffectScope.cleanups.push(fn);\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn(`onScopeDispose() is called when there is no active effect scope` +\r\n ` to be associated with.`);\r\n }\r\n}\n\nconst createDep = (effects) => {\r\n const dep = new Set(effects);\r\n dep.w = 0;\r\n dep.n = 0;\r\n return dep;\r\n};\r\nconst wasTracked = (dep) => (dep.w & trackOpBit) > 0;\r\nconst newTracked = (dep) => (dep.n & trackOpBit) > 0;\r\nconst initDepMarkers = ({ deps }) => {\r\n if (deps.length) {\r\n for (let i = 0; i < deps.length; i++) {\r\n deps[i].w |= trackOpBit; // set was tracked\r\n }\r\n }\r\n};\r\nconst finalizeDepMarkers = (effect) => {\r\n const { deps } = effect;\r\n if (deps.length) {\r\n let ptr = 0;\r\n for (let i = 0; i < deps.length; i++) {\r\n const dep = deps[i];\r\n if (wasTracked(dep) && !newTracked(dep)) {\r\n dep.delete(effect);\r\n }\r\n else {\r\n deps[ptr++] = dep;\r\n }\r\n // clear bits\r\n dep.w &= ~trackOpBit;\r\n dep.n &= ~trackOpBit;\r\n }\r\n deps.length = ptr;\r\n }\r\n};\n\nconst targetMap = new WeakMap();\r\n// The number of effects currently being tracked recursively.\r\nlet effectTrackDepth = 0;\r\nlet trackOpBit = 1;\r\n/**\r\n * The bitwise track markers support at most 30 levels of recursion.\r\n * This value is chosen to enable modern JS engines to use a SMI on all platforms.\r\n * When recursion depth is greater, fall back to using a full cleanup.\r\n */\r\nconst maxMarkerBits = 30;\r\nlet activeEffect;\r\nconst ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'iterate' : '');\r\nconst MAP_KEY_ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'Map key iterate' : '');\r\nclass ReactiveEffect {\r\n constructor(fn, scheduler = null, scope) {\r\n this.fn = fn;\r\n this.scheduler = scheduler;\r\n this.active = true;\r\n this.deps = [];\r\n this.parent = undefined;\r\n recordEffectScope(this, scope);\r\n }\r\n run() {\r\n if (!this.active) {\r\n return this.fn();\r\n }\r\n let parent = activeEffect;\r\n let lastShouldTrack = shouldTrack;\r\n while (parent) {\r\n if (parent === this) {\r\n return;\r\n }\r\n parent = parent.parent;\r\n }\r\n try {\r\n this.parent = activeEffect;\r\n activeEffect = this;\r\n shouldTrack = true;\r\n trackOpBit = 1 << ++effectTrackDepth;\r\n if (effectTrackDepth <= maxMarkerBits) {\r\n initDepMarkers(this);\r\n }\r\n else {\r\n cleanupEffect(this);\r\n }\r\n return this.fn();\r\n }\r\n finally {\r\n if (effectTrackDepth <= maxMarkerBits) {\r\n finalizeDepMarkers(this);\r\n }\r\n trackOpBit = 1 << --effectTrackDepth;\r\n activeEffect = this.parent;\r\n shouldTrack = lastShouldTrack;\r\n this.parent = undefined;\r\n if (this.deferStop) {\r\n this.stop();\r\n }\r\n }\r\n }\r\n stop() {\r\n // stopped while running itself - defer the cleanup\r\n if (activeEffect === this) {\r\n this.deferStop = true;\r\n }\r\n else if (this.active) {\r\n cleanupEffect(this);\r\n