UNPKG

ucc-utils

Version:
1 lines 17.8 kB
function e(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function n(e){if(Array.isArray(e))return e}function t(n){if(Array.isArray(n))return e(n)}function r(e,n,t,r,i,o,u){try{var a=e[o](u);var s=a.value}catch(e){t(e);return}if(a.done){n(s)}else{Promise.resolve(s).then(r,i)}}function i(e){return function(){var n=this,t=arguments;return new Promise(function(i,o){var u=e.apply(n,t);function a(e){r(u,i,o,a,s,"next",e)}function s(e){r(u,i,o,a,s,"throw",e)}a(undefined)})}}function o(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function u(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,n){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var r=[];var i=true;var o=false;var u,a;try{for(t=t.call(e);!(i=(u=t.next()).done);i=true){r.push(u.value);if(n&&r.length===n)break}}catch(e){o=true;a=e}finally{try{if(!i&&t["return"]!=null)t["return"]()}finally{if(o)throw a}}return r}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){return n(e)||a(e,t)||p(e,t)||s()}function l(e){return t(e)||u(e)||p(e)||c()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function p(n,t){if(!n)return;if(typeof n==="string")return e(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor)r=n.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(n,t)}function y(e,n){var t,r,i,o,u={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(n){return s([e,n])}}function s(o){if(t)throw new TypeError("Generator is already executing.");while(u)try{if(t=1,r&&(i=o[0]&2?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;if(r=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:u.label++;return{value:o[1],done:false};case 5:u.label++;r=o[1];o=[0];continue;case 7:o=u.ops.pop();u.trys.pop();continue;default:if(!(i=u.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){u=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(o[0]===6&&u.label<i[1]){u.label=i[1];i=o;break}if(i&&u.label<i[2]){u.label=i[2];u.ops.push(o);break}if(i[2])u.ops.pop();u.trys.pop();continue}o=n.call(e,u)}catch(e){o=[6,e];r=0}finally{t=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}import{a as h}from"../chunk-3SAEGOMQ.mjs";import{cloneDeep as v,startsWith as b,isNil as g}from"lodash-es";var m=function(){return typeof h=="function"&&(typeof module==="undefined"?"undefined":d(module))=="object"&&module!==null&&d(module.exports)=="object"||(typeof global==="undefined"?"undefined":d(global))=="object"&&(typeof process==="undefined"?"undefined":d(process))=="object"&&typeof __dirname=="string"},w=function(){var e;return typeof h=="function"&&(typeof module==="undefined"?"undefined":d(module))<"u"&&module.exports?!1:d(import.meta)<"u"||(typeof document==="undefined"?"undefined":d(document))<"u"&&((e=document.currentScript)===null||e===void 0?void 0:e.type)==="module"},S=function(e){return typeof e=="number"||typeof e=="string"||typeof e=="boolean"||(typeof e==="undefined"?"undefined":d(e))=="symbol"||e===null||e===void 0},A=function(e){return S(e)?O(e)?!!(e===null||e===void 0?void 0:e.description):!!e:N(e)?e.length>0:T(e)?Object.keys(e).length>0:!1},_=function(e){return e===null},j=function(e){return e==null},E=function(e){return e===void 0},O=function(e){return(typeof e==="undefined"?"undefined":d(e))=="symbol"},P=function(e){return typeof e=="function"},T=function(e){return(typeof e==="undefined"?"undefined":d(e))=="object"&&e!==null},x=function(e){if((typeof e==="undefined"?"undefined":d(e))!="object"||e===null)return!1;var n=Object.getPrototypeOf(e);return n===Object.prototype||n===null},C=function(e){return x(e)&&Object.keys(e).length===0||N(e)&&e.length===0},R=function(e){return x(e)&&Object.keys(e).length===0},I=function(e){return typeof e=="string"},N=function(e){return Array.isArray(e)},W=function(e){return Array.isArray(e)&&e.length===0},M=function(e){return typeof e=="number"&&!Number.isInteger(e)},F=function(e){return typeof e=="number"},k=function(e){return typeof e=="number"&&Number.isInteger(e)},U=function(e){if(typeof e!="string"||(e=e.trim(),!e.startsWith("{")&&!e.startsWith("[")))return!1;try{return JSON.parse(e),!0}catch(e){return!1}},$=/^\d+(\.\d+)?$/,L=function(e){return typeof e!="string"?!1:$.test(e.trim())},J=function(e){return typeof e!="string"?!1:["true","false"].includes(e.trim())},V=function(e){return typeof e=="string"&&e.startsWith("[")&&e.endsWith("]")},z=function(e){return typeof e=="string"&&e.startsWith("{")&&e.endsWith("}")},B=function(e){return typeof e!="string"?!1:(e=e.replace(/\s+/g,""),e.startsWith("function")||e.startsWith("()=>")||e.startsWith("_=>"))},Q=[/Win/i,/Win(?:dows)?/i],G=function(e){return(typeof e==="undefined"?"undefined":d(e))<"u"&&e.userAgent?Q[0].test(e.platform)||Q[1].test(e.userAgent):!1},Z=[/Mac(?:intosh|Intel|PPC|68K)/i,/Mac/i],q=function(e){return(typeof e==="undefined"?"undefined":d(e))<"u"&&e.userAgent?Z[0].test(e.platform)||Z[1].test(e.userAgent):!1},D=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone|Windows Mobile|MeeGo|Tizen|Bada|Kindle|Silk|MiuiBrowser|SamsungBrowser|OPR\/|Fennec/i,K=function(e){return(typeof e==="undefined"?"undefined":d(e))<"u"&&e.userAgent?D.test(e.userAgent.toLocaleLowerCase()):!1},H=function(e){return!K(e)},X=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,Y=function(e){return X.test(e)},ee=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,en=function(e){return ee.test(e)},et=[/^(?:(?:\+|00)86)?1[3-9]\d{9}$/,/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/],er=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return n?et[1].test(e):et[0].test(e)},ei=/^[1-9][0-9]{4,10}$/,eo=function(e){return ei.test(e)},eu=function(e){return!!e&&((typeof e==="undefined"?"undefined":d(e))=="object"||typeof e=="function")&&typeof e.then=="function"},ea=function(e){return!!e&&(typeof e==="undefined"?"undefined":d(e))=="object"&&e.name==="AsyncComponentWrapper"&&typeof e.__asyncLoader=="function"},es=function(e){return(typeof e==="undefined"?"undefined":d(e))=="object"&&e!==null&&(typeof e.setup=="function"||typeof e.render=="function"||typeof e.template=="string"||typeof e.name=="string"||e.functional===!0)},ec=function(e){return e!=null&&!Number.isNaN(e)},ef=function(e){return e&&Array.isArray(e)&&e.length>0},el=function(e){return e&&(typeof e==="undefined"?"undefined":d(e))=="object"&&!Array.isArray(e)&&Object.keys(e).length>0};var ed=/\s+/g,ep=/\n+/g,ey=/\r+/g,eh=/\t+/g,ev=/\s+/g,eb=/(\w+):()/g,eg=/\b\w/g,em=/Symbol\("([^"]*)"\)/g,ew=/([A-Z])/g,eS=/_(\w)/g,eA=/\{(\d+)\}/g;var e_=(typeof window==="undefined"?"undefined":d(window))=="object"&&window.Object===Object?window:(typeof globalThis==="undefined"?"undefined":d(globalThis))=="object"&&globalThis.Object===Object?globalThis:(typeof global==="undefined"?"undefined":d(global))=="object"&&global.Object===Object?global:(typeof self==="undefined"?"undefined":d(self))=="object"&&self.Object===Object?self:Function("return this")(),ej=function(e){return e.replace(ed,"")},eE=function(e){return e.replace(ep,"")},eO=function(e){return e.replace(ey,"")},eP=function(e){return e.replace(eh,"")},eT=function(e){return e.replace(ev,"")},ex=function(e){return e.replace(eb,'"$1":$2')},eC=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=n.fld,r=t===void 0?"id":t,i=n.glFld,o=i===void 0?"parentId":i,u=n.childFld,a=u===void 0?"children":u,s=n.isJudgeType,c=s===void 0?!0:s,f=n.isChangeOwner,l=f===void 0?!0:f,d=l?e:v(e);var p=true,y=false,h=undefined;try{var b=function(){var e=m.value;if(e[o]){var n=c?d.find(function(n){return n[r]&&n[r]===e[o]}):d.find(function(n){return n[r]&&n[r]==e[o]});if(!n)return"continue";(n[a]=n[a]||[]).push(e)}};for(var g=d[Symbol.iterator](),m;!(p=(m=g.next()).done);p=true)b()}catch(e){y=true;h=e}finally{try{if(!p&&g.return!=null){g.return()}}finally{if(y){throw h}}}return e.filter(function(e){return!e[o]})},eR=function(e,n){return(e===null||e===void 0?void 0:e.length)?e.reduce(function(e,t){var r=t[n];return(e[r]||(e[r]=[])).push(t),e},{}):e},eI=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||typeof e!="string")return n;try{return JSON.parse(e)}catch(e){return n}},eN=function(e){return e?e.replace(eg,function(e){return e.toUpperCase()}):""},eW=function(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()};function eM(e){var n=e.startsWith("linear-gradient"),t=e.startsWith("radial-gradient"),r=/rgba?\((\d+), (\d+), (\d+),? ([\d.]+)?\)\s(\d+)%/g,i,o=[];for(;(i=r.exec(e))!==null;){var u=f(i.slice(1),5),a=u[0],s=u[1],c=u[2],l=u[3],d=l===void 0?"1":l,p=u[4];o.push({offset:parseInt(p)/100,color:"rgba(".concat(a,", ").concat(s,", ").concat(c,", ").concat(d,")")})}if(n){var y=/linear-gradient\(([\d.]+)deg/.exec(e),h=y?parseFloat(y[1]):0;return{type:"linear",x:Math.cos(h*Math.PI/180),y:Math.sin(h*Math.PI/180),x2:1,y2:0,colorStops:o,global:!1,value:e}}else return t?{type:"radial",x:.5,y:.5,r:.5,colorStops:o,global:!1,value:e}:e}function eF(e,n,t){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".";if(typeof n=="string"){if(n.indexOf(r)===-1)return e[n]=t,[e,n];n=n.split(r)}var i=e,o=n.length;for(var u=0;u<o-1;u++){var a=n[u];i=i[a]=i[a]||{}}var s=n[o-1];return Array.isArray(i[s])?i[s].push(t):i[s]=t,[i,s]}function ek(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";return typeof n=="string"&&(n=n.split(t)),n.reduce(function(e,n){return(e||{})[n]},e)}function eU(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=t.delay,o=r===void 0?100:r,u=t.limit,a=u===void 0?1:u,s=t.timeout,c=s===void 0?0:s,f=t.timeoutFn,l=0,d=Date.now(),p=setInterval(/*#__PURE__*/i(function(){var t;return y(this,function(r){switch(r.label){case 0:if(c&&Date.now()-d>c){f&&typeof f=="function"&&f(),clearInterval(p);return[2]}return[4,e()];case 1:if(!r.sent())return[3,3];return[4,n()];case 2:t=(r.sent(),++l>=a&&clearInterval(p));return[3,4];case 3:t=l=0;r.label=4;case 4:t;return[2]}})}),o);return function(){return clearInterval(p)}}var e$=function(e,n){return n?e.call(n):e()},eL=function(e){try{return new Function("return ".concat(e))()}catch(n){return e}};function eJ(e){if(typeof e!="string")return e;if(e=e.trim(),e!=="undefined")return e==="null"?null:e==="true"?!0:e==="false"?!1:e==="NaN"?NaN:e==="Infinity"?1/0:e==="-Infinity"?-1/0:L(e)?Number(e):V(e)||z(e)||B(e)?eL(e):e}function eV(e){try{return JSON.parse(e,function(e,n){if(b(n,"function-"))return new Function("return ".concat(n.slice(9)))();if(b(n,"symbol-")){var t=n.slice(7).match(em);return t?Symbol(t[1]):n}if(!b(n,"undef-"))return eJ(n)})}catch(n){return e}}function ez(e){return JSON.stringify(e,function(e,n){return typeof n=="function"?"function-".concat(n.toString()):(typeof n==="undefined"?"undefined":d(n))=="symbol"?"symbol-".concat(n.toString()):n===void 0?"undef-":n})}function eB(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:" ";return e.replace(ew,n+"$1").trim().toLowerCase()}var eQ=function(e){return e.replace(eS,function(e,n){return n.toUpperCase()})},eG=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;var t=e.toString(),r=t.indexOf(".");return r===-1?e:Number(t.slice(0,r+n+1))},eZ=function(e,n){return e.replace(eA,function(e,t){var r=parseInt(t,10);return isNaN(r)?n[t]:n[r]})};function eq(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=n.isReverse,r=t===void 0?!1:t,i=n.isNumber,o=i===void 0?!1:i,u=n.rootFontSize,a=u===void 0?parseInt(getComputedStyle(document.documentElement).fontSize,10)||window.innerWidth/100:u;if(g(e))return e;var s=r?"px":"rem",c=r?e*a:e/a;return o?c:"".concat(c).concat(s)}var eD=function(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"\n";return e.split("").reduce(function(r,i,o){return(o+1)%n===0&&o<e.length-1?r+i+t:r+i},"")},eK=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=n.timeout,r=n.isComplete,u=r===void 0?!0:r,a=Array(e.length).fill(void 0),s=!1;return e.reduce(/*#__PURE__*/function(){var e=i(function(e,n,r){return y(this,function(c){switch(c.label){case 0:return[4,e];case 1:if(c.sent(),!(s&&!u))return[2,new Promise(/*#__PURE__*/function(){var e=i(function(e){var i,u,c,f;return y(this,function(l){switch(l.label){case 0:i=null,u=function(n){i&&clearTimeout(i),a[r]=n,o(n,Error)&&(s=!0),e()};l.label=1;case 1:l.trys.push([1,3,,4]);t&&(i=setTimeout(function(){return u(new Error("chain: step ".concat(r," timeout")))},t));c=r>0?a[r-1]:null;return[4,n(c,u)];case 2:l.sent();return[3,4];case 3:f=l.sent();u(o(f,Error)?f:new Error(String(f)));return[3,4];case 4:return[2]}})});return function(n){return e.apply(this,arguments)}}())];return[2]}})});return function(n,t,r){return e.apply(this,arguments)}}(),Promise.resolve()),a};var eH=function(e){return window.requestIdleCallback(/*#__PURE__*/function(){var n=i(function(n){var t;return y(this,function(r){switch(r.label){case 0:if(!(n.timeRemaining()>0))return[3,4];t=e&&typeof e=="function";if(!t)return[3,2];return[4,e()];case 1:t=r.sent();r.label=2;case 2:t;r.label=3;case 3:return[3,0];case 4:return[2]}})});return function(e){return n.apply(this,arguments)}}())},eX=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new WeakMap;if(!e)return e;if(Array.isArray(e))eX(e,n);else{var t=window.requestIdleCallback(/*#__PURE__*/function(){var t=i(function(t){var r,i;return y(this,function(o){switch(o.label){case 0:r=Array.isArray(e),i=r?e.shift():e;o.label=1;case 1:if(!(t.timeRemaining()>0))return[3,4];return[4,i()];case 2:o.sent();o.label=3;case 3:return[3,1];case 4:r&&e.length>0&&eX(e,n);return[2]}})});return function(e){return t.apply(this,arguments)}}());n.set(e,t)}},eY=/*#__PURE__*/function(){var e=i(function(e){var n,t,r;var o=arguments;return y(this,function(u){n=o.length>1&&o[1]!==void 0?o[1]:{};t=n.limit,r=t===void 0?3:t;return[2,(e=e.map(function(e){return eu(e)?e:Promise.resolve(e)}),new Promise(/*#__PURE__*/function(){var n=i(function(n,t){var o,u,a,s,c;return y(this,function(t){if(e.length===0)return[2,n([])];o=[],u=0,a=0,s=/*#__PURE__*/function(){var n=i(function(){var n,t,r,i;return y(this,function(a){switch(a.label){case 0:n=u++,t=e[n];a.label=1;case 1:a.trys.push([1,3,,4]);r={success:!0};return[4,t];case 2:o[n]=(r.value=a.sent(),r);return[3,4];case 3:i=a.sent();o[n]={success:!1,value:i};return[3,4];case 4:return[2]}})});return function e(){return n.apply(this,arguments)}}();if(u<e.length&&s(),++a===e.length)return[2,n(o)];for(c=0;c<Math.min(r,e.length);c++)s();return[2]})});return function(e,t){return n.apply(this,arguments)}}()))]})});return function n(n){return e.apply(this,arguments)}}();var e0=/*#__PURE__*/function(){var e=i(function(e,n){var t,r,i,o,u,a,s,c,f;return y(this,function(d){switch(d.label){case 0:t=n.fnArgs,r=t===void 0?[]:t,i=n.isToThrow,o=i===void 0?!1:i,u=n.onErrorFn,a=u===void 0?null:u,s=[];d.label=1;case 1:d.trys.push([1,3,,4]);c=1;return[4,e.apply(void 0,l(r))];case 2:s[c]=d.sent();return[3,4];case 3:f=d.sent();if(o)throw new Error(f);a&&typeof a=="function"&&a(f.message||f),s[0]=f;return[3,4];case 4:return[2,s]}})});return function n(n,t){return e.apply(this,arguments)}}();export{eb as AddQuotesToPropsRegExp,ew as CamelCaseRegExp,eA as PlaceholderRegExp,em as SymbolRegExp,ey as TrimCRRegExp,ep as TrimNLRegExp,ed as TrimSpaceRegExp,eh as TrimTabRegExp,ev as TrimWhitespaceRegExp,eS as UnderlineToCamelCaseRegExp,eg as UpperCaseRegExp,eD as addCustomSeparator,ex as addQuotesToProps,eN as capitalizeForWord,eK as chain,eY as concurRequest,eC as convertRoutesToLevel,eM as cssGradientToECharts,eB as expandCamelCase,eZ as fillTemplate,eW as getType,ek as getValue,eR as groupByProp,A as hasWeightValue,eH as idleCallback,eX as idleTaskQueue,N as isArray,ea as isAsyncComponent,m as isCJS,w as isESM,en as isEmail,W as isEmptyArray,C as isEmptyObject,R as isEmptyPlainObject,M as isFloat,P as isFunction,k as isInteger,U as isJSONString,q as isMacOS,K as isMobile,_ as isNull,j as isNullish,F as isNumber,T as isObject,H as isPC,er as isPhone,x as isPlainObject,S as isPrimitive,eu as isPromise,eo as isQQ,I as isString,V as isStringArray,J as isStringBoolean,B as isStringFunction,L as isStringNumber,z as isStringObject,O as isSymbol,Y as isURL,E as isUndefined,ef as isValidArray,el as isValidPlainObject,ec as isValue,es as isVueComponent,G as isWindows,eI as parseJSON,eL as parseStrWithType,eV as parseStringify,eq as pxToRem,eJ as restoreValue,e_ as root,e$ as runFn,eF as setValue,eG as toFixed,ez as toStringify,eO as trimCR,eE as trimNL,ej as trimSpace,eP as trimTab,eT as trimWhitespace,e0 as tryit,eQ as underlineToCamelCase,eU as watchFn};