@ivujs/i-utils
Version:
前端模块化 JavaScript 工具库
6 lines • 81.7 kB
JavaScript
/*!
* @ivujs/i-utils v2.1.8
* Copyright 2021-2026, <gao911222@163.com>
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).iUtils={})}(this,(function(t){"use strict";const e={DESC:0,ASC:1,RANDOM:2},n={ROUND:0,ROUND_FLOOR:1},r={CH:/^[\u4E00-\u9FA5]+$/,EN:/^[a-zA-Z]+$/,LOWER_CASE:/^[a-z]+$/,UPPER_CASE:/^[A-Z]+$/,CH_NAME:/^[\u4e00-\u9fa5·]{2,16}$/,EN_NAME:/^[a-zA-Z\s]{1,20}$/,NUMBER:/^([-+])?\d+(\.\d+)?$/,INTEGER:/^(0|[1-9][0-9]*|-[1-9][0-9]*)$/,DECIMAL:/^([-+])?\d+\.\d+$/,INT_OR_FLOAT:/(^[1-9][0-9]*$)|(^[1-9][0-9]*\.[0-9]{1,2}$)|(^0\.[0-9]{1,2}$)|(^0$)/,MOBILE:/^(?:(?:\+|00)86)?1[1-9]\d{9}$/,PHONE:/^(?:(?:\d{3}-)?\d{8}|^(?:\d{4}-)?\d{7,8})(?:-\d+)?$/,EMAIL:/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/,ID_CARD:/(^\d{8}(0\d|10|11|12)([0-2]\d|30|31)\d{3}$)|(^\d{6}(18|19|20)\d{2}(0[1-9]|10|11|12)([0-2]\d|30|31)\d{3}(\d|X|x)$)/,ID_CARD15:/(^\d{8}(0\d|10|11|12)([0-2]\d|30|31)\d{3}$)/,ID_CARD18:/(^\d{6}(18|19|20)\d{2}(0[1-9]|10|11|12)([0-2]\d|30|31)\d{3}(\d|X|x)$)/,BANK_CARD:/^[1-9]\d{9,29}$/,POST_CODE:/^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[0-5]|8[013-6])\d{4}$/,URL:/^(?:(ftp|https?|ftps):\/\/)?((?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+(?:[a-zA-Z]{2,6})?)?(?::(\d+))?(?:\/([^\?#]*))?(?:\?([^#]*))?(?:#(.*))?$/,IP:/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,IP6:/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|::([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}|[0-9a-fA-F]{1,4}::([0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4})$/i,EXTERNAL:/^(http:|https:|ftp:|ftps:|mailto:|tel:)/i},o={AM_PM:{zh:{AM:"上午",PM:"下午"},en:{AM:"AM",PM:"PM"}},WEEK:{zh:{FULL:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],SHORT:["周日","周一","周二","周三","周四","周五","周六"],MINI:["日","一","二","三","四","五","六"]},en:{FULL:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],SHORT:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MINI:["Su","Mo","Tu","We","Th","Fr","Sa"]}},MONTH:{zh:{FULL:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],SHORT:["一","二","三","四","五","六","七","八","九","十","十一","十二"]},en:{FULL:["January","February","March","April","May","June","July","August","September","October","November","December"],SHORT:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}},QUARTER:{zh:{FULL:["第一季度","第二季度","第三季度","第四季度"],SHORT:["一季度","二季度","三季度","四季度"],MINI:["一","二","三","四"]},en:{FULL:["quarter 1st","quarter 2nd","quarter 3rd","quarter 4th"],SHORT:["Q1th","Q2nd","Q3rd","Q4th"],MINI:["Q1","Q2","Q3","Q4"]}},OVER_TIME:{zh:{YEAR:"年",MONTH:"月",DATE:"日",HOUR:"时",MINUTE:"分",SECOND:"秒",MILLISECOND:"毫秒",DAY:"天",QUARTER:"季度"},en:{YEAR:"year",MONTH:"month",DATE:"date",HOUR:"hour",MINUTE:"minute",SECOND:"second",MILLISECOND:"millisecond",DAY:"day",QUARTER:"quarter"}},PASS_TIME:{zh:{YEAR:"年前",MONTH:"个月前",DAY:"天前",BEFORE_YESTERDAY:"前天",YESTERDAY:"昨天",TODAY:"今天",HOUR:"小时前",MINUTE:"分钟前",JUST:"刚刚"},en:{YEAR:" year ago",MONTH:" month ago",DAY:" day ago",BEFORE_YESTERDAY:"before yesterday",YESTERDAY:" yesterday",TODAY:" today",HOUR:" hour ago",MINUTE:" minute ago",JUST:" just"}},HOLIDAY:{zh:["元旦","春节","清明节","劳动节","端午节","中秋节","国庆节"],en:["New Year‘s Day","Spring Festival","Tomb Sweeping Day","Labor Day","Dragon Boat Festival","Mid-Autumn Day","National Day"]},ZODIAC:{zh:["摩羯座","水瓶座","双鱼座","白羊座","金牛座","双子座","巨蟹座","狮子座","处女座","天秤座","天蝎座","射手座"],en:["Capricorn","Aquarius","Pisces","Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius"]},CHINESE_ZODIAC:{zh:["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"],en:["Rat","Ox","Tiger","Rabbit","Dragon","Snake","Horse","Goat","Monkey","Rooster","Dog","Pig"]},HEAVENLY_STEMS:{zh:["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],en:["Jia","Yi","Bing","Ding","Wu","Ji","Geng","Xin","Ren","Gui"]},EARTHLY_BRANCHES:{zh:["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],en:["Zi","Chou","Yin","Mao","Chen","Si","Wu","Wei","Shen","You","Xu","Hai"]}},i={8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"Caps Lock",27:"Escape",32:"Space",33:"Page Up",34:"Page Down",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",42:"Print Screen",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Windows",93:"Right Click",96:"Numpad 0",97:"Numpad 1",98:"Numpad 2",99:"Numpad 3",100:"Numpad 4",101:"Numpad 5",102:"Numpad 6",103:"Numpad 7",104:"Numpad 8",105:"Numpad 9",106:"Numpad *",107:"Numpad +",109:"Numpad -",110:"Numpad .",111:"Numpad /",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Num Lock",145:"Scroll Lock",182:"My Computer",183:"My Calculator",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={PROVINCE:{11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"},SEX:{MAN:"男",WOMAN:"女"}};function s(t){return Number.isInteger(t)}function u(t){return"String"===Object.prototype.toString.call(t).slice(8,-1)}function c(t){return"Array"===Object.prototype.toString.call(t).slice(8,-1)}function f(t){return"Object"===Object.prototype.toString.call(t).slice(8,-1)}function l(t){return"Date"===Object.prototype.toString.call(t).slice(8,-1)}function h(t){return null==t||"undefined"===t||"null"===t||0===t||!1===t||g(t)}function g(t){return null==t||"boolean"==typeof t||Array.isArray(t)||""===t||Number.isNaN(Number(t))}function p(t){return null==t||""===t}function d(t){return!!p(t)||("string"==typeof t||Array.isArray(t)?0===t.length:"object"==typeof t&&(t instanceof Map||t instanceof Set?0===t.size:!(t instanceof Date||t instanceof RegExp||t instanceof Error)&&0===Object.keys(t).length))}function w(t){return d(t)||/^\s*$/.test(t)}function m(t){return void 0===t}function y(t){if(t.indexOf("_")>0){const e=t.replace(/\_(\w)/g,(function(t,e){return e.toUpperCase()}));return e.charAt(0).toUpperCase()+e.slice(1)}if(t.indexOf("-")>0){const e=t.replace(/\-(\w)/g,(function(t,e){return e.toUpperCase()}));return e.charAt(0).toUpperCase()+e.slice(1)}if(/^[a-z]$/.test(t.charAt(0))&&!(t.indexOf("-")>0||t.indexOf("_")>0))return t.charAt(0).toUpperCase()+t.slice(1);throw new TypeError("toPascalCase: value should be a string")}function b(t,e=10){return p(t)?0:Number.parseInt(String(t),e)}function A(t){return t.reduce((function(t,e){return t+e}))}function S(t=[],e=0,n=void 0){if(e<0)return t;if(0===t.length)t.push(n);else{if(e>t.length-1)return t;t.splice(e,0,n)}return t}function D(t=[],e=0,n=void 0){if(e<0)return t;if(0===t.length)t.push(n);else{if(e>t.length-1)return t;t.splice(e,0,t.splice(e,1,n)[0])}return t}function E(t){const e=Object.create(null);for(const[n,r]of t)e[n]=r;return e}function M(t){const e=new Map;for(const n of Object.keys(t))e.set(n,t[n]);return e}function T(t){const e=t.match(/^(\w+)\[(\d+)]$/);return{propName:e&&e[1]||void 0,propIndex:e?parseInt(e[2],10):void 0,isArray:!!e}}function C(t=new Date){const e=t.getFullYear();return e%100!=0&&e%4==0||e%400==0}function O(t,e=new Date){return t.getTime()-e.getTime()<0}function R(t,e=new Date){return t.getTime()-e.getTime()>0}function N(t,e){return["getFullYear","getMonth","getDate"].every((n=>t[n]()===e[n]()))}function U(t=new Date,e={format:"yyyy-MM-dd"}){const{format:n}=e;return _(t,{format:n})}function I(t=new Date){return{year:t.getFullYear(),month:t.getMonth()+1,date:t.getDate(),hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),milliseconds:t.getMilliseconds()}}function $(t=new Date){return[7,1,2,3,4,5,6][t.getDay()]}function x(t=new Date){return t.getDate()}function F(t=new Date){return Math.ceil((t.getTime()-new Date(t.getFullYear().toString()).getTime())/864e5)+1}function v(t=new Date){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()}function P(t=new Date){return C(t)?366:365}function L(t){let e=0;const n=_(t).split("-"),r=Number(n[0]),o=Number(n[1]),i=Number(n[2]),a=new Date,s=a.getFullYear(),u=a.getMonth()+1,c=a.getDate(),f=s-r;if(f>0){const t=u-o;e=0===t?c-i<0?f-1:f:t<0?f-1:f}return e}function k(t=new Date,e=1){return t.setFullYear(t.getFullYear()+e),t}function B(t=new Date,e=1){return t.setMonth(t.getMonth()+e),t}function j(t=new Date,e=1){return t.setDate(t.getDate()+e),t}function Y(t=new Date){return new Date(t.getTime()+60*t.getTimezoneOffset()*1e3)}function H(t){if(p(t))throw new TypeError("toDate: value cannot be null or undefined");if(u(t))return new Date(String(t).replace(/-/g,"/"));if(s(t)&&13===String(t).length)return new Date(t);if(s(t)&&10===String(t).length)return new Date(1e3*Number(t));throw new TypeError(`toDate: invalid input type: ${typeof t}, expected string or number`)}function _(t,e={format:"yyyy-MM-dd",lang:"zh"}){const{format:n="yyyy-MM-dd",lang:r="zh"}=e;if(p(t))throw new TypeError("toDateString: date cannot be null or undefined");if(!l(t))throw new TypeError(`toDateString: invalid input type: ${typeof t}, expected Date object`);const i={"(y+)":e=>{const n=t.getFullYear().toString();return 2===e.length?n.slice(-2):n},"(M+)":e=>{const n=t.getMonth()+1;return 1===e.length?n.toString():z(n)},"(d+)":e=>{const n=t.getDate();return 1===e.length?n.toString():z(n)},"(h+)":e=>{const n=t.getHours()%12||12;return 1===e.length?n.toString():z(n)},"(H+)":e=>{const n=t.getHours();return 1===e.length?n.toString():z(n)},"(m+)":e=>{const n=t.getMinutes();return 1===e.length?n.toString():z(n)},"(s+)":e=>{const n=t.getSeconds();return 1===e.length?n.toString():z(n)},"(S+)":e=>t.getMilliseconds().toString().padStart(e.length,"0").slice(0,e.length),"([aA]+)":e=>{const n=t.getHours()<12;return e.length>1?n?o.AM_PM[r].AM:o.AM_PM[r].PM:n?e.toLowerCase():e.toUpperCase()},"(E+)":e=>{const n=t.getDay();return 1===e.length?o.WEEK[r].MINI[n]:2===e.length?o.WEEK[r].SHORT[n]:o.WEEK[r].FULL[n]},"(Q+)":e=>{const n=Math.floor((t.getMonth()+3)/3)-1;return 1===e.length?o.QUARTER[r].MINI[n]:2===e.length?o.QUARTER[r].SHORT[n]:o.QUARTER[r].FULL[n]}};let a=n;return Object.entries(i).forEach((([t,e])=>{const n=new RegExp(t,"g");a=a.replace(n,((t,n)=>e(n)))})),a}function z(t){const e=Number(t);return e>9?String(e):"0"+e}function W(t,e){let n=Math.abs(Number(t)),r=Math.abs(Number(e));for(;0!==r;){const t=r;r=n%r,n=t}return n}function Z(t,e){return new RegExp(e).test(t)}function Q(t,e=String(Date.now())){return new Promise(((e,n)=>{try{const n=t.type,r=n.split("/")[1];e(new File([t],`${Date.now()}.${r}`,{type:n,lastModified:Date.now()}))}catch(t){console.error(t),n(t)}}))}function K(t){return new Promise(((e,n)=>{const r=new FileReader;r.onload=function(t){const n=t.target?.result;e(n)},r.onerror=function(t){n(t)},r.readAsText(t)}))}function V(t){if(t>255)throw"'"+t+"'' is greater than 255(0xff);";return("0"+Number(t).toString(16)).slice(-2)}const J="not a UTF-8 string",q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),X={};for(let t=0;t<64;++t)X[q[t]]=t;X["-"]=62,X._=63;const G="object"==typeof process&&process.versions&&process.versions.node,tt="object"==typeof window&&"function"==typeof window.btoa,et=G?global:"object"==typeof self?self:window,nt=function(t){return t.split("=")[0].replace(/[\r\n]/g,"").replace(/[^A-Za-z0-9+/=_-]/g,"")},rt=function(t){const e=t.length,n=new Array(4*e);let r=0;for(let o=0;o<e;o++){const e=t.charCodeAt(o);if(e<128)n[r++]=e;else if(e<2048)n[r++]=192|e>>6,n[r++]=128|63&e;else if(e<55296||e>=57344)n[r++]=224|e>>12,n[r++]=128|e>>6&63,n[r++]=128|63&e;else{const i=65536+((1023&e)<<10|1023&t.charCodeAt(++o));n[r++]=240|i>>18,n[r++]=128|i>>12&63,n[r++]=128|i>>6&63,n[r++]=128|63&i}}return n.slice(0,r)},ot=function(t){if(!t)return[];const e=(t=nt(t)).length,n=e>>2<<2,r=new Array(Math.floor(3*e/4));let o=0,i=0;for(;i<n;){const e=X[t.charAt(i++)]||0,n=X[t.charAt(i++)]||0,a=X[t.charAt(i++)]||0,s=X[t.charAt(i++)]||0;r[o++]=255&(e<<2|n>>>4),r[o++]=255&(n<<4|a>>>2),r[o++]=255&(a<<6|s)}const a=e-n;if(2===a){const e=X[t.charAt(i++)]||0,n=X[t.charAt(i++)]||0;r[o++]=255&(e<<2|n>>>4)}else if(3===a){const e=X[t.charAt(i++)]||0,n=X[t.charAt(i++)]||0,a=X[t.charAt(i++)]||0;r[o++]=255&(e<<2|n>>>4),r[o++]=255&(n<<4|a>>>2)}return r.slice(0,o)},it=function(t){const e=t.length,n=3*Math.floor(e/3),r=new Array(Math.ceil(4*e/3));let o=0;for(let e=0;e<n;){const n=t[e++],i=t[e++],a=t[e++];r[o++]=q[n>>>2],r[o++]=q[63&(n<<4|i>>>4)],r[o++]=q[63&(i<<2|a>>>6)],r[o++]=q[63&a]}const i=e-n;if(1===i){const e=t[n];r[o++]=q[e>>>2],r[o++]=q[e<<4&63],r[o++]="=",r[o++]="="}else if(2===i){const e=t[n],i=t[n+1];r[o++]=q[e>>>2],r[o++]=q[63&(e<<4|i>>>4)],r[o++]=q[i<<2&63],r[o++]="="}return r.join("")};let at,st,ut=et.btoa,ct=et.atob;G?(ut=function(t){if(!t)return"";const e=Array.from(t).map((t=>t.charCodeAt(0)));return it(e)},ct=function(t){if(!t)return"";const e=ot(t);return String.fromCharCode.apply(null,e)},at=function(t){if(!t)return"";const e=rt(t);return it(e)},st=function(t){if(!t)return"";const e=ot(t),n=[],r=e.length;let o=0;for(;o<r;){const t=e[o++];if(t<=127){n.push(String.fromCharCode(t));continue}let i,a;if(t>191&&t<=223)i=31&t,a=1;else if(t<=239)i=15&t,a=2;else{if(!(t<=247))throw new Error(J);i=7&t,a=3}for(let t=0;t<a;++t){const t=e[o++];if(o>r||t<128||t>191)throw new Error(J);i=(i<<6)+(63&t)}if(i>=55296&&i<=57343)throw new Error(J);if(i>1114111)throw new Error(J);i<=65535?n.push(String.fromCharCode(i)):(i-=65536,n.push(String.fromCharCode(55296+(i>>10)),String.fromCharCode(56320+(1023&i))))}return n.join("")}):tt?(at=function(t){if(!t)return"";const e=[],n=t.length;for(let r=0;r<n;r++){const n=t.charCodeAt(r);if(n<128)e.push(String.fromCharCode(n));else if(n<2048)e.push(String.fromCharCode(192|n>>6),String.fromCharCode(128|63&n));else if(n<55296||n>=57344)e.push(String.fromCharCode(224|n>>12),String.fromCharCode(128|n>>6&63),String.fromCharCode(128|63&n));else{const o=65536+((1023&n)<<10|1023&t.charCodeAt(++r));e.push(String.fromCharCode(240|o>>18),String.fromCharCode(128|o>>12&63),String.fromCharCode(128|o>>6&63),String.fromCharCode(128|63&o))}}return ut(e.join(""))},st=function(t){if(!t)return"";const e=ct(t.replace(/-/g,"+").replace(/_/g,"/"));if(!/[^\u0000-\u007F]/.test(e))return e;const n=[],r=e.length;let o=0;for(;o<r;){const t=e.charCodeAt(o++);if(t<=127){n.push(String.fromCharCode(t));continue}let i,a;if(t>191&&t<=223)i=31&t,a=1;else if(t<=239)i=15&t,a=2;else{if(!(t<=247))throw new Error(J);i=7&t,a=3}for(let t=0;t<a;++t){const t=e.charCodeAt(o++);if(o>r||t<128||t>191)throw new Error(J);i=(i<<6)+(63&t)}if(i>=55296&&i<=57343)throw new Error(J);if(i>1114111)throw new Error(J);i<=65535?n.push(String.fromCharCode(i)):(i-=65536,n.push(String.fromCharCode(55296+(i>>10)),String.fromCharCode(56320+(1023&i))))}return n.join("")}):(ut=function(t){if(!t)return"";const e=Array.from(t).map((t=>t.charCodeAt(0)));return it(e)},ct=function(t){if(!t)return"";const e=ot(t);return String.fromCharCode.apply(null,e)},at=function(t){if(!t)return"";const e=rt(t);return it(e)},st=function(t){if(!t)return"";const e=ot(t),n=[],r=e.length;let o=0;for(;o<r;){const t=e[o++];if(t<=127){n.push(String.fromCharCode(t));continue}let i,a;if(t>191&&t<=223)i=31&t,a=1;else if(t<=239)i=15&t,a=2;else{if(!(t<=247))throw new Error(J);i=7&t,a=3}for(let t=0;t<a;++t){const t=e[o++];if(o>r||t<128||t>191)throw new Error(J);i=(i<<6)+(63&t)}if(i>=55296&&i<=57343)throw new Error(J);if(i>1114111)throw new Error(J);i<=65535?n.push(String.fromCharCode(i)):(i-=65536,n.push(String.fromCharCode(55296+(i>>10)),String.fromCharCode(56320+(1023&i))))}return n.join("")});const ft=function(t,e=!1){if(null==t)return"";let n="";if("string"!=typeof t)t.constructor===et.ArrayBuffer&&(t=new Uint8Array(t)),n=(r=t)&&0!==r.length?it(r):"";else{if(""===t)return"";n=at(t)}var r;return e&&(n=n.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")),n},lt=function(t){return null==t||""===t?"":(t=t.replace(/-/g,"+").replace(/_/g,"/"),t=nt(t),st(t))};function ht(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function gt(t,e,n,r,o,i){return ht((a=ht(ht(e,t),ht(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function pt(t,e,n,r,o,i,a){return gt(e&n|~e&r,t,e,o,i,a)}function dt(t,e,n,r,o,i,a){return gt(e&r|n&~r,t,e,o,i,a)}function wt(t,e,n,r,o,i,a){return gt(e^n^r,t,e,o,i,a)}function mt(t,e,n,r,o,i,a){return gt(n^(e|~r),t,e,o,i,a)}function yt(t,e){var n,r,o,i,a;t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;var s=1732584193,u=-271733879,c=-1732584194,f=271733878;for(n=0;n<t.length;n+=16)r=s,o=u,i=c,a=f,s=pt(s,u,c,f,t[n],7,-680876936),f=pt(f,s,u,c,t[n+1],12,-389564586),c=pt(c,f,s,u,t[n+2],17,606105819),u=pt(u,c,f,s,t[n+3],22,-1044525330),s=pt(s,u,c,f,t[n+4],7,-176418897),f=pt(f,s,u,c,t[n+5],12,1200080426),c=pt(c,f,s,u,t[n+6],17,-1473231341),u=pt(u,c,f,s,t[n+7],22,-45705983),s=pt(s,u,c,f,t[n+8],7,1770035416),f=pt(f,s,u,c,t[n+9],12,-1958414417),c=pt(c,f,s,u,t[n+10],17,-42063),u=pt(u,c,f,s,t[n+11],22,-1990404162),s=pt(s,u,c,f,t[n+12],7,1804603682),f=pt(f,s,u,c,t[n+13],12,-40341101),c=pt(c,f,s,u,t[n+14],17,-1502002290),s=dt(s,u=pt(u,c,f,s,t[n+15],22,1236535329),c,f,t[n+1],5,-165796510),f=dt(f,s,u,c,t[n+6],9,-1069501632),c=dt(c,f,s,u,t[n+11],14,643717713),u=dt(u,c,f,s,t[n],20,-373897302),s=dt(s,u,c,f,t[n+5],5,-701558691),f=dt(f,s,u,c,t[n+10],9,38016083),c=dt(c,f,s,u,t[n+15],14,-660478335),u=dt(u,c,f,s,t[n+4],20,-405537848),s=dt(s,u,c,f,t[n+9],5,568446438),f=dt(f,s,u,c,t[n+14],9,-1019803690),c=dt(c,f,s,u,t[n+3],14,-187363961),u=dt(u,c,f,s,t[n+8],20,1163531501),s=dt(s,u,c,f,t[n+13],5,-1444681467),f=dt(f,s,u,c,t[n+2],9,-51403784),c=dt(c,f,s,u,t[n+7],14,1735328473),s=wt(s,u=dt(u,c,f,s,t[n+12],20,-1926607734),c,f,t[n+5],4,-378558),f=wt(f,s,u,c,t[n+8],11,-2022574463),c=wt(c,f,s,u,t[n+11],16,1839030562),u=wt(u,c,f,s,t[n+14],23,-35309556),s=wt(s,u,c,f,t[n+1],4,-1530992060),f=wt(f,s,u,c,t[n+4],11,1272893353),c=wt(c,f,s,u,t[n+7],16,-155497632),u=wt(u,c,f,s,t[n+10],23,-1094730640),s=wt(s,u,c,f,t[n+13],4,681279174),f=wt(f,s,u,c,t[n],11,-358537222),c=wt(c,f,s,u,t[n+3],16,-722521979),u=wt(u,c,f,s,t[n+6],23,76029189),s=wt(s,u,c,f,t[n+9],4,-640364487),f=wt(f,s,u,c,t[n+12],11,-421815835),c=wt(c,f,s,u,t[n+15],16,530742520),s=mt(s,u=wt(u,c,f,s,t[n+2],23,-995338651),c,f,t[n],6,-198630844),f=mt(f,s,u,c,t[n+7],10,1126891415),c=mt(c,f,s,u,t[n+14],15,-1416354905),u=mt(u,c,f,s,t[n+5],21,-57434055),s=mt(s,u,c,f,t[n+12],6,1700485571),f=mt(f,s,u,c,t[n+3],10,-1894986606),c=mt(c,f,s,u,t[n+10],15,-1051523),u=mt(u,c,f,s,t[n+1],21,-2054922799),s=mt(s,u,c,f,t[n+8],6,1873313359),f=mt(f,s,u,c,t[n+15],10,-30611744),c=mt(c,f,s,u,t[n+6],15,-1560198380),u=mt(u,c,f,s,t[n+13],21,1309151649),s=mt(s,u,c,f,t[n+4],6,-145523070),f=mt(f,s,u,c,t[n+11],10,-1120210379),c=mt(c,f,s,u,t[n+2],15,718787259),u=mt(u,c,f,s,t[n+9],21,-343485551),s=ht(s,r),u=ht(u,o),c=ht(c,i),f=ht(f,a);return[s,u,c,f]}function bt(t){var e,n="",r=32*t.length;for(e=0;e<r;e+=8)n+=String.fromCharCode(t[e>>5]>>>e%32&255);return n}function At(t){var e,n=[];for(n[(t.length>>2)-1]=void 0,e=0;e<n.length;e+=1)n[e]=0;var r=8*t.length;for(e=0;e<r;e+=8)n[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return n}function St(t){var e,n,r="0123456789abcdef",o="";for(n=0;n<t.length;n+=1)e=t.charCodeAt(n),o+=r.charAt(e>>>4&15)+r.charAt(15&e);return o}function Dt(t){return unescape(encodeURIComponent(t))}function Et(t){return function(t){return bt(yt(At(t),8*t.length))}(Dt(t))}function Mt(t,e){return function(t,e){var n,r,o=At(t),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=yt(o,8*t.length)),n=0;n<16;n+=1)i[n]=909522486^o[n],a[n]=1549556828^o[n];return r=yt(i.concat(At(e)),512+8*e.length),bt(yt(a.concat(r),640))}(Dt(t),Dt(e))}function Tt(t,e,n){return e?n?Mt(e,t):St(Mt(e,t)):n?Et(t):St(Et(t))}const Ct="input is invalid type",Ot="0123456789abcdef".split(""),Rt=[-2147483648,8388608,32768,128],Nt=[24,16,8,0],Ut=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];class It{constructor(t=!1){this.blocks=new Array(17).fill(0),t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}update(t){if(this.finalized)return this;let e=!1;const n=typeof t;if("string"!==n){if("object"!==n)throw new Error(Ct);if(null===t)throw new Error(Ct);if(t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&!ArrayBuffer.isView(t))throw new Error(Ct);e=!0}let r,o,i=0,a=t.length;const s=this.blocks;for(;i<a;){if(this.hashed&&(this.hashed=!1,s.fill(0),s[0]=this.block),e)for(o=this.start;i<a&&o<64;++i)s[o>>>2]|=t[i]<<Nt[3&o++];else for(o=this.start;i<a&&o<64;++i)r=t.charCodeAt(i),r<128?s[o>>>2]|=r<<Nt[3&o++]:r<2048?(s[o>>>2]|=(192|r>>>6)<<Nt[3&o++],s[o>>>2]|=(128|63&r)<<Nt[3&o++]):r<55296||r>=57344?(s[o>>>2]|=(224|r>>>12)<<Nt[3&o++],s[o>>>2]|=(128|r>>>6&63)<<Nt[3&o++],s[o>>>2]|=(128|63&r)<<Nt[3&o++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++i)),s[o>>>2]|=(240|r>>>18)<<Nt[3&o++],s[o>>>2]|=(128|r>>>12&63)<<Nt[3&o++],s[o>>>2]|=(128|r>>>6&63)<<Nt[3&o++],s[o>>>2]|=(128|63&r)<<Nt[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}hash(){let t=this.h0,e=this.h1,n=this.h2,r=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7;const u=this.blocks;let c,f,l,h,g,p,d,w,m,y,b;for(c=16;c<64;++c)g=u[c-15],f=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,g=u[c-2],l=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,u[c]=u[c-16]+f+u[c-7]+l|0;for(b=e&n,c=0;c<64;c+=4)this.first?(this.is224?(w=300032,g=u[0]-1413257819,s=g-150054599|0,r=g+24177077|0):(w=704751109,g=u[0]-210244248,s=g-1521486534|0,r=g+143694565|0),this.first=!1):(f=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),l=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),w=t&e,h=w^t&n^b,d=o&i^~o&a,g=s+l+d+Ut[c]+u[c],p=f+h,s=r+g|0,r=g+p|0),f=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),l=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),m=r&t,h=m^r&e^w,d=s&o^~s&i,g=a+l+d+Ut[c+1]+u[c+1],p=f+h,a=n+g|0,n=g+p|0,f=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),l=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),y=n&r,h=y^n&t^m,d=a&s^~a&o,g=i+l+d+Ut[c+2]+u[c+2],p=f+h,i=e+g|0,e=g+p|0,f=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),l=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),b=e&n,h=b^e&r^y,d=i&a^~i&s,g=o+l+d+Ut[c+3]+u[c+3],p=f+h,o=t+g|0,t=g+p|0;this.h0=this.h0+t|0,this.h1=this.h1+e|0,this.h2=this.h2+n|0,this.h3=this.h3+r|0,this.h4=this.h4+o|0,this.h5=this.h5+i|0,this.h6=this.h6+a|0,this.h7=this.h7+s|0}finalize(){if(this.finalized)return this;this.finalized=!0;const t=this.blocks;let e=this.lastByteIndex;return t[16]=this.block,t[e>>>2]|=Rt[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t.fill(0),t[0]=this.block),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash(),this}hex(){this.finalize();const t=this.h0,e=this.h1,n=this.h2,r=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7;let u="";return u+=Ot[t>>>28&15]+Ot[t>>>24&15]+Ot[t>>>20&15]+Ot[t>>>16&15]+Ot[t>>>12&15]+Ot[t>>>8&15]+Ot[t>>>4&15]+Ot[15&t],u+=Ot[e>>>28&15]+Ot[e>>>24&15]+Ot[e>>>20&15]+Ot[e>>>16&15]+Ot[e>>>12&15]+Ot[e>>>8&15]+Ot[e>>>4&15]+Ot[15&e],u+=Ot[n>>>28&15]+Ot[n>>>24&15]+Ot[n>>>20&15]+Ot[n>>>16&15]+Ot[n>>>12&15]+Ot[n>>>8&15]+Ot[n>>>4&15]+Ot[15&n],u+=Ot[r>>>28&15]+Ot[r>>>24&15]+Ot[r>>>20&15]+Ot[r>>>16&15]+Ot[r>>>12&15]+Ot[r>>>8&15]+Ot[r>>>4&15]+Ot[15&r],u+=Ot[o>>>28&15]+Ot[o>>>24&15]+Ot[o>>>20&15]+Ot[o>>>16&15]+Ot[o>>>12&15]+Ot[o>>>8&15]+Ot[o>>>4&15]+Ot[15&o],u+=Ot[i>>>28&15]+Ot[i>>>24&15]+Ot[i>>>20&15]+Ot[i>>>16&15]+Ot[i>>>12&15]+Ot[i>>>8&15]+Ot[i>>>4&15]+Ot[15&i],u+=Ot[a>>>28&15]+Ot[a>>>24&15]+Ot[a>>>20&15]+Ot[a>>>16&15]+Ot[a>>>12&15]+Ot[a>>>8&15]+Ot[a>>>4&15]+Ot[15&a],this.is224||(u+=Ot[s>>>28&15]+Ot[s>>>24&15]+Ot[s>>>20&15]+Ot[s>>>16&15]+Ot[s>>>12&15]+Ot[s>>>8&15]+Ot[s>>>4&15]+Ot[15&s]),u}digest(){this.finalize();const t=this.h0,e=this.h1,n=this.h2,r=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o,i>>>24&255,i>>>16&255,i>>>8&255,255&i,a>>>24&255,a>>>16&255,a>>>8&255,255&a];return this.is224||u.push(s>>>24&255,s>>>16&255,s>>>8&255,255&s),u}raw(){this.finalize();const t=this.digest();let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}arrayBuffer(){this.finalize();const t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t}}class $t{constructor(t,e=!1){let n=[];const r=typeof t;if("string"===r){let e,r=0,o=t.length;for(let i=0;i<o;++i)e=t.charCodeAt(i),e<128?n[r++]=e:e<2048?(n[r++]=192|e>>>6,n[r++]=128|63&e):e<55296||e>=57344?(n[r++]=224|e>>>12,n[r++]=128|e>>>6&63,n[r++]=128|63&e):(e=65536+((1023&e)<<10|1023&t.charCodeAt(++i)),n[r++]=240|e>>>18,n[r++]=128|e>>>12&63,n[r++]=128|e>>>6&63,n[r++]=128|63&e)}else{if("object"!==r)throw new Error(Ct);if(null===t)throw new Error(Ct);if(t.constructor===ArrayBuffer)n=Array.from(new Uint8Array(t));else{if(!Array.isArray(t)&&!ArrayBuffer.isView(t))throw new Error(Ct);n=Array.from(t)}}n.length>64&&(n=new It(e).update(n).digest());const o=[],i=[];for(let t=0;t<64;++t){const e=n[t]||0;o[t]=92^e,i[t]=54^e}this.sha256=new It(e),this.sha256.update(i),this.oKeyPad=o,this.is224=e,this.inner=!0}update(t){return this.sha256.update(t),this}finalize(){if(this.inner){const t=this.sha256.digest();this.sha256=new It(this.is224),this.sha256.update(this.oKeyPad).update(t),this.inner=!1}return this.sha256.finalize(),this}hex(){return this.finalize(),this.sha256.hex()}digest(){return this.finalize(),this.sha256.digest()}raw(){return this.finalize(),this.sha256.raw()}arrayBuffer(){return this.finalize(),this.sha256.arrayBuffer()}}const xt=(t=!1)=>{const e=e=>new It(t).update(e).hex();return e.raw=e=>new It(t).update(e).raw(),e.digest=e=>new It(t).update(e).digest(),e.arrayBuffer=e=>new It(t).update(e).arrayBuffer(),e.create=()=>new It(t),e.update=t=>e.create().update(t),e},Ft=(t=!1)=>{const e=e=>new It(t).update(e).raw();return e.hex=e=>new It(t).update(e).hex(),e.digest=e=>new It(t).update(e).digest(),e.arrayBuffer=e=>new It(t).update(e).arrayBuffer(),e.create=()=>new It(t),e.update=t=>e.create().update(t),e},vt=(t=!1)=>{const e=(e,n)=>new $t(e,t).update(n).hex();return e.raw=(e,n)=>new $t(e,t).update(n).raw(),e.digest=(e,n)=>new $t(e,t).update(n).digest(),e.arrayBuffer=(e,n)=>new $t(e,t).update(n).arrayBuffer(),e.create=e=>new $t(e,t),e.update=(t,n)=>e.create(t).update(n),e},Pt=(t=!1)=>{const e=(e,n)=>new $t(e,t).update(n).raw();return e.hex=(e,n)=>new $t(e,t).update(n).hex(),e.digest=(e,n)=>new $t(e,t).update(n).digest(),e.arrayBuffer=(e,n)=>new $t(e,t).update(n).arrayBuffer(),e.create=e=>new $t(e,t),e.update=(t,n)=>e.create(t).update(n),e},Lt=xt(),kt=Ft(),Bt=vt(),jt=Pt(),Yt=xt(!0),Ht=Ft(!0),_t=vt(!0),zt=Pt(!0);const Wt=64,Zt=new Uint8Array(Wt).fill(54),Qt=new Uint8Array(Wt).fill(92),Kt=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]);function Vt(t,e){const n=31&e;return t<<n|t>>>32-n}function Jt(t,e){const n=[];for(let r=t.length-1;r>=0;r--)n[r]=255&(t[r]^e[r]);return n}function qt(t){return t^Vt(t,9)^Vt(t,17)}function Xt(t){return t.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join("")}function Gt(t){const e=[];let n=t.length;var r,o;n%2!=0&&(o=n+1,t=(r=t).length>=o?r:new Array(o-r.length+1).join("0")+r),n=t.length;for(let r=0;r<n;r+=2)e.push(parseInt(t.substr(r,2),16));return e}function te(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t.codePointAt(n);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>>6),e.push(128|63&r);else if(r<=55295||r>=57344&&r<=65535)e.push(224|r>>>12),e.push(128|r>>>6&63),e.push(128|63&r);else{if(!(r>=65536&&r<=1114111))throw e.push(r),new TypeError("utf8ToArray: input is not supported in sm3");n++,e.push(240|r>>>18&28),e.push(128|r>>>12&63),e.push(128|r>>>6&63),e.push(128|63&r)}}return e}function ee(t){let e=8*t.length,n=e%512;n=n>=448?512-n%448-1:448-n-1;const r=new Array((n-7)/8).fill(0),o=new Array(8).fill(0);let i=e.toString(2);for(let t=7;t>=0;t--)if(i.length>8){const e=i.length-8;o[t]=parseInt(i.substr(e),2),i=i.substr(0,e)}else i.length>0&&(o[t]=parseInt(i,2),i="");const a=new Uint8Array([...t,128,...r,...o]),s=new DataView(a.buffer,0),u=a.length/64,c=new Uint32Array(Kt),f=new Uint32Array(68),l=new Uint32Array(64);for(let t=0;t<u;t++){f.fill(0),l.fill(0);const e=16*t;for(let t=0;t<16;t++)f[t]=s.getUint32(4*(e+t),!1);for(let t=16;t<68;t++)f[t]=(h=f[t-16]^f[t-9]^Vt(f[t-3],15))^Vt(h,15)^Vt(h,23)^Vt(f[t-13],7)^f[t-6];for(let t=0;t<64;t++)l[t]=f[t]^f[t+4];const n=2043430169,r=2055708042;let o,i,a,u,g,p=c[0],d=c[1],w=c[2],m=c[3],y=c[4],b=c[5],A=c[6],S=c[7];for(let t=0;t<64;t++){g=t<=15?n:r,o=Vt(Vt(p,12)+y+Vt(g,t)&4294967295,7),i=o^Vt(p,12);const e=t<=15?y^b^A:y&b|~y&A;a=(t<=15?p^d^w:p&d|p&w|d&w)+m+i+l[t]&4294967295,u=e+S+o+f[t]&4294967295,m=w,w=Vt(d,9),d=p,p=a,S=A,A=Vt(b,19),b=y,y=qt(u)}c[0]^=p,c[1]^=d,c[2]^=w,c[3]^=m,c[4]^=y,c[5]^=b,c[6]^=A,c[7]^=S}var h;const g=[];for(let t=0;t<c.length;t++)g.push((4278190080&c[t])>>>24,(16711680&c[t])>>>16,(65280&c[t])>>>8,255&c[t]);return g}function ne(t,e){const n="string"==typeof t?te(t):Array.prototype.slice.call(t);if(e){const t=function(t,e){let n=e.length>Wt?ee(e):[...e];for(;n.length<Wt;)n.push(0);const r=Jt(n,Zt),o=Jt(n,Qt),i=ee([...r,...t]);return ee([...o,...i])}(n,"string"==typeof e?/^[0-9a-fA-F]+$/.test(e)?Gt(e):te(e):Array.prototype.slice.call(e));return Xt(t)}return Xt(ee(n))}const re="ecb",oe="cbc",ie="pkcs#7",ae="hex",se="utf8",ue="array",ce="uint8array",fe="arraybuffer",le=1,he=0,ge=32,pe=16,de=16,we=16,me=new Uint8Array([214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72]),ye=new Uint32Array([462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257]),be=new Uint32Array([2746333894,1453994832,1736282519,2993693404]);function Ae(t){if((t=t.replace(/\s+/g,"")).length%2!=0)throw new TypeError("hexToUint8Array: hex string length must be even from sm4");const e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n/2]=255&parseInt(t.substr(n,2),16);return e}function Se(t,e){if(t instanceof ArrayBuffer)return new Uint8Array(t);if(t instanceof Uint8Array)return new Uint8Array(t);if(Array.isArray(t))return new Uint8Array(t);if("string"==typeof t)return e===le?(n=t,(new TextEncoder).encode(n)):Ae(t);var n;throw new TypeError(`normalizeInput: unsupported input type: ${typeof t} from sm4`)}function De(t,e,n){let r;if("string"==typeof t)r=Ae(t);else if(t instanceof ArrayBuffer)r=new Uint8Array(t);else if(t instanceof Uint8Array)r=t;else{if(!Array.isArray(t))throw new TypeError(`normalizeKeyIv: unsupported ${n} type: ${typeof t} from sm4`);r=new Uint8Array(t)}if(r.length!==e)throw new TypeError(`normalizeKeyIv: ${n} must be ${8*e} bits (${e} bytes) from sm4`);return r}function Ee(t,e){const n=31&e;return(t<<n|t>>>32-n)>>>0}function Me(t){return(me[t>>>24&255]<<24|me[t>>>16&255]<<16|me[t>>>8&255]<<8|me[255&t])>>>0}function Te(t){return(t^Ee(t,2)^Ee(t,10)^Ee(t,18)^Ee(t,24))>>>0}function Ce(t){return(t^Ee(t,13)^Ee(t,23))>>>0}function Oe(t,e,n){if(t.length!==pe)throw new TypeError(`sm4BlockCrypt: input block must be ${pe} bytes for block crypt from sm4`);const r=new Uint32Array(4);for(let e=0;e<4;e++){const n=4*e;r[e]=(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3])>>>0}for(let t=0;t<ge;t+=4){let e=(r[1]^r[2]^r[3]^n[t])>>>0;r[0]^=Te(Me(e)),e=(r[2]^r[3]^r[0]^n[t+1])>>>0,r[1]^=Te(Me(e)),e=(r[3]^r[0]^r[1]^n[t+2])>>>0,r[2]^=Te(Me(e)),e=(r[0]^r[1]^r[2]^n[t+3])>>>0,r[3]^=Te(Me(e))}for(let t=0;t<pe;t+=4){const n=3-t/4;e[t]=r[n]>>>24&255,e[t+1]=r[n]>>>16&255,e[t+2]=r[n]>>>8&255,e[t+3]=255&r[n]}}function Re(t,e,n,r={}){const{mode:o=re,iv:i=[],padding:a=ie,output:s=ae}=r;if(![re,oe].includes(o))throw new TypeError(`sm4Core: unsupported mode: ${o}, only 'ecb' and 'cbc' are supported from sm4`);const u=Se(t,n),c=De(e,de,"key");let f=new Uint8Array(we);o===oe&&(f=De(i,we,"IV"));let l=u;if(a===ie&&n===le&&(l=function(t){const e=pe-t.length%pe,n=new Uint8Array(t.length+e);n.set(t);for(let r=0;r<e;r++)n[t.length+r]=255&e;return n}(u),l.length%pe!=0))throw new TypeError("sm4Core: PKCS7 padding failed: data length is not multiple of block size from sm4");const h=new Uint32Array(ge);!function(t,e,n){const r=new Uint32Array(4);for(let e=0;e<4;e++){const n=4*e;r[e]=(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3])>>>0}r[0]^=be[0],r[1]^=be[1],r[2]^=be[2],r[3]^=be[3];for(let t=0;t<ge;t+=4){let n=(r[1]^r[2]^r[3]^ye[t])>>>0;e[t]=r[0]^=Ce(Me(n)),n=(r[2]^r[3]^r[0]^ye[t+1])>>>0,e[t+1]=r[1]^=Ce(Me(n)),n=(r[3]^r[0]^r[1]^ye[t+2])>>>0,e[t+2]=r[2]^=Ce(Me(n)),n=(r[0]^r[1]^r[2]^ye[t+3])>>>0,e[t+3]=r[3]^=Ce(Me(n))}if(n===he)for(let t=0;t<16;t++){const n=e[t];e[t]=e[31-t],e[31-t]=n}}(c,h,n);const g=new Uint8Array(l.length);let p=new Uint8Array(f),d=0;for(;d<l.length;){const t=l.subarray(d,d+pe),e=new Uint8Array(pe);if(o===oe){if(n===le){const n=new Uint8Array(pe);for(let e=0;e<pe;e++)n[e]=255&(t[e]^p[e]);Oe(n,e,h)}else{Oe(t,e,h);for(let t=0;t<pe;t++)e[t]=255&(e[t]^p[t])}p=n===le?e:t}else Oe(t,e,h);g.set(e,d),d+=pe}let w=g;if(a===ie&&n===he&&(w=function(t){const e=255&t[t.length-1];for(let n=1;n<=e;n++)if(t[t.length-n]!==e)throw new TypeError("pkcs7Unpad: invalid PKCS#7 padding from sm4");return t.subarray(0,t.length-e)}(g)),n===he&&s===se)return m=w,new TextDecoder("utf-8").decode(m);var m;switch(s){case ae:return function(t){return Array.from(t).map((t=>{const e=t.toString(16);return 1===e.length?"0"+e:e})).join("")}(w);case ue:return Array.from(w);case ce:return w;case fe:return w.buffer;default:throw new TypeError(`sm4Core: unsupported output format: ${s} from sm4`)}}const Ne={ECB:re,CBC:oe},Ue=ie;const Ie=function(t=ae){if(!window?.crypto?.getRandomValues&&!global?.crypto?.getRandomValues)throw new TypeError("generateKey: the current environment does not support secure random number generation. please upgrade your browser/Node.js from sm4");const e=window?.crypto||global?.crypto,n=new Uint8Array(16);switch(e.getRandomValues(n),t){case ce:return n;case ue:return Array.from(n).map((t=>Number(t)));case fe:return n.buffer;default:return Array.from(n).map((t=>t.toString(16).padStart(2,"0"))).join("")}},$e=function(t=ae){if(!window?.crypto?.getRandomValues)throw new TypeError("generateIv: your browser does not support secure random generation (crypto API) from sm4");const e=new Uint8Array(we);switch(window.crypto.getRandomValues(e),t){case ce:return e;case ue:return Array.from(e).map((t=>Number(t)));case fe:return e.buffer;default:return Array.from(e).map((t=>{const e=t.toString(16);return 1===e.length?`0${e}`:e})).join("")}};function xe(t={},e){const{mode:n=Ne.ECB,iv:r}=t,o=Object.values(Ne);if(!o.includes(n))throw new TypeError(`sm4${e}:unsupported encryption mode "${n}", supports only ${o.join("/")}`);if(n===Ne.CBC&&!r)throw new TypeError(`sm4${e}:the CBC mode must be inputted with an IV (initialization vector)`);if(n===Ne.ECB&&void 0!==r)throw new TypeError(`sm4${e}: the ECB mode does not require an IV to be passed in. Please do not pass the iv parameter`);if(r){let t;if(t="string"==typeof r?32===r.length?16:r.length:r instanceof ArrayBuffer?r.byteLength:r instanceof Uint8Array||Array.isArray(r)?r.length:0,16!==t)throw new TypeError(`sm4${e}:IV must be 16 bytes in length, and the current length is ${t}`)}if(t.padding&&t.padding!==String(Ue))throw new TypeError(`sm4${e}: only pkcs#7 padding mode is supported, currently being input ${String(t.padding)}`)}const Fe={MODE:Ne,PADDING:Ue,OUTPUT:{HEX:ae,UTF8:se,ARRAY:ue,UINT8ARRAY:ce,ARRAYBUFFER:fe}};function ve(t,e,n){if(e>(t=String(t)).length)return t;let r="";return n<0&&(n=0),n>t.length-e&&(n=t.length-e),r=String().padEnd(n,"*"),t.substring(0,e)+r+t.substring(e+n)}function Pe(t){if(!p(t))return 15===t.length?"19"+t.substring(6,8)+"-"+t.substring(8,10)+"-"+t.substring(10,12):18===t.length?t.substring(6,10)+"-"+t.substring(10,12)+"-"+t.substring(12,14):void 0}function Le(t){if(p(t))return;const e=Pe(t);return e?L(H(String(e))):void 0}function ke(t){if(!p(t))return 15===t.length?Number(t.substring(14))%2==0?a.SEX.WOMAN:a.SEX.MAN:18===t.length?Number(t.substring(16,17))%2==0?a.SEX.WOMAN:a.SEX.MAN:void 0}function Be(t){if(p(t))return;const e=t.substring(0,2);return e?a.PROVINCE[e]:void 0}function je(t={page:1,pageSize:10,total:0,totalPage:0,pagerCount:7}){return Math.ceil((t.total||0)/(t.pageSize||0))}function Ye(t=window.location.href){const e=t.match(r.URL);if(e)return e[5]}function He(t=window.location.href){const e=(Ye(t)||"").split("&"),n={};for(let t=0;t<e.length;t++){const r=e[t].split("=");n[decodeURIComponent(r[0])]=decodeURIComponent(r[1]||"")}return n}function _e(t,e=""){if("object"!=typeof t)return t;const n=[];for(const e in t){const r=t[e];if(c(r))for(let t=0;t<r.length;++t)n.push(encodeURIComponent(e+"["+t+"]")+"="+encodeURIComponent(r[t]));else n.push(encodeURIComponent(e)+"="+encodeURIComponent(t[e]))}return e?e.replace(/(\?.+?)(?=#|$)/,"?"+n.join("&")):n.join("&")}function ze(t,e,n=864e5){"undefined"!=typeof document&&(document.cookie=t+"="+e+";expires="+new Date(Date.now()+n))}function We(t,e){return t.className.indexOf(e)>0}function Ze(t,e){We(t,e)||(t.className+=" "+e)}function Qe(t,e){We(t,e)&&(t.className=t.className.replace(new RegExp(e,"gm"),""))}function Ke(){const t=window&&window.navigator.userAgent;return/Android|webOS|iPhone|iPod|BlackBerry|Windows Phone|IEMobile/i.test(t)}function Ve(t){return new Promise(((e,n)=>{window&&window.navigator?window.navigator.clipboard.writeText(t).then((t=>{e(!0)}),(t=>{n(!1)})):console.warn("not support navigator clipboard!")}))}t.DATE=o,t.ID_CARD=a,t.KEYCODE=i,t.LANG={ZH:"zh",EN:"en"},t.MATH=n,t.REGEXP=r,t.SM4=Fe,t.SORT=e,t.add=function(t,e){let n,r;try{n=t.toString().split(".")[1].length}catch(t){n=0}try{r=e.toString().split(".")[1].length}catch(t){r=0}const o=Math.pow(10,Math.max(n,r));return(Number(t)*o+Number(e)*o)/o},t.addClass=Ze,t.addDate=j,t.addHours=function(t=new Date,e=1){return t.setHours(t.getHours()+e),t},t.addMillisecond=function(t=new Date,e=100){return t.setMilliseconds(t.getMilliseconds()+e),t},t.addMinutes=function(t=new Date,e=1){return t.setMinutes(t.getMinutes()+e),t},t.addMonth=B,t.addQuarter=function(t=new Date,e=1){return t.setMonth(t.getMonth()+4*e),t},t.addSeconds=function(t=new Date,e=1){return t.setSeconds(t.getSeconds()+e),t},t.addStyle=function(t,e={}){if(t)for(const[n,r]of Object.entries(e))t.style.setProperty(n,r)},t.addWeek=function(t=new Date,e=1){return t.setDate(t.getDate()+7*e),t},t.addYear=k,t.appendSearchParam=function(t=window.location.href,e,n){const r=(Ye(t)||"").split("&");return r.push(`${e}=${n}`),t.replace(/(\?.+?)(?=#|$)/,"?"+r.join("&"))},t.appendToSearchParam=function(t=window.location.href,e,n,r){const o=(Ye(t)||"").split("&"),i=o.findIndex((t=>t.includes(e))),a=D(o,i,`${n}=${r}`);return t.replace(/(\?.+?)(?=#|$)/,"?"+a.join("&"))},t.arrayAvg=function(t){return A(t)/t.length},t.arrayBottom=function(t=[],e=0){return e<0||e>t.length-1||t.push(t.splice(e,1)[0]),t},t.arrayComplement=function(t,e){return[...[...new Set(t)].filter((t=>!e.includes(t))),...[...new Set(e)].filter((e=>!t.includes(e)))]},t.arrayCreate=function(t=0){return[...Array(t).keys()]},t.arrayDifference=function(t,e){return[...new Set(t)].filter((t=>!e.includes(t)))},t.arrayDown=function(t=[],e=0){return e<0||e>t.length-1||(e<t.length-1?t.splice(e+1,0,t.splice(e,1)[0]):t.unshift(t.splice(e,1)[0])),t},t.arrayEquals=function(t,e){return t===e||t.length===e.length&&t.every(((t,n)=>t===e[n]))},t.arrayInsert=function(t=[],e=0,n=void 0){if(e<0)return t;if(0===t.length)t.push(n);else{if(e>t.length-1)return t;t.splice(e,0,n)}return t},t.arrayInsertAfter=D,t.arrayInsertBefore=S,t.arrayIntersect=function(t,e){return[...new Set(t)].filter((t=>e.includes(t)))},t.arrayMax=function(t){return Math.max.apply(null,t)},t.arrayMin=function(t){return Math.min.apply(null,t)},t.arrayRemove=function(t=[],e=0){return e<0||e>t.length-1||t.splice(e,1),t},t.arrayRemoveAfter=function(t=[],e=0){return e<0||e>t.length-1||t.splice(e+1,1),t},t.arrayRemoveBefore=function(t=[],e=0){return e<=0||e>t.length-1||t.splice(e-1,1),t},t.arrayShuffle=function(t){for(let e=1;e<t.length;e++){const n=Math.floor(Math.random()*(e+1));[t[n],t[e]]=[t[e],t[n]]}return t},t.arraySort=function(t,n=e.ASC){return t.sort(((t,r)=>{switch(n){case e.ASC:return t-r;case e.DESC:return r-t;case e.RANDOM:return Math.random()-.5;default:return 0}}))},t.arraySortBy=function(t,e){return t.sort(((t,n)=>{for(const r of e){let e="",o="asc";if(f(r)?(e=r.prop,o=r.order||"asc"):(e=r,o="asc"),t[e]<n[e])return"asc"===o?-1:1;if(t[e]>n[e])return"asc"===o?1:-1}return 0}))},t.arraySum=A,t.arraySwap=function(t,e,n){return e<0||n<0||e>t.length-1||n>t.length-1||([t[n],t[e]]=[t[e],t[n]]),t},t.arrayToTree=function(t,e={key:"id",parentKey:"pid",childrenKey:"children"}){const n=e.key,r=e.parentKey,o=e.childrenKey;if(!t||0===t.length||!n||""===n)return[];const i=function(t,e,n){return t?(void 0!==n&&(t[e]=n),t[e]):null},a=[],s={};for(let e=0;e<t.length;e++)t[e][o]&&delete t[e][o],s[t[e][n]]=t[e];for(let e=0;e<t.length;e++){const u=s[t[e][r]];if(u&&t[e][n]!==t[e][r]){let n=i(u,o);n||(n=i(u,o,[])),n.push(t[e])}else a.push(t[e])}return a},t.arrayTop=function(t=[],e=0){return e<0||e>t.length-1||t.unshift(t.splice(e,1)[0]),t},t.arrayUnion=function(t,e){return[...new Set(t.concat(e))]},t.arrayUnique=function(t){return d(t)?[]:Array.from(new Set(t))},t.arrayUp=function(t=[],e=0){return e<0||e>t.length-1||(e>0?t.splice(e-1,0,t.splice(e,1)[0]):t.push(t.splice(e,1)[0])),t},t.base64Decode=function(t){return lt(t)},t.base64DecodeURI=function(t){return lt(t)},t.base64Encode=function(t,e=!1){return ft(t,e)},t.base64EncodeURI=function(t){return ft(t,!0)},t.base64FromHex=function(t,e=!1){return function(t,e=!1){if("string"!=typeof t||!/^[0-9a-fA-F]+$/.test(t))throw new TypeError("fromHex: input must be hex string");const n=t.length%2?`0${t}`:t,r=new Array(n.length/2);for(let t=0;t<r.length;t++)r[t]=parseInt(n.substr(2*t,2),16);let o=it(r);return e&&(o=o.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")),o}(t,e)},t.base64FromUint8Array=function(t,e=!1){return function(t,e=!1){if(!(t instanceof Uint8Array))throw new TypeError("fromUint8Array: input must be Uint8Array");const n=Array.from(t);let r=it(n);return e&&(r=r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")),r}(t,e)},t.base64ToBlob=function(t){return new Promise(((e,n)=>{try{const n=t.split(","),r=n[0]?n[0].match(/:(.+?);/):null,o=r?r[1]:"",i=window.atob(n[1]);let a=i.length;const s=new Uint8Array(a);for(;a--;)s[a]=i.charCodeAt(a);e(new Blob([s],{type:o}))}catch(t){console.error(t),n(t)}}))},t.base64ToFile=function(t,e=String(Date.now())){return new Promise(((n,r)=>{try{const r=t.split(","),o=r[0]?r[0].match(/:(.+?);/):null,i=o?o[1]:"",a=i.split("/")[1],s=window.atob(r[1]);let u=s.length;const c=new Uint8Array(u);for(;u--;)c[u]=s.charCodeAt(u);n(new File([c],`${e}.${a}`,{type:i}))}catch(t){console.error(t),r(t)}}))},t.base64ToHex=function(t,e=!1){return function(t,e=!1){if("string"!=typeof t)throw new TypeError("toHex: input must be string");e&&(t=t.replace(/-/g,"+").replace(/_/g,"/"));const n=ot(t);return Array.from(n).map((t=>t.toString(16).padStart(2,"0"))).join("")}(t,e)},t.base64ToUint8Array=function(t,e=!1){return function(t,e=!1){if("string"!=typeof t)throw new TypeError("toUint8Array: input must be string");e&&(t=t.replace(/-/g,"+").replace(/_/g,"/"));const n=ot(t);return new Uint8Array(n)}(t,e)},t.blobToBase64=function(t){return new Promise(((e,n)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=function(t){const n=t.target?.result;e(n)},r.onerror=function(t){console.error(t),n(t)}}))},t.blobToFile=Q,t.blobToText=K,t.clearClipboard=function(){return new Promise(((t,e)=>{Ve("").then((()=>t(!0))).catch(e)}))},t.clearCookie=function(t=document.domain){const e=document.cookie.match(/[^ =;]+(?==)/g)||[];if(e&&e.length>0)for(let n=e.length;n--;)document.cookie=e[n]+"=0;path=/;"+t?"domain="+t+";":"expires="+new Date(0).toUTCString()},t.clearLocalStorage=function(){window&&window.localStorage.clear()},t.clearSessionStorage=function(){window&&window.sessionStorage.clear()},t.clone=function(t){return null===t||"object"!=typeof t?t:Array.isArray(t)?[...t]:t.constructor===Object?Object.assign({},t):t instanceof Date?new Date(t.getTime()):t instanceof RegExp?new RegExp(t.source,t.flags):t},t.cloneDeep=function t(e){if(null==e)return e;if(f(e)){const n={};for(const r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}if(c(e)){const n=[];for(let r=0,o=e.length;r<o;r++)n[r]=t(e[r]);return n}if(l(e)){const t=new Date;return t.setTime(e.getTime()),t}return e},t.debounce=function(t,e=1e3,n=!0){let r=null;return function(...o){if(r&&clearTimeout(r),n){const n=!r;r=setTimeout((()=>{r=null}),e),n&&t.apply(this,o)}else r=setTimeout((()=>{t.apply(this,o)}),e)}},t.deepCompare=function(t,...e){let n=[],r=[];const o=(t,e)=>{if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(t===e)return!0;if("function"===typeof t&&"function"===typeof e)return t.toString()===e.toString();if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp&&e instanceof RegExp)return t.source===e.source&&t.flags===e.flags;if(t instanceof String&&e instanceof String||t instanceof Number&&e instanceof Number)return t.toString()===e.toString();if(!(t instanceof Object&&e instanceof Object))return!1;if(t.isPrototypeOf(e)||e.isPrototypeOf(t))return!1;if(t.constructor!==e.constructor)return!1;if(t.prototype!==e.prototype)return!1;if(n.includes(t)||r.includes(e))return!1;const i=Object.keys(t),a=Object.keys(e);if(i.length!==a.length)return!1;for(const n of a){if(Object.prototype.hasOwnProperty.call(t,n)!==Object.prototype.hasOwnProperty.call(e,n))return!1;if(typeof t[n]!=typeof e[n])return!1}for(const a of i){const i=t[a],s=e[a];if("object"==typeof i||"function"==typeof i){if(n.push(t),r.push(e),!o(i,s))return!1;n.pop(),r.pop()}else if(i!==s)return!1}return!0};if(arguments.length<2)return console.warn("deepCompare 需要至少两个对比参数"),!0;for(const i of e)if(n=[],r=[],!o(t,i))return!1;return!0},t.divide=function(t,e){let n=0,r=0;try{n=t.toString().split(".")[1].length}catch(t){}try{r=e.toString().split(".")[1].length}catch(t){}return Number(t.toString().replace(".",""))/Number(e.toString().replace(".",""))*Math.pow(10,r-n)},t.downloadBlobFile=function(t,e){try{const n=window.URL.createObjectURL(t),r=window.document.createElement("a");r.download=e,r.href=n,r.click(),URL.revokeObjectURL(n)}catch(t){console.error(t)}},t.downloadFileUrl=function(t,e){try{const n=window.document.createElement("a");n.download=e,n.href=t,n.target="_blank",window.document.body.appendChild(n),n.click(),window.document.body.removeChild(n)}catch(t){console.error(t)}},t.equals=function(t,e){return Object.is(t,e)},t.equalsIgnoreCase=function(t,e){return Object.is(t.toLowerCase(),e.toLowerCase())},t.fileToBase64=function(t){return new Promise(((e,n)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=function(t){const n=t.target?.result;e(n)},r.onerror=function(t){console.error(t),n(t)}}))},t.fileToBlob=function(t){return new Promise(((e,n)=>{const r=new FileReader;r.readAsArrayBuffer(t),r.onload=n=>{const r=n.target?.result,o=new Blob([r],{type:t.type});e(o)},r.onerror=function(t){console.error(t),n(t)}}))},t.fileToUrl=function(t){return new Promise(((e,n)=>{try{e(UR