@minsize/utils 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=(e,t)=>t[e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2];const t={date:e=>e instanceof Date,regexp:e=>e instanceof RegExp,error:e=>e instanceof Error,map:e=>e instanceof Map,set:e=>e instanceof Set,weakmap:e=>e instanceof WeakMap,weakset:e=>e instanceof WeakSet,promise:e=>e instanceof Promise,buffer:e=>e instanceof Buffer,undefined:e=>void 0===e,string:e=>"string"==typeof e,bigint:e=>"bigint"==typeof e,number:e=>"number"==typeof e&&!isNaN(e),nan:e=>"number"==typeof e&&isNaN(e),boolean:e=>"boolean"==typeof e,array:e=>Array.isArray(e),object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,function:e=>"function"==typeof e,null:e=>null===e,symbol:e=>"symbol"==typeof e,unknown:()=>!0};const r=(e,t)=>{if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return e===t;if("[object Map]"===Object.prototype.toString.call(e)&&"[object Map]"===Object.prototype.toString.call(t))return n(e,t);const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(let n of o){if(!t.hasOwnProperty(n))return!1;const o=e[n],s=t[n];if(Array.isArray(o)&&Array.isArray(s)){if(o.length!==s.length)return!1;for(let e=0;e<o.length;e++)if(!r(o[e],s[e]))return!1}else if(!r(o,s))return!1}return!0},n=(e,t)=>{if(e.size!==t.size)return!1;for(const[n,o]of e){if(!t.has(n))return!1;if(!r(t.get(n),o))return!1}return!0},o=e=>Object.prototype.toString.call(e),s=(e,t)=>{switch(t||o(t)){case"[object Number]":return Number(String(e));case"[object String]":return String(e);case"[object BigInt]":return BigInt(String(e));case"[object Map]":return new Map(e);case"[object Set]":return new Set(e);default:return e}},a=e=>{const t=[];for(const r of e){const e=o(r);"[object Array]"===e?t.push(a(r)):"[object Object]"===e?t.push(c(r)):t.push(s(r))}return t},c=e=>{const t={},r=Object.keys(e);for(const n of r){const r=o(e[n]);t[n]="[object Array]"===r?a(e[n]):"[object Object]"===r?c(e[n]):e[n]}return t},
|
|
1
|
+
"use strict";const e=(e,t)=>t[e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2];const t={date:e=>e instanceof Date,regexp:e=>e instanceof RegExp,error:e=>e instanceof Error,map:e=>e instanceof Map,set:e=>e instanceof Set,weakmap:e=>e instanceof WeakMap,weakset:e=>e instanceof WeakSet,promise:e=>e instanceof Promise,buffer:e=>e instanceof Buffer,undefined:e=>void 0===e,string:e=>"string"==typeof e,bigint:e=>"bigint"==typeof e,number:e=>"number"==typeof e&&!isNaN(e),nan:e=>"number"==typeof e&&isNaN(e),boolean:e=>"boolean"==typeof e,array:e=>Array.isArray(e),object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,function:e=>"function"==typeof e,null:e=>null===e,symbol:e=>"symbol"==typeof e,unknown:()=>!0};const r=(e,t)=>{if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return e===t;if("[object Map]"===Object.prototype.toString.call(e)&&"[object Map]"===Object.prototype.toString.call(t))return n(e,t);const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(let n of o){if(!t.hasOwnProperty(n))return!1;const o=e[n],s=t[n];if(Array.isArray(o)&&Array.isArray(s)){if(o.length!==s.length)return!1;for(let e=0;e<o.length;e++)if(!r(o[e],s[e]))return!1}else if(!r(o,s))return!1}return!0},n=(e,t)=>{if(e.size!==t.size)return!1;for(const[n,o]of e){if(!t.has(n))return!1;if(!r(t.get(n),o))return!1}return!0},o=e=>Object.prototype.toString.call(e),s=(e,t)=>{switch(t||o(t)){case"[object Number]":return Number(String(e));case"[object String]":return String(e);case"[object BigInt]":return BigInt(String(e));case"[object Map]":return new Map(e);case"[object Set]":return new Set(e);default:return e}},a=e=>{const t=[];for(const r of e){const e=o(r);"[object Array]"===e?t.push(a(r)):"[object Object]"===e?t.push(c(r)):t.push(s(r))}return t},c=e=>{const t={},r=Object.keys(e);for(const n of r){const r=o(e[n]);t[n]="[object Array]"===r?a(e[n]):"[object Object]"===r?c(e[n]):e[n]}return t},i=e=>e,u=e=>{const t=e.toString(16);return 1==t.length?"0"+t:t};exports.HEXtoRGB=e=>{if(3===(e=e.replace("#","")).length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6!==e.length)return[0,0,0];const t=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),n=parseInt(e.substring(4,6),16);return isNaN(t)||isNaN(r)||isNaN(n)||t<0||t>255||r<0||r>255||n<0||n>255?[0,0,0]:[t,r,n]},exports.HSVtoRGB=(e,t,r)=>{var n,o,s,a,c,i,u,l;switch(i=r*(1-t),u=r*(1-(c=6*e-(a=Math.floor(6*e)))*t),l=r*(1-(1-c)*t),a%6){case 0:n=r,o=l,s=i;break;case 1:n=u,o=r,s=i;break;case 2:n=i,o=r,s=l;break;case 3:n=i,o=u,s=r;break;case 4:n=l,o=i,s=r;break;case 5:n=r,o=i,s=u}return[Math.round(255*n),Math.round(255*o),Math.round(255*s)]},exports.RGBtoHEX=(e,t,r)=>"#"+u(e)+u(t)+u(r),exports.RGBtoHSV=(e,t,r)=>{var n=Math.max(e,t,r),o=Math.min(e,t,r),s=n-o,a=0,c=0===n?0:s/n,i=n/255;switch(n){case o:a=0;break;case e:a=t-r+s*(t<r?6:0),a/=6*s;break;case t:a=r-e+2*s,a/=6*s;break;case r:a=e-t+4*s,a/=6*s}return[a,c,i]},exports.alignTo=function(e,t){return e<=0?t:e+(t-e%t)%t},exports.chunks=(e,t)=>{const r=[];for(let n=0;n<t.length;n+=e)r.push(t.slice(n,n+e));return r},exports.clamp=(e,t,r)=>e>t?e<r?e:r:t,exports.comparison=r,exports.copyText=e=>{if(!e)return!1;try{return navigator.clipboard?.writeText(e),!0}catch{}try{var t=document.createElement("input");return t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),!0}catch{}return!1},exports.createLinksFromText=(e,t)=>{const r=[],n=/{{([^}]+):([^}]+)}}/g;let o,s=0;for(;null!==(o=n.exec(e));)r.push(e.substring(s,o.index)),s=o.index+o[0].length,r.push({key:o[1],text:o[2]});return r.push(e.substring(s)),r.map((e=>"string"==typeof e?e:t(e.key,e.text)))},exports.decWord=e,exports.formatNumber=e=>(e||0).toString().replace(/\B(?=(\d{3})+(?!\d))/g,"."),exports.generateUniqueKey=e=>{const t=e=>{if("string"==typeof e||"number"==typeof e||"boolean"==typeof e||null===e)return JSON.stringify(e);if(Array.isArray(e))return"["+e.map(t).join(",")+"]";if("object"==typeof e){const r=Object.keys(e).sort();let n="{";for(let o=0;o<r.length;o++){const s=r[o];n+=JSON.stringify(s)+":"+t(e[s]),o<r.length-1&&(n+=",")}return n+="}",n}return String(e)},r=e=>{let t=0;if(0===e.length)return t;for(let r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t|=0}return t};try{const n=t(e);return r(n).toString(16)}catch(t){return console.warn(`Object could not be fully stringified. Using a simple string conversion. Error: ${t}`),r(String(e)).toString(16)}},exports.isType=function(e,r){for(const[n,o]of Object.entries(t))if(o(e))return void 0!==r?n===r:n;return void 0===r&&"unknown"},exports.omit=function(e,t){return Object.keys(e).reduce(((r,n)=>(t.includes(n)||(r[n]=e[n]),r)),{})},exports.pick=function(e,t){return Object.keys(e).reduce(((r,n)=>(t.includes(n)&&(r[n]=e[n]),r)),{})},exports.random=(e,t)=>Math.floor(Math.random()*(t-e+1)+e),exports.shuffle=e=>{for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e},exports.sleep=async e=>await new Promise((t=>setTimeout(t,e))),exports.textParserUrl=(e,t)=>{const r=t?.onToken??i,n=t?.requireProtocol??!1,o=t?.regex??new RegExp(`(?:https?://)${n?"":"?"}(?:www.)?([А-Яа-яa-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*.(?:ru|com|org|net|me|su|рф|biz|info|co|uk|de|fr|jp|cn|es|it|ca|au|nl|se|no|dk|fi|pl|at|ch|be|cz|ie|pt|ro|hu|gr|sk|bg|hr|si|lt|lv|ee|is|mt|lu|li|mc|sm|va|ad|al|ba|mk|me|rs|tr|ua|by|kz|uz|am|ge|az|tm|kg|tj|md|kg|tj|af|dz|bh|eg|iq|ir|jo|kw|lb|ly|ma|om|ps|qa|sa|sd|sy|tn|ae|ye|ar|bo|br|cl|co|ec|gf|gy|pe|py|sr|uy|ve|ag|ai|aw|bb|bm|bs|bz|ca|cr|cu|dm|do|gd|gp|gt|hn|ht|jm|kn|ky|lc|ms|mx|ni|pa|pr|sv|tc|tt|vc|vg|vi|an|aq|as|fj|fm|gu|hm|id|ki|mh|mp|nc|nf|nr|nu|pf|pg|pw|sb|tk|to|tv|vu|wf|ws)(?:/[a-zA-Z0-9._~:/?#[]@!$&'()*+,;=-]*)?)`),s=[];let a=e,c=o.exec(a);for(;c;){const e=c[0],t=c.index;t>0&&(s.push(r({type:"raw",value:a.substring(0,t)})),a=a.substring(t)),s.push(r({type:"url",value:e})),a=a.substring(e.length),c=o.exec(a)}return a.length>0&&s.push(r({type:"raw",value:a})),s},exports.timeAgo=t=>{if(!t)return"только что";const r=new Date(t),n=Math.floor((Date.now()-r.getTime())/1e3),o=()=>new Intl.DateTimeFormat("RU-ru",{day:"numeric",month:"short"}).format(r).replace(".",""),s=()=>r.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),a=(t,r,n)=>Array.isArray(t)?`${n} ${e(n,t)} ${r}`:`${t} ${r}`;switch(!0){case n<0:return"скоро";case n<60:return a(["секунду","секунды","секунд"],"назад",n);case n<3600:return a(["минуту","минуты","минут"],"назад",Math.floor(n/60));case n<7200:return a("час","назад",Math.floor(n/3600));case n<10800:return a("два часа","назад",Math.floor(n/3600));case n<14400:return a("три часа","назад",Math.floor(n/3600));case n<86400:return a(`сегодня в ${s()}`,"",Math.floor(n/3600));case n<172800:return a(`вчера в ${s()}`,"",Math.floor(n/86400));case n<259200:return a("два дня","назад",Math.floor(n/86400));case n<345600:return a("три дня","назад",Math.floor(n/86400));case n<31536e3:return a(`${o()} в ${s()}`,"",Math.floor(n/86400));case n>=31536e3:return a(`${o()} ${r.getFullYear()} г.`,"",Math.floor(n/31536e3))}return"только что"},exports.toShort=(e,t,r=1)=>{const n=t||["","k","M","G","T","P"],o=e<0,s=Math.abs(e),a=Math.log10(s)/3|0,c=s/10**(3*a);return parseFloat(`${o?"-":""}${c%1?(Math.floor(10*c)/10).toFixed(r):c}`)+n[a]},exports.unlink=e=>{switch(o(e)){case"[object Array]":return a(e);case"[object Object]":return c(e);default:return s(e)}};
|
package/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=(e,t)=>{const r=[];for(let n=0;n<t.length;n+=e)r.push(t.slice(n,n+e));return r},t=(e,t,r)=>e>t?e<r?e:r:t,r=(e,t)=>t[e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2];function n(e,t){return e<=0?t:e+(t-e%t)%t}const o=(e,t,r=1)=>{const n=t||["","k","M","G","T","P"],o=e<0,a=Math.abs(e),s=Math.log10(a)/3|0,c=a/10**(3*s);return parseFloat(`${o?"-":""}${c%1?(Math.floor(10*c)/10).toFixed(r):c}`)+n[s]},a=e=>{if(!e)return"только что";const t=new Date(e),n=Math.floor((Date.now()-t.getTime())/1e3),o=()=>new Intl.DateTimeFormat("RU-ru",{day:"numeric",month:"short"}).format(t).replace(".",""),a=()=>t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),s=(e,t,n)=>Array.isArray(e)?`${n} ${r(n,e)} ${t}`:`${e} ${t}`;switch(!0){case n<0:return"скоро";case n<60:return s(["секунду","секунды","секунд"],"назад",n);case n<3600:return s(["минуту","минуты","минут"],"назад",Math.floor(n/60));case n<7200:return s("час","назад",Math.floor(n/3600));case n<10800:return s("два часа","назад",Math.floor(n/3600));case n<14400:return s("три часа","назад",Math.floor(n/3600));case n<86400:return s(`сегодня в ${a()}`,"",Math.floor(n/3600));case n<172800:return s(`вчера в ${a()}`,"",Math.floor(n/86400));case n<259200:return s("два дня","назад",Math.floor(n/86400));case n<345600:return s("три дня","назад",Math.floor(n/86400));case n<31536e3:return s(`${o()} в ${a()}`,"",Math.floor(n/86400));case n>=31536e3:return s(`${o()} ${t.getFullYear()} г.`,"",Math.floor(n/31536e3))}return"только что"},s=e=>(e||0).toString().replace(/\B(?=(\d{3})+(?!\d))/g,"."),c=e=>{for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e},u=(e,t)=>Math.floor(Math.random()*(t-e+1)+e),i={date:e=>e instanceof Date,regexp:e=>e instanceof RegExp,error:e=>e instanceof Error,map:e=>e instanceof Map,set:e=>e instanceof Set,weakmap:e=>e instanceof WeakMap,weakset:e=>e instanceof WeakSet,promise:e=>e instanceof Promise,buffer:e=>e instanceof Buffer,undefined:e=>void 0===e,string:e=>"string"==typeof e,bigint:e=>"bigint"==typeof e,number:e=>"number"==typeof e&&!isNaN(e),nan:e=>"number"==typeof e&&isNaN(e),boolean:e=>"boolean"==typeof e,array:e=>Array.isArray(e),object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,function:e=>"function"==typeof e,null:e=>null===e,symbol:e=>"symbol"==typeof e,unknown:()=>!0};function l(e,t){for(const[r,n]of Object.entries(i))if(n(e))return void 0!==t?r===t:r;return void 0===t&&"unknown"}function f(e,t){return Object.keys(e).reduce(((r,n)=>(t.includes(n)||(r[n]=e[n]),r)),{})}function
|
|
1
|
+
const e=(e,t)=>{const r=[];for(let n=0;n<t.length;n+=e)r.push(t.slice(n,n+e));return r},t=(e,t,r)=>e>t?e<r?e:r:t,r=(e,t)=>t[e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2];function n(e,t){return e<=0?t:e+(t-e%t)%t}const o=(e,t,r=1)=>{const n=t||["","k","M","G","T","P"],o=e<0,a=Math.abs(e),s=Math.log10(a)/3|0,c=a/10**(3*s);return parseFloat(`${o?"-":""}${c%1?(Math.floor(10*c)/10).toFixed(r):c}`)+n[s]},a=e=>{if(!e)return"только что";const t=new Date(e),n=Math.floor((Date.now()-t.getTime())/1e3),o=()=>new Intl.DateTimeFormat("RU-ru",{day:"numeric",month:"short"}).format(t).replace(".",""),a=()=>t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),s=(e,t,n)=>Array.isArray(e)?`${n} ${r(n,e)} ${t}`:`${e} ${t}`;switch(!0){case n<0:return"скоро";case n<60:return s(["секунду","секунды","секунд"],"назад",n);case n<3600:return s(["минуту","минуты","минут"],"назад",Math.floor(n/60));case n<7200:return s("час","назад",Math.floor(n/3600));case n<10800:return s("два часа","назад",Math.floor(n/3600));case n<14400:return s("три часа","назад",Math.floor(n/3600));case n<86400:return s(`сегодня в ${a()}`,"",Math.floor(n/3600));case n<172800:return s(`вчера в ${a()}`,"",Math.floor(n/86400));case n<259200:return s("два дня","назад",Math.floor(n/86400));case n<345600:return s("три дня","назад",Math.floor(n/86400));case n<31536e3:return s(`${o()} в ${a()}`,"",Math.floor(n/86400));case n>=31536e3:return s(`${o()} ${t.getFullYear()} г.`,"",Math.floor(n/31536e3))}return"только что"},s=e=>(e||0).toString().replace(/\B(?=(\d{3})+(?!\d))/g,"."),c=e=>{for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e},u=(e,t)=>Math.floor(Math.random()*(t-e+1)+e),i={date:e=>e instanceof Date,regexp:e=>e instanceof RegExp,error:e=>e instanceof Error,map:e=>e instanceof Map,set:e=>e instanceof Set,weakmap:e=>e instanceof WeakMap,weakset:e=>e instanceof WeakSet,promise:e=>e instanceof Promise,buffer:e=>e instanceof Buffer,undefined:e=>void 0===e,string:e=>"string"==typeof e,bigint:e=>"bigint"==typeof e,number:e=>"number"==typeof e&&!isNaN(e),nan:e=>"number"==typeof e&&isNaN(e),boolean:e=>"boolean"==typeof e,array:e=>Array.isArray(e),object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,function:e=>"function"==typeof e,null:e=>null===e,symbol:e=>"symbol"==typeof e,unknown:()=>!0};function l(e,t){for(const[r,n]of Object.entries(i))if(n(e))return void 0!==t?r===t:r;return void 0===t&&"unknown"}function f(e,t){return Object.keys(e).reduce(((r,n)=>(t.includes(n)||(r[n]=e[n]),r)),{})}function b(e,t){return Object.keys(e).reduce(((r,n)=>(t.includes(n)&&(r[n]=e[n]),r)),{})}const g=async e=>await new Promise((t=>setTimeout(t,e))),p=e=>{if(!e)return!1;try{return navigator.clipboard?.writeText(e),!0}catch{}try{var t=document.createElement("input");return t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),!0}catch{}return!1},h=(e,t)=>{const r=[],n=/{{([^}]+):([^}]+)}}/g;let o,a=0;for(;null!==(o=n.exec(e));)r.push(e.substring(a,o.index)),a=o.index+o[0].length,r.push({key:o[1],text:o[2]});return r.push(e.substring(a)),r.map((e=>"string"==typeof e?e:t(e.key,e.text)))},y=(e,t)=>{if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return e===t;if("[object Map]"===Object.prototype.toString.call(e)&&"[object Map]"===Object.prototype.toString.call(t))return m(e,t);const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n of r){if(!t.hasOwnProperty(n))return!1;const r=e[n],o=t[n];if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(let e=0;e<r.length;e++)if(!y(r[e],o[e]))return!1}else if(!y(r,o))return!1}return!0},m=(e,t)=>{if(e.size!==t.size)return!1;for(const[r,n]of e){if(!t.has(r))return!1;if(!y(t.get(r),n))return!1}return!0},d=e=>{const t=e=>{if("string"==typeof e||"number"==typeof e||"boolean"==typeof e||null===e)return JSON.stringify(e);if(Array.isArray(e))return"["+e.map(t).join(",")+"]";if("object"==typeof e){const r=Object.keys(e).sort();let n="{";for(let o=0;o<r.length;o++){const a=r[o];n+=JSON.stringify(a)+":"+t(e[a]),o<r.length-1&&(n+=",")}return n+="}",n}return String(e)},r=e=>{let t=0;if(0===e.length)return t;for(let r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t|=0}return t};try{const n=t(e);return r(n).toString(16)}catch(t){return console.warn(`Object could not be fully stringified. Using a simple string conversion. Error: ${t}`),r(String(e)).toString(16)}},j=e=>Object.prototype.toString.call(e),k=(e,t)=>{switch(t||j(t)){case"[object Number]":return Number(String(e));case"[object String]":return String(e);case"[object BigInt]":return BigInt(String(e));case"[object Map]":return new Map(e);case"[object Set]":return new Set(e);default:return e}},M=e=>{const t=[];for(const r of e){const e=j(r);"[object Array]"===e?t.push(M(r)):"[object Object]"===e?t.push(w(r)):t.push(k(r))}return t},w=e=>{const t={},r=Object.keys(e);for(const n of r){const r=j(e[n]);t[n]="[object Array]"===r?M(e[n]):"[object Object]"===r?w(e[n]):e[n]}return t},v=e=>{switch(j(e)){case"[object Array]":return M(e);case"[object Object]":return w(e);default:return k(e)}},S=e=>e,A=(e,t)=>{const r=t?.onToken??S,n=t?.requireProtocol??!1,o=t?.regex??new RegExp(`(?:https?://)${n?"":"?"}(?:www.)?([А-Яа-яa-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*.(?:ru|com|org|net|me|su|рф|biz|info|co|uk|de|fr|jp|cn|es|it|ca|au|nl|se|no|dk|fi|pl|at|ch|be|cz|ie|pt|ro|hu|gr|sk|bg|hr|si|lt|lv|ee|is|mt|lu|li|mc|sm|va|ad|al|ba|mk|me|rs|tr|ua|by|kz|uz|am|ge|az|tm|kg|tj|md|kg|tj|af|dz|bh|eg|iq|ir|jo|kw|lb|ly|ma|om|ps|qa|sa|sd|sy|tn|ae|ye|ar|bo|br|cl|co|ec|gf|gy|pe|py|sr|uy|ve|ag|ai|aw|bb|bm|bs|bz|ca|cr|cu|dm|do|gd|gp|gt|hn|ht|jm|kn|ky|lc|ms|mx|ni|pa|pr|sv|tc|tt|vc|vg|vi|an|aq|as|fj|fm|gu|hm|id|ki|mh|mp|nc|nf|nr|nu|pf|pg|pw|sb|tk|to|tv|vu|wf|ws)(?:/[a-zA-Z0-9._~:/?#[]@!$&'()*+,;=-]*)?)`),a=[];let s=e,c=o.exec(s);for(;c;){const e=c[0],t=c.index;t>0&&(a.push(r({type:"raw",value:s.substring(0,t)})),s=s.substring(t)),a.push(r({type:"url",value:e})),s=s.substring(e.length),c=o.exec(s)}return s.length>0&&a.push(r({type:"raw",value:s})),a},x=(e,t,r)=>{var n,o,a,s,c,u,i,l;switch(u=r*(1-t),i=r*(1-(c=6*e-(s=Math.floor(6*e)))*t),l=r*(1-(1-c)*t),s%6){case 0:n=r,o=l,a=u;break;case 1:n=i,o=r,a=u;break;case 2:n=u,o=r,a=l;break;case 3:n=u,o=i,a=r;break;case 4:n=l,o=u,a=r;break;case 5:n=r,o=u,a=i}return[Math.round(255*n),Math.round(255*o),Math.round(255*a)]},O=e=>{const t=e.toString(16);return 1==t.length?"0"+t:t},$=(e,t,r)=>"#"+O(e)+O(t)+O(r),N=(e,t,r)=>{var n=Math.max(e,t,r),o=Math.min(e,t,r),a=n-o,s=0,c=0===n?0:a/n,u=n/255;switch(n){case o:s=0;break;case e:s=t-r+a*(t<r?6:0),s/=6*a;break;case t:s=r-e+2*a,s/=6*a;break;case r:s=e-t+4*a,s/=6*a}return[s,c,u]},z=e=>{if(3===(e=e.replace("#","")).length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6!==e.length)return[0,0,0];const t=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),n=parseInt(e.substring(4,6),16);return isNaN(t)||isNaN(r)||isNaN(n)||t<0||t>255||r<0||r>255||n<0||n>255?[0,0,0]:[t,r,n]};export{z as HEXtoRGB,x as HSVtoRGB,$ as RGBtoHEX,N as RGBtoHSV,n as alignTo,e as chunks,t as clamp,y as comparison,p as copyText,h as createLinksFromText,r as decWord,s as formatNumber,d as generateUniqueKey,l as isType,f as omit,b as pick,u as random,c as shuffle,g as sleep,A as textParserUrl,a as timeAgo,o as toShort,v as unlink};
|