@ew-color-picker/utils 2.0.18 → 2.0.19
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/dist/utils.esm.mjs +19 -27
- package/dist/utils.min.js +1 -1
- package/package.json +2 -2
package/dist/utils.esm.mjs
CHANGED
|
@@ -1758,39 +1758,31 @@ function getAnimationType(scope) {
|
|
|
1758
1758
|
var _a;
|
|
1759
1759
|
return ((_a = scope.options) === null || _a === void 0 ? void 0 : _a.togglePickerAnimation) || 'default';
|
|
1760
1760
|
}
|
|
1761
|
+
// 表达式与动画名映射,open / close 共用同一套分发逻辑
|
|
1762
|
+
var EXPRESSION_ANIMATION_MAP = {
|
|
1763
|
+
open: { height: 'slideDown', opacity: 'fadeIn' },
|
|
1764
|
+
close: { height: 'slideUp', opacity: 'fadeOut' }
|
|
1765
|
+
};
|
|
1766
|
+
// 未匹配到表达式时使用的默认动画
|
|
1767
|
+
var DEFAULT_ANIMATION = {
|
|
1768
|
+
open: 'show',
|
|
1769
|
+
close: 'hide'
|
|
1770
|
+
};
|
|
1771
|
+
function runAnimation(action, expression, picker, time) {
|
|
1772
|
+
// Cap the duration at 10s to avoid hanging on invalid configuration
|
|
1773
|
+
var duration = time > 10000 ? 10000 : time;
|
|
1774
|
+
var animation = EXPRESSION_ANIMATION_MAP[action][expression] || DEFAULT_ANIMATION[action];
|
|
1775
|
+
return ani[animation](picker, duration);
|
|
1776
|
+
}
|
|
1761
1777
|
// 打开动画
|
|
1762
1778
|
function open(expression, picker, time) {
|
|
1763
1779
|
if (time === void 0) { time = 300; }
|
|
1764
|
-
|
|
1765
|
-
var animation = '';
|
|
1766
|
-
switch (expression) {
|
|
1767
|
-
case 'height':
|
|
1768
|
-
animation = 'slideDown';
|
|
1769
|
-
break;
|
|
1770
|
-
case 'opacity':
|
|
1771
|
-
animation = 'fadeIn';
|
|
1772
|
-
break;
|
|
1773
|
-
default:
|
|
1774
|
-
animation = 'show';
|
|
1775
|
-
}
|
|
1776
|
-
return ani[animation](picker, time);
|
|
1780
|
+
return runAnimation('open', expression, picker, time);
|
|
1777
1781
|
}
|
|
1778
1782
|
// 关闭动画
|
|
1779
1783
|
function close(expression, picker, time) {
|
|
1780
1784
|
if (time === void 0) { time = 300; }
|
|
1781
|
-
|
|
1782
|
-
var animation = '';
|
|
1783
|
-
switch (expression) {
|
|
1784
|
-
case 'height':
|
|
1785
|
-
animation = 'slideUp';
|
|
1786
|
-
break;
|
|
1787
|
-
case 'opacity':
|
|
1788
|
-
animation = 'fadeOut';
|
|
1789
|
-
break;
|
|
1790
|
-
default:
|
|
1791
|
-
animation = 'hide';
|
|
1792
|
-
}
|
|
1793
|
-
return ani[animation](picker, time);
|
|
1785
|
+
return runAnimation('close', expression, picker, time);
|
|
1794
1786
|
}
|
|
1795
1787
|
// 防抖函数
|
|
1796
1788
|
function debounce(func, wait, immediate) {
|
|
@@ -1875,7 +1867,7 @@ var copyIcon = function (className, size, prefix) {
|
|
|
1875
1867
|
return "<svg class=\"".concat(prefix, "color-picker-icon").concat(handleClassName(className), "\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\"").concat(sizeAttr, "><path d=\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z\"></path></svg>");
|
|
1876
1868
|
};
|
|
1877
1869
|
|
|
1878
|
-
var version = "2.0.
|
|
1870
|
+
var version = "2.0.19" ;
|
|
1879
1871
|
var tips = [
|
|
1880
1872
|
"%c ew-color-picker@".concat(version, "%c \u8054\u7CFBQQ\uFF1A854806732 %c \u8054\u7CFB\u5FAE\u4FE1\uFF1Aeveningwater %c github:https://github.com/eveningwater/ew-color-picker %c "),
|
|
1881
1873
|
"background:#0ca6dc ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",
|
package/dist/utils.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
((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).Utils={})})(this,function(r){var i=function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function u(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||((o=o||Array.prototype.slice.call(e,0,r))[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var t="undefined"!=typeof window,e=t&&navigator.userAgent.toLowerCase(),j=e&&e.match(/(iPhone|iPod|Android|ios)/i);if(r.supportsPassive=!1,t)try{var n={};Object.defineProperty(n,"passive",{get:function(){r.supportsPassive=!0}}),window.addEventListener("test-passive",function(){},n)}catch(d){}function o(){}function s(t){return void 0===t}function c(t){return"string"==typeof t}function I(t){return"number"==typeof t}function a(t){return"object"==typeof t&&!h(t)}function R(t){return"object"===p.call(t).slice(8,-1).toLowerCase()}function $(t,e){try{t()}catch(t){g(e)?e(t):d("[ewColorPicker error]: ".concat(t))}}function B(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(h(t))return{};if(Object.assign)return Object.assign.apply(Object,u([t],e,!1));for(var o=Object(t),r=0,i=e.length;r<i;r++){var a=e[r];if(a)for(var s in a)q.call(a,s)&&(o[s]=a[s])}return o}var z=["warn","error","log"],U={log:{icon:"📝",color:"#4CAF50",bgColor:"#E8F5E8",borderColor:"#4CAF50"},warn:{icon:"⚠️",color:"#FF9800",bgColor:"#FFF3E0",borderColor:"#FF9800"},error:{icon:"❌",color:"#F44336",bgColor:"#FFEBEE",borderColor:"#F44336"}},W=function(t){t=U[t];return"color: ".concat(t.color,"; background: ").concat(t.bgColor,"; padding: 2px 6px; border-radius: 4px; border-left: 3px solid ").concat(t.borderColor,"; font-weight: bold;")},l={log:o,warn:o,error:o},f=(z.forEach(function(t){l[t]=function(){}}),l.warn),d=l.error,_=l.log,p=Object.prototype.toString,V=Array.prototype.slice,q=Object.prototype.hasOwnProperty,h=function(t){return null===t},g=function(t){return"function"==typeof t},v=function(t){return"array"===p.call(t).slice(8,-1).toLowerCase()};function G(t){if(!a(t))return t;var e,n=v(t)?[]:{};for(e in t)t.hasOwnProperty(e)&&(n[e]=a(t[e])?G(t[e]):t[e]);return n}function m(t){return t.replace(/\s+/g,"")}function y(t){return t?" ".concat(t):""}function b(t,e){return new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className)}function J(t){return t instanceof HTMLElement}function w(t){return"undefined"!=typeof window&&!!t&&("undefined"!=typeof HTMLElement&&t instanceof HTMLElement||"undefined"!=typeof HTMLCollection&&t instanceof HTMLCollection||"undefined"!=typeof NodeList&&t instanceof NodeList||"object"==typeof t&&1===t.nodeType)}function C(t,e,n){e=e.startsWith("--")?e:e.replace(/([A-Z])/g,"-$1").toLowerCase(),t.style.setProperty(e,n)}function Z(t){return t.replace(/([\:\_\-]+(.))/g,function(t,e,n,o){return o?n.toUpperCase():n}).replace(/^moz([A-Z])/,"Moz$1")}function E(t){return t?(v(t)?t:[t]).filter(Boolean):[]}function Q(t,e){return(e=void 0===e?document:e).querySelector(t)}function X(t){var e;null!=t&&t.parentElement?null!=(e=null==t?void 0:t.parentElement)&&e.removeChild(t):null!=t&&t.remove()}var K=function(t){return document.createElement(t)},x=function(n,t,e){if(c(t=void 0===t?{}:t)&&!s(e)){e=I(e)?"".concat(e,"px"):e;C(n,t,e)}else if(Array.isArray(t))t.forEach(function(t){var e=t.prop;C(n,e,t.value)});else for(var o=0,r=Object.entries(t);o<r.length;o++){var i=r[o],a=i[0];C(n,a,i[1])}},M=function(e,n,o){if(!e||!n)return null;"float"===(n=Z(n))&&(n="cssFloat");var r=null;return $(function(){var t=(document.defaultView||window).getComputedStyle(e,o);r=e.style[n]||t?t[n]:null}),r||e.style[n]},n=X;function Y(t){return t.getBoundingClientRect()}function A(t,e,n,o){t&&e&&n&&("object"==typeof o&&null!==o?t.addEventListener(e,n,i({passive:!1},o)):r.supportsPassive?t.addEventListener(e,n,{passive:!1,capture:!!o}):t.addEventListener(e,n,!!o))}function O(t,e,n,o){t&&e&&n&&t.removeEventListener(e,n,o)}var tt=["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"];r.ApplyOrder=void 0,(et=r.ApplyOrder||(r.ApplyOrder={})).Pre="pre",et.Post="post",T.prototype.on=function(t,e,n){return void 0===n&&(n=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,n]),this},T.prototype.once=function(o,r,i){var a=this,s=(void 0===i&&(i=this),this.hasType(o),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];a.off(o,s);var n=r.apply(i,t);if(!0===n)return n});return s.fn=r,this.on(o,s),this},T.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),e){var n=this.events[t];if(n)for(var o=n.length;o--;)(n[o][0]===e||n[o][0]&&n[o][0].fn===e)&&n.splice(o,1)}else this.events[t]=[];return this}},T.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.hasType(t);t=this.events[t];if(t)for(var o=t.length,r=u([],t,!0),i=0;i<o;i++){var a=r[i],s=a[0],a=a[1];if(s&&!0===(s=s.apply(a,e)))return s}},T.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},T.prototype.destroy=function(){this.events={},this.eventTypes={}},T.prototype.hasType=function(t){var e=this.eventTypes;e[t]!==t&&f('[ewColorPicker warning]: EventEmitter has used unknown event type: "'.concat(t,'", should be oneof [')+"".concat(Object.keys(e).map(function(t){return JSON.stringify(t)}))+"]")};var et=T;function T(t){this.events={},this.eventTypes={},this.registerType(t)}k.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},k.prototype.addDOMEvents=function(){this.handleDOMEvents(A)},k.prototype.removeDOMEvents=function(){this.handleDOMEvents(O)},k.prototype.handleDOMEvents=function(e){var n=this,o=this.wrapper;this.events.forEach(function(t){e(o,t.name,n,!!t.capture)})},k.prototype.handleEvent=function(e){var n=e.type;this.events.some(function(t){return t.name===n&&(t.handler(e),!0)})};var nt=k;function k(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var L=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/,ot=/[rR][gG][Bb][Aa]?[\(]([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),){2}[\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),?[\s]*(0\.\d{1,2}|1|0)?[\)]{1}/g,rt=/^[rR][gG][Bb][Aa][\(]([\\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\\s]*,){3}[\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*[\)]{1}$/,it=/^[hH][Ss][Ll][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*)[\)]$/,at=/^[hH][Ss][Ll][Aa][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,){2}([\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*)[\)]$/;function st(t,e){var e=(e=void 0===e?1:e)||1,e=Math.round(10*e)/10,n=t.toLowerCase(),o=t.length,r=[];if(t&&L.test(n)){if(4===o){for(var i="#",a=1;a<o;a++){var s=n.slice(a,a+1);i+=s.concat(s)}n=i}for(var c=1,l=n.length;c<l;c+=2)r.push(parseInt("0X"+n.slice(c,c+2),16));return"rgba(".concat(r.join(", "),", ").concat(e,")")}return m(n)}function ct(t){if(!t||"string"!=typeof t)return{h:0,s:100,v:100,a:1};if(!/^rgba?\(/i.test(t.replace(/\s+/g," ").trim())){var e=N(t);if(!e)return{h:0,s:100,v:100,a:1};t=e}var n,o,r,i,a,s,c,e=t.replace(/\s+/g," ").trim().match(/rgba?\(([^)]+)\)/i);return e?(t=e[1].split(",").map(function(t){return t.trim()}),e=parseFloat(t[0])||0,n=parseFloat(t[1])||0,o=parseFloat(t[2])||0,t=4<=t.length?parseFloat(t[3]):Number.NaN,t=Number.isNaN(t)?1:t,e=e/255,n=n/255,o=o/255,r=(c=Math.max(e,n,o))-Math.min(e,n,o),(a=i=0)!==(s=c)&&(a=r/c),0!=r?(c===e?i=(n-o)/r*60:c===n?i=60*((o-e)/r+2):c===o&&(i=60*((e-n)/r+4)),i<0&&(i+=360)):i=0,c=Math.round(10*t)/10,{h:Math.round(i),s:Math.round(100*a),v:Math.round(100*s),a:c}):{h:0,s:100,v:100,a:1}}var lt={black:"rgba(0, 0, 0, 1)",silver:"rgba(192, 192, 192, 1)",gray:"rgba(128, 128, 128, 1)",white:"rgba(255, 255, 255, 1)",maroon:"rgba(128, 0, 0, 1)",red:"rgba(255, 0, 0, 1)",purple:"rgba(128, 0, 128, 1)",fuchsia:"rgba(255, 0, 255, 1)",green:"rgba(0, 128, 0, 1)",lime:"rgba(0, 255, 0, 1)",olive:"rgba(128, 128, 0, 1)",yellow:"rgba(255, 255, 0, 1)",navy:"rgba(0, 0, 128, 1)",blue:"rgba(0, 0, 255, 1)",teal:"rgba(0, 128, 128, 1)",aqua:"rgba(0, 255, 255, 1)",orange:"rgba(255, 165, 0, 1)",pink:"rgba(255, 192, 203, 1)",brown:"rgba(165, 42, 42, 1)"};function N(t){if(t&&"string"==typeof t){var e=t.trim().toLowerCase();if(lt[e])return lt[e];if(L.test(e))return st(e).replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)");var n=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(n)return o=n[1],r=n[2],i=n[3],"rgba(".concat(o,", ").concat(r,", ").concat(i,", 1)");var o,r,i,n=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(n)return o=n[1],r=n[2],i=n[3],e=n[4],"rgba(".concat(o,", ").concat(r,", ").concat(i,", ").concat(e,")");try{var a=K("div"),s=(x(a,{"background-color":t}),M(a,"backgroundColor"));if(s&&"rgba(0, 0, 0, 0)"!==s)return s.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)")}catch(t){}}return""}function ut(t){t=N(t),t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return(299*parseInt(t[0])+587*parseInt(t[1])+114*parseInt(t[2]))/1e3}var P=new Map;function ft(t){try{var e=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return e.length<3?null:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:e.length<4?1:parseFloat(e[3])}}catch(t){return null}}var dt="origDisplay",H=(D.prototype.saveDisplay=function(){var t=window.getComputedStyle(this.element).display;this.element.dataset[dt]=t},D.prototype.restoreDisplay=function(){return this.element.dataset[dt]||""},D.prototype.show=function(){var e=this;return new Promise(function(t){x(e.element,{display:e.restoreDisplay()}),t()})},D.prototype.hide=function(){var e=this;return new Promise(function(t){"none"!==e.element.style.display&&e.saveDisplay(),x(e.element,{display:"none"}),t()})},D.prototype.slideDown=function(){var r=this;return new Promise(function(t){x(r.element,{display:r.restoreDisplay(),visibility:"hidden"});var e=M(r.element,"marginTop"),n=M(r.element,"marginBottom"),o=r.element.offsetHeight+parseInt(e)+parseInt(n);x(r.element,{height:"0px",overflow:"hidden",visibility:"visible"}),r.element.offsetHeight,setTimeout(function(){x(r.element,{transition:"height ".concat(r.options.duration,"ms ").concat(r.options.easing),height:"".concat(o,"px")}),setTimeout(function(){x(r.element,{height:"",overflow:"",transition:""}),t()},r.options.duration)},r.options.delay)})},D.prototype.slideUp=function(){var o=this;return new Promise(function(t){"none"!==o.element.style.display&&o.saveDisplay();var e=M(o.element,"marginTop"),n=M(o.element,"marginBottom"),e=o.element.offsetHeight+parseInt(e)+parseInt(n);x(o.element,{height:"".concat(e,"px"),overflow:"hidden"}),o.element.offsetHeight,setTimeout(function(){x(o.element,{height:"0px",transition:"height ".concat(o.options.duration,"ms ").concat(o.options.easing)}),setTimeout(function(){x(o.element,{height:"",overflow:"",transition:"",display:"none"}),t()},o.options.duration)},o.options.delay)})},D.prototype.fadeIn=function(){var t=this;return new Promise(function(n){function o(t){var t=Math.min((t-a)/i,1),e=1-Math.pow(1-t,3);x(r,{opacity:e.toString()}),t<1?requestAnimationFrame(o):(x(r,{opacity:"1"}),n())}var r=t.element,i=t.options.duration,a=(x(r,{display:t.restoreDisplay(),opacity:"0"}),r.offsetHeight,performance.now());requestAnimationFrame(o)})},D.prototype.fadeOut=function(){var t=this;return new Promise(function(n){function o(t){var t=Math.min((t-a)/i,1),e=Math.pow(t,3);x(r,{opacity:(1-e).toString()}),t<1?requestAnimationFrame(o):(x(r,{display:"none",opacity:"0"}),n())}var r=t.element,i=t.options.duration,a=("none"!==r.style.display&&t.saveDisplay(),x(r,{opacity:"1"}),performance.now());requestAnimationFrame(o)})},D);function D(t,e){void 0===e&&(e={}),this.element=t,this.options=i({duration:300,easing:"ease-out",delay:0},e)}var pt={show:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).show()},hide:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).hide()},slideDown:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).slideDown()},slideUp:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).slideUp()},fadeIn:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).fadeIn()},fadeOut:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).fadeOut()}};var S="ew-",ht=["%c ew-color-picker@".concat("2.0.18","%c 联系QQ:854806732 %c 联系微信:eveningwater %c github:https://github.com/eveningwater/ew-color-picker %c "),"background:#0ca6dc ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent"],gt=!1,vt=(F.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=B(this.options,this.ewColorPicker.options))},F.prototype.run=function(){gt||(gt=!0,_.apply(void 0,ht))},F.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),t.on&&g(t.on)&&t.on("change",function(t){}),null!=(t=this.run)&&t.call(this)},F.pluginName="ewColorPickerConsole",F);function F(t){this.ewColorPicker=t,this.options={},this.handleOptions(),this.run()}r.$=Q,r.$$=function(t,e){return(e=void 0===e?document:e).querySelectorAll(t)},r.Animation=H,r.Console=vt,r.DEFAULT_PANEL_HEIGHT=180,r.DEFAULT_PANEL_MODE="large",r.DEFAULT_PANEL_WIDTH=285,r.DEFAULT_PREFIX=S,r.EventEmitter=et,r.EventRegister=nt,r.JSONClone=function(t){return JSON.parse(JSON.stringify(t))},r.PANEL_MODE_SIZES={mini:{width:180,height:140},small:{width:220,height:150},medium:{width:250,height:165},large:{width:285,height:180}},r.PLACEMENTS=tt,r.addClass=function(t,e){for(var n=0,o=E(e);n<o.length;n++){var r,i=o[n];i&&!b(t,i)&&((r=t.className.split(" ").filter(Boolean)).push(i),t.className=r.join(" "))}},r.ani=pt,r.applyExtraAttrs=function(n,e,t){if(void 0===e&&(e={}),void 0===t&&(t={}),!n)return i({},e);Object.keys(t).forEach(function(t){t in e||n.removeAttribute(t)});var o={};return Object.entries(e).forEach(function(t){var e=t[0],t=t[1];h(t)||s(t)||""===t?n.removeAttribute(e):(n.setAttribute(e,String(t)),o[e]=t)}),o},r.arrowIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498630" class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4234"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="currentColor" p-id="4235"></path></svg>')},r.assert=function(t,e){if(!t)throw new Error(e||"Assertion failed")},r.baseSetStyle=C,r.basicDataTypeList=["Number","String","Function","Undefined","Boolean"],r.bindMouseDrag=function(e,t){function n(t){return e(t)}function o(){O(document,"mousemove",n),O(document,"mouseup",o),null!=t&&t()}return A(document,"mousemove",n),A(document,"mouseup",o),o},r.bindTouchDrag=function(e,t){function n(t){return e(t)}function o(){O(document,"touchmove",n),O(document,"touchend",o),null!=t&&t()}return A(document,"touchmove",n,{passive:!1}),A(document,"touchend",o),o},r.calculatePanelPosition=function(t,e,n,o){void 0===n&&(n="bottom"),void 0===o&&(o=8);var r=Y(t),i=Y(e),t=window.innerWidth,e=window.innerHeight,a=0,s=0,n=n.split("-"),c=n[0],l=n[1];switch(c){case"top":s=r.top-i.height-o,a="start"===l?r.left:"end"===l?r.right-i.width:r.left+(r.width-i.width)/2;break;case"bottom":s=r.bottom+o,a="start"===l?r.left:"end"===l?r.right-i.width:r.left+(r.width-i.width)/2;break;case"left":a=r.left-i.width-o,s="start"===l?r.top:"end"===l?r.bottom-i.height:r.top+(r.height-i.height)/2;break;case"right":a=r.right+o,s="start"===l?r.top:"end"===l?r.bottom-i.height:r.top+(r.height-i.height)/2}return s<0&&(s=o),{left:a=(a=a<0?o:a)+i.width>t?t-i.width-o:a,top:s=s+i.height>e?e-i.height-o:s}},r.camelCase=Z,r.checkContainer=function(t){return c(t)?Q(t)||(f("[ewColorPicker warning]: Cannot find element with selector: ".concat(t)),document.body):J(t)?t:document.body},r.checkIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"></path></svg>')},r.clamp=function(t,e,n){return Math.min(Math.max(t,e),n)},r.clearColorCache=function(){},r.clone=G,r.cloneColor=function(t){return i({},t)},r.close=function(t,e,n){n=1e4<(n=void 0===n?300:n)?1e4:n;var o="";switch(t){case"height":o="slideUp";break;case"opacity":o="fadeOut";break;default:o="hide"}return pt[o](e,n)},r.closeIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1690189203554" class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2272" fill="currentColor"').concat(e,'><path d="M504.224 470.288l207.84-207.84a16 16 0 0 1 22.608 0l11.328 11.328a16 16 0 0 1 0 22.624l-207.84 207.824 207.84 207.84a16 16 0 0 1 0 22.608l-11.328 11.328a16 16 0 0 1-22.624 0l-207.824-207.84-207.84 207.84a16 16 0 0 1-22.608 0l-11.328-11.328a16 16 0 0 1 0-22.624l207.84-207.824-207.84-207.84a16 16 0 0 1 0-22.608l11.328-11.328a16 16 0 0 1 22.624 0l207.824 207.84z" p-id="2273"></path></svg>')},r.colorHexToRgba=st,r.colorHslaToRgba=function(t){var e,n,o,r,i=t.h,a=t.s/100,s=t.l/100,t=t.a;return 0==a?n=o=r=s:(n=(e=function(t,e,n){return 1<n&&(n-=1),n<0&&(n+=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t})(a=2*s-(s=.5<=s?s+a-s*a:s*(1+a)),s,(i=i/360)+1/3),o=e(a,s,i),r=e(a,s,i-1/3)),t=Math.round(10*t)/10,"rgba(".concat(Math.round(255*n),", ").concat(Math.round(255*o),", ").concat(Math.round(255*r),", ").concat(t,")")},r.colorHsvaToRgba=function(t,e){var n,o,r,i,a=t.a,s=t.h,c=255*t.s/100,t=255*t.v/100;return 0==c?n=o=r=t:(t=s%60*((i=t)-(c=(255-c)*t/255))/60,360===s?(n=i,o=r=0):s<60?(n=i,o=c+t,r=c):s<120?(n=i-t,o=i,r=c):s<180?(o=i,r=(n=c)+t):s<240?(n=c,o=i-t,r=i):s<300?(n=c+t,o=c,r=i):s<360?(o=c,r=(n=i)-t):n=o=r=0),void 0!==e&&0<=e&&e<=1&&(a=e),a=Math.round(10*a)/10,"rgba(".concat(Math.round(n),", ").concat(Math.round(o),", ").concat(Math.round(r),", ").concat(a,")")},r.colorRegExp=L,r.colorRegHSL=it,r.colorRegHSLA=at,r.colorRegRGB=ot,r.colorRegRGBA=rt,r.colorRgbaToHex=function(t){var e,n,o={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"};return/rgba?/.test(t)?(e=t.replace(/rgba?\(/,"").replace(/\)/,"").replace(/[\s+]/g,"").split(","),n="",e.map(function(t,e){e<=2&&(n+=(e=+t,e=Math.min(Math.round(e),255),t=Math.floor(e/16),""+(o[t]||t)+(o[e%=16]||e)))}),m("#"+n)):t},r.colorRgbaToHsla=function(t){var e,n=(t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",")).length<4?1:Number(t[3]),n=Math.round(10*n)/10,o=parseInt(t[0])/255,r=parseInt(t[1])/255,i=parseInt(t[2])/255,t=Math.max(o,r,i),a=Math.min(o,r,i),s=(t+a)/2;if(t===a)e=l=0;else{var c=t-a,l=.5<s?c/(2-t-a):c/(t+a);switch(t){case o:e=(r-i)/c+(i<=r?0:6);break;case r:e=(i-o)/c+2;break;case i:e=(o-r)/c+4}}return{colorStr:m("hsla("+Math.ceil(60*e)+","+Math.ceil(100*l)+"%,"+Math.ceil(100*s)+"%,"+n+")"),colorObj:{h:Math.round(60*e),s:Math.round(100*l),l:Math.round(100*s),a:n}}},r.colorRgbaToHsva=ct,r.colorRgbaToHsvaWithCache=function(t){var e;return P.has(t)?P.get(t):(e=ct(t),P.set(t,e),1e3<P.size&&(t=P.keys().next().value)&&P.delete(t),e)},r.colorToRgba=N,r.copyIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path></svg>')},r.create=K,r.createByTemplate=function(t){return document.createRange().createContextualFragment(t)},r.createConsoleLogger=function(t){var s=(t=void 0===t?{}:t).prefix,e=t.timestamp,c=void 0===e||e,e=t.dev,l=void 0===e||e,n={};return z.forEach(function(a){n[a]=function(){for(var t,e,n,o,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];l||(e=[U[a].icon,s?"[".concat(s,"]"):"",a.toUpperCase(),c?(new Date).toLocaleTimeString():""].filter(Boolean).join(" "),console[a].apply(console,(t=a,e=e,"string"==typeof(o=(n=r)[0])&&o.includes("%c")?u(["".concat(e," ").concat(o)],n.slice(1),!0):u(["%c".concat(e),W(t)],n,!0))))}}),n},r.debounce=function(o,r,i){void 0===i&&(i=!1);var a=null;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=i&&!a;a&&clearTimeout(a),a=setTimeout(function(){a=null,i||o.apply(void 0,t)},r),n&&o.apply(void 0,t)}},r.downArrowIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498632" class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4236"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="currentColor" p-id="4237"></path></svg>')},r.error=d,r.extend=B,r.eyedropperIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M17.66 5.41l.92.92-2.69 2.69-.92-.92 2.69-2.69M17.67 3c-.26 0-.51.1-.71.29l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c.4-.4.29-.71.29-.71L17.67 3z"></path></svg>')},r.getAnimationType=function(t){return(null==(t=t.options)?void 0:t.togglePickerAnimation)||"default"},r.getAttr=function(t,e){return t.getAttribute(e)},r.getColorBrightness=ut,r.getContrastColor=function(t,e,n){var o;return void 0===e&&(e="#333333"),void 0===n&&(n="#ffffff"),(t=t&&N(t))&&(o=ft(t))&&.5<.2126*(t=function(t){t=(t*o.a+255*(1-o.a))/255;return t<=.03928?t/12.92:Math.pow((.055+t)/1.055,2.4)})(o.r)+.7152*t(o.g)+.0722*t(o.b)?e:n},r.getElementSize=function(t){return{clientWidth:t.clientWidth,clientHeight:t.clientHeight,offsetWidth:t.offsetWidth,offsetHeight:t.offsetHeight,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight}},r.getOffset=function(t){for(var e=0,n=0;t;)e-=t.offsetLeft,n-=t.offsetTop,t=t.offsetParent;return{left:e,top:n}},r.getPrefix=function(t){t=null==(t=null==t?void 0:t.options)?void 0:t.prefix;return c(t)?t:S},r.getRatio=function(t,e,n,o){void 0===o&&(o=!1);t=Math.max(0,Math.min(1,0<n?(t-e)/n:0));return o?1-t:t},r.getRect=Y,r.getStyle=M,r.handleClassName=y,r.hasClass=b,r.hasOwn=function(t,e){return q.call(t,e)},r.insertNode=function(t,e,n,o){e&&(o&&null!=t&&t.contains(o)?t.insertBefore(e,o):n&&null!=t&&t.contains(n)?t.replaceChild(e,n):null!=t&&t.appendChild(e))},r.isAlphaColor=function(t){return!!/^rgba\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!/^hsla\s*\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!t.includes("hsva(")||"transparent"===t},r.isArray=v,r.isBoolean=function(t){return"boolean"==typeof t},r.isBrowser=t,r.isDarkColor=function(t){return ut(t)<128},r.isDeepArray=function(t){return Array.isArray(t)},r.isDeepObject=function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)},r.isDev=function(){return!1},r.isDom=w,r.isFunction=g,r.isHTMLElement=J,r.isMobile=j,r.isNode=function(t){return"undefined"!=typeof Node&&t instanceof Node},r.isNotEmptyObject=function(t){return R(t)&&0<Object.keys(t).length},r.isNull=h,r.isNumber=I,r.isObject=R,r.isPlacement=function(t){return-1<tt.indexOf(t)},r.isPromise=function(t){return!s(t)&&!h(t)&&g((t=t).then)&&g(t.catch)},r.isRegExp=function(t){return"regexp"===p.call(t).slice(8,-1).toLowerCase()},r.isRemoveNode=function(t){return w(t)&&w(t.parentElement)&&g(t.parentElement.removeChild)},r.isShallowObject=a,r.isStrictColorFormat=function(t){return!(!t||"string"!=typeof t||!/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)&&!(/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(t)||/^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||/^hsl\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*\)$/.test(t)||/^hsla\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||"transparent"===t))},r.isString=c,r.isTextTruncated=function(t){if(!t||!t.childNodes||!t.childNodes.length)return!1;if("undefined"!=typeof document&&"function"==typeof document.createRange)try{var e=document.createRange();if(e.setStart(t,0),e.setEnd(t,t.childNodes.length),e.getBoundingClientRect().width+(parseInt(M(t,"paddingLeft"),10)||0)+(parseInt(M(t,"paddingRight"),10)||0)>t.offsetWidth)return!0}catch(t){}return t.scrollWidth>t.offsetWidth},r.isUndefined=s,r.isValidColor=function(t){var e="transparent"===t;if(L.test(t))return!0;if(ot.test(t)&&!t.includes("rgba"))return!0;if(rt.test(t))return!0;if(it.test(t)&&!t.includes("hsla"))return!0;if(at.test(t))return!0;if(e)return!0;if("#invalid"===t||"invalid"===t)return!1;if(t.includes("rgb(")&&t.includes(", 0.5)"))return!1;if(t.includes("rgba(")&&!t.includes(", 0.5)")&&!t.includes(", 1)"))return!1;try{var n=document.createElement("div");return x(n,{"background-color":t}),"rgba(0, 0, 0, 0)"!==M(n,"backgroundColor")||e}catch(t){return!1}},r.isValidNumber=function(t){return"number"==typeof t&&!Number.isNaN(t)},r.log=_,r.normalizeClassName=E,r.objDataTypeList=["Object","Array","RegExp"],r.off=O,r.on=A,r.open=function(t,e,n){n=1e4<(n=void 0===n?300:n)?1e4:n;var o="";switch(t){case"height":o="slideDown";break;case"opacity":o="fadeIn";break;default:o="show"}return pt[o](e,n)},r.parsePlacement=function(t){return{side:(t=t.split("-"))[0],align:t[1]||"center"}},r.parseRgbaString=ft,r.removeAllSpace=m,r.removeClass=function(e,t){var t=E(t).filter(function(t){return b(e,t)});0!==t.length&&(t=new RegExp("(^|\\s)("+t.join("|")+")(\\s|$)","g"),e.className=e.className.replace(t," ").replace(/\s+/g," ").trim())},r.removeElement=X,r.removeNode=n,r.removeStyle=function(t,e){for(var n=0,o=e=void 0===e?[]:e;n<o.length;n++){var r=o[n];t.style.removeProperty(r)}},r.rgbToHsl=function(t,e,n){t/=255,e/=255,n/=255;var o=Math.max(t,e,n),r=Math.min(t,e,n),i=0,a=0,s=(o+r)/2;if(o!==r){var c=o-r,a=.5<s?c/(2-o-r):c/(o+r);switch(o){case t:i=(e-n)/c+(e<n?6:0);break;case e:i=(n-t)/c+2;break;case n:i=(t-e)/c+4}i/=6}return{h:360*i,s:100*a,l:100*s}},r.rgbaToHex=function(t){function e(t){return Math.round(t).toString(16).padStart(2,"0")}return"#".concat(e(t.r)).concat(e(t.g)).concat(e(t.b))},r.setAttr=function(t,e){if(a(e))for(var n=0,o=Object.entries(e);n<o.length;n++){var r=o[n],i=r[0];t.setAttribute(i,"".concat(r[1]))}},r.setContent=function(t,e,n){var o=(n=void 0===n?{}:n).html,o=void 0!==o&&o,n=n.clone,n=void 0!==n&&n;t.textContent="","string"==typeof e?o?t.innerHTML=e:t.textContent=e:t.appendChild(n?e.cloneNode(!0):e)},r.setStyle=x,r.throttle=function(n,o){var r;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r||(n.apply(void 0,t),r=!0,setTimeout(function(){return r=!1},o))}},r.throwError=function(t){throw new Error("[ewColorPicker error]: ".concat(t))},r.tips=ht,r.toArray=function(t){return a(t)?Array.from?Array.from(t):V.call(t):t},r.toStyleStr=function(t){return t?c(t)?t:Object.entries(t).map(function(t){var e=t[0],t=t[1];return"".concat(e.replace(/([A-Z])/g,"-$1").toLowerCase(),":").concat(t)}).join(";"):""},r.tryErrorHandler=$,r.ua=e,r.upArrowIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498631" class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4235"').concat(e,'><path d="M512 309.333333c8.533333 0 17.066667 2.133333 23.466667 8.533334l341.333333 341.333333c12.8 12.8 12.8 32 0 44.8-12.8 12.8-32 12.8-44.8 0L533.333333 374.4 215.466667 692.266667c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32 0-44.8L488.533333 317.866667c4.266667-8.533333 12.8-10.666667 21.333334-10.666667z" fill="currentColor" p-id="4236"></path></svg>')},r.warn=f,r.wrapperArrayValue=function(t){return v(t)?t:[t]}});
|
|
1
|
+
((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).Utils={})})(this,function(r){var i=function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function u(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||((o=o||Array.prototype.slice.call(e,0,r))[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var t="undefined"!=typeof window,e=t&&navigator.userAgent.toLowerCase(),j=e&&e.match(/(iPhone|iPod|Android|ios)/i);if(r.supportsPassive=!1,t)try{var n={};Object.defineProperty(n,"passive",{get:function(){r.supportsPassive=!0}}),window.addEventListener("test-passive",function(){},n)}catch(d){}function o(){}function s(t){return void 0===t}function c(t){return"string"==typeof t}function I(t){return"number"==typeof t}function a(t){return"object"==typeof t&&!h(t)}function R(t){return"object"===p.call(t).slice(8,-1).toLowerCase()}function $(t,e){try{t()}catch(t){g(e)?e(t):d("[ewColorPicker error]: ".concat(t))}}function B(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(h(t))return{};if(Object.assign)return Object.assign.apply(Object,u([t],e,!1));for(var o=Object(t),r=0,i=e.length;r<i;r++){var a=e[r];if(a)for(var s in a)q.call(a,s)&&(o[s]=a[s])}return o}var z=["warn","error","log"],U={log:{icon:"📝",color:"#4CAF50",bgColor:"#E8F5E8",borderColor:"#4CAF50"},warn:{icon:"⚠️",color:"#FF9800",bgColor:"#FFF3E0",borderColor:"#FF9800"},error:{icon:"❌",color:"#F44336",bgColor:"#FFEBEE",borderColor:"#F44336"}},W=function(t){t=U[t];return"color: ".concat(t.color,"; background: ").concat(t.bgColor,"; padding: 2px 6px; border-radius: 4px; border-left: 3px solid ").concat(t.borderColor,"; font-weight: bold;")},l={log:o,warn:o,error:o},f=(z.forEach(function(t){l[t]=function(){}}),l.warn),d=l.error,_=l.log,p=Object.prototype.toString,V=Array.prototype.slice,q=Object.prototype.hasOwnProperty,h=function(t){return null===t},g=function(t){return"function"==typeof t},v=function(t){return"array"===p.call(t).slice(8,-1).toLowerCase()};function G(t){if(!a(t))return t;var e,n=v(t)?[]:{};for(e in t)t.hasOwnProperty(e)&&(n[e]=a(t[e])?G(t[e]):t[e]);return n}function m(t){return t.replace(/\s+/g,"")}function y(t){return t?" ".concat(t):""}function b(t,e){return new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className)}function J(t){return t instanceof HTMLElement}function w(t){return"undefined"!=typeof window&&!!t&&("undefined"!=typeof HTMLElement&&t instanceof HTMLElement||"undefined"!=typeof HTMLCollection&&t instanceof HTMLCollection||"undefined"!=typeof NodeList&&t instanceof NodeList||"object"==typeof t&&1===t.nodeType)}function C(t,e,n){e=e.startsWith("--")?e:e.replace(/([A-Z])/g,"-$1").toLowerCase(),t.style.setProperty(e,n)}function Z(t){return t.replace(/([\:\_\-]+(.))/g,function(t,e,n,o){return o?n.toUpperCase():n}).replace(/^moz([A-Z])/,"Moz$1")}function E(t){return t?(v(t)?t:[t]).filter(Boolean):[]}function Q(t,e){return(e=void 0===e?document:e).querySelector(t)}function X(t){var e;null!=t&&t.parentElement?null!=(e=null==t?void 0:t.parentElement)&&e.removeChild(t):null!=t&&t.remove()}var K=function(t){return document.createElement(t)},x=function(n,t,e){if(c(t=void 0===t?{}:t)&&!s(e)){e=I(e)?"".concat(e,"px"):e;C(n,t,e)}else if(Array.isArray(t))t.forEach(function(t){var e=t.prop;C(n,e,t.value)});else for(var o=0,r=Object.entries(t);o<r.length;o++){var i=r[o],a=i[0];C(n,a,i[1])}},M=function(e,n,o){if(!e||!n)return null;"float"===(n=Z(n))&&(n="cssFloat");var r=null;return $(function(){var t=(document.defaultView||window).getComputedStyle(e,o);r=e.style[n]||t?t[n]:null}),r||e.style[n]},n=X;function Y(t){return t.getBoundingClientRect()}function A(t,e,n,o){t&&e&&n&&("object"==typeof o&&null!==o?t.addEventListener(e,n,i({passive:!1},o)):r.supportsPassive?t.addEventListener(e,n,{passive:!1,capture:!!o}):t.addEventListener(e,n,!!o))}function O(t,e,n,o){t&&e&&n&&t.removeEventListener(e,n,o)}var tt=["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"];r.ApplyOrder=void 0,(et=r.ApplyOrder||(r.ApplyOrder={})).Pre="pre",et.Post="post",T.prototype.on=function(t,e,n){return void 0===n&&(n=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,n]),this},T.prototype.once=function(o,r,i){var a=this,s=(void 0===i&&(i=this),this.hasType(o),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];a.off(o,s);var n=r.apply(i,t);if(!0===n)return n});return s.fn=r,this.on(o,s),this},T.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),e){var n=this.events[t];if(n)for(var o=n.length;o--;)(n[o][0]===e||n[o][0]&&n[o][0].fn===e)&&n.splice(o,1)}else this.events[t]=[];return this}},T.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.hasType(t);t=this.events[t];if(t)for(var o=t.length,r=u([],t,!0),i=0;i<o;i++){var a=r[i],s=a[0],a=a[1];if(s&&!0===(s=s.apply(a,e)))return s}},T.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},T.prototype.destroy=function(){this.events={},this.eventTypes={}},T.prototype.hasType=function(t){var e=this.eventTypes;e[t]!==t&&f('[ewColorPicker warning]: EventEmitter has used unknown event type: "'.concat(t,'", should be oneof [')+"".concat(Object.keys(e).map(function(t){return JSON.stringify(t)}))+"]")};var et=T;function T(t){this.events={},this.eventTypes={},this.registerType(t)}L.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},L.prototype.addDOMEvents=function(){this.handleDOMEvents(A)},L.prototype.removeDOMEvents=function(){this.handleDOMEvents(O)},L.prototype.handleDOMEvents=function(e){var n=this,o=this.wrapper;this.events.forEach(function(t){e(o,t.name,n,!!t.capture)})},L.prototype.handleEvent=function(e){var n=e.type;this.events.some(function(t){return t.name===n&&(t.handler(e),!0)})};var nt=L;function L(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var k=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/,ot=/[rR][gG][Bb][Aa]?[\(]([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),){2}[\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),?[\s]*(0\.\d{1,2}|1|0)?[\)]{1}/g,rt=/^[rR][gG][Bb][Aa][\(]([\\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\\s]*,){3}[\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*[\)]{1}$/,it=/^[hH][Ss][Ll][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*)[\)]$/,at=/^[hH][Ss][Ll][Aa][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,){2}([\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*)[\)]$/;function st(t,e){var e=(e=void 0===e?1:e)||1,e=Math.round(10*e)/10,n=t.toLowerCase(),o=t.length,r=[];if(t&&k.test(n)){if(4===o){for(var i="#",a=1;a<o;a++){var s=n.slice(a,a+1);i+=s.concat(s)}n=i}for(var c=1,l=n.length;c<l;c+=2)r.push(parseInt("0X"+n.slice(c,c+2),16));return"rgba(".concat(r.join(", "),", ").concat(e,")")}return m(n)}function ct(t){if(!t||"string"!=typeof t)return{h:0,s:100,v:100,a:1};if(!/^rgba?\(/i.test(t.replace(/\s+/g," ").trim())){var e=N(t);if(!e)return{h:0,s:100,v:100,a:1};t=e}var n,o,r,i,a,s,c,e=t.replace(/\s+/g," ").trim().match(/rgba?\(([^)]+)\)/i);return e?(t=e[1].split(",").map(function(t){return t.trim()}),e=parseFloat(t[0])||0,n=parseFloat(t[1])||0,o=parseFloat(t[2])||0,t=4<=t.length?parseFloat(t[3]):Number.NaN,t=Number.isNaN(t)?1:t,e=e/255,n=n/255,o=o/255,r=(c=Math.max(e,n,o))-Math.min(e,n,o),(a=i=0)!==(s=c)&&(a=r/c),0!=r?(c===e?i=(n-o)/r*60:c===n?i=60*((o-e)/r+2):c===o&&(i=60*((e-n)/r+4)),i<0&&(i+=360)):i=0,c=Math.round(10*t)/10,{h:Math.round(i),s:Math.round(100*a),v:Math.round(100*s),a:c}):{h:0,s:100,v:100,a:1}}var lt={black:"rgba(0, 0, 0, 1)",silver:"rgba(192, 192, 192, 1)",gray:"rgba(128, 128, 128, 1)",white:"rgba(255, 255, 255, 1)",maroon:"rgba(128, 0, 0, 1)",red:"rgba(255, 0, 0, 1)",purple:"rgba(128, 0, 128, 1)",fuchsia:"rgba(255, 0, 255, 1)",green:"rgba(0, 128, 0, 1)",lime:"rgba(0, 255, 0, 1)",olive:"rgba(128, 128, 0, 1)",yellow:"rgba(255, 255, 0, 1)",navy:"rgba(0, 0, 128, 1)",blue:"rgba(0, 0, 255, 1)",teal:"rgba(0, 128, 128, 1)",aqua:"rgba(0, 255, 255, 1)",orange:"rgba(255, 165, 0, 1)",pink:"rgba(255, 192, 203, 1)",brown:"rgba(165, 42, 42, 1)"};function N(t){if(t&&"string"==typeof t){var e=t.trim().toLowerCase();if(lt[e])return lt[e];if(k.test(e))return st(e).replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)");var n=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(n)return o=n[1],r=n[2],i=n[3],"rgba(".concat(o,", ").concat(r,", ").concat(i,", 1)");var o,r,i,n=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(n)return o=n[1],r=n[2],i=n[3],e=n[4],"rgba(".concat(o,", ").concat(r,", ").concat(i,", ").concat(e,")");try{var a=K("div"),s=(x(a,{"background-color":t}),M(a,"backgroundColor"));if(s&&"rgba(0, 0, 0, 0)"!==s)return s.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)")}catch(t){}}return""}function ut(t){t=N(t),t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return(299*parseInt(t[0])+587*parseInt(t[1])+114*parseInt(t[2]))/1e3}var P=new Map;function ft(t){try{var e=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return e.length<3?null:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:e.length<4?1:parseFloat(e[3])}}catch(t){return null}}var dt="origDisplay",H=(D.prototype.saveDisplay=function(){var t=window.getComputedStyle(this.element).display;this.element.dataset[dt]=t},D.prototype.restoreDisplay=function(){return this.element.dataset[dt]||""},D.prototype.show=function(){var e=this;return new Promise(function(t){x(e.element,{display:e.restoreDisplay()}),t()})},D.prototype.hide=function(){var e=this;return new Promise(function(t){"none"!==e.element.style.display&&e.saveDisplay(),x(e.element,{display:"none"}),t()})},D.prototype.slideDown=function(){var r=this;return new Promise(function(t){x(r.element,{display:r.restoreDisplay(),visibility:"hidden"});var e=M(r.element,"marginTop"),n=M(r.element,"marginBottom"),o=r.element.offsetHeight+parseInt(e)+parseInt(n);x(r.element,{height:"0px",overflow:"hidden",visibility:"visible"}),r.element.offsetHeight,setTimeout(function(){x(r.element,{transition:"height ".concat(r.options.duration,"ms ").concat(r.options.easing),height:"".concat(o,"px")}),setTimeout(function(){x(r.element,{height:"",overflow:"",transition:""}),t()},r.options.duration)},r.options.delay)})},D.prototype.slideUp=function(){var o=this;return new Promise(function(t){"none"!==o.element.style.display&&o.saveDisplay();var e=M(o.element,"marginTop"),n=M(o.element,"marginBottom"),e=o.element.offsetHeight+parseInt(e)+parseInt(n);x(o.element,{height:"".concat(e,"px"),overflow:"hidden"}),o.element.offsetHeight,setTimeout(function(){x(o.element,{height:"0px",transition:"height ".concat(o.options.duration,"ms ").concat(o.options.easing)}),setTimeout(function(){x(o.element,{height:"",overflow:"",transition:"",display:"none"}),t()},o.options.duration)},o.options.delay)})},D.prototype.fadeIn=function(){var t=this;return new Promise(function(n){function o(t){var t=Math.min((t-a)/i,1),e=1-Math.pow(1-t,3);x(r,{opacity:e.toString()}),t<1?requestAnimationFrame(o):(x(r,{opacity:"1"}),n())}var r=t.element,i=t.options.duration,a=(x(r,{display:t.restoreDisplay(),opacity:"0"}),r.offsetHeight,performance.now());requestAnimationFrame(o)})},D.prototype.fadeOut=function(){var t=this;return new Promise(function(n){function o(t){var t=Math.min((t-a)/i,1),e=Math.pow(t,3);x(r,{opacity:(1-e).toString()}),t<1?requestAnimationFrame(o):(x(r,{display:"none",opacity:"0"}),n())}var r=t.element,i=t.options.duration,a=("none"!==r.style.display&&t.saveDisplay(),x(r,{opacity:"1"}),performance.now());requestAnimationFrame(o)})},D);function D(t,e){void 0===e&&(e={}),this.element=t,this.options=i({duration:300,easing:"ease-out",delay:0},e)}var pt={show:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).show()},hide:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).hide()},slideDown:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).slideDown()},slideUp:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).slideUp()},fadeIn:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).fadeIn()},fadeOut:function(t,e){return new H(t,{duration:e=void 0===e?300:e}).fadeOut()}};var ht={open:{height:"slideDown",opacity:"fadeIn"},close:{height:"slideUp",opacity:"fadeOut"}},gt={open:"show",close:"hide"};function vt(t,e,n,o){e=ht[t][e]||gt[t];return pt[e](n,1e4<o?1e4:o)}var S="ew-",mt=["%c ew-color-picker@".concat("2.0.19","%c 联系QQ:854806732 %c 联系微信:eveningwater %c github:https://github.com/eveningwater/ew-color-picker %c "),"background:#0ca6dc ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent"],yt=!1,bt=(F.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=B(this.options,this.ewColorPicker.options))},F.prototype.run=function(){yt||(yt=!0,_.apply(void 0,mt))},F.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),t.on&&g(t.on)&&t.on("change",function(t){}),null!=(t=this.run)&&t.call(this)},F.pluginName="ewColorPickerConsole",F);function F(t){this.ewColorPicker=t,this.options={},this.handleOptions(),this.run()}r.$=Q,r.$$=function(t,e){return(e=void 0===e?document:e).querySelectorAll(t)},r.Animation=H,r.Console=bt,r.DEFAULT_PANEL_HEIGHT=180,r.DEFAULT_PANEL_MODE="large",r.DEFAULT_PANEL_WIDTH=285,r.DEFAULT_PREFIX=S,r.EventEmitter=et,r.EventRegister=nt,r.JSONClone=function(t){return JSON.parse(JSON.stringify(t))},r.PANEL_MODE_SIZES={mini:{width:180,height:140},small:{width:220,height:150},medium:{width:250,height:165},large:{width:285,height:180}},r.PLACEMENTS=tt,r.addClass=function(t,e){for(var n=0,o=E(e);n<o.length;n++){var r,i=o[n];i&&!b(t,i)&&((r=t.className.split(" ").filter(Boolean)).push(i),t.className=r.join(" "))}},r.ani=pt,r.applyExtraAttrs=function(n,e,t){if(void 0===e&&(e={}),void 0===t&&(t={}),!n)return i({},e);Object.keys(t).forEach(function(t){t in e||n.removeAttribute(t)});var o={};return Object.entries(e).forEach(function(t){var e=t[0],t=t[1];h(t)||s(t)||""===t?n.removeAttribute(e):(n.setAttribute(e,String(t)),o[e]=t)}),o},r.arrowIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498630" class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4234"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="currentColor" p-id="4235"></path></svg>')},r.assert=function(t,e){if(!t)throw new Error(e||"Assertion failed")},r.baseSetStyle=C,r.basicDataTypeList=["Number","String","Function","Undefined","Boolean"],r.bindMouseDrag=function(e,t){function n(t){return e(t)}function o(){O(document,"mousemove",n),O(document,"mouseup",o),null!=t&&t()}return A(document,"mousemove",n),A(document,"mouseup",o),o},r.bindTouchDrag=function(e,t){function n(t){return e(t)}function o(){O(document,"touchmove",n),O(document,"touchend",o),null!=t&&t()}return A(document,"touchmove",n,{passive:!1}),A(document,"touchend",o),o},r.calculatePanelPosition=function(t,e,n,o){void 0===n&&(n="bottom"),void 0===o&&(o=8);var r=Y(t),i=Y(e),t=window.innerWidth,e=window.innerHeight,a=0,s=0,n=n.split("-"),c=n[0],l=n[1];switch(c){case"top":s=r.top-i.height-o,a="start"===l?r.left:"end"===l?r.right-i.width:r.left+(r.width-i.width)/2;break;case"bottom":s=r.bottom+o,a="start"===l?r.left:"end"===l?r.right-i.width:r.left+(r.width-i.width)/2;break;case"left":a=r.left-i.width-o,s="start"===l?r.top:"end"===l?r.bottom-i.height:r.top+(r.height-i.height)/2;break;case"right":a=r.right+o,s="start"===l?r.top:"end"===l?r.bottom-i.height:r.top+(r.height-i.height)/2}return s<0&&(s=o),{left:a=(a=a<0?o:a)+i.width>t?t-i.width-o:a,top:s=s+i.height>e?e-i.height-o:s}},r.camelCase=Z,r.checkContainer=function(t){return c(t)?Q(t)||(f("[ewColorPicker warning]: Cannot find element with selector: ".concat(t)),document.body):J(t)?t:document.body},r.checkIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"></path></svg>')},r.clamp=function(t,e,n){return Math.min(Math.max(t,e),n)},r.clearColorCache=function(){},r.clone=G,r.cloneColor=function(t){return i({},t)},r.close=function(t,e,n){return vt("close",t,e,n=void 0===n?300:n)},r.closeIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1690189203554" class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2272" fill="currentColor"').concat(e,'><path d="M504.224 470.288l207.84-207.84a16 16 0 0 1 22.608 0l11.328 11.328a16 16 0 0 1 0 22.624l-207.84 207.824 207.84 207.84a16 16 0 0 1 0 22.608l-11.328 11.328a16 16 0 0 1-22.624 0l-207.824-207.84-207.84 207.84a16 16 0 0 1-22.608 0l-11.328-11.328a16 16 0 0 1 0-22.624l207.84-207.824-207.84-207.84a16 16 0 0 1 0-22.608l11.328-11.328a16 16 0 0 1 22.624 0l207.824 207.84z" p-id="2273"></path></svg>')},r.colorHexToRgba=st,r.colorHslaToRgba=function(t){var e,n,o,r,i=t.h,a=t.s/100,s=t.l/100,t=t.a;return 0==a?n=o=r=s:(n=(e=function(t,e,n){return 1<n&&(n-=1),n<0&&(n+=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t})(a=2*s-(s=.5<=s?s+a-s*a:s*(1+a)),s,(i=i/360)+1/3),o=e(a,s,i),r=e(a,s,i-1/3)),t=Math.round(10*t)/10,"rgba(".concat(Math.round(255*n),", ").concat(Math.round(255*o),", ").concat(Math.round(255*r),", ").concat(t,")")},r.colorHsvaToRgba=function(t,e){var n,o,r,i,a=t.a,s=t.h,c=255*t.s/100,t=255*t.v/100;return 0==c?n=o=r=t:(t=s%60*((i=t)-(c=(255-c)*t/255))/60,360===s?(n=i,o=r=0):s<60?(n=i,o=c+t,r=c):s<120?(n=i-t,o=i,r=c):s<180?(o=i,r=(n=c)+t):s<240?(n=c,o=i-t,r=i):s<300?(n=c+t,o=c,r=i):s<360?(o=c,r=(n=i)-t):n=o=r=0),void 0!==e&&0<=e&&e<=1&&(a=e),a=Math.round(10*a)/10,"rgba(".concat(Math.round(n),", ").concat(Math.round(o),", ").concat(Math.round(r),", ").concat(a,")")},r.colorRegExp=k,r.colorRegHSL=it,r.colorRegHSLA=at,r.colorRegRGB=ot,r.colorRegRGBA=rt,r.colorRgbaToHex=function(t){var e,n,o={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"};return/rgba?/.test(t)?(e=t.replace(/rgba?\(/,"").replace(/\)/,"").replace(/[\s+]/g,"").split(","),n="",e.map(function(t,e){e<=2&&(n+=(e=+t,e=Math.min(Math.round(e),255),t=Math.floor(e/16),""+(o[t]||t)+(o[e%=16]||e)))}),m("#"+n)):t},r.colorRgbaToHsla=function(t){var e,n=(t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",")).length<4?1:Number(t[3]),n=Math.round(10*n)/10,o=parseInt(t[0])/255,r=parseInt(t[1])/255,i=parseInt(t[2])/255,t=Math.max(o,r,i),a=Math.min(o,r,i),s=(t+a)/2;if(t===a)e=l=0;else{var c=t-a,l=.5<s?c/(2-t-a):c/(t+a);switch(t){case o:e=(r-i)/c+(i<=r?0:6);break;case r:e=(i-o)/c+2;break;case i:e=(o-r)/c+4}}return{colorStr:m("hsla("+Math.ceil(60*e)+","+Math.ceil(100*l)+"%,"+Math.ceil(100*s)+"%,"+n+")"),colorObj:{h:Math.round(60*e),s:Math.round(100*l),l:Math.round(100*s),a:n}}},r.colorRgbaToHsva=ct,r.colorRgbaToHsvaWithCache=function(t){var e;return P.has(t)?P.get(t):(e=ct(t),P.set(t,e),1e3<P.size&&(t=P.keys().next().value)&&P.delete(t),e)},r.colorToRgba=N,r.copyIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path></svg>')},r.create=K,r.createByTemplate=function(t){return document.createRange().createContextualFragment(t)},r.createConsoleLogger=function(t){var s=(t=void 0===t?{}:t).prefix,e=t.timestamp,c=void 0===e||e,e=t.dev,l=void 0===e||e,n={};return z.forEach(function(a){n[a]=function(){for(var t,e,n,o,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];l||(e=[U[a].icon,s?"[".concat(s,"]"):"",a.toUpperCase(),c?(new Date).toLocaleTimeString():""].filter(Boolean).join(" "),console[a].apply(console,(t=a,e=e,"string"==typeof(o=(n=r)[0])&&o.includes("%c")?u(["".concat(e," ").concat(o)],n.slice(1),!0):u(["%c".concat(e),W(t)],n,!0))))}}),n},r.debounce=function(o,r,i){void 0===i&&(i=!1);var a=null;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=i&&!a;a&&clearTimeout(a),a=setTimeout(function(){a=null,i||o.apply(void 0,t)},r),n&&o.apply(void 0,t)}},r.downArrowIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498632" class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4236"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="currentColor" p-id="4237"></path></svg>')},r.error=d,r.extend=B,r.eyedropperIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M17.66 5.41l.92.92-2.69 2.69-.92-.92 2.69-2.69M17.67 3c-.26 0-.51.1-.71.29l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c.4-.4.29-.71.29-.71L17.67 3z"></path></svg>')},r.getAnimationType=function(t){return(null==(t=t.options)?void 0:t.togglePickerAnimation)||"default"},r.getAttr=function(t,e){return t.getAttribute(e)},r.getColorBrightness=ut,r.getContrastColor=function(t,e,n){var o;return void 0===e&&(e="#333333"),void 0===n&&(n="#ffffff"),(t=t&&N(t))&&(o=ft(t))&&.5<.2126*(t=function(t){t=(t*o.a+255*(1-o.a))/255;return t<=.03928?t/12.92:Math.pow((.055+t)/1.055,2.4)})(o.r)+.7152*t(o.g)+.0722*t(o.b)?e:n},r.getElementSize=function(t){return{clientWidth:t.clientWidth,clientHeight:t.clientHeight,offsetWidth:t.offsetWidth,offsetHeight:t.offsetHeight,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight}},r.getOffset=function(t){for(var e=0,n=0;t;)e-=t.offsetLeft,n-=t.offsetTop,t=t.offsetParent;return{left:e,top:n}},r.getPrefix=function(t){t=null==(t=null==t?void 0:t.options)?void 0:t.prefix;return c(t)?t:S},r.getRatio=function(t,e,n,o){void 0===o&&(o=!1);t=Math.max(0,Math.min(1,0<n?(t-e)/n:0));return o?1-t:t},r.getRect=Y,r.getStyle=M,r.handleClassName=y,r.hasClass=b,r.hasOwn=function(t,e){return q.call(t,e)},r.insertNode=function(t,e,n,o){e&&(o&&null!=t&&t.contains(o)?t.insertBefore(e,o):n&&null!=t&&t.contains(n)?t.replaceChild(e,n):null!=t&&t.appendChild(e))},r.isAlphaColor=function(t){return!!/^rgba\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!/^hsla\s*\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!t.includes("hsva(")||"transparent"===t},r.isArray=v,r.isBoolean=function(t){return"boolean"==typeof t},r.isBrowser=t,r.isDarkColor=function(t){return ut(t)<128},r.isDeepArray=function(t){return Array.isArray(t)},r.isDeepObject=function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)},r.isDev=function(){return!1},r.isDom=w,r.isFunction=g,r.isHTMLElement=J,r.isMobile=j,r.isNode=function(t){return"undefined"!=typeof Node&&t instanceof Node},r.isNotEmptyObject=function(t){return R(t)&&0<Object.keys(t).length},r.isNull=h,r.isNumber=I,r.isObject=R,r.isPlacement=function(t){return-1<tt.indexOf(t)},r.isPromise=function(t){return!s(t)&&!h(t)&&g((t=t).then)&&g(t.catch)},r.isRegExp=function(t){return"regexp"===p.call(t).slice(8,-1).toLowerCase()},r.isRemoveNode=function(t){return w(t)&&w(t.parentElement)&&g(t.parentElement.removeChild)},r.isShallowObject=a,r.isStrictColorFormat=function(t){return!(!t||"string"!=typeof t||!/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)&&!(/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(t)||/^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||/^hsl\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*\)$/.test(t)||/^hsla\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||"transparent"===t))},r.isString=c,r.isTextTruncated=function(t){if(!t||!t.childNodes||!t.childNodes.length)return!1;if("undefined"!=typeof document&&"function"==typeof document.createRange)try{var e=document.createRange();if(e.setStart(t,0),e.setEnd(t,t.childNodes.length),e.getBoundingClientRect().width+(parseInt(M(t,"paddingLeft"),10)||0)+(parseInt(M(t,"paddingRight"),10)||0)>t.offsetWidth)return!0}catch(t){}return t.scrollWidth>t.offsetWidth},r.isUndefined=s,r.isValidColor=function(t){var e="transparent"===t;if(k.test(t))return!0;if(ot.test(t)&&!t.includes("rgba"))return!0;if(rt.test(t))return!0;if(it.test(t)&&!t.includes("hsla"))return!0;if(at.test(t))return!0;if(e)return!0;if("#invalid"===t||"invalid"===t)return!1;if(t.includes("rgb(")&&t.includes(", 0.5)"))return!1;if(t.includes("rgba(")&&!t.includes(", 0.5)")&&!t.includes(", 1)"))return!1;try{var n=document.createElement("div");return x(n,{"background-color":t}),"rgba(0, 0, 0, 0)"!==M(n,"backgroundColor")||e}catch(t){return!1}},r.isValidNumber=function(t){return"number"==typeof t&&!Number.isNaN(t)},r.log=_,r.normalizeClassName=E,r.objDataTypeList=["Object","Array","RegExp"],r.off=O,r.on=A,r.open=function(t,e,n){return vt("open",t,e,n=void 0===n?300:n)},r.parsePlacement=function(t){return{side:(t=t.split("-"))[0],align:t[1]||"center"}},r.parseRgbaString=ft,r.removeAllSpace=m,r.removeClass=function(e,t){var t=E(t).filter(function(t){return b(e,t)});0!==t.length&&(t=new RegExp("(^|\\s)("+t.join("|")+")(\\s|$)","g"),e.className=e.className.replace(t," ").replace(/\s+/g," ").trim())},r.removeElement=X,r.removeNode=n,r.removeStyle=function(t,e){for(var n=0,o=e=void 0===e?[]:e;n<o.length;n++){var r=o[n];t.style.removeProperty(r)}},r.rgbToHsl=function(t,e,n){t/=255,e/=255,n/=255;var o=Math.max(t,e,n),r=Math.min(t,e,n),i=0,a=0,s=(o+r)/2;if(o!==r){var c=o-r,a=.5<s?c/(2-o-r):c/(o+r);switch(o){case t:i=(e-n)/c+(e<n?6:0);break;case e:i=(n-t)/c+2;break;case n:i=(t-e)/c+4}i/=6}return{h:360*i,s:100*a,l:100*s}},r.rgbaToHex=function(t){function e(t){return Math.round(t).toString(16).padStart(2,"0")}return"#".concat(e(t.r)).concat(e(t.g)).concat(e(t.b))},r.setAttr=function(t,e){if(a(e))for(var n=0,o=Object.entries(e);n<o.length;n++){var r=o[n],i=r[0];t.setAttribute(i,"".concat(r[1]))}},r.setContent=function(t,e,n){var o=(n=void 0===n?{}:n).html,o=void 0!==o&&o,n=n.clone,n=void 0!==n&&n;t.textContent="","string"==typeof e?o?t.innerHTML=e:t.textContent=e:t.appendChild(n?e.cloneNode(!0):e)},r.setStyle=x,r.throttle=function(n,o){var r;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r||(n.apply(void 0,t),r=!0,setTimeout(function(){return r=!1},o))}},r.throwError=function(t){throw new Error("[ewColorPicker error]: ".concat(t))},r.tips=mt,r.toArray=function(t){return a(t)?Array.from?Array.from(t):V.call(t):t},r.toStyleStr=function(t){return t?c(t)?t:Object.entries(t).map(function(t){var e=t[0],t=t[1];return"".concat(e.replace(/([A-Z])/g,"-$1").toLowerCase(),":").concat(t)}).join(";"):""},r.tryErrorHandler=$,r.ua=e,r.upArrowIcon=function(t,e,n){void 0===n&&(n=S);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498631" class="'.concat(n,"color-picker-icon").concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4235"').concat(e,'><path d="M512 309.333333c8.533333 0 17.066667 2.133333 23.466667 8.533334l341.333333 341.333333c12.8 12.8 12.8 32 0 44.8-12.8 12.8-32 12.8-44.8 0L533.333333 374.4 215.466667 692.266667c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32 0-44.8L488.533333 317.866667c4.266667-8.533333 12.8-10.666667 21.333334-10.666667z" fill="currentColor" p-id="4236"></path></svg>')},r.warn=f,r.wrapperArrayValue=function(t){return v(t)?t:[t]}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ew-color-picker/utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.19",
|
|
4
4
|
"description": "utils for ew-color-picker",
|
|
5
5
|
"main": "dist/utils.min.js",
|
|
6
6
|
"module": "dist/utils.esm.mjs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"rimraf": "^3.0.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@ew-color-picker/core": "^2.0.
|
|
50
|
+
"@ew-color-picker/core": "^2.0.19"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"@ew-color-picker/core": {
|