Current File : /home/bqrcodec/contact.rohto.com.vn/wp-content/plugins/code-snippets-pro/dist//edit.js
(self.webpackChunkcode_snippets_pro=self.webpackChunkcode_snippets_pro||[]).push([[922],{8042:(t,e,r)=>{"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var i={css:"text/css",js:"javascript",php:"text/x-php",html:"application/x-httpd-php"};function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var a="dashicon-clipboard",l="dashicon-yes";function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var c,h,f,v,d,g=function(t){var e=-1!==document.body.className.indexOf("network-admin"),r=document.querySelector("input[name=snippet_id]"),n=r?parseInt(r.value,10):0,i="[code_snippet";n&&(i+=" id=".concat(n)),e&&(i+=" network=true");var o,a=s(t);try{for(a.s();!(o=a.n()).done;){var l=o.value;l.checked&&(i+=" ".concat(l.value,"=true"))}}catch(t){a.e(t)}finally{a.f()}i+="]";var u=document.querySelector(".html-scopes-list");if(u){var c=u.querySelector(".shortcode-tag");c&&(c.textContent=i)}},p=r(1002);function m(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach((function(e){m(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}r(9354),r(3178),function(){var t,e=window.wp.codeEditor,r=document.getElementById("snippet_code");if(r){var n=e.initialize(r);window.code_snippets_editor=n;var i=n.codemirror.getOption("extraKeys"),o=window.navigator.platform.match("Mac")?"Cmd":"Ctrl",a=function(){var t;return null===(t=document.getElementById("save_snippet"))||void 0===t?void 0:t.click()};if(n.codemirror.setOption("extraKeys",b(b({},"object"===(0,p.Z)(i)?i:{}),{},(m(t={},"".concat(o,"-S"),a),m(t,"".concat(o,"-Enter"),a),t))),window.navigator.platform.match("Mac")){var l=document.querySelector(".editor-help-text");l&&(l.className+=" platform-mac")}var s=document.getElementById("snippet-code-direction");null==s||s.addEventListener("change",(function(){var t;null===(t=window.code_snippets_editor)||void 0===t||t.codemirror.setOption("direction","rtl"===s.value?"rtl":"ltr")}))}else console.error("Could not initialise CodeMirror on textarea.",r)}(),function(){var t=document.getElementById("snippet-type-tabs");if(t){var e,r=document.getElementById("snippet-form"),o=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return l=t.done,t},e:function(t){s=!0,a=t},f:function(){try{l||null==r.return||r.return()}finally{if(s)throw a}}}}(t.querySelectorAll(".nav-tab"));try{var a=function(){var n=e.value;n.addEventListener("click",(function(e){if(!n.classList.contains("nav-tab-active")&&!n.classList.contains("nav-tab-inactive")){var o=n.getAttribute("data-type");e.preventDefault(),null==r||r.setAttribute("data-snippet-type",o),function(t,e){var r=t.querySelector(".nav-tab-active");null==r||r.setAttribute("href","#"),null==r||r.classList.remove("nav-tab-active"),e.classList.add("nav-tab-active"),e.removeAttribute("href")}(t,n),function(t,e){var r,n=null===(r=window.code_snippets_editor)||void 0===r?void 0:r.codemirror,o=null==e?void 0:e.querySelector(".".concat(t,"-scopes-list input:first-child"));o&&(o.checked=!0),null==n||n.setOption("lint","php"===t||"css"===t),t in i&&(null==n||n.setOption("mode",i[t]))}(o,r)}}))};for(o.s();!(e=o.n()).done;)a()}catch(t){o.e(t)}finally{o.f()}}}(),function(){var t,e=null===(t=document.querySelector(".html-shortcode-options"))||void 0===t?void 0:t.getElementsByTagName("input");if(e){var r,n=s(e);try{for(n.s();!(r=n.n()).done;)r.value.addEventListener("change",(function(){return g(e)}))}catch(t){n.e(t)}finally{n.f()}}}(),h=document.getElementById("snippet-form"),f=null===(c=window.code_snippets_editor)||void 0===c?void 0:c.codemirror,v=window.code_snippets_edit_i18n,d=document.querySelector("input[name=snippet_name]"),h&&f&&d&&h.addEventListener("submit",(function(t){var e,r=""===d.value.trim(),n=""===f.getValue().trim(),i=r?n?v.missing_title_code:v.missing_title:n?v.missing_code:"";null!=t&&null!==(e=t.submitter)&&void 0!==e&&e.id.startsWith("save_snippet")&&i&&!confirm(i)&&t.preventDefault()})),function(){var t,e=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return l=t.done,t},e:function(t){s=!0,a=t},f:function(){try{l||null==r.return||r.return()}finally{if(s)throw a}}}}(document.querySelectorAll(".code-snippets-copy-text"));try{var r=function(){var e=t.value;navigator.clipboard?e.addEventListener("click",(function(t){t.preventDefault();var r=e.getAttribute("data-text");r&&navigator.clipboard.writeText(r).then((function(){e.classList.replace(a,l),setTimeout((function(){return e.classList.replace(l,a)}),3e3)})).catch((function(t){return console.error(t)}))})):e.style.display="none"};for(e.s();!(t=e.n()).done;)r()}catch(t){e.e(t)}finally{e.f()}}()},9354:function(t,e,r){t.exports=function(){"use strict";function t(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgba(0, 0, 0, 0)";return Array.isArray(t)&&(t={r:t[0],g:t[1],b:t[2],a:t[3]}),"hex"==r?e(t):"rgb"==r?n(t,o):"hsl"==r?i(t):t}function e(t){Array.isArray(t)&&(t={r:t[0],g:t[1],b:t[2],a:t[3]});var e=t.r.toString(16);t.r<16&&(e="0"+e);var r=t.g.toString(16);t.g<16&&(r="0"+r);var n=t.b.toString(16);t.b<16&&(n="0"+n);var i="";if(t.a<1){var o=Math.floor(255*t.a);i=o.toString(16),o<16&&(i="0"+i)}return"#"+e+r+n+i}function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"rgba(0, 0, 0, 0)";if(Array.isArray(t)&&(t={r:t[0],g:t[1],b:t[2],a:t[3]}),void 0!==t)return 1==t.a||void 0===t.a?isNaN(t.r)?e:"rgb("+t.r+","+t.g+","+t.b+")":"rgba("+t.r+","+t.g+","+t.b+","+t.a+")"}function i(t){return Array.isArray(t)&&(t={r:t[0],g:t[1],b:t[2],a:t[3]}),1==t.a||void 0===t.a?"hsl("+t.h+","+t.s+"%,"+t.l+"%)":"hsla("+t.h+","+t.s+"%,"+t.l+"%,"+t.a+")"}var o={format:t,rgb:n,hsl:i,hex:e};function a(t,e){return e=void 0===e?1:e,Math.round(t*e)/e}function l(t){return t*Math.PI/180}function s(t){var e=180*t/Math.PI;return e<0&&(e=360+e),e}function u(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)+e*Math.cos(l(t))}function c(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)+e*Math.sin(l(t))}function h(t,e){return s(Math.atan2(e,t))}var f={round:a,radianToDegree:s,degreeToRadian:l,getXInCircle:u,getYInCircle:c,caculateAngle:h},v={aliceblue:"rgb(240, 248, 255)",antiquewhite:"rgb(250, 235, 215)",aqua:"rgb(0, 255, 255)",aquamarine:"rgb(127, 255, 212)",azure:"rgb(240, 255, 255)",beige:"rgb(245, 245, 220)",bisque:"rgb(255, 228, 196)",black:"rgb(0, 0, 0)",blanchedalmond:"rgb(255, 235, 205)",blue:"rgb(0, 0, 255)",blueviolet:"rgb(138, 43, 226)",brown:"rgb(165, 42, 42)",burlywood:"rgb(222, 184, 135)",cadetblue:"rgb(95, 158, 160)",chartreuse:"rgb(127, 255, 0)",chocolate:"rgb(210, 105, 30)",coral:"rgb(255, 127, 80)",cornflowerblue:"rgb(100, 149, 237)",cornsilk:"rgb(255, 248, 220)",crimson:"rgb(237, 20, 61)",cyan:"rgb(0, 255, 255)",darkblue:"rgb(0, 0, 139)",darkcyan:"rgb(0, 139, 139)",darkgoldenrod:"rgb(184, 134, 11)",darkgray:"rgb(169, 169, 169)",darkgrey:"rgb(169, 169, 169)",darkgreen:"rgb(0, 100, 0)",darkkhaki:"rgb(189, 183, 107)",darkmagenta:"rgb(139, 0, 139)",darkolivegreen:"rgb(85, 107, 47)",darkorange:"rgb(255, 140, 0)",darkorchid:"rgb(153, 50, 204)",darkred:"rgb(139, 0, 0)",darksalmon:"rgb(233, 150, 122)",darkseagreen:"rgb(143, 188, 143)",darkslateblue:"rgb(72, 61, 139)",darkslategray:"rgb(47, 79, 79)",darkslategrey:"rgb(47, 79, 79)",darkturquoise:"rgb(0, 206, 209)",darkviolet:"rgb(148, 0, 211)",deeppink:"rgb(255, 20, 147)",deepskyblue:"rgb(0, 191, 255)",dimgray:"rgb(105, 105, 105)",dimgrey:"rgb(105, 105, 105)",dodgerblue:"rgb(30, 144, 255)",firebrick:"rgb(178, 34, 34)",floralwhite:"rgb(255, 250, 240)",forestgreen:"rgb(34, 139, 34)",fuchsia:"rgb(255, 0, 255)",gainsboro:"rgb(220, 220, 220)",ghostwhite:"rgb(248, 248, 255)",gold:"rgb(255, 215, 0)",goldenrod:"rgb(218, 165, 32)",gray:"rgb(128, 128, 128)",grey:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",greenyellow:"rgb(173, 255, 47)",honeydew:"rgb(240, 255, 240)",hotpink:"rgb(255, 105, 180)",indianred:"rgb(205, 92, 92)",indigo:"rgb(75, 0, 130)",ivory:"rgb(255, 255, 240)",khaki:"rgb(240, 230, 140)",lavender:"rgb(230, 230, 250)",lavenderblush:"rgb(255, 240, 245)",lawngreen:"rgb(124, 252, 0)",lemonchiffon:"rgb(255, 250, 205)",lightblue:"rgb(173, 216, 230)",lightcoral:"rgb(240, 128, 128)",lightcyan:"rgb(224, 255, 255)",lightgoldenrodyellow:"rgb(250, 250, 210)",lightgreen:"rgb(144, 238, 144)",lightgray:"rgb(211, 211, 211)",lightgrey:"rgb(211, 211, 211)",lightpink:"rgb(255, 182, 193)",lightsalmon:"rgb(255, 160, 122)",lightseagreen:"rgb(32, 178, 170)",lightskyblue:"rgb(135, 206, 250)",lightslategray:"rgb(119, 136, 153)",lightslategrey:"rgb(119, 136, 153)",lightsteelblue:"rgb(176, 196, 222)",lightyellow:"rgb(255, 255, 224)",lime:"rgb(0, 255, 0)",limegreen:"rgb(50, 205, 50)",linen:"rgb(250, 240, 230)",magenta:"rgb(255, 0, 255)",maroon:"rgb(128, 0, 0)",mediumaquamarine:"rgb(102, 205, 170)",mediumblue:"rgb(0, 0, 205)",mediumorchid:"rgb(186, 85, 211)",mediumpurple:"rgb(147, 112, 219)",mediumseagreen:"rgb(60, 179, 113)",mediumslateblue:"rgb(123, 104, 238)",mediumspringgreen:"rgb(0, 250, 154)",mediumturquoise:"rgb(72, 209, 204)",mediumvioletred:"rgb(199, 21, 133)",midnightblue:"rgb(25, 25, 112)",mintcream:"rgb(245, 255, 250)",mistyrose:"rgb(255, 228, 225)",moccasin:"rgb(255, 228, 181)",navajowhite:"rgb(255, 222, 173)",navy:"rgb(0, 0, 128)",oldlace:"rgb(253, 245, 230)",olive:"rgb(128, 128, 0)",olivedrab:"rgb(107, 142, 35)",orange:"rgb(255, 165, 0)",orangered:"rgb(255, 69, 0)",orchid:"rgb(218, 112, 214)",palegoldenrod:"rgb(238, 232, 170)",palegreen:"rgb(152, 251, 152)",paleturquoise:"rgb(175, 238, 238)",palevioletred:"rgb(219, 112, 147)",papayawhip:"rgb(255, 239, 213)",peachpuff:"rgb(255, 218, 185)",peru:"rgb(205, 133, 63)",pink:"rgb(255, 192, 203)",plum:"rgb(221, 160, 221)",powderblue:"rgb(176, 224, 230)",purple:"rgb(128, 0, 128)",rebeccapurple:"rgb(102, 51, 153)",red:"rgb(255, 0, 0)",rosybrown:"rgb(188, 143, 143)",royalblue:"rgb(65, 105, 225)",saddlebrown:"rgb(139, 69, 19)",salmon:"rgb(250, 128, 114)",sandybrown:"rgb(244, 164, 96)",seagreen:"rgb(46, 139, 87)",seashell:"rgb(255, 245, 238)",sienna:"rgb(160, 82, 45)",silver:"rgb(192, 192, 192)",skyblue:"rgb(135, 206, 235)",slateblue:"rgb(106, 90, 205)",slategray:"rgb(112, 128, 144)",slategrey:"rgb(112, 128, 144)",snow:"rgb(255, 250, 250)",springgreen:"rgb(0, 255, 127)",steelblue:"rgb(70, 130, 180)",tan:"rgb(210, 180, 140)",teal:"rgb(0, 128, 128)",thistle:"rgb(216, 191, 216)",tomato:"rgb(255, 99, 71)",turquoise:"rgb(64, 224, 208)",violet:"rgb(238, 130, 238)",wheat:"rgb(245, 222, 179)",white:"rgb(255, 255, 255)",whitesmoke:"rgb(245, 245, 245)",yellow:"rgb(255, 255, 0)",yellowgreen:"rgb(154, 205, 50)",transparent:"rgba(0, 0, 0, 0)"};var d={isColorName:function(t){return!!v[t]},getColorByName:function(t){return v[t]}};function g(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function p(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.h,e=n.s,r=n.l}var i,o,l;if(t/=360,r/=100,0==(e/=100))i=o=l=r;else{var s=r<.5?r*(1+e):r+e-r*e,u=2*r-s;i=g(u,s,t+1/3),o=g(u,s,t),l=g(u,s,t-1/3)}return{r:a(255*i),g:a(255*o),b:a(255*l)}}var m={HUEtoRGB:g,HSLtoHSV:function(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.h,e=n.s,r=n.l}var i=p(t,e,r);return j(i.r,i.g,i.b)},HSLtoRGB:p},y=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},b=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),$=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},k=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},C=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(n):void 0},x=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},_=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},w=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,l=t[Symbol.iterator]();!(n=(a=l.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&l.return&&l.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},O=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)},S=/(#(?:[\da-f]{8})|#(?:[\da-f]{3}){1,2}|rgb\((?:\s*\d{1,3},\s*){2}\d{1,3}\s*\)|rgba\((?:\s*\d{1,3},\s*){3}\d*\.?\d+\s*\)|hsl\(\s*\d{1,3}(?:,\s*\d{1,3}%){2}\s*\)|hsla\(\s*\d{1,3}(?:,\s*\d{1,3}%){2},\s*\d*\.?\d+\s*\)|([\w_\-]+))/gi;function E(t){var e=t.match(S),r=[];if(!e)return r;for(var n=0,i=e.length;n<i;n++)if(e[n].indexOf("#")>-1||e[n].indexOf("rgb")>-1||e[n].indexOf("hsl")>-1)r.push({color:e[n]});else{var o=d.getColorByName(e[n]);o&&r.push({color:e[n],nameColor:o})}var a={next:0};return r.forEach((function(e){var r=t.indexOf(e.color,a.next);e.startIndex=r,e.endIndex=r+e.color.length,a.next=e.endIndex})),r}function M(t){var e=E(t);return e.forEach((function(e,r){t=t.replace(e.color,"@"+r)})),{str:t,matches:e}}function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",",r=M(t);return r.str.split(e).map((function(t,e){return t=T(t),r.matches[e]&&(t=t.replace("@"+e,r.matches[e].color)),t}))}function I(t,e){return e.forEach((function(e,r){t=t.replace("@"+r,e.color)})),t}function T(t){return t.replace(/^\s+|\s+$/g,"")}function P(t){if("string"==typeof t){if(d.isColorName(t)&&(t=d.getColorByName(t)),t.indexOf("rgb(")>-1){for(var e=0,r=(i=t.replace("rgb(","").replace(")","").split(",")).length;e<r;e++)i[e]=parseInt(T(i[e]),10);var n={type:"rgb",r:i[0],g:i[1],b:i[2],a:1};return Object.assign(n,R(n))}if(t.indexOf("rgba(")>-1){for(e=0,r=(i=t.replace("rgba(","").replace(")","").split(",")).length;e<r;e++)i[e]=r-1==e?parseFloat(T(i[e])):parseInt(T(i[e]),10);return n={type:"rgb",r:i[0],g:i[1],b:i[2],a:i[3]},Object.assign(n,R(n))}if(t.indexOf("hsl(")>-1){for(e=0,r=(i=t.replace("hsl(","").replace(")","").split(",")).length;e<r;e++)i[e]=parseFloat(T(i[e]));return n={type:"hsl",h:i[0],s:i[1],l:i[2],a:1},Object.assign(n,p(n))}if(t.indexOf("hsla(")>-1){for(e=0,r=(i=t.replace("hsla(","").replace(")","").split(",")).length;e<r;e++)i[e]=r-1==e?parseFloat(T(i[e])):parseInt(T(i[e]),10);return n={type:"hsl",h:i[0],s:i[1],l:i[2],a:i[3]},Object.assign(n,p(n))}if(0==t.indexOf("#")){var i=[],o=1;if(3==(t=t.replace("#","")).length)for(e=0,r=t.length;e<r;e++){var a=t.substr(e,1);i.push(parseInt(a+a,16))}else if(8===t.length){for(e=0,r=t.length;e<r;e+=2)i.push(parseInt(t.substr(e,2),16));o=i.pop()/255}else for(e=0,r=t.length;e<r;e+=2)i.push(parseInt(t.substr(e,2),16));return n={type:"hex",r:i[0],g:i[1],b:i[2],a:o},Object.assign(n,R(n))}}else if("number"==typeof t){if(0<=t&&t<=16777215)return n={type:"hex",r:(16711680&t)>>16,g:(65280&t)>>8,b:(255&t)>>0,a:1},Object.assign(n,R(n));if(0<=t&&t<=4294967295)return n={type:"hex",r:(4278190080&t)>>24,g:(16711680&t)>>16,b:(65280&t)>>8,a:(255&t)/255},Object.assign(n,R(n))}return t}function D(t){"string"==typeof t&&(t=A(t));var e=(t=t.map((function(t){if("string"==typeof t){var e=M(t),r=T(e.str).split(" ");return r[1]?r[1].includes("%")?r[1]=parseFloat(r[1].replace(/%/,""))/100:r[1]=parseFloat(r[1]):r[1]="*",r[0]=I(r[0],e.matches),r}if(Array.isArray(t))return t[1]?"string"==typeof t[1]&&(t[1].includes("%")?t[1]=parseFloat(t[1].replace(/%/,""))/100:t[1]=+t[1]):t[1]="*",[].concat(O(t))}))).filter((function(t){return"*"===t[1]})).length;if(e>0){var r=(1-t.filter((function(t){return"*"!=t[1]&&1!=t[1]})).map((function(t){return t[1]})).reduce((function(t,e){return t+e}),0))/e;t.forEach((function(e,n){"*"==e[1]&&n>0&&(t.length-1==n||(e[1]=r))}))}return t}var B={matches:E,convertMatches:M,convertMatchesArray:A,reverseMatches:I,parse:P,parseGradient:D,trim:T,color_regexp:S,color_split:","};function j(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.r,e=n.g,r=n.b}var i=t/255,o=e/255,a=r/255,l=Math.max(i,o,a),s=l-Math.min(i,o,a),u=0;return 0==s?u=0:l==i?u=(o-a)/s%6*60:l==o?u=60*((a-i)/s+2):l==a&&(u=60*((i-o)/s+4)),u<0&&(u=360+u),{h:u,s:0==l?0:s/l,v:l}}function R(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.r,e=n.g,r=n.b}t/=255,e/=255,r/=255;var i,o,l=Math.max(t,e,r),s=Math.min(t,e,r),u=(l+s)/2;if(l==s)i=o=0;else{var c=l-s;switch(o=u>.5?c/(2-l-s):c/(l+s),l){case t:i=(e-r)/c+(e<r?6:0);break;case e:i=(r-t)/c+2;break;case r:i=(t-e)/c+4}i/=6}return{h:a(360*i),s:a(100*o),l:a(100*u)}}function U(t){return{r:t,g:t,b:t}}function F(t,e,r){return Math.ceil(.2126*t+.7152*e+.0722*r)}function L(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.r,e=n.g,r=n.b}var i=F(t,e,r);return{y:i,cr:.713*(t-i),cb:.564*(r-i)}}function H(t){return 100*(t>(arguments.length>1&&void 0!==arguments[1]?arguments[1]:.04045)?Math.pow((t+.055)/1.055,2.4):t/12.92)}function V(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.r,e=n.g,r=n.b}var i=t/255,o=e/255,a=r/255;return{x:.4124*(i=H(i))+.3576*(o=H(o))+.1805*(a=H(a)),y:.2126*i+.7152*o+.0722*a,z:.0193*i+.1192*o+.9505*a}}var N={RGBtoCMYK:function(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.r,e=n.g,r=n.b}var i=t/255,o=e/255,a=r/255,l=1-Math.max(i,o,a);return{c:(1-i-l)/(1-l),m:(1-o-l)/(1-l),y:(1-a-l)/(1-l),k:l}},RGBtoGray:function(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.r,e=n.g,r=n.b}return U(L(t,e,r).y)},RGBtoHSL:R,RGBtoHSV:j,RGBtoLAB:function(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.r,e=n.g,r=n.b}return XYZtoLAB(V(t,e,r))},RGBtoSimpleGray:function(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.r,e=n.g,r=n.b}return U(Math.ceil((t+e+r)/3))},RGBtoXYZ:V,RGBtoYCrCb:L,c:function(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.r,e=n.g,r=n.b}return U((t+e+r)/3>90?0:255)},brightness:F,gray:U};var G={CMYKtoRGB:function(t,e,r,n){if(1==arguments.length){var i=arguments[0];t=i.c,e=i.m,r=i.y,n=i.k}return{r:255*(1-t)*(1-n),g:255*(1-e)*(1-n),b:255*(1-r)*(1-n)}}};function z(t){return Math.pow(t,3)>.008856?Math.pow(t,3):(t-16/116)/7.787}function X(t){return t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t}function q(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.x,e=n.y,r=n.z}var i=t/100,o=e/100,l=r/100,s=3.2406*i+-1.5372*o+-.4986*l,u=-.9689*i+1.8758*o+.0415*l,c=.0557*i+-.204*o+1.057*l;return s=X(s),u=X(u),c=X(c),{r:a(255*s),g:a(255*u),b:a(255*c)}}function Y(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.l,e=n.a,r=n.b}var i=(t+16)/116,o=e/500+i,a=i-r/200;return i=z(i),{x:95.047*(o=z(o)),y:100*i,z:108.883*(a=z(a))}}var W={XYZtoRGB:q,LABtoRGB:function(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.l,e=n.a,r=n.b}return q(Y(t,e,r))},LABtoXYZ:Y};function K(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.h,e=n.s,r=n.v}var i=t,o=r;i>=360&&(i=0);var l=e*o,s=l*(1-Math.abs(i/60%2-1)),u=o-l,c=[];return 0<=i&&i<60?c=[l,s,0]:60<=i&&i<120?c=[s,l,0]:120<=i&&i<180?c=[0,l,s]:180<=i&&i<240?c=[0,s,l]:240<=i&&i<300?c=[s,0,l]:300<=i&&i<360&&(c=[l,0,s]),{r:a(255*(c[0]+u)),g:a(255*(c[1]+u)),b:a(255*(c[2]+u))}}var Z={HSVtoHSL:function(t,e,r){if(1==arguments.length){var n=arguments[0];t=n.h,e=n.s,r=n.v}var i=K(t,e,r);return R(i.r,i.g,i.b)},HSVtoRGB:K};var J={YCrCbtoRGB:function(t,e,r,n){if(1==arguments.length){var i=arguments[0];t=i.y,e=i.cr,r=i.cb,n=(n=i.bit)||0}var o=t+1.402*(e-n),a=t-.344*(r-n)-.714*(e-n),l=t+1.772*(r-n);return{r:Math.ceil(o),g:Math.ceil(a),b:Math.ceil(l)}}};function Q(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"hex",o={r:a(e.r+(r.r-e.r)*n),g:a(e.g+(r.g-e.g)*n),b:a(e.b+(r.b-e.b)*n),a:a(e.a+(r.a-e.a)*n,100)};return t(o,o.a<1?"rgb":i)}function tt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;if(!t)return[];"string"==typeof t&&(t=A(t));for(var r=(t=t||[]).length,n=[],i=0;i<r-1;i++)for(var o=0;o<e;o++)n.push(et(t[i],t[i+1],o/e));return n}function et(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"hex";return Q(P(t),P(e),r,n)}function rt(t){return t=P(t),(Math.round(299*t.r)+Math.round(587*t.g)+Math.round(114*t.b))/1e3}function nt(e){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"h",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"rgb",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:100,s=j(P(e)),u=(a-o)*l/n,c=[],h=1;h<=n;h++)s[r]=Math.abs((l-u*h)/l),c.push(t(K(s),i));return c}tt.parula=function(t){return tt(["#352a87","#0f5cdd","#00b5a6","#ffc337","#fdff00"],t)},tt.jet=function(t){return tt(["#00008f","#0020ff","#00ffff","#51ff77","#fdff00","#ff0000","#800000"],t)},tt.hsv=function(t){return tt(["#ff0000","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ff0000"],t)},tt.hot=function(t){return tt(["#0b0000","#ff0000","#ffff00","#ffffff"],t)},tt.pink=function(t){return tt(["#1e0000","#bd7b7b","#e7e5b2","#ffffff"],t)},tt.bone=function(t){return tt(["#000000","#4a4a68","#a6c6c6","#ffffff"],t)},tt.copper=function(t){return tt(["#000000","#3d2618","#9d623e","#ffa167","#ffc77f"],t)};var it={interpolateRGB:Q,blend:et,mix:function(t,e){return et(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5,arguments.length>3&&void 0!==arguments[3]?arguments[3]:"hex")},scale:tt,contrast:rt,contrastColor:function(t){return rt(t)>=128?"black":"white"},gradient:function(t){for(var e=[],r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:10)-((t=D(t)).length-1),n=r,i=1,o=t.length;i<o;i++){var a=t[i-1][0],l=t[i][0],s=1==i?t[i][1]:t[i][1]-t[i-1][1],u=i==t.length-1?n:Math.floor(s*r);e=e.concat(tt([a,l],u),[l]),n-=u}return e},scaleHSV:nt,scaleH:function(t){return nt(t,"h",arguments.length>1&&void 0!==arguments[1]?arguments[1]:9,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgb",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,arguments.length>4&&void 0!==arguments[4]?arguments[4]:360,1)},scaleS:function(t){return nt(t,"s",arguments.length>1&&void 0!==arguments[1]?arguments[1]:9,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgb",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,100)},scaleV:function(t){return nt(t,"v",arguments.length>1&&void 0!==arguments[1]?arguments[1]:9,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgb",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,100)}};function ot(t,e){if(t.length!==e.length)return!1;for(var r=0,n=t.length;r<n;++r)if(t[r]!==e[r])return!1;return!0}var at={euclidean:function(t,e){for(var r=0,n=0,i=t.length;n<i;n++)r+=Math.pow(e[n]-t[n],2);return Math.sqrt(r)},manhattan:function(t,e){for(var r=0,n=0,i=t.length;n<i;n++)r+=Math.abs(e[n]-t[n]);return r},max:function(t,e){for(var r=0,n=0,i=t.length;n<i;n++)r=Math.max(r,Math.abs(e[n]-t[n]));return r}},lt={linear:function(t,e){var r=[],n=Math.round(Math.random()*t),i=Math.floor(t/e);do{r.push(n),n=(n+i)%t}while(r.length<e);return r},shuffle:function(t,e){for(var r=[];r.length<e;){var n=Math.round(Math.random()*t);-1==r.indexOf(n)&&r.push(n)}return r}};function st(t,e){return lt[arguments.length>2&&void 0!==arguments[2]?arguments[2]:"linear"](t.length,e).map((function(e){return t[e]}))}function ut(t,e,r){var n=1/0,i=0;return e.forEach((function(e,o){var a=r(t,e);a<n&&(n=a,i=o)})),i}function ct(t){if(!t.length)return[];for(var e=new Array(t[0].length),r=0,n=e.length;r<n;r++)e[r]=0;var i=0;for(n=t.length;i<n;i++)for(var o=t[i],a=i+1,l=0,s=o.length;l<s;l++)e[l]+=(o[l]-e[l])/a;return e=e.map((function(t){return Math.floor(t)})),e}function ht(t,e,r,n){for(var i=new Array(t),o=0;o<t;o++)i[o]=[];for(var a=0,l=e.length;a<l;a++){var s=e[a];i[ut(s,r,n)].push(s)}return i}function ft(t,e,r,n,i,o){for(var a=0;a<t;a++){var l=r[a],s=n[a],u=new Array(s.length);i=!ot(u=l.length>0?ct(l):e[Math.floor(o()*e.length)],s),n[a]=u}return i}function vt(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"linear";e=e||Math.max(2,Math.ceil(Math.sqrt(t.length/2)));var o=r||"euclidean";"string"==typeof o&&(o=at[o]);for(var a=0,l=function(){return(a=(9301*a+49297)%233280)/233280},s=st(t,e,i),u=!0,c=0;u&&(u=ft(e,t,ht(e,t,s,o),s,!1,l),++c%n!=0););return s}var dt={create:function(t,e){var r=document.createElement("canvas");return r.width=t||0,r.height=e||0,r},drawPixels:function(t){var e=this.create(t.width,t.height),r=e.getContext("2d"),n=r.getImageData(0,0,e.width,e.height);return n.data.set(t.pixels),r.putImageData(n,0,0),e},createHistogram:function(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{black:!0,red:!1,green:!1,blue:!1},o=this.create(t,e),a=o.getContext("2d");a.clearRect(0,0,t,e),a.fillStyle="white",a.fillRect(0,0,t,e),a.globalAlpha=.7;var l={black:!1};i.black?l.black=!1:l.black=!0,i.red?l.red=!1:l.red=!0,i.green?l.green=!1:l.green=!0,i.blue?l.blue=!1:l.blue=!0,Object.keys(r).forEach((function(n){if(!l[n]){var i=r[n],o=Math.max.apply(Math,i),s=t/i.length;a.fillStyle=n,i.forEach((function(t,r){var n=e*(t/o),i=r*s;a.fillRect(i,e-n,s,n)}))}})),"function"==typeof n&&n(o)},getHistogram:function(t){for(var e=new Array(256),r=new Array(256),n=new Array(256),i=new Array(256),o=0;o<256;o++)e[o]=0,r[o]=0,n[o]=0,i[o]=0;return function(t,e){!function(t,e){for(var r=0;r<t;r+=4)e(r)}(t.pixels.length,(function(r){e(t.pixels,r)}))}(t,(function(t,o){var a=Math.round(Je.brightness(t[o],t[o+1],t[o+2]));e[a]++,r[t[o]]++,n[t[o+1]]++,i[t[o+2]]++})),{black:e,red:r,green:n,blue:i}},getBitmap:function(t,e){var r=this.drawPixels(t);return{pixels:r.getContext("2d").getImageData(e.x||0,e.y||0,e.width||r.width,e.height||r.height).data,width:e.width,height:e.height}},putBitmap:function(t,e,r){var n=this.drawPixels(t),i=this.drawPixels(e),o=n.getContext("2d");return o.drawImage(i,r.x,r.y),t.pixels=o.getImageData(0,0,t.width,t.height).data,t}},gt=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y(this,t),this.isLoaded=!1,this.imageUrl=e,this.opt=r,this.initialize()}return b(t,[{key:"initialize",value:function(){this.canvas=this.createCanvas(),this.context=this.canvas.getContext("2d")}},{key:"createCanvas",value:function(){return document.createElement("canvas")}},{key:"load",value:function(t){this.loadImage(t)}},{key:"loadImage",value:function(t){var e=this,r=this.context;this.newImage=new Image;var n=this.newImage;n.onload=function(){var i=n.height/n.width;e.opt.canvasWidth&&e.opt.canvasHeight?(e.canvas.width=e.opt.canvasWidth,e.canvas.height=e.opt.canvasHeight):(e.canvas.width=e.opt.maxWidth?e.opt.maxWidth:n.width,e.canvas.height=e.canvas.width*i),r.drawImage(n,0,0,n.width,n.height,0,0,e.canvas.width,e.canvas.height),e.isLoaded=!0,t&&t()},this.getImageUrl((function(t){n.src=t}))}},{key:"load",value:function(t){var e=this;this.newImage=new Image;var r=this.newImage;r.onload=function(){e.isLoaded=!0,t&&t()},this.getImageUrl((function(t){r.src=t}))}},{key:"getImageUrl",value:function(t){if("string"==typeof this.imageUrl)return t(this.imageUrl);if(this.imageUrl instanceof Blob){var e=new FileReader;e.onload=function(e){t(e.target.result)},e.readAsDataURL(this.imageUrl)}}},{key:"getRGBA",value:function(t,e,r,n){return[t,e,r,n]}},{key:"toArray",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.context.getImageData(0,0,this.canvas.width,this.canvas.height),i=n.width,o=n.height;t||(t=function(t,e){e(t)}),t({pixels:new Uint8ClampedArray(n.data),width:i,height:o},(function(t){var n=dt.drawPixels(t);"canvas"==r.returnTo?e(n):e(n.toDataURL(r.outputFormat||"image/png"))}),r)}},{key:"toHistogram",value:function(t){var e=this.context.getImageData(0,0,this.canvas.width,this.canvas.height),r=e.width,n=e.height,i={pixels:new Uint8ClampedArray(e.data),width:r,height:n};return dt.getHistogram(i)}},{key:"toRGB",value:function(){for(var t=this.context.getImageData(0,0,this.canvas.width,this.canvas.height).data,e=[],r=0,n=t.length;r<n;r+=4)e[e.length]=[t[r+0],t[r+1],t[r+2],t[r+3]];return e}}]),t}(),pt={identity:function(){return[1,0,0,0,1,0,0,0,1]},stretching:function(t){return[t,0,0,0,1,0,0,0,1]},squeezing:function(t){return[t,0,0,0,1/t,0,0,0,1]},scale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return[t=t||0===t?t:1,0,0,0,e=e||0===e?e:1,0,0,0,1]},scaleX:function(t){return this.scale(t)},scaleY:function(t){return this.scale(1,t)},translate:function(t,e){return[1,0,t,0,1,e,0,0,1]},rotate:function(t){var e=this.radian(t);return[Math.cos(e),-Math.sin(e),0,Math.sin(e),Math.cos(e),0,0,0,1]},rotate90:function(){return[0,-1,0,1,0,0,0,0,1]},rotate180:function(){return[-1,0,0,0,-1,0,0,0,1]},rotate270:function(){return[0,1,0,-1,0,0,0,0,1]},radian:function(t){return t*Math.PI/180},skew:function(t,e){var r=this.radian(t),n=this.radian(e);return[1,Math.tan(r),0,Math.tan(n),1,0,0,0,1]},skewX:function(t){var e=this.radian(t);return[1,Math.tan(e),0,0,1,0,0,0,1]},skewY:function(t){var e=this.radian(t);return[1,0,0,Math.tan(e),1,0,0,0,1]},shear1:function(t){return[1,-Math.tan(this.radian(t)/2),0,0,1,0,0,0,1]},shear2:function(t){return[1,0,0,Math.sin(this.radian(t)),1,0,0,0,1]}},mt={CONSTANT:pt,radian:function(t){return pt.radian(t)},multiply:function(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2],t[3]*e[0]+t[4]*e[1]+t[5]*e[2],t[6]*e[0]+t[7]*e[1]+t[8]*e[2]]},identity:function(t){return this.multiply(pt.identity(),t)},translate:function(t,e,r){return this.multiply(pt.translate(t,e),r)},rotate:function(t,e){return this.multiply(pt.rotate(t),e)},shear1:function(t,e){return this.multiply(pt.shear1(t),e)},shear2:function(t,e){return this.multiply(pt.shear2(t),e)},rotateShear:function(t,e){var r=e;return r=this.shear1(t,r),r=this.shear2(t,r),this.shear1(t,r)}};function yt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"center",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"center";return function(n,i){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=qt(n.pixels.length,n.width,n.height),l=n.width,s=n.height;"center"==e&&(e=Math.floor(l/2)),"center"==r&&(r=Math.floor(s/2));var u=mt.CONSTANT.translate(-e,-r),c=mt.CONSTANT.translate(e,r),h=mt.CONSTANT.shear1(t),f=mt.CONSTANT.shear2(t);le((function(t,e,r,i){var o=mt.multiply(u,[r,i,1]);o=mt.multiply(h,o).map(Math.round),o=mt.multiply(f,o).map(Math.round),o=mt.multiply(h,o).map(Math.round),o=mt.multiply(c,o);var a=w(o,2),v=a[0],d=a[1];v<0||d<0||v>l-1||d>s-1||ce(t,d*l+v<<2,n.pixels,e)}))(a,(function(){i(a)}),o)}}function bt(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=Qt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:200);return ie("\n // refer to Color.brightness \n const v = ($C * Math.ceil($r * 0.2126 + $g * 0.7152 + $b * 0.0722) ) >= $scale ? 255 : 0;\n\n if ($hasColor) {\n\n if (v == 0) {\n $r = 0 \n $g = 0 \n $b = 0\n }\n \n } else {\n const value = Math.round(v)\n $r = value \n $g = value \n $b = value \n }\n \n ",{$C:(t=Qt(t))/100,$scale:r,$hasColor:e})}function $t(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ve(Ht([1,2,1,2,4,2,1,2,1],1/16*((t=Qt(t))/100)))}function kt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ve(Ht([1,4,6,4,1,4,16,24,16,4,6,24,36,24,6,4,16,24,16,4,1,4,6,4,1],1/256*((t=Qt(t))/100)))}function Ct(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return t=Qt(t),ve([5,5,5,-3,0,-3,-3,-3,-3])}function xt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return t=Qt(t),ve([5,-3,-3,5,0,-3,5,-3,-3])}function _t(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ve(Ht([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],(t=Qt(t))/100))}function wt(){return ve(Ht([1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1],1/9))}function Ot(){return ve(Ht([1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1],1/9))}function St(){return ve(Ht([1,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1],1/9))}function Et(){return ve([-1,-2,-1,0,0,0,1,2,1])}function Mt(){return ve([-1,0,1,-2,0,2,-1,0,1])}var At=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],It=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Tt(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}function Pt(t,e,r){return r?function(t,e,r,n){if(isNaN(n)||n<1)return t;n|=0;var i,o,a,l,s,u,c,h,f,v,d,g,p,m,y,b,$,k,C,x,_=t.pixels,w=t.width,O=t.height,S=n+n+1,E=w-1,M=O-1,A=n+1,I=A*(A+1)/2,T=new Tt,P=T;for(a=1;a<S;a++)if(P=P.next=new Tt,a==A)var D=P;P.next=T;var B=null,j=null;c=u=0;var R=At[n],U=It[n];for(o=0;o<O;o++){for(m=y=b=h=f=v=0,d=A*($=_[u]),g=A*(k=_[u+1]),p=A*(C=_[u+2]),h+=I*$,f+=I*k,v+=I*C,P=T,a=0;a<A;a++)P.r=$,P.g=k,P.b=C,P=P.next;for(a=1;a<A;a++)l=u+((E<a?E:a)<<2),h+=(P.r=$=_[l])*(x=A-a),f+=(P.g=k=_[l+1])*x,v+=(P.b=C=_[l+2])*x,m+=$,y+=k,b+=C,P=P.next;for(B=T,j=D,i=0;i<w;i++)_[u]=h*R>>U,_[u+1]=f*R>>U,_[u+2]=v*R>>U,h-=d,f-=g,v-=p,d-=B.r,g-=B.g,p-=B.b,l=c+((l=i+n+1)<E?l:E)<<2,h+=m+=B.r=_[l],f+=y+=B.g=_[l+1],v+=b+=B.b=_[l+2],B=B.next,d+=$=j.r,g+=k=j.g,p+=C=j.b,m-=$,y-=k,b-=C,j=j.next,u+=4;c+=w}for(i=0;i<w;i++){for(y=b=m=f=v=h=0,d=A*($=_[u=i<<2]),g=A*(k=_[u+1]),p=A*(C=_[u+2]),h+=I*$,f+=I*k,v+=I*C,P=T,a=0;a<A;a++)P.r=$,P.g=k,P.b=C,P=P.next;for(s=w,a=1;a<=n;a++)u=s+i<<2,h+=(P.r=$=_[u])*(x=A-a),f+=(P.g=k=_[u+1])*x,v+=(P.b=C=_[u+2])*x,m+=$,y+=k,b+=C,P=P.next,a<M&&(s+=w);for(u=i,B=T,j=D,o=0;o<O;o++)_[l=u<<2]=h*R>>U,_[l+1]=f*R>>U,_[l+2]=v*R>>U,h-=d,f-=g,v-=p,d-=B.r,g-=B.g,p-=B.b,l=i+((l=o+A)<M?l:M)*w<<2,h+=m+=B.r=_[l],f+=y+=B.g=_[l+1],v+=b+=B.b=_[l+2],B=B.next,d+=$=j.r,g+=k=j.g,p+=C=j.b,m-=$,y-=k,b-=C,j=j.next,u+=w}return t}(t,0,0,e):stackBlurCanvasRGB(t,0,0,e)}function Dt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t=Qt(t),function(r,n){n(Pt(r,t,e))}}function Bt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:256;return ve(Ht([1,4,6,4,1,4,16,24,16,4,6,24,-476,24,6,4,16,24,16,4,1,4,6,4,1],-1/(t=Qt(t))))}var jt,Rt=k({},{crop:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments[2],n=arguments[3],i=qt(r*n*4,r,n);return function(o,a){for(var l=e,s=0;l<n;l++,s++)for(var u=t,c=0;u<r;u++,c++)i.pixels[s*r*c]=o.pixels[l*r*u];a(i)}},resize:function(t,e){return function(r,n){var i=dt.drawPixels(r),o=i.getContext("2d");i.width=t,i.height=e,n({pixels:new Uint8ClampedArray(o.getImageData(0,0,t,e).data),width:t,height:e})}},flipH:function(){return function(t,e){for(var r=t.width,n=t.height,i=r%2==1?Math.floor(r/2):r/2,o=0;o<n;o++)for(var a=0;a<i;a++){var l=o*r+a<<2,s=o*r+(r-1-a)<<2;ae(t.pixels,l,s)}e(t)}},flipV:function(){return function(t,e){for(var r=t.width,n=t.height,i=n%2==1?Math.floor(n/2):n/2,o=0;o<i;o++)for(var a=0;a<r;a++){var l=o*r+a<<2,s=(n-1-o)*r+a<<2;ae(t.pixels,l,s)}e(t)}},rotate:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t=Qt(t),t%=360,function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(0==t)return e;if(90==t||270==t)var i=qt(e.pixels.length,e.height,e.width);else{if(180!=t)return yt(t)(e,r,n);i=qt(e.pixels.length,e.width,e.height)}le((function(r,n,o,a){if(90==t)var l=o*i.width+(i.width-1-a)<<2;else 270==t?l=(i.height-1-o)*i.width+a<<2:180==t&&(l=(i.height-1-a)*i.width+(i.width-1-o)<<2);ce(i.pixels,l,e.pixels,n)}))(e,(function(){r(i)}),n)}},rotateDegree:yt,histogram:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"gray",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=[],n=0;n<e.length-1;n++)for(var i=e[n],o=e[n+1],a=o[0]-i[0],l=(o[1]-i[1])/a,s=0,u=i[0];s<a;s++,u++)r[u]=i[1]+s*l;return r[255]=255,ie("red"===t?function(){$r=r[$r]}:"green"===t?function(){$g=r[$g]}:"blue"===t?function(){$b=r[$b]}:function(){var t=Color.RGBtoYCrCb($r,$g,$b),e=Color.YCrCbtoRGB(clamp(r[clamp(t.y)]),t.cr,t.cb,0);$r=e.r,$g=e.g,$b=e.b},{},{$realPoints:r})},"rotate-degree":yt},{bitonal:function(t,e){return ie("\n const thresholdColor = ( $r + $g + $b ) <= $threshold ? $darkColor : $lightColor\n\n $r = thresholdColor.r\n $g = thresholdColor.g \n $b = thresholdColor.b \n ",{$threshold:arguments.length>2&&void 0!==arguments[2]?arguments[2]:100},{$darkColor:Je.parse(t),$lightColor:Je.parse(e)})},brightness:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return t=Qt(t),ie("\n $r += $C \n $g += $C \n $b += $C \n ",{$C:Math.floor(t/100*255)})},brownie:function(){return ie("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[.5997023498159715,.34553243048391263,-.2708298674538042,0,-.037703249837783157,.8609577587992641,.15059552388459913,0,.24113635128153335,-.07441037908422492,.44972182064877153,0,0,0,0,1]})},clip:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t=Qt(t),ie("\n\n $r = ($r > 255 - $C) ? 255 : 0\n $g = ($g > 255 - $C) ? 255 : 0\n $b = ($b > 255 - $C) ? 255 : 0\n\n ",{$C:2.55*Math.abs(t)})},contrast:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t=Qt(t),ie("\n $r *= $C\n $g *= $C\n $b *= $C\n ",{$C:Math.max((128+t)/128,0)})},gamma:function(){return ie("\n $r = Math.pow($r / 255, $C) * 255\n $g = Math.pow($g / 255, $C) * 255\n $b = Math.pow($b / 255, $C) * 255\n ",{$C:Qt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)})},gradient:function(){var t=[].concat(Array.prototype.slice.call(arguments));1===t.length&&"string"==typeof t[0]&&(t=Je.convertMatchesArray(t[0]));var e=(t=t.map((function(t){return Je.matches(t).length?{type:"param",value:t}:{type:"scale",value:t}}))).filter((function(t){return"scale"==t.type}))[0];e=e?+e.value:256,t=t.filter((function(t){return"param"==t.type})).map((function(t){return t.value})).join(",");var r=Je.gradient(t,e).map((function(t){var e=Je.parse(t);return{r:e.r,g:e.g,b:e.b,a:e.a}}));return ie("\n const colorIndex = clamp(Math.ceil($r * 0.2126 + $g * 0.7152 + $b * 0.0722))\n const newColorIndex = clamp(Math.floor(colorIndex * ($scale / 256)))\n const color = $colors[newColorIndex]\n\n $r = color.r \n $g = color.g \n $b = color.b \n $a = clamp(Math.floor(color.a * 256))\n ",{},{$colors:r,$scale:e})},grayscale:function(t){var e=(t=Qt(t))/100;return e>1&&(e=1),ie("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a\n ",{$matrix:[.2126+.7874*(1-e),.7152-.7152*(1-e),.0722-.0722*(1-e),0,.2126-.2126*(1-e),.7152+.2848*(1-e),.0722-.0722*(1-e),0,.2126-.2126*(1-e),.7152-.7152*(1-e),.0722+.9278*(1-e),0,0,0,0,1]})},hue:function(){return ie("\n var hsv = Color.RGBtoHSV($r, $g, $b);\n\n // 0 ~ 360 \n var h = hsv.h;\n h += Math.abs($C)\n h = h % 360\n hsv.h = h\n\n var rgb = Color.HSVtoRGB(hsv);\n\n $r = rgb.r\n $g = rgb.g\n $b = rgb.b\n ",{$C:Qt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:360)})},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ie("\n $r = (255 - $r) * $C\n $g = (255 - $g) * $C\n $b = (255 - $b) * $C\n ",{$C:(t=Qt(t))/100})},kodachrome:function(){return ie("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,0,0,0,1]})},matrix:function(){return ie("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,arguments.length>11&&void 0!==arguments[11]?arguments[11]:0,arguments.length>12&&void 0!==arguments[12]?arguments[12]:0,arguments.length>13&&void 0!==arguments[13]?arguments[13]:0,arguments.length>14&&void 0!==arguments[14]?arguments[14]:0,arguments.length>15&&void 0!==arguments[15]?arguments[15]:0]})},noise:function(){return ie("\n const C = Math.abs($C) * 5\n const min = -C\n const max = C \n const noiseValue = Math.round(min + (Math.random() * (max - min)))\n\n $r += noiseValue\n $g += noiseValue\n $b += noiseValue\n ",{$C:Qt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)})},opacity:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ie("\n $a *= $C \n ",{$C:(t=Qt(t))/100})},polaroid:function(){return ie("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1]})},saturation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,e=(t=Qt(t))/100,r=1-Math.abs(e);return ie("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[r,0,0,0,0,r,0,0,0,0,r,0,0,0,0,r]})},sepia:function(){var t=Qt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1);return t>1&&(t=1),ie("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[.393+.607*(1-t),.769-.769*(1-t),.189-.189*(1-t),0,.349-.349*(1-t),.686+.314*(1-t),.168-.168*(1-t),0,.272-.272*(1-t),.534-.534*(1-t),.131+.869*(1-t),0,0,0,0,1]})},shade:function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return ie("\n $r *= $redValue\n $g *= $greenValue\n $b *= $blueValue\n ",{$redValue:Qt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1),$greenValue:Qt(t),$blueValue:Qt(e)})},shift:function(){return ie("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1]})},solarize:function(t,e,r){return ie("\n $r = ($r < $redValue) ? 255 - $r: $r\n $g = ($g < $greenValue) ? 255 - $g: $g\n $b = ($b < $blueValue) ? 255 - $b: $b\n ",{$redValue:Qt(t),$greenValue:Qt(e),$blueValue:Qt(r)})},technicolor:function(){return ie("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-.231103377548616,-.7501899197440212,1.847597816108189,0,0,0,0,1]})},threshold:function(){return bt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:200,arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,!1)},"threshold-color":bt,tint:function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return ie("\n\n $r += (255 - $r) * $redTint\n $g += (255 - $g) * $greenTint\n $b += (255 - $b) * $blueTint\n\n ",{$redTint:Qt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1),$greenTint:Qt(t),$blueTint:Qt(e)})}},{blur:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;return ve(se(t=Qt(t)))},emboss:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;return ve([-2*(t=Qt(t)),-t,0,-t,1,t,0,t,2*t])},gaussianBlur:$t,"gaussian-blur":$t,gaussianBlur5x:kt,"gaussian-blur-5x":kt,grayscale2:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ve(Ht([.3,.3,.3,0,0,.59,.59,.59,0,0,.11,.11,.11,0,0,0,0,0,0,0,0,0,0,0,0],(t=Qt(t))/100))},normal:function(){return ve([0,0,0,0,1,0,0,0,0])},kirschHorizontal:Ct,"kirsch-horizontal":Ct,kirschVertical:xt,"kirsch-vertical":xt,laplacian:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ve(Ht([-1,-1,-1,-1,8,-1,-1,-1,-1],(t=Qt(t))/100))},laplacian5x:_t,"laplacian-5x":_t,motionBlur:wt,"motion-blur":wt,motionBlur2:Ot,"motion-blur-2":Ot,motionBlur3:St,"motion-blur-3":St,negative:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ve(Ht([-1,0,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0,0,0,1,0,1,1,1,1,1],(t=Qt(t))/100))},sepia2:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ve(Ht([.393,.349,.272,0,0,.769,.686,.534,0,0,.189,.168,.131,0,0,0,0,0,0,0,0,0,0,0,0],(t=Qt(t))/100))},sharpen:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ve(Ht([0,-1,0,-1,5,-1,0,-1,0],(t=Qt(t))/100))},sobelHorizontal:Et,"sobel-horizontal":Et,sobelVertical:Mt,"sobel-vertical":Mt,stackBlur:Dt,"stack-blur":Dt,transparency:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return ve(Ht([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,.3,0,0,0,0,0,1],(t=Qt(t))/100))},unsharpMasking:Bt,"unsharp-masking":Bt},{kirsch:function(){return me("kirsch-horizontal kirsch-vertical")},sobel:function(){return me("sobel-horizontal sobel-vertical")},vintage:function(){return me("brightness(15) saturation(-20) gamma(1.8)")}}),Ut=0,Ft=($(jt={partial:ke,multi:be,merge:$e,weight:Ht,repeat:Vt,colorMatrix:function(t,e,r){var n=t[e],i=t[e+1],o=t[e+2],a=t[e+3];ue(t,e,r[0]*n+r[1]*i+r[2]*o+r[3]*a,r[4]*n+r[5]*i+r[6]*o+r[7]*a,r[8]*n+r[9]*i+r[10]*o+r[11]*a,r[12]*n+r[13]*i+r[14]*o+r[15]*a)},each:zt,eachXY:Xt,createRandomCount:function(){return[9,16,25,36,49,64,81,100].sort((function(t,e){return.5-Math.random()}))[0]},createRandRange:function(t,e,r){for(var n=[],i=1;i<=r;i++){var o=Math.random()*(e-t)+t,a=Math.floor(10*Math.random())%2==0?-1:1;n.push(a*o)}n.sort();var l=Math.floor(r>>1),s=n[l];return n[l]=n[0],n[0]=s,n},createBitmap:qt,createBlurMatrix:se,pack:function(t){return function(e,r){zt(e.pixels.length,(function(r,n){t(e.pixels,r,n,e.pixels[r],e.pixels[r+1],e.pixels[r+2],e.pixels[r+3])}),(function(){r(e)}))}},packXY:le,pixel:ie,getBitmap:Zt,putBitmap:Jt,radian:function(t){return mt.CONSTANT.radian(t)},convolution:ve,parseParamNumber:Qt,filter:me,clamp:pe,fillColor:ue,fillPixelColor:ce},"multi",be),$(jt,"merge",$e),$(jt,"matches",de),$(jt,"parseFilter",ge),$(jt,"partial",ke),jt),Lt=Ft;function Ht(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t.map((function(t){return t*e}))}function Vt(t,e){for(var r=new Array(e),n=0;n<e;n++)r[n]=t;return r}function Nt(t){if("function"==typeof t)return t;"string"==typeof t&&(t=[t]);var e=(t=t.slice(0)).shift();if("function"==typeof e)return e;var r=t,n=Rt[e]||Lt[e];if(!n)throw new Error(e+" is not filter. please check filter name.");return n.apply(n,r)}function Gt(t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments[3],n=arguments[4],i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1e4,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"full",a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:50,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=function(t){setTimeout(t,0)};function u(){var t=[].concat(O(Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:50))).map((function(t){return"cri = ri + i * s; if (cri >= mx) return {currentRunIndex: cri, i: null}; c(cri); i++;"})).join("\n");return new Function("ri","i","s","mx","c","\n let cri = ri;\n \n "+t+"\n \n return {currentRunIndex: cri, i: i} \n ")}function c(){for(var n=u(a),o=l,s={},c=0;c<i;){if(null==(s=n(l,c,e,t,r)).i){o=s.currentRunIndex;break}c=s.i,o=s.currentRunIndex}h(o)}function h(r){r?l=r:l+=e,l>=t?n():s?s(c):c()}"requestAnimationFrame"==o&&(s=requestAnimationFrame,i=1e3),"full"==o&&(s=null,i=t),c()}function zt(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Gt(t,0,4,(function(t){e(t,t>>2)}),(function(){r()}),n.functionDumpCount,n.frameTimer,n.loopCount)}function Xt(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};Gt(t,0,4,(function(t){var n=t>>2;r(t,n%e,Math.floor(n/e))}),(function(){n()}),i.functionDumpCount,i.frameTimer,i.loopCount)}function qt(t,e,r){return{pixels:new Uint8ClampedArray(t),width:e,height:r}}function Yt(t,e,r,n){for(var i=e.pixels.length/4,o=0,a=0,l=0,s=0,u=0,c=0,h=0;h<i;h++)l=h%e.width,a=n+(s=Math.floor(h/e.width)),(o=r+l)>t.width||a>t.height||(u=s*e.width+l<<2,c=a*t.width+o<<2,t.pixels[c]=e.pixels[u],t.pixels[c+1]=e.pixels[u+1],t.pixels[c+2]=e.pixels[u+2],t.pixels[c+3]=e.pixels[u+3])}function Wt(t,e,r,n){for(var i=e.pixels.length>>2,o=0,a=0,l=0,s=0,u=0,c=0,h=0;h<i;h++)l=h%e.width,a=n+(s=Math.floor(h/e.width)),(o=r+l)>t.width||a>t.height||(u=a*t.width+o<<2,c=s*e.width+l<<2,e.pixels[c]=t.pixels[u],e.pixels[c+1]=t.pixels[u+1],e.pixels[c+2]=t.pixels[u+2],e.pixels[c+3]=t.pixels[u+3])}function Kt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=t.width+e,n=t.height+e;return{pixels:new Uint8ClampedArray(r*n*4),width:r,height:n}}function Zt(t,e){return dt.getBitmap(t,e)}function Jt(t,e,r){return dt.putBitmap(t,e,r)}function Qt(t){return"string"==typeof t&&(t=(t=t.replace(/deg/,"")).replace(/px/,"")),+t}var te=/(([\w_\-]+)(\(([^\)]*)\))?)+/gi;function ee(t){var e=t.map((function(t){return" \n "+t.userFunction.$preContext+"\n\n "+t.userFunction.$preCallbackString+"\n\n $r = clamp($r); $g = clamp($g); $b = clamp($b); $a = clamp($a);\n "})).join("\n\n"),r={clamp:pe,Color:Je};t.forEach((function(t){Object.assign(r,t.userFunction.rootContextObject)}));var n="const "+Object.keys(r).map((function(t){return" "+t+" = $rc."+t+" "})).join(","),i=new Function("$p","$pi","$rc"," \n let $r = $p[$pi], $g = $p[$pi+1], $b = $p[$pi+2], $a = $p[$pi+3];\n \n "+n+"\n\n "+e+"\n \n $p[$pi] = $r; $p[$pi+1] = $g; $p[$pi+2] = $b; $p[$pi+3] = $a;\n ");return function(t,e){i(t,e,r)}}function re(t){var e={},r=t.map((function(t){var r=[];Object.keys(t.context).forEach((function(t,e){r[t]="n$"+Ut+++t+"$"})),Object.keys(t.rootContext).forEach((function(n,i){r[n]="r$"+Ut+++n+"$",e[r[n]]=t.rootContext[n]}));var n=Object.keys(t.context).filter((function(e){return"number"!=typeof t.context[e]&&"string"!=typeof t.context[e]&&(!Array.isArray(t.context[e])||"number"!=typeof t.context[e][0]&&"string"!=typeof t.context[e][0])})).map((function(e,n){return[r[e],JSON.stringify(t.context[e])].join(" = ")})),i=t.callback;return"function"==typeof t.callback&&((i=t.callback.toString().split("{")).shift(),(i=(i=i.join("{")).split("}")).pop(),i=i.join("}")),Object.keys(r).forEach((function(e){var n=r[e];"number"==typeof t.context[e]||"string"==typeof t.context[e]?i=i.replace(new RegExp("\\"+e,"g"),t.context[e]):!Array.isArray(t.context[e])||"number"!=typeof t.context[e][0]&&"string"!=typeof t.context[e][0]?i=i.replace(new RegExp("\\"+e,"g"),n):t.context[e].forEach((function(t,r){i=i.replace(new RegExp("\\"+e+"\\["+r+"\\]","g"),t)}))})),{preCallbackString:i,preContext:n}})),n=r.map((function(t,e){return t.preContext.length?"const "+t.preContext+";":""})).join("\n\n"),i=r.map((function(t){return t.preCallbackString})).join("\n\n"),o=new Function("$pixels","$pixelIndex","$clamp","$Color"," \n let $r = $pixels[$pixelIndex], $g = $pixels[$pixelIndex+1], $b = $pixels[$pixelIndex+2], $a = $pixels[$pixelIndex+3];\n\n "+n+"\n\n "+i+"\n \n $pixels[$pixelIndex] = $r\n $pixels[$pixelIndex+1] = $g \n $pixels[$pixelIndex+2] = $b \n $pixels[$pixelIndex+3] = $a \n ");return o.$preCallbackString=i,o.$preContext=n,o.rootContextObject=e,o}function ne(t){return re([{callback:t,context:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},rootContext:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}])}function ie(t){var e=ne(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),r=function(t,e){};return r.userFunction=e,r}var oe=[0,1,2,3];function ae(t,e,r){oe.forEach((function(n){var i=t[e+n];t[e+n]=t[r+n],t[r+n]=i}))}function le(t){return function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Xt(e.pixels.length,e.width,(function(r,n,i){t(e.pixels,r,n,i)}),(function(){r(e)}),n)}}function se(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,e=Math.pow(t,2);return Vt(1/e,e)}function ue(t,e,r,n,i,o){if(3==arguments.length){var a=arguments[2];r=a.r,n=a.g,i=a.b,o=a.a}"number"==typeof r&&(t[e]=r),"number"==typeof n&&(t[e+1]=n),"number"==typeof i&&(t[e+2]=i),"number"==typeof o&&(t[e+3]=o)}function ce(t,e,r,n){ue(t,e,r[n],r[n+1],r[n+2],r[n+3])}function he(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:255,n=[];return n=t.map((function(t,e){return[]})),t.forEach((function(t,i){if(0!=t){var o=n[i];for(i=e;i<=r;i++)o[i]=t*i}})),n}function fe(t,e,r,n,i){var o=Math.round(Math.sqrt(t.length)),a=Math.floor(o/2),l=i?1:0,s="let r = 0, g = 0, b = 0, a = 0, scy = 0, scx =0, si = 0; ",u=[],c=[],h=[],f=[];t.forEach((function(t,e){var n=Math.floor(e/o)-a,i=e%o-a;0!=t&&(u.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+r+" + ($sx + ("+i+"))) * 4]]"),c.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+r+" + ($sx + ("+i+"))) * 4 + 1]]"),h.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+r+" + ($sx + ("+i+"))) * 4 + 2]]"),f.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+r+" + ($sx + ("+i+"))) * 4 + 3]]"))})),s+="r = "+u.join(" + ")+"; g = "+c.join(" + ")+"; b = "+h.join(" + ")+"; a = "+f.join(" + ")+";",s+="$dp[$di] = r; $dp[$di+1] = g;$dp[$di+2] = b;$dp[$di+3] = a + ("+l+")*(255-a); ";var v=new Function("$dp","$sp","$di","$sx","$sy","$t",s);return function(t,r,n,i,o){v(t,r,n,i,o,e)}}function ve(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=he(t);return function(n,i){var o=Math.round(Math.sqrt(t.length)),a=Kt(n,2*o);Yt(a,n,o,o);for(var l=qt(a.pixels.length,a.width,a.height),s=qt(n.pixels.length,n.width,n.height),u=fe(t,r,a.width,a.height,e),c=n.pixels.length/4,h=0;h<c;h++){var f=h,v=f%n.width+o,d=Math.floor(f/n.width)+o;u(l.pixels,a.pixels,4*(d*a.width+v),v,d)}Wt(l,s,o,o),i(s)}}function de(t){var e=Je.convertMatches(t),r=e.str.match(te),n=[];if(!r)return n;n=r.map((function(t){return{filter:t,origin:Je.reverseMatches(t,e.matches)}}));var i={next:0};return n.map((function(e){var r=t.indexOf(e.origin,i.next);return e.startIndex=r,e.endIndex=r+e.origin.length,e.arr=ge(e.origin),i.next=e.endIndex,e})).filter((function(t){return!!t.arr.length}))}function ge(t){var e=Je.convertMatches(t),r=e.str.match(te);if(!r[0])return[];var n=r[0].split("("),i=n.shift(),o=[];return n.length&&(o=n.shift().split(")")[0].split(",").map((function(t){return Je.reverseMatches(t,e.matches)}))),[i].concat(O(o)).map(Je.trim)}function pe(t){return Math.min(255,t)}function me(t){return $e(de(t).map((function(t){return t.arr})))}function ye(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=[],r=[],n=0,i=t.length;n<i;n++){var o=t[n];o.userFunction?r.push(o):(r.length&&e.push([].concat(O(r))),e.push(o),r=[])}return r.length&&e.push([].concat(O(r))),e.forEach((function(t,r){var n;Array.isArray(t)&&(e[r]=(n=ee(t),function(t,e){for(var r=0,i=t.pixels.length;r<i;r+=4)n(t.pixels,r);e(t)}))})),e}function be(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];e=e.map((function(t){return Nt(t)})).filter((function(t){return t}));var n=(e=ye(e)).length;return function(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=t,a=0;function l(){e[a].call(null,o,(function(t){o=t,s()}),i)}function s(){++a>=n?r(o):l()}l()}}function $e(t){return be.apply(void 0,O(t))}function ke(t){for(var e=null,r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return e=1==n.length&&"string"==typeof n[0]?me(n[0]):$e(n),function(r,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e(Zt(r,t),(function(e){n(Jt(r,e,t))}),i)}}function Ce(t){return"string"==typeof t&&(t=(t=t.replace(/deg/,"")).replace(/px/,"")),+t}function xe(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t.map((function(t){return t*e}))}var _e=0;function we(t){return[].concat(Array.prototype.slice.call(arguments))}function Oe(t){return{type:"convolution",length:t.length,content:t}}function Se(t,e){return"\n if (u_filterIndex == "+e+".0) {\n "+t+"\n }\n "}function Ee(t,e){return{type:"shader",index:_e,options:e,content:Se(t,_e++)}}function Me(t){return"\n \n if (u_kernelSelect == "+t+".0) {\n vec4 colorSum = "+function(t){var e=Math.sqrt(t),r=Math.floor(e/2);return[].concat(O(Array(t))).map((function(n,i){var o=Math.floor(i/e)-r;return"texture(u_image, v_texCoord + onePixel * vec2("+(i%e-r)+", "+o+")) * u_kernel"+t+"["+i+"]"})).join(" + \n")}(t)+"; \n\n outColor = vec4((colorSum / u_kernel"+t+"Weight).rgb, 1);\n \n }\n "}function Ae(t){return"vec4("+(t=[t.r/255,t.g/255,t.b/255,t.a||0].map(Ie))+")"}function Ie(t){return t==Math.floor(t)?t+".0":t}function Te(){return Oe(xe([1,2,1,2,4,2,1,2,1],Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)*(1/16)))}function Pe(){return Oe([1,4,6,4,1,4,16,24,16,4,6,24,36,24,6,4,16,24,16,4,1,4,6,4,1])}function De(){return Oe([5,5,5,-3,0,-3,-3,-3,-3])}function Be(){return Oe([5,-3,-3,5,0,-3,5,-3,-3])}function je(){return Oe([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}function Re(){return Oe([1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1])}function Ue(){return Oe([1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1])}function Fe(){return Oe([1,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1])}function Le(){return Oe([-1,-2,-1,0,0,0,1,2,1])}function He(){return Oe([-1,0,1,-2,0,2,-1,0,1])}function Ve(){return Oe(xe([1,4,6,4,1,4,16,24,16,4,6,24,-476,24,6,4,16,24,16,4,1,4,6,4,1],-1/256))}function Ne(){var t=[arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,arguments.length>11&&void 0!==arguments[11]?arguments[11]:0,arguments.length>12&&void 0!==arguments[12]?arguments[12]:0,arguments.length>13&&void 0!==arguments[13]?arguments[13]:0,arguments.length>14&&void 0!==arguments[14]?arguments[14]:0,arguments.length>15&&void 0!==arguments[15]?arguments[15]:0].map(Ie);return Ee("\n\n outColor = vec4(\n "+t[0]+" * pixelColor.r + "+t[1]+" * pixelColor.g + "+t[2]+" * pixelColor.b + "+t[3]+" * pixelColor.a,\n "+t[4]+" * pixelColor.r + "+t[5]+" * pixelColor.g + "+t[6]+" * pixelColor.b + "+t[7]+" * pixelColor.a,\n "+t[8]+" * pixelColor.r + "+t[9]+" * pixelColor.g + "+t[10]+" * pixelColor.b + "+t[11]+" * pixelColor.a,\n "+t[12]+" * pixelColor.r + "+t[13]+" * pixelColor.g + "+t[14]+" * pixelColor.b + "+t[15]+" * pixelColor.a\n ); \n ")}function Ge(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return Ee("\n float c = ( (pixelColor.r * 0.2126 + pixelColor.g * 0.7152 + pixelColor.b * 0.0722) ) >= "+(t=Ie(Ce(t)))+" ? 1.0 : 0.0;\n\n outColor = vec4(c, c, c, pixelColor.a);\n ")}var ze=k({},{blur:function(){return Oe([1,1,1,1,1,1,1,1,1])},normal:function(){return Oe([0,0,0,0,1,0,0,0,0])},emboss:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;return Oe([-2*(t=Ce(t)),-t,0,-t,1,t,0,t,2*t])},gaussianBlur:Te,"gaussian-blur":Te,gaussianBlur5x:Pe,"gaussian-blur-5x":Pe,grayscale2:function(){return Oe([.3,.3,.3,0,0,.59,.59,.59,0,0,.11,.11,.11,0,0,0,0,0,0,0,0,0,0,0,0])},kirschHorizontal:De,"kirsch-horizontal":De,kirschVertical:Be,"kirsch-vertical":Be,laplacian:function(){return Oe([-1,-1,-1,-1,8,-1,-1,-1,-1])},laplacian5x:je,"laplacian-5x":je,motionBlur:Re,"motion-blur":Re,motionBlur2:Ue,"motion-blur-2":Ue,motionBlur3:Fe,"motion-blur-3":Fe,negative:function(){return Oe([-1,0,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0,0,0,1,0,1,1,1,1,1])},sepia2:function(){return Oe([.393,.349,.272,0,0,.769,.686,.534,0,0,.189,.168,.131,0,0,0,0,0,0,0,0,0,0,0,0])},sharpen:function(){return Oe([0,-1,0,-1,5,-1,0,-1,0])},sobelHorizontal:Le,"sobel-horizontal":Le,sobelVertical:He,"sobel-vertical":He,transparency:function(){return Oe([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,.3,0,0,0,0,0,1])},unsharpMasking:Ve,"unsharp-masking":Ve},{bitonal:function(t,e){var r=Ie(arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5),n=Ae(Je.parse(t));return Ee("\n if ((pixelColor.r + pixelColor.g + pixelColor.b) > "+r+") {\n outColor = vec4("+Ae(Je.parse(e))+".rgb, pixelColor.a);\n } else {\n outColor = vec4("+n+".rgb, pixelColor.a);\n }\n ")},brightness:function(){return Ee("\n outColor = pixelColor + ("+Ie(Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1))+");\n ")},brownie:function(){return Ne(.5997023498159715,.34553243048391263,-.2708298674538042,0,-.037703249837783157,.8609577587992641,.15059552388459913,0,.24113635128153335,-.07441037908422492,.44972182064877153,0,0,0,0,1)},clip:function(){var t=Ie(Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0));return Ee("\n outColor = vec4(\n (pixelColor.r > 1.0 - "+t+") ? 1.0 : 0.0,\n (pixelColor.g > 1.0 - "+t+") ? 1.0 : 0.0,\n (pixelColor.b > 1.0 - "+t+") ? 1.0 : 0.0,\n pixelColor.a \n );\n ")},chaos:function(){return Ee("\n vec2 st = pixelColor.st;\n st *= "+Ie(Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:10))+";\n \n vec2 ipos = floor(st); // get the integer coords\n\n vec3 color = vec3(random( ipos ));\n\n outColor = vec4(color, pixelColor.a);\n ")},contrast:function(){return Ee("\n outColor = pixelColor * "+Ie(Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1))+";\n ")},gamma:function(){var t=Ie(Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1));return Ee("\n outColor = vec4(pow(pixelColor.r, "+t+"), pow(pixelColor.g, "+t+"), pow(pixelColor.b, "+t+"), pixelColor.a );\n ")},gradient:function(){var t=[].concat(Array.prototype.slice.call(arguments));1===t.length&&"string"==typeof t[0]&&(t=Je.convertMatchesArray(t[0])),t=t.map((function(t){return t})).join(", ");var e=Je.parseGradient(t);e[0][1]=0,e[e.length-1][1]=1,e=e.map((function(t){var e=Je.parse(t[0]);return[{r:e.r,g:e.g,b:e.b,a:e.a},t[1]]}));for(var r=[],n=0,i=e.length;n<i-1;n++){var o=e[n],a=e[n+1],l=Ae(o[0]),s=Ae(a[0]),u=Ie(o[1]),c=Ie(a[1]);r.push("\n if ("+u+" <= rate && rate < "+c+") {\n outColor = mix("+l+", "+s+", (rate - "+u+")/("+c+" - "+u+"));\n }\n ")}return Ee("\n float rate = (pixelColor.r * 0.2126 + pixelColor.g * 0.7152 + pixelColor.b * 0.0722); \n\n "+r.join("\n")+" \n ")},grayscale:function(){var t=Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1);return t>1&&(t=1),Ne(.2126+.7874*(1-t),.7152-.7152*(1-t),.0722-.0722*(1-t),0,.2126-.2126*(1-t),.7152+.2848*(1-t),.0722-.0722*(1-t),0,.2126-.2126*(1-t),.7152-.7152*(1-t),.0722+.9278*(1-t),0,0,0,0,1)},hue:function(){return Ee("\n vec3 hsv = rgb2hsv(pixelColor.rgb);\n hsv.x += "+Ie(Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1))+";\n outColor = vec4(hsv2rgb(hsv).rgb, pixelColor.a);\n ")},invert:function(){var t=Ie(Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1));return Ee("\n outColor = vec4(\n (1.0 - pixelColor.r) * "+t+",\n (1.0 - pixelColor.g) * "+t+",\n (1.0 - pixelColor.b) * "+t+",\n pixelColor.a\n );\n ")},kodachrome:function(){return Ne(1.1285582396593525,-.3967382283601348,-.03992559172921793,0,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,0,0,0,1)},matrix:Ne,noise:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=Math.abs(Ce(t)),r=Ie(-e);return Ee("\n float rnd = "+r+" + random( pixelColor.st ) * ("+Ie(e)+" - "+r+");\n\n outColor = vec4(pixelColor.rgb + rnd, 1.0);\n ")},opacity:function(){return Ee("\n outColor = vec4(pixelColor.rgb, pixelColor.a * "+Ie(Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1))+");\n ")},polaroid:function(){return Ne(1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1)},saturation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=1-Math.abs(Ce(t));return Ne(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,e)},sepia:function(){var t=Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1);return t>1&&(t=1),Ne(.393+.607*(1-t),.769-.769*(1-t),.189-.189*(1-t),0,.349-.349*(1-t),.686+.314*(1-t),.168-.168*(1-t),0,.272-.272*(1-t),.534-.534*(1-t),.131+.869*(1-t),0,0,0,0,1)},shade:function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Ee("\n outColor = vec4(\n pixelColor.r * "+Ie(Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)/255)+",\n pixelColor.g * "+Ie(Ce(t)/255)+",\n pixelColor.b * "+Ie(Ce(e)/255)+",\n pixelColor.a\n );\n ")},shift:function(){return Ne(1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1)},solarize:function(t,e,r){return Ee("\n outColor = vec4(\n (pixelColor.r < "+Ie(Ce(t))+") ? 1.0 - pixelColor.r: pixelColor.r,\n (pixelColor.g < "+Ie(Ce(e))+") ? 1.0 - pixelColor.g: pixelColor.g,\n (pixelColor.b < "+Ie(Ce(r))+") ? 1.0 - pixelColor.b: pixelColor.b,\n pixelColor.a\n );\n ")},technicolor:function(){return Ne(1.9125277891456083,-.8545344976951645,-.09155508482755585,0,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-.231103377548616,-.7501899197440212,1.847597816108189,0,0,0,0,1)},threshold:function(){return Ge(arguments.length>0&&void 0!==arguments[0]?arguments[0]:200,arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,!1)},"threshold-color":Ge,tint:function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ee("\n outColor = vec4(\n pixelColor.r += (1 - pixelColor.r) * "+Ce(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)+",\n pixelColor.g += (1 - pixelColor.g) * "+Ce(t)+",\n pixelColor.b += (1 - pixelColor.b) * "+Ce(e)+",\n pixelColor.a\n );\n ")}},{kirsch:function(){return we("kirsch-horizontal kirsch-vertical")},sobel:function(){return we("sobel-horizontal sobel-vertical")},vintage:function(){return we("brightness(0.15) saturation(-0.2) gamma(1.8)")}}),Xe=0,qe=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{width:"400px",height:"300px"};y(this,t),this.img=e.img,this.width=parseFloat(this.img.width||e.width||"400px"),this.height=parseFloat(this.img.height||e.height||"300px"),this.init()}return b(t,[{key:"resize",value:function(){this.canvas.width=this.width,this.canvas.height=this.height,this.canvas.style.width=this.width+"px",this.canvas.style.height=this.height+"px",this.viewport()}},{key:"clear",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=this.gl;i.clearColor(t,e,r,n),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT)}},{key:"viewport",value:function(t,e,r,n){var i=this.gl;i.viewport(t||0,e||0,r||i.canvas.width,n||i.canvas.height)}},{key:"initCanvas",value:function(t,e){if(this.canvas=document.createElement("canvas"),this.gl=this.canvas.getContext("webgl2"),!this.gl)throw new Error("you need webgl2 support");this.program=this.createProgram(t,e),this.resize(),this.initBuffer()}},{key:"draw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"TRIANGLES",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6,n=this.gl;n.drawArrays(n[t],e,r)}},{key:"triangles",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6;this.draw("TRIANGLES",t,e)}},{key:"uniform2f",value:function(){for(var t,e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r.shift();(t=this.gl).uniform2f.apply(t,[this.locations[i]].concat(r))}},{key:"uniform1f",value:function(){for(var t,e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r.shift();(t=this.gl).uniform1f.apply(t,[this.locations[i]].concat(r))}},{key:"uniform1fv",value:function(){for(var t,e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r.shift();(t=this.gl).uniform1fv.apply(t,[this.locations[i]].concat(r))}},{key:"uniform1i",value:function(){for(var t,e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r.shift();(t=this.gl).uniform1i.apply(t,[this.locations[i]].concat(r))}},{key:"useProgram",value:function(){this.gl.useProgram(this.program)}},{key:"bindBuffer",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"STATIC_DRAW",n=this.gl;this.buffers[t]||(this.buffers[t]=n.createBuffer()),n.bindBuffer(n.ARRAY_BUFFER,this.buffers[t]),e&&n.bufferData(n.ARRAY_BUFFER,new Float32Array(e),n[r])}},{key:"enable",value:function(t){this.gl.enableVertexAttribArray(this.locations[t])}},{key:"location",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"attribute";"attribute"===e?this.locations[t]=this.gl.getAttribLocation(this.program,t):"uniform"===e&&(this.locations[t]=this.gl.getUniformLocation(this.program,t))}},{key:"a",value:function(t){return this.location(t)}},{key:"u",value:function(t){return this.location(t,"uniform")}},{key:"pointer",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOAT",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=this.gl;a.vertexAttribPointer(this.locations[t],r,a[e],n,i,o)}},{key:"bufferData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=this.gl;e.bufferData(e.ARRAY_BUFFER,new Float32Array(t),e.STATIC_DRAW)}},{key:"isPowerOf2",value:function(t){return 0==(t&t-1)}},{key:"bindTexture",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"RGBA",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"RGBA",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"UNSIGNED_BYTE",a=this.gl;1!=arguments.length?(this.textures[t]||(this.textures[t]=a.createTexture()),this.textureIndex[t]=Xe++,a.bindTexture(a.TEXTURE_2D,this.textures[t]),this.setTextureParameter(),a.texImage2D(a.TEXTURE_2D,r,a[n],a[i],a[o],e.newImage||e)):a.bindTexture(a.TEXTURE_2D,this.textures[t])}},{key:"bindColorTexture",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:256,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"RGBA",a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"RGBA",l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"UNSIGNED_BYTE",s=this.gl;this.textures[t]||(this.textures[t]=s.createTexture()),this.textureIndex[t]=Xe++,s.bindTexture(s.TEXTURE_2D,this.textures[t]),this.setTextureParameter(),s.texImage2D(s.TEXTURE_2D,i,s[o],r,n,0,s[a],s[l],new Uint8Array(e))}},{key:"bindEmptyTexture",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"RGBA",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"RGBA",a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"UNSIGNED_BYTE",l=this.gl;this.textures[t]||(this.textures[t]=l.createTexture()),this.textureIndex[t]=Xe++,l.bindTexture(l.TEXTURE_2D,this.textures[t]),this.setTextureParameter();var s=0,u=null;l.texImage2D(l.TEXTURE_2D,n,l[i],e,r,s,l[o],l[a],u)}},{key:"setTextureParameter",value:function(){var t=this.gl;t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)}},{key:"bindFrameBufferWithTexture",value:function(t,e,r,n){this.bindEmptyTexture(e,r,n),this.bindFrameBuffer(t,e)}},{key:"enumToString",value:function(t){var e=this.gl;if(0===t)return"NONE";for(var r in e)if(e[r]===t)return r;return"0x"+t.toString(16)}},{key:"bindFrameBuffer",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.gl;if(1!==arguments.length){this.framebuffers[t]||(this.framebuffers[t]=r.createFramebuffer()),r.bindFramebuffer(r.FRAMEBUFFER,this.framebuffers[t]);var n=0,i=r.COLOR_ATTACHMENT0;r.framebufferTexture2D(r.FRAMEBUFFER,i,r.TEXTURE_2D,this.textures[e],n),r.checkFramebufferStatus(r.FRAMEBUFFER),r.FRAMEBUFFER_COMPLETE}else r.bindFramebuffer(r.FRAMEBUFFER,null==t?null:this.framebuffers[t])}},{key:"bindVA",value:function(){var t=this.gl;this.vao||(this.vao=t.createVertexArray()),t.bindVertexArray(this.vao)}},{key:"bindAttr",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"STATIC_DRAW",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;this.bindBuffer(t,e,r),this.enable(t),this.pointer(t,"FLOAT",n)}},{key:"initBuffer",value:function(){var t=this.canvas,e=t.width,r=t.height;this.a("a_position"),this.a("a_texCoord"),this.u("u_resolution"),this.u("u_image"),this.u("u_flipY"),this.u("u_kernelSelect"),this.u("u_filterIndex"),this.u("u_kernel9[0]"),this.u("u_kernel9Weight"),this.u("u_kernel25[0]"),this.u("u_kernel25Weight"),this.u("u_kernel49[0]"),this.u("u_kernel49Weight"),this.u("u_kernel81[0]"),this.u("u_kernel81Weight"),this.bindVA(),this.bindAttr("a_position",[0,0,e,0,0,r,0,r,e,0,e,r],"STATIC_DRAW",2),this.bindAttr("a_texCoord",[0,0,1,0,0,1,0,1,1,0,1,1],"STATIC_DRAW",2),this.bindTexture("u_image",this.img),this.bindFrameBufferWithTexture("frame_buffer_0","img_texture_0",e,r),this.bindFrameBufferWithTexture("frame_buffer_1","img_texture_1",e,r)}},{key:"activeTexture",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.gl;e.activeTexture(e.TEXTURE0+t)}},{key:"drawFilter",value:function(){var t=this,e=this.gl;this.resize(),this.clear(),this.useProgram(),this.bindVA(),this.activeTexture(0),this.bindTexture("u_image"),this.uniform1i("u_image",0),this.uniform1f("u_flipY",1);var r=e.canvas,n=r.width,i=r.height;this.eachFilter((function(e,r){t.bindFrameBuffer("frame_buffer_"+r%2),t.uniform2f("u_resolution",n,i),t.viewport(0,0,n,i),t.effectFilter(e),t.bindTexture("img_texture_"+r%2)})),this.uniform1f("u_flipY",-1),this.bindFrameBuffer(null),this.uniform2f("u_resolution",n,i),this.viewport(0,0,n,i),this.clear(),this.effectFilter("normal")}},{key:"effectFilter",value:function(t){"string"==typeof t&&(t=(ze[t]||ze.normal).call(ze)),"convolution"==t.type?(this.uniform1f("u_kernelSelect",t.length),this.uniform1f("u_filterIndex",-1),this.uniform1fv("u_kernel"+t.length+"[0]",t.content),this.uniform1f("u_kernel"+t.length+"Weight",this.computeKernelWeight(t.content))):(this.uniform1f("u_kernelSelect",-1),this.uniform1f("u_filterIndex",t.index)),this.triangles(0,6)}},{key:"computeKernelWeight",value:function(t){var e=t.reduce((function(t,e){return t+e}));return e<=0?1:e}},{key:"createProgram",value:function(t,e){var r=this.gl,n=r.createProgram();if(this.vertexShader=this.createVertexShader(t),this.fragmentShader=this.createFragmentShader(e),r.attachShader(n,this.vertexShader),r.attachShader(n,this.fragmentShader),r.linkProgram(n),r.getProgramParameter(n,r.LINK_STATUS))return n;console.error(r.getProgramInfoLog(n)),r.deleteProgram(n)}},{key:"createShader",value:function(t,e){var r=this.gl,n=r.createShader(t);if(r.shaderSource(n,e),r.compileShader(n),r.getShaderParameter(n,r.COMPILE_STATUS))return n;console.error(r.getShaderInfoLog(n)),r.deleteShader(n)}},{key:"createVertexShader",value:function(t){var e=this.gl;return this.createShader(e.VERTEX_SHADER,t)}},{key:"createFragmentShader",value:function(t){var e=this.gl;return this.createShader(e.FRAGMENT_SHADER,t)}},{key:"eachFilter",value:function(t){this.filterList.forEach(t)}},{key:"init",value:function(){this.locations={},this.buffers={},this.framebuffers={},this.textures={},this.textureIndex={},this.hasTexParameter={}}},{key:"destroy",value:function(){var t=this.gl;this.init(),t.deleteProgram(this.program)}},{key:"filter",value:function(t,e){var r,n,i;this.filterList=t,this.initCanvas("#version 300 es \n\n in vec2 a_position;\n in vec2 a_texCoord; \n\n uniform vec2 u_resolution;\n uniform float u_flipY;\n\n out vec2 v_texCoord; \n\n void main() {\n vec2 zeroToOne = a_position / u_resolution;\n\n vec2 zeroToTwo = zeroToOne * 2.0;\n\n vec2 clipSpace = zeroToTwo - 1.0;\n\n gl_Position = vec4(clipSpace * vec2(1, u_flipY), 0, 1);\n\n v_texCoord = a_texCoord;\n\n }\n ",(r=this.filterList,n=r.filter((function(t){return"shader"==t.type})).map((function(t){return t.content})).join("\n\n"),i={9:!0},r.filter((function(t){return"convolution"==t.type})).forEach((function(t){i[t.length]=!0})),"#version 300 es\n\n precision highp int;\n precision mediump float;\n \n uniform sampler2D u_image;\n\n // 3 is 3x3 matrix kernel \n uniform float u_kernelSelect;\n uniform float u_filterIndex;\n\n uniform float u_kernel9[9];\n uniform float u_kernel9Weight;\n uniform float u_kernel25[25];\n uniform float u_kernel25Weight;\n uniform float u_kernel49[49];\n uniform float u_kernel49Weight;\n uniform float u_kernel81[81];\n uniform float u_kernel81Weight; \n\n in vec2 v_texCoord;\n \n out vec4 outColor;\n\n float random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n } \n\n // \n vec3 rgb2hsv(vec3 c)\n {\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\n vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\n\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n }\n\n vec3 hsv2rgb(vec3 c)\n {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n }\n \n void main() {\n vec4 pixelColor = texture(u_image, v_texCoord);\n vec2 onePixel = vec2(1) / vec2(textureSize(u_image, 0)); \n\n "+n+"\n\n "+Object.keys(i).map((function(t){return Me(+t)})).join("\n")+"\n\n }")),this.drawFilter(),"function"==typeof e&&e(this)}}]),t}(),Ye={GLCanvas:qe};function We(t){var e=[];"string"==typeof t?e=de(t):Array.isArray(t)&&(e=t);var r=[];return e.forEach((function(t){var e=t.arr[0];if(ze[e]){var n=function(t){var e=t.arr[0],r=ze[e],n=t.arr;return n.shift(),r.apply(this,n)}(t);"convolution"==n.type||"shader"==n.type?r.push(n):n.forEach((function(t){r=r.concat(We(t))}))}})),r}var Ke=k({},Ye,{filter:function(t,e,r,n){var i=new Ye.GLCanvas({width:n.width||t.width,height:n.height||t.height,img:t});i.filter(We(e),(function(){"function"==typeof r&&r(i)}))}});function Ze(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{frameTimer:"full"},i=new gt(t);i.loadImage((function(){i.toArray(e,(function(t){"function"==typeof r&&r(t)}),n)}))}var Je=k({},o,f,it,B,J,N,G,Z,m,W,{palette:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"hex";return e.length>r&&(e=vt(e,r)),e.map((function(e){return t(e,n)}))},ImageToCanvas:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{frameTimer:"full"};Ze(t,e,r,Object.assign({returnTo:"canvas"},n))},ImageToHistogram:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{width:200,height:100},n=new gt(t);n.loadImage((function(){dt.createHistogram(r.width||200,r.height||100,n.toHistogram(r),(function(t){"function"==typeof e&&e(t.toDataURL("image/png"))}),r)}))},ImageToRGB:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];if(r){if(r){var n;(n=new gt(t,e)).loadImage((function(){"function"==typeof r&&r(n.toRGB())}))}}else(n=new gt(t)).loadImage((function(){"function"==typeof e&&e(n.toRGB())}))},ImageToURL:Ze,GLToCanvas:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=new gt(t);i.load((function(){Ke.filter(i.newImage,e,(function(t){"function"==typeof r&&r(t)}),n)}))},histogram:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=new gt(t);n.loadImage((function(){"function"==typeof e&&e(n.toHistogram(r))}))},histogramToPoints:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2,r=[],n=0;n<t.length;n++){var i=t[n];if(0!=n)if(n!=t.length-1){var o=t[n-1],a=t[n+1],l=(a[1],o[1],a[0],o[0],[o[0]+(a[0]-o[0])*e,o[1]+(a[1]-o[1])*e]),s=[[].concat(O(o)),[].concat(l)],u=Math.sqrt(Math.pow(i[0]-o[0],2)+Math.pow(i[1]-o[1],2))/Math.sqrt(Math.pow(a[0]-i[0],2)+Math.pow(a[1]-i[1],2)),c=s[0][0]+(s[1][0]-s[0][0])*u,h=s[0][1]+(s[1][1]-s[0][1])*u;s[0][0]+=i[0]-c,s[0][1]+=i[1]-h,s[1][0]+=i[0]-c,s[1][1]+=i[1]-h,r[n]=s}else r[n]=[];else r[n]=[]}return r}}),Qe=[{rgb:"#ff0000",start:0},{rgb:"#ffff00",start:.17},{rgb:"#00ff00",start:.33},{rgb:"#00ffff",start:.5},{rgb:"#0000ff",start:.67},{rgb:"#ff00ff",start:.83},{rgb:"#ff0000",start:1}];!function(){for(var t=0,e=Qe.length;t<e;t++){var r=Qe[t],n=Je.parse(r.rgb);r.r=n.r,r.g=n.g,r.b=n.b}}();var tr={colors:Qe,checkHueColor:function(t){for(var e,r,n=0;n<Qe.length;n++)if(Qe[n].start>=t){e=Qe[n-1],r=Qe[n];break}return e&&r?Je.interpolateRGB(e,r,(t-e.start)/(r.start-e.start)):Qe[0].rgb}},er=k({},Rt,Ft),rr={Color:Je,HueColor:tr,ColorNames:d,ImageFilter:er,GL:Ke,Canvas:dt,ImageLoader:gt},nr=(Je.color,0),ir=[],or=function(){function t(e,r,n){if(y(this,t),"string"!=typeof e)this.el=e;else{var i=document.createElement(e);for(var o in this.uniqId=nr++,r&&(i.className=r),n=n||{})i.setAttribute(o,n[o]);this.el=i}}return b(t,[{key:"attr",value:function(t,e){return 1==arguments.length?this.el.getAttribute(t):(this.el.setAttribute(t,e),this)}},{key:"closest",value:function(e){for(var r=this,n=!1;!(n=r.hasClass(e));){if(!r.el.parentNode)return null;r=new t(r.el.parentNode)}return n?r:null}},{key:"checked",value:function(){return this.el.checked}},{key:"removeClass",value:function(t){return this.el.className=(" "+this.el.className+" ").replace(" "+t+" "," ").trim(),this}},{key:"hasClass",value:function(t){return!!this.el.className&&(" "+this.el.className+" ").indexOf(" "+t+" ")>-1}},{key:"addClass",value:function(t){return this.hasClass(t)||(this.el.className=this.el.className+" "+t),this}},{key:"toggleClass",value:function(t){this.hasClass(t)?this.removeClass(t):this.addClass(t)}},{key:"html",value:function(t){try{"string"==typeof t?this.el.innerHTML=t:this.empty().append(t)}catch(e){console.log(t)}return this}},{key:"find",value:function(t){return this.el.querySelector(t)}},{key:"$",value:function(e){return new t(this.find(e))}},{key:"findAll",value:function(t){return this.el.querySelectorAll(t)}},{key:"$$",value:function(e){return[].concat(O(this.findAll(e))).map((function(e){return new t(e)}))}},{key:"empty",value:function(){return this.html("")}},{key:"append",value:function(t){return"string"==typeof t?this.el.appendChild(document.createTextNode(t)):this.el.appendChild(t.el||t),this}},{key:"appendTo",value:function(t){return(t.el?t.el:t).appendChild(this.el),this}},{key:"remove",value:function(){return this.el.parentNode&&this.el.parentNode.removeChild(this.el),this}},{key:"text",value:function(){return this.el.textContent}},{key:"css",value:function(t,e){var r=this;if(2==arguments.length)this.el.style[t]=e;else if(1==arguments.length){if("string"==typeof t)return getComputedStyle(this.el)[t];var n=t||{};Object.keys(n).forEach((function(t){r.el.style[t]=n[t]}))}return this}},{key:"cssFloat",value:function(t){return parseFloat(this.css(t))}},{key:"cssInt",value:function(t){return parseInt(this.css(t))}},{key:"offset",value:function(){var e=this.el.getBoundingClientRect();return{top:e.top+t.getScrollTop(),left:e.left+t.getScrollLeft()}}},{key:"rect",value:function(){return this.el.getBoundingClientRect()}},{key:"position",value:function(){return this.el.style.top?{top:parseFloat(this.css("top")),left:parseFloat(this.css("left"))}:this.el.getBoundingClientRect()}},{key:"size",value:function(){return[this.width(),this.height()]}},{key:"width",value:function(){return this.el.offsetWidth||this.el.getBoundingClientRect().width}},{key:"contentWidth",value:function(){return this.width()-this.cssFloat("padding-left")-this.cssFloat("padding-right")}},{key:"height",value:function(){return this.el.offsetHeight||this.el.getBoundingClientRect().height}},{key:"contentHeight",value:function(){return this.height()-this.cssFloat("padding-top")-this.cssFloat("padding-bottom")}},{key:"dataKey",value:function(t){return this.uniqId+"."+t}},{key:"data",value:function(t,e){if(2!=arguments.length){if(1==arguments.length)return ir[this.dataKey(t)];var r=Object.keys(ir),n=this.uniqId+".";return r.filter((function(t){return 0==t.indexOf(n)})).map((function(t){return ir[t]}))}return ir[this.dataKey(t)]=e,this}},{key:"val",value:function(t){return 0==arguments.length?this.el.value:(1==arguments.length&&(this.el.value=t),this)}},{key:"int",value:function(){return parseInt(this.val(),10)}},{key:"float",value:function(){return parseFloat(this.val())}},{key:"show",value:function(){return this.css("display","block")}},{key:"hide",value:function(){return this.css("display","none")}},{key:"toggle",value:function(){return"none"==this.css("display")?this.show():this.hide()}},{key:"scrollTop",value:function(){return this.el===document.body?t.getScrollTop():this.el.scrollTop}},{key:"scrollLeft",value:function(){return this.el===document.body?t.getScrollLeft():this.el.scrollLeft}},{key:"on",value:function(t,e,r,n){return this.el.addEventListener(t,e,r,n),this}},{key:"off",value:function(t,e){return this.el.removeEventListener(t,e),this}},{key:"getElement",value:function(){return this.el}},{key:"createChild",value:function(e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=new t(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",arguments.length>2&&void 0!==arguments[2]?arguments[2]:{});return n.css(r),this.append(n),n}},{key:"firstChild",value:function(){return new t(this.el.firstElementChild)}},{key:"replace",value:function(t,e){return this.el.replaceChild(e,t),this}}],[{key:"getScrollTop",value:function(){return Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop)}},{key:"getScrollLeft",value:function(){return Math.max(window.pageXOffset,document.documentElement.scrollLeft,document.body.scrollLeft)}}]),t}(),ar=function(){function t(e){y(this,t),this.$store=e,this.initialize()}return b(t,[{key:"initialize",value:function(){var t=this;this.filterProps().forEach((function(e){t.$store.action(e,t)}))}},{key:"filterProps",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";return Object.getOwnPropertyNames(this.__proto__).filter((function(e){return e.startsWith(t)}))}}]),t}(),lr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"initialize",value:function(){C(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"initialize",this).call(this),this.$store.colorSetsList=[{name:"Material",colors:["#F44336","#E91E63","#9C27B0","#673AB7","#3F51B5","#2196F3","#03A9F4","#00BCD4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548","#9E9E9E","#607D8B"]},{name:"Custom",edit:!0,colors:[]},{name:"Color Scale",scale:["red","yellow","black"],count:5}],this.$store.currentColorSets={}}},{key:"/list",value:function(t){return Array.isArray(t.userList)&&t.userList.length?t.userList:t.colorSetsList}},{key:"/setUserPalette",value:function(t,e){t.userList=e,t.dispatch("/resetUserPalette"),t.dispatch("/setCurrentColorSets")}},{key:"/resetUserPalette",value:function(t){t.userList&&t.userList.length&&(t.userList=t.userList.map((function(e,r){if("function"==typeof e.colors){var n=e.colors;e.colors=n(t),e._colors=n}return Object.assign({name:"color-"+r,colors:[]},e)})),t.emit("changeUserList"))}},{key:"/setCurrentColorSets",value:function(t,e){var r=t.dispatch("/list");t.currentColorSets=void 0===e?r[0]:"number"==typeof e?r[e]:r.filter((function(t){return t.name==e}))[0],t.emit("changeCurrentColorSets")}},{key:"/getCurrentColorSets",value:function(t){return t.currentColorSets}},{key:"/addCurrentColor",value:function(t,e){Array.isArray(t.currentColorSets.colors)&&(t.currentColorSets.colors.push(e),t.emit("changeCurrentColorSets"))}},{key:"/setCurrentColorAll",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.currentColorSets.colors=e,t.emit("changeCurrentColorSets")}},{key:"/removeCurrentColor",value:function(t,e){t.currentColorSets.colors[e]&&(t.currentColorSets.colors.splice(e,1),t.emit("changeCurrentColorSets"))}},{key:"/removeCurrentColorToTheRight",value:function(t,e){t.currentColorSets.colors[e]&&(t.currentColorSets.colors.splice(e,Number.MAX_VALUE),t.emit("changeCurrentColorSets"))}},{key:"/clearPalette",value:function(t){t.currentColorSets.colors&&(t.currentColorSets.colors=[],t.emit("changeCurrentColorSets"))}},{key:"/getCurrentColors",value:function(t){return t.dispatch("/getColors",t.currentColorSets)}},{key:"/getColors",value:function(t,e){return e.scale?Je.scale(e.scale,e.count):e.colors||[]}},{key:"/getColorSetsList",value:function(t){return t.dispatch("/list").map((function(e){return{name:e.name,edit:e.edit,colors:t.dispatch("/getColors",e)}}))}}]),e}(ar),sr={addEvent:function(t,e,r,n){t&&t.addEventListener(e,r,n)},removeEvent:function(t,e,r){t&&t.removeEventListener(e,r)},pos:function(t){return t.touches&&t.touches[0]?t.touches[0]:t},posXY:function(t){var e=this.pos(t);return{x:e.pageX,y:e.pageY}}},ur=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y(this,t),this.masterObj=e,this.settingObj=r}return b(t,[{key:"set",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;this.settingObj[t]=e||r}},{key:"init",value:function(t){if(!this.has(t)){var e=t.split("."),r=this.masterObj.refs[e[0]]||this.masterObj[e[0]]||this.masterObj,n=e.pop();if(r[n]){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];var l=r[n].apply(r,o);this.set(t,l)}}}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this.init(t,e),this.settingObj[t]||e}},{key:"has",value:function(t){return!!this.settingObj[t]}}]),t}(),cr=/^(click|mouse(down|up|move|enter|leave)|touch(start|move|end)|key(down|up|press)|contextmenu|change|input)/gi,hr=/^load (.*)/gi,fr=["Control","Shift","Alt","Meta"],vr=function(){function t(){y(this,t),this.state=new ur(this),this.refs={},this.childComponents=this.components()}return b(t,[{key:"newChildComponents",value:function(){var t=this;Object.keys(this.childComponents).forEach((function(e){var r=t.childComponents[e];t[e]=new r(t)}))}},{key:"render",value:function(){this.$el=this.parseTemplate(this.template()),this.refs.$el=this.$el,this.parseTarget(),this.load(),this.afterRender()}},{key:"afterRender",value:function(){}},{key:"components",value:function(){return{}}},{key:"parseTemplate",value:function(t){var e=this,r=new or("div").html(t).firstChild(),n=r.findAll("[ref]");return[].concat(O(n)).forEach((function(t){var r=t.getAttribute("ref");e.refs[r]=new or(t)})),r}},{key:"parseTarget",value:function(){var t=this,e=this.$el.findAll("[target]");[].concat(O(e)).forEach((function(e){var r=e.getAttribute("target"),n=e.getAttribute("ref")||r,i=new(0,t.childComponents[r])(t);t[n]=i,t.refs[n]=i.$el,i&&(i.render(),new or(e.parentNode).replace(e,i.$el.el))}))}},{key:"load",value:function(){var t=this;this.filterProps(hr).forEach((function(e){var r=e.split("load ")[1];t.refs[r]&&t.refs[r].html(t.parseTemplate(t[e].call(t)))}))}},{key:"template",value:function(){return"<div></div>"}},{key:"initialize",value:function(){}},{key:"initializeEvent",value:function(){var t=this;this.initializeEventMachin(),Object.keys(this.childComponents).forEach((function(e){t[e]&&t[e].initializeEvent()}))}},{key:"destroy",value:function(){var t=this;this.destroyEventMachin(),Object.keys(this.childComponents).forEach((function(e){t[e]&&t[e].destroy()}))}},{key:"destroyEventMachin",value:function(){this.removeEventAll()}},{key:"initializeEventMachin",value:function(){this.filterProps(cr).forEach(this.parseEvent.bind(this))}},{key:"collectProps",value:function(){if(!this.collapsedProps){var t=this.__proto__,e=[];do{e.push.apply(e,O(Object.getOwnPropertyNames(t))),t=t.__proto__}while(t);this.collapsedProps=e}return this.collapsedProps}},{key:"filterProps",value:function(t){return this.collectProps().filter((function(e){return e.match(t)}))}},{key:"parseEvent",value:function(t){var e=t.split(" ");this.bindingEvent(e,this[t].bind(this))}},{key:"getDefaultDomElement",value:function(t){var e=void 0;return(e=t?this.refs[t]||this[t]||window[t]:this.el||this.$el||this.$root)instanceof or?e.getElement():e}},{key:"getDefaultEventObject",value:function(t){var e=this,r=t.split("."),n=r.shift(),i=r.includes("Control"),o=r.includes("Shift"),a=r.includes("Alt"),l=r.includes("Meta"),s=(r=r.filter((function(t){return!1===fr.includes(t)}))).filter((function(t){return!!e[t]}));return{eventName:n,isControl:i,isShift:o,isAlt:a,isMeta:l,codes:r=r.filter((function(t){return!1===s.includes(t)})).map((function(t){return t.toLowerCase()})),checkMethodList:s}}},{key:"bindingEvent",value:function(t,e){var r,n=(r=t,Array.isArray(r)?r:Array.from(r)),i=n[0],o=n[1],a=n.slice(2);o=this.getDefaultDomElement(o);var l=this.getDefaultEventObject(i);l.dom=o,l.delegate=a.join(" "),this.addEvent(l,e)}},{key:"matchPath",value:function(t,e){return t?t.matches(e)?t:this.matchPath(t.parentElement,e):null}},{key:"getBindings",value:function(){return this._bindings||this.initBindings(),this._bindings}},{key:"addBinding",value:function(t){this.getBindings().push(t)}},{key:"initBindings",value:function(){this._bindings=[]}},{key:"checkEventType",value:function(t,e){var r=this,n=!e.isControl||t.ctrlKey,i=!e.isShift||t.shiftKey,o=!e.isAlt||t.altKey,a=!e.isMeta||t.metaKey,l=!0;e.codes.length&&(l=e.codes.includes(t.code.toLowerCase())||e.codes.includes(t.key.toLowerCase()));var s=!0;return e.checkMethodList.length&&(s=e.checkMethodList.every((function(e){return r[e].call(r,t)}))),n&&o&&i&&a&&l&&s}},{key:"makeCallback",value:function(t,e){var r=this;return t.delegate?function(n){if(n.xy=sr.posXY(n),r.checkEventType(n,t)){var i=r.matchPath(n.target||n.srcElement,t.delegate);if(i)return n.delegateTarget=i,n.$delegateTarget=new or(i),e(n)}}:function(n){if(n.xy=sr.posXY(n),r.checkEventType(n,t))return e(n)}}},{key:"addEvent",value:function(t,e){t.callback=this.makeCallback(t,e),this.addBinding(t);var r=!0;"touchstart"===t.eventName&&(r={passive:!0}),sr.addEvent(t.dom,t.eventName,t.callback,r)}},{key:"removeEventAll",value:function(){var t=this;this.getBindings().forEach((function(e){t.removeEvent(e)})),this.initBindings()}},{key:"removeEvent",value:function(t){var e=t.eventName,r=t.dom,n=t.callback;sr.removeEvent(r,e,n)}}]),t}(),dr=/^@/,gr=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.opt=t||{},t&&t.$store&&(r.$store=t.$store),r.initialize(),r.initializeStoreEvent(),r}return x(e,t),b(e,[{key:"initializeStoreEvent",value:function(){var t=this;this.storeEvents={},this.filterProps(dr).forEach((function(e){var r=e.split("@");r.shift();var n=r.join("@");t.storeEvents[n]=t[e].bind(t),t.$store.on(n,t.storeEvents[n])}))}},{key:"destoryStoreEvent",value:function(){var t=this;Object.keys(this.storeEvents).forEach((function(e){t.$store.off(e,t.storeEvents[e])}))}}]),e}(vr);var pr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"initialize",value:function(){C(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"initialize",this).call(this),this.$store.rgb={},this.$store.hsl={},this.$store.hsv={},this.$store.alpha=1,this.$store.format="hex"}},{key:"/changeFormat",value:function(t,e){t.format=e,t.emit("changeFormat")}},{key:"/initColor",value:function(t,e,r){t.dispatch("/changeColor",e,r,!0),t.emit("initColor")}},{key:"/changeColor",value:function(t,e,r,n){var i;"string"==typeof(e=e||"#FF0000")&&(e=Je.parse(e)),e.source=e.source||r,t.alpha=void 0===(i=e.a)||null==i?t.alpha:e.a,t.format="hsv"!=e.type&&e.type||t.format,"hsl"==e.type?(t.hsl=Object.assign(t.hsl,e),t.rgb=Je.HSLtoRGB(t.hsl),t.hsv=Je.HSLtoHSV(e)):"hex"==e.type||"rgb"==e.type?(t.rgb=Object.assign(t.rgb,e),t.hsl=Je.RGBtoHSL(t.rgb),t.hsv=Je.RGBtoHSV(e)):"hsv"==e.type&&(t.hsv=Object.assign(t.hsv,e),t.rgb=Je.HSVtoRGB(t.hsv),t.hsl=Je.HSVtoHSL(t.hsv)),n||t.emit("changeColor",e.source)}},{key:"/getHueColor",value:function(t){return tr.checkHueColor(t.hsv.h/360)}},{key:"/toString",value:function(t,e){var r=t[e=e||t.format]||t.rgb;return Je.format(k({},r,{a:t.alpha}),e)}},{key:"/toColor",value:function(t,e){return"rgb"==(e=e||t.format)?t.dispatch("/toRGB"):"hsl"==e?t.dispatch("/toHSL"):"hex"==e?t.dispatch("/toHEX"):t.dispatch("/toString",e)}},{key:"/toRGB",value:function(t){return t.dispatch("/toString","rgb")}},{key:"/toHSL",value:function(t){return t.dispatch("/toString","hsl")}},{key:"/toHEX",value:function(t){return t.dispatch("/toString","hex").toUpperCase()}}]),e}(ar),mr=function(){function t(e){y(this,t),this.callbacks=[],this.actions=[],this.modules=e.modules||[],this.initialize()}return b(t,[{key:"initialize",value:function(){this.initializeModule()}},{key:"initializeModule",value:function(){var t=this;this.modules.forEach((function(e){new e(t)}))}},{key:"action",value:function(t,e){this.actions[t]={context:e,callback:e[t]}}},{key:"dispatch",value:function(t){var e=[].concat(Array.prototype.slice.call(arguments)),r=(t=e.shift(),this.actions[t]);if(r)return r.callback.apply(r.context,[this].concat(O(e)))}},{key:"module",value:function(t){}},{key:"on",value:function(t,e){this.callbacks.push({event:t,callback:e})}},{key:"off",value:function(t,e){0==arguments.length?this.callbacks=[]:1==arguments.length?this.callbacks=this.callbacks.filter((function(e){return e.event!=t})):2==arguments.length&&(this.callbacks=this.callbacks.filter((function(r){return r.event!=t&&r.callback!=e})))}},{key:"emit",value:function(){var t=[].concat(Array.prototype.slice.call(arguments)),e=t.shift();this.callbacks.filter((function(t){return t.event==e})).forEach((function(e){e&&"function"==typeof e.callback&&e.callback.apply(e,O(t))}))}}]),t}(),yr=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.isColorPickerShow=!1,r.isShortCut=!1,r.hideDelay=+(void 0===r.opt.hideDeplay?2e3:r.opt.hideDelay),r.timerCloseColorPicker,r.autoHide=r.opt.autoHide||!0,r.outputFormat=r.opt.outputFormat,r.$checkColorPickerClass=r.checkColorPickerClass.bind(r),r}return x(e,t),b(e,[{key:"initialize",value:function(){var t=this;this.$body=null,this.$root=null,this.$store=new mr({modules:[pr,lr]}),this.callbackChange=function(){t.callbackColorValue()},this.callbackLastUpdate=function(){t.callbackLastUpdateColorValue()},this.colorpickerShowCallback=function(){},this.colorpickerHideCallback=function(){},this.colorpickerLastUpdateCallback=function(){},this.$body=new or(this.getContainer()),this.$root=new or("div","codemirror-colorpicker"),"inline"==this.opt.position&&this.$body.append(this.$root),this.opt.type&&this.$root.addClass(this.opt.type),this.opt.hideInformation&&this.$root.addClass("hide-information"),this.opt.hideColorsets&&this.$root.addClass("hide-colorsets"),this.$arrow=new or("div","arrow"),this.$root.append(this.$arrow),this.$store.dispatch("/setUserPalette",this.opt.colorSets),this.render(),this.$root.append(this.$el),this.initColorWithoutChangeEvent(this.opt.color),this.initializeEvent()}},{key:"initColorWithoutChangeEvent",value:function(t){this.$store.dispatch("/initColor",t)}},{key:"show",value:function(t,e,r,n,i){this.colorpickerShowCallback=r,this.colorpickerHideCallback=n,this.colorpickerLastUpdateCallback=i,this.$root.css(this.getInitalizePosition()).show(),this.isColorPickerShow=!0,this.isShortCut=t.isShortCut||!1,this.outputFormat=t.outputFormat,this.hideDelay=+(void 0===t.hideDelay?2e3:t.hideDelay),this.hideDelay>0&&this.setHideDelay(this.hideDelay),this.$root.appendTo(this.$body),this.definePosition(t),this.initColorWithoutChangeEvent(e)}},{key:"initColor",value:function(t,e){this.$store.dispatch("/changeColor",t,e)}},{key:"hide",value:function(){this.isColorPickerShow&&(this.$root.hide(),this.$root.remove(),this.isColorPickerShow=!1,this.callbackHideColorValue())}},{key:"setColorsInPalette",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.$store.dispatch("/setCurrentColorAll",t)}},{key:"setUserPalette",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.$store.dispatch("/setUserPalette",t)}},{key:"getOption",value:function(t){return this.opt[t]}},{key:"setOption",value:function(t,e){this.opt[t]=e}},{key:"isType",value:function(t){return this.getOption("type")==t}},{key:"isPaletteType",value:function(){return this.isType("palette")}},{key:"isSketchType",value:function(){return this.isType("sketch")}},{key:"getContainer",value:function(){return this.opt.container||document.body}},{key:"getColor",value:function(t){return this.$store.dispatch("/toColor",t)}},{key:"definePositionForArrow",value:function(t,e,r){}},{key:"definePosition",value:function(t){var e=this.$root.width(),r=this.$root.height(),n=t.left-this.$body.scrollLeft();e+n>window.innerWidth&&(n-=e+n-window.innerWidth),n<0&&(n=0);var i=t.top-this.$body.scrollTop();r+i>window.innerHeight&&(i-=r+i-window.innerHeight),i<0&&(i=0),this.$root.css({left:n+"px",top:i+"px"})}},{key:"getInitalizePosition",value:function(){return"inline"==this.opt.position?{position:"relative",left:"auto",top:"auto",display:"inline-block"}:{position:"fixed",left:"-10000px",top:"-10000px"}}},{key:"isAbsolute",value:function(){return"inline"!==this.opt.position}},{key:"mouseup.isAbsolute document",value:function(t){this.__isMouseDown=!1,this.checkInHtml(t.target)||(0==this.checkColorPickerClass(t.target)?this.hide():this.__isMouseIn||(clearTimeout(this.timerCloseColorPicker),this.timerCloseColorPicker=setTimeout(this.hide.bind(this),this.delayTime||this.hideDelay)))}},{key:"keyup.isAbsolute.escape $root",value:function(t){this.hide()}},{key:"mouseover.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker)}},{key:"mousemove.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker)}},{key:"mouseenter.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker),this.__isMouseIn=!0}},{key:"mouseleave.isAbsolute $root",value:function(t){this.__isMouseIn=!1,this.__isMouseDown||(clearTimeout(this.timerCloseColorPicker),this.timerCloseColorPicker=setTimeout(this.hide.bind(this),this.delayTime||this.hideDelay))}},{key:"mousedown.isAbsolute $root",value:function(t){this.__isMouseDown=!0}},{key:"setHideDelay",value:function(t){this.delayTime=t||0}},{key:"runHideDelay",value:function(){this.isColorPickerShow&&this.setHideDelay()}},{key:"callbackColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onChange&&this.opt.onChange.call(this,t),"function"==typeof this.colorpickerShowCallback&&this.colorpickerShowCallback(t)}},{key:"callbackLastUpdateColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onLastUpdate&&this.opt.onLastUpdate.call(this,t),"function"==typeof this.colorpickerLastUpdateCallback&&this.colorpickerLastUpdateCallback(t)}},{key:"callbackHideColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onHide&&this.opt.onHide.call(this,t),"function"==typeof this.colorpickerHideCallback&&this.colorpickerHideCallback(t)}},{key:"getCurrentColor",value:function(){return this.$store.dispatch("/toColor",this.outputFormat)}},{key:"checkColorPickerClass",value:function(t){var e=new or(t).closest("codemirror-colorview"),r=new or(t).closest("codemirror-colorpicker"),n=new or(t).closest("CodeMirror");return t.nodeName,!!(r||e||n)}},{key:"checkInHtml",value:function(t){return"HTML"==t.nodeName}},{key:"initializeStoreEvent",value:function(){C(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"initializeStoreEvent",this).call(this),this.$store.on("changeColor",this.callbackChange),this.$store.on("lastUpdateColor",this.callbackLastUpdate),this.$store.on("changeFormat",this.callbackChange)}},{key:"destroy",value:function(){C(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this),this.$store.off("changeColor",this.callbackChange),this.$store.off("lastUpdateColor",this.callbackLastUpdate),this.$store.off("changeFormat",this.callbackChange),this.callbackChange=void 0,this.callbackLastUpdate=void 0,this.colorpickerShowCallback=void 0,this.colorpickerHideCallback=void 0}}]),e}(gr),br=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.minValue=0,r.maxValue=1,r.source="base-slider",r}return x(e,t),b(e,[{key:"getMinMaxPosition",value:function(){var t=this.getMinPosition(),e=this.getMaxDist();return{min:t,max:t+e,width:e}}},{key:"getCurrent",value:function(t){return min+this.getMaxDist()*t}},{key:"getMinPosition",value:function(){return this.refs.$container.offset().left}},{key:"getMaxDist",value:function(){return this.state.get("$container.width")}},{key:"getDist",value:function(t){var e=this.getMinMaxPosition(),r=e.min,n=e.max;return t<r?0:t>n?100:(t-r)/(n-r)*100}},{key:"getCaculatedDist",value:function(t){var e=t?this.getMousePosition(t):this.getCurrent(this.getDefaultValue()/this.maxValue);return this.getDist(e)}},{key:"getDefaultValue",value:function(){return 0}},{key:"setMousePosition",value:function(t){this.refs.$bar.css({left:t+"px"})}},{key:"getMousePosition",value:function(t){return sr.pos(t).pageX}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(t){(t=t||this.getDefaultValue())<=this.minValue?this.refs.$bar.addClass("first").removeClass("last"):t>=this.maxValue?this.refs.$bar.addClass("last").removeClass("first"):this.refs.$bar.removeClass("last").removeClass("first"),this.setMousePosition(this.getMaxDist()*((t||0)/this.maxValue))}}]),e}(function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.source="base-box",r}return x(e,t),b(e,[{key:"refresh",value:function(){}},{key:"refreshColorUI",value:function(t){}},{key:"changeColor",value:function(t){this.$store.dispatch("/changeColor",Object.assign({source:this.source},t||{}))}},{key:"mouseup document",value:function(t){this.onDragEnd(t)}},{key:"mousemove document",value:function(t){this.onDragMove(t)}},{key:"mousedown $bar",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"mousedown $container",value:function(t){this.isDown=!0,this.onDragStart(t)}},{key:"touchend document",value:function(t){this.onDragEnd(t)}},{key:"touchmove document",value:function(t){this.onDragMove(t)}},{key:"touchstart $bar",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"touchstart $container",value:function(t){this.onDragStart(t)}},{key:"onDragStart",value:function(t){this.isDown=!0,this.refreshColorUI(t)}},{key:"onDragMove",value:function(t){this.isDown&&this.refreshColorUI(t)}},{key:"onDragEnd",value:function(t){this.isDown&&(this.$store.emit("lastUpdateColor"),this.isDown=!1)}},{key:"@changeColor",value:function(t){this.source!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),e}(gr)),kr=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.minValue=0,r.maxValue=1,r.source="value-control",r}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="value">\n <div ref="$container" class="value-container">\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"setBackgroundColor",value:function(){this.refs.$container.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){C(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"refresh",this).call(this),this.setBackgroundColor()}},{key:"getDefaultValue",value:function(){return this.$store.hsv.v}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({type:"hsv",v:e/100*this.maxValue})}}]),e}(br),Cr=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.minValue=0,r.maxValue=1,r.source="opacity-control",r}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="opacity">\n <div ref="$container" class="opacity-container">\n <div ref="$colorbar" class="color-bar"></div>\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"refresh",value:function(){C(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=Object.assign({},this.$store.rgb);t.a=0;var e=Je.format(t,"rgb");t.a=1;var r=Je.format(t,"rgb");this.setOpacityColorBarBackground(e,r)}},{key:"setOpacityColorBarBackground",value:function(t,e){this.refs.$colorbar.css("background","linear-gradient(to right, "+t+", "+e+")")}},{key:"getDefaultValue",value:function(){return this.$store.alpha}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({a:Math.floor(e)/100*this.maxValue})}}]),e}(br);var xr,_r=(xr=window,"EyeDropper"in xr),wr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <nav class="el-cp-color-eyedropper">\n <button type="button" ref="$button" title="Eyedropper">\n <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path d="M7.797 18.344c-.019.001-.074-.009-.24-.065-.277-.094-.745-.25-1.137.141l-1.542 1.543a.595.595 0 0 1-.84-.84L5.58 17.58c.391-.39.235-.859.141-1.14-.045-.134-.06-.195-.072-.206-.002-.003-.005-.003-.007-.001l1.06-1.06.703.705a.432.432 0 1 0 .611-.611l-.703-.705.557-.557.703.703a.434.434 0 0 0 .611 0 .434.434 0 0 0 0-.61l-.703-.703.571-.572.703.704a.435.435 0 0 0 .612 0 .434.434 0 0 0 0-.61l-.705-.706L14 7.875l2.126 2.127-8.33 8.342zM19.29 9.37l-.654-.655 1.669-1.668a2.372 2.372 0 0 0-3.353-3.354l-1.669 1.669-.655-.654a1.341 1.341 0 0 0-1.898 1.897l.658.658-8.358 8.359c-.373.373-.214.841-.13 1.094.061.18.069.24.069.253l-1.543 1.542a1.458 1.458 0 1 0 2.062 2.061l1.536-1.54c.019-.003.08.006.259.066.252.085.72.243 1.093-.13l8.359-8.358.658.658a1.341 1.341 0 1 0 1.897-1.898z" fill="currentColor"/>\n </svg>\n </button>\n </nav>\n '}},{key:"click $button",value:function(){var t=this;_r&&(new EyeDropper).open().then((function(e){t.$store.dispatch("/changeColor",e.sRGBHex),t.$store.emit("lastUpdateColor")}))}}]),e}(gr),Or=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"components",value:function(){return{Value:kr,Opacity:Cr,Eyedropper:wr}}},{key:"template",value:function(){return'\n <div class="control '+(_r?"has-eyedropper":"")+'">\n <div target="Value" ></div>\n <div target="Opacity" ></div>\n <div ref="$controlPattern" class="empty"></div>\n <div ref="$controlColor" class="color"></div>\n '+(_r?'\n <div class="el-cp-color-control__left">\n <div target="Eyedropper"></div>\n </div>\n ':"")+" \n </div>\n "}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Value.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"macos-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),e}(gr),Sr=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.width=214,r.height=214,r.thinkness=0,r.half_thinkness=0,r.source="colorwheel",r}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="wheel">\n <canvas class="wheel-canvas" ref="$colorwheel" ></canvas>\n <div class="wheel-canvas" ref="$valuewheel" ></div>\n <div class="drag-pointer" ref="$drag_pointer"></div>\n </div>\n '}},{key:"refresh",value:function(t){this.setColorUI(t)}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.renderValue(),this.setHueColor(null,t)}},{key:"renderValue",value:function(){var t=1-this.$store.hsv.v;this.refs.$valuewheel.css({"background-color":"rgba(0, 0, 0, "+t+")"})}},{key:"renderWheel",value:function(t,e){this.width&&!t&&(t=this.width),this.height&&!e&&(e=this.height);var r=new or("canvas"),n=r.el.getContext("2d");r.el.width=t,r.el.height=e,r.css({width:t+"px",height:e+"px"});for(var i=n.getImageData(0,0,t,e),o=i.data,a=Math.floor(t/2),l=Math.floor(e/2),s=t>e?l:a,u=a,c=l,f=0;f<e;f++)for(var v=0;v<t;v++){var d=v-u+1,g=f-c+1,p=d*d+g*g,m=h(d,g),y=Je.HSVtoRGB(m,Math.min(Math.sqrt(p)/s,1),1),b=4*(f*t+v);o[b]=y.r,o[b+1]=y.g,o[b+2]=y.b,o[b+3]=255}return n.putImageData(i,0,0),this.thinkness>0&&(n.globalCompositeOperation="destination-out",n.fillStyle="black",n.beginPath(),n.arc(u,c,s-this.thinkness,0,2*Math.PI),n.closePath(),n.fill()),r}},{key:"renderCanvas",value:function(){if(!this.$store.createdWheelCanvas){var t=this.refs.$colorwheel,e=t.el.getContext("2d"),r=t.size(),n=w(r,2),i=n[0],o=n[1];this.width&&!i&&(i=this.width),this.height&&!o&&(o=this.height),t.el.width=i,t.el.height=o,t.css({width:i+"px",height:o+"px"});var a=this.renderWheel(i,o);e.drawImage(a.el,0,0),this.$store.createdWheelCanvas=!0}}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"getDefaultSaturation",value:function(){return this.$store.hsv.s}},{key:"getCurrentXY",value:function(t,e,r,n,i){return t?sr.posXY(t):function(t,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return{x:u(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0),y:c(t,e,r)}}(e,r,n,i)}},{key:"getRectangle",value:function(){var t=this.state.get("$el.width"),e=this.state.get("$el.height"),r=this.state.get("$colorwheel.width")/2,n=this.refs.$el.offset().left,i=n+t/2,o=this.refs.$el.offset().top;return{minX:n,minY:o,width:t,height:e,radius:r,centerX:i,centerY:o+e/2}}},{key:"setHueColor",value:function(t,e){if(this.state.get("$el.width")){var r=this.getRectangle(),n=r.minX,i=r.minY,o=r.radius,a=r.centerX,l=r.centerY,s=this.getCurrentXY(t,this.getDefaultValue(),this.getDefaultSaturation()*o,a,l),u=(g=s.x)-a,c=(p=s.y)-l,f=u*u+c*c,v=h(u,c);if(f>o*o)var d=this.getCurrentXY(null,v,o,a,l),g=d.x,p=d.y;var m=Math.min(Math.sqrt(f)/o,1);this.refs.$drag_pointer.css({left:g-n+"px",top:p-i+"px"}),e||this.changeColor({type:"hsv",h:v,s:m})}}},{key:"changeColor",value:function(t){this.$store.dispatch("/changeColor",Object.assign({source:this.source},t||{}))}},{key:"@changeColor",value:function(t){this.source!=t&&this.refresh(!0)}},{key:"@initColor",value:function(){this.refresh(!0)}},{key:"mouseup document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"mousemove document",value:function(t){this.isDown&&this.setHueColor(t)}},{key:"mousedown $drag_pointer",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"mousedown $el",value:function(t){this.isDown=!0,this.setHueColor(t)}},{key:"touchend document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"touchmove document",value:function(t){this.isDown&&this.setHueColor(t)}},{key:"touchstart $drag_pointer",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"touchstart $el",value:function(t){t.preventDefault(),this.isDown=!0,this.setHueColor(t)}}]),e}(gr),Er="chromedevtool-information",Mr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="information hex">\n <div ref="$informationChange" class="information-change">\n <button ref="$formatChangeButton" type="button" class="format-change-button arrow-button"></button>\n </div>\n <div class="information-item hex">\n <div class="input-field hex">\n <input ref="$hexCode" class="input" type="text" />\n <div class="title">HEX</div>\n </div>\n </div>\n <div class="information-item rgb">\n <div class="input-field rgb-r">\n <input ref="$rgb_r" class="input" type="number" step="1" min="0" max="255" />\n <div class="title">R</div>\n </div>\n <div class="input-field rgb-g">\n <input ref="$rgb_g" class="input" type="number" step="1" min="0" max="255" />\n <div class="title">G</div>\n </div>\n <div class="input-field rgb-b">\n <input ref="$rgb_b" class="input" type="number" step="1" min="0" max="255" />\n <div class="title">B</div>\n </div> \n <div class="input-field rgb-a">\n <input ref="$rgb_a" class="input" type="number" step="0.01" min="0" max="1" />\n <div class="title">A</div>\n </div> \n </div>\n <div class="information-item hsl">\n <div class="input-field hsl-h">\n <input ref="$hsl_h" class="input" type="number" step="1" min="0" max="360" />\n <div class="title">H</div>\n </div>\n <div class="input-field hsl-s">\n <input ref="$hsl_s" class="input" type="number" step="1" min="0" max="100" />\n <div class="postfix">%</div>\n <div class="title">S</div>\n </div>\n <div class="input-field hsl-l">\n <input ref="$hsl_l" class="input" type="number" step="1" min="0" max="100" />\n <div class="postfix">%</div> \n <div class="title">L</div>\n </div>\n <div class="input-field hsl-a">\n <input ref="$hsl_a" class="input" type="number" step="0.01" min="0" max="1" />\n <div class="title">A</div>\n </div>\n </div>\n </div>\n '}},{key:"setCurrentFormat",value:function(t){this.format=t,this.initFormat()}},{key:"initFormat",value:function(){var t=this,e=this.format||"hex";["hex","rgb","hsl"].filter((function(t){return t!==e})).forEach((function(e){t.$el.removeClass(e)})),this.$el.addClass(e)}},{key:"nextFormat",value:function(){var t=this.$store.format||"hex",e="hex";"hex"==t?e="rgb":"rgb"==t?e="hsl":"hsl"==t&&(e="hex"),this.format=e,this.$store.dispatch("/changeFormat",e),this.$store.emit("lastUpdateColor"),this.initFormat()}},{key:"goToFormat",value:function(t){this.format=t,this.$store.dispatch("/changeFormat",this.format),this.$store.emit("lastUpdateColor"),this.initFormat()}},{key:"getFormat",value:function(){return this.format||"hex"}},{key:"checkNumberKey",value:function(t){var e=t.which,r=!1;return 37!=e&&39!=e&&8!=e&&46!=e&&9!=e||(r=!0),!(!r&&(e<48||e>57))}},{key:"checkNotNumberKey",value:function(t){return!this.checkNumberKey(t)}},{key:"changeRgbColor",value:function(){this.$store.dispatch("/changeColor",{type:"rgb",r:this.refs.$rgb_r.int(),g:this.refs.$rgb_g.int(),b:this.refs.$rgb_b.int(),a:this.refs.$rgb_a.float(),source:Er}),this.$store.emit("lastUpdateColor")}},{key:"changeHslColor",value:function(){this.$store.dispatch("/changeColor",{type:"hsl",h:this.refs.$hsl_h.int(),s:this.refs.$hsl_s.int(),l:this.refs.$hsl_l.int(),a:this.refs.$hsl_a.float(),source:Er}),this.$store.emit("lastUpdateColor")}},{key:"@changeColor",value:function(t){Er!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}},{key:"input $rgb_r",value:function(t){this.changeRgbColor()}},{key:"input $rgb_g",value:function(t){this.changeRgbColor()}},{key:"input $rgb_b",value:function(t){this.changeRgbColor()}},{key:"input $rgb_a",value:function(t){this.changeRgbColor()}},{key:"input $hsl_h",value:function(t){this.changeHslColor()}},{key:"input $hsl_s",value:function(t){this.changeHslColor()}},{key:"input $hsl_l",value:function(t){this.changeHslColor()}},{key:"input $hsl_a",value:function(t){this.changeHslColor()}},{key:"keyup $hexCode",value:function(t){var e=this.refs.$hexCode.val();"#"!=e.charAt(0)||7!=e.length&&9!==e.length||(this.$store.dispatch("/changeColor",e,Er),this.$store.emit("lastUpdateColor"))}},{key:"click $formatChangeButton",value:function(t){this.nextFormat()}},{key:"click $el .information-item.hex .input-field .title",value:function(t){this.goToFormat("rgb")}},{key:"click $el .information-item.rgb .input-field .title",value:function(t){this.goToFormat("hsl")}},{key:"click $el .information-item.hsl .input-field .title",value:function(t){this.goToFormat("hex")}},{key:"setRGBInput",value:function(){this.refs.$rgb_r.val(this.$store.rgb.r),this.refs.$rgb_g.val(this.$store.rgb.g),this.refs.$rgb_b.val(this.$store.rgb.b),this.refs.$rgb_a.val(this.$store.alpha)}},{key:"setHSLInput",value:function(){this.refs.$hsl_h.val(this.$store.hsl.h),this.refs.$hsl_s.val(this.$store.hsl.s),this.refs.$hsl_l.val(this.$store.hsl.l),this.refs.$hsl_a.val(this.$store.alpha)}},{key:"setHexInput",value:function(){this.refs.$hexCode.val(this.$store.dispatch("/toHEX"))}},{key:"refresh",value:function(){this.setCurrentFormat(this.$store.format),this.setRGBInput(),this.setHSLInput(),this.setHexInput()}}]),e}(gr),Ar=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="color-chooser">\n <div class="color-chooser-container">\n <div class="colorsets-item colorsets-item-header">\n <h1 class="title">Color Palettes</h1>\n <span ref="$toggleButton" class="items">×</span>\n </div>\n <div ref="$colorsetsList" class="colorsets-list"></div>\n </div>\n </div>\n '}},{key:"refresh",value:function(){this.load()}},{key:"@changeCurrentColorSets",value:function(){this.refresh()}},{key:"@toggleColorChooser",value:function(){this.toggle()}},{key:"load $colorsetsList",value:function(){return"\n <div>\n "+this.$store.dispatch("/getColorSetsList").map((function(t,e){return'\n <div class="colorsets-item" data-colorsets-index="'+e+'" >\n <h1 class="title">'+t.name+'</h1>\n <div class="items">\n <div>\n '+t.colors.filter((function(t,e){return e<5})).map((function(t){return'<div class="color-item" title="'+(t=t||"rgba(255, 255, 255, 1)")+'">\n <div class="color-view" style="background-color: '+t+'"></div>\n </div>'})).join("")+"\n </div>\n </div>\n </div>"})).join("")+"\n </div>\n "}},{key:"show",value:function(){this.$el.addClass("open")}},{key:"hide",value:function(){this.$el.removeClass("open")}},{key:"toggle",value:function(){this.$el.toggleClass("open")}},{key:"click $toggleButton",value:function(t){this.toggle()}},{key:"click $colorsetsList .colorsets-item",value:function(t){var e=t.$delegateTarget;if(e){var r=parseInt(e.attr("data-colorsets-index"));this.$store.dispatch("/setCurrentColorSets",r),this.hide()}}},{key:"destroy",value:function(){C(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this),this.hide()}}]),e}(gr),Ir=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="colorsets">\n <div class="menu" title="Open Color Palettes">\n <button ref="$colorSetsChooseButton" type="button" class="color-sets-choose-btn arrow-button"></button>\n </div>\n <div ref="$colorSetsColorList" class="color-list"></div>\n </div>\n '}},{key:"load $colorSetsColorList",value:function(){var t=this.$store.dispatch("/getCurrentColorSets");return'\n <div class="current-color-sets">\n '+this.$store.dispatch("/getCurrentColors").map((function(t,e){return'<div class="color-item" title="'+t+'" data-index="'+e+'" data-color="'+t+'">\n <div class="empty"></div>\n <div class="color-view" style="background-color: '+t+'"></div>\n </div>'})).join("")+" \n "+(t.edit?'<div class="add-color-item">+</div>':"")+" \n </div>\n "}},{key:"refresh",value:function(){this.load()}},{key:"addColor",value:function(t){this.$store.dispatch("/addCurrentColor",t)}},{key:"@changeCurrentColorSets",value:function(){this.refresh()}},{key:"click $colorSetsChooseButton",value:function(t){this.$store.emit("toggleColorChooser")}},{key:"contextmenu $colorSetsColorList",value:function(t){if(t.preventDefault(),this.$store.dispatch("/getCurrentColorSets").edit){var e=new or(t.target).closest("color-item");if(e){var r=parseInt(e.attr("data-index"));this.$store.emit("showContextMenu",t,r)}else this.$store.emit("showContextMenu",t)}}},{key:"click $colorSetsColorList .add-color-item",value:function(t){this.addColor(this.$store.dispatch("/toColor"))}},{key:"click $colorSetsColorList .color-item",value:function(t){this.$store.dispatch("/changeColor",t.$delegateTarget.attr("data-color")),this.$store.emit("lastUpdateColor")}}]),e}(gr),Tr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <ul class="colorsets-contextmenu">\n <li class="menu-item small-hide" data-type="remove-color">Remove color</li>\n <li class="menu-item small-hide" data-type="remove-all-to-the-right">Remove all to the right</li>\n <li class="menu-item" data-type="clear-palette">Clear palette</li>\n </ul>\n '}},{key:"show",value:function(t,e){var r=sr.pos(t);this.$el.css({top:r.clientY-10+"px",left:r.clientX+"px"}),this.$el.addClass("show"),this.selectedColorIndex=e,void 0===this.selectedColorIndex?this.$el.addClass("small"):this.$el.removeClass("small")}},{key:"hide",value:function(){this.$el.removeClass("show")}},{key:"runCommand",value:function(t){switch(t){case"remove-color":this.$store.dispatch("/removeCurrentColor",this.selectedColorIndex);break;case"remove-all-to-the-right":this.$store.dispatch("/removeCurrentColorToTheRight",this.selectedColorIndex);break;case"clear-palette":this.$store.dispatch("/clearPalette")}}},{key:"@showContextMenu",value:function(t,e){this.show(t,e)}},{key:"click $el .menu-item",value:function(t){t.preventDefault(),this.runCommand(t.$delegateTarget.attr("data-type")),this.hide()}}]),e}(gr),Pr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="colorwheel"></div>\n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div> \n </div>\n '}},{key:"components",value:function(){return{colorwheel:Sr,control:Or,information:Mr,currentColorSets:Ir,colorSetsChooser:Ar,contextMenu:Tr}}}]),e}(yr),Dr=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.minValue=0,r.maxValue=360,r.source="hue-control",r}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="hue">\n <div ref="$container" class="hue-container">\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({h:e/100*this.maxValue,type:"hsv"})}}]),e}(br),Br=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"components",value:function(){return{Hue:Dr,Opacity:Cr,Eyedropper:wr}}},{key:"template",value:function(){return'\n <div class="control '+(_r?"has-eyedropper":"")+'">\n <div target="Hue" ></div>\n <div target="Opacity" ></div>\n <div ref="$controlPattern" class="empty"></div>\n <div ref="$controlColor" class="color"></div>\n '+(_r?'\n <div class="el-cp-color-control__left">\n <div target="Eyedropper"></div>\n </div>\n ':"")+" \n </div>\n "}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"chromedevtool-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),e}(gr),jr="chromedevtool-palette",Rr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="color">\n <div ref="$saturation" class="saturation">\n <div ref="$value" class="value">\n <div ref="$drag_pointer" class="drag-pointer"></div>\n </div>\n </div> \n </div> \n '}},{key:"setBackgroundColor",value:function(t){this.$el.css("background-color",t)}},{key:"refresh",value:function(){this.setColorUI()}},{key:"caculateSV",value:function(){var t=this.drag_pointer_pos||{x:0,y:0},e=this.state.get("$el.width"),r=this.state.get("$el.height"),n=t.x/e,i=(r-t.y)/r;this.$store.dispatch("/changeColor",{type:"hsv",s:n,v:i,source:jr})}},{key:"setColorUI",value:function(){var t=this.state.get("$el.width")*this.$store.hsv.s,e=this.state.get("$el.height")*(1-this.$store.hsv.v);this.refs.$drag_pointer.css({left:t+"px",top:e+"px"}),this.drag_pointer_pos={x:t,y:e},this.setBackgroundColor(this.$store.dispatch("/getHueColor"))}},{key:"setMainColor",value:function(t){var e=this.$el.offset(),r=this.state.get("$el.contentWidth"),n=this.state.get("$el.contentHeight"),i=sr.pos(t).pageX-e.left,o=sr.pos(t).pageY-e.top;i<0?i=0:i>r&&(i=r),o<0?o=0:o>n&&(o=n),this.refs.$drag_pointer.css({left:i+"px",top:o+"px"}),this.drag_pointer_pos={x:i,y:o},this.caculateSV()}},{key:"@changeColor",value:function(t){jr!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}},{key:"mouseup document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"mousemove document",value:function(t){this.isDown&&this.setMainColor(t)}},{key:"mousedown",value:function(t){this.isDown=!0,this.setMainColor(t)}},{key:"touchend document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"touchmove document",value:function(t){this.isDown&&this.setMainColor(t)}},{key:"touchstart",value:function(t){t.preventDefault(),this.isDown=!0,this.setMainColor(t)}}]),e}(gr),Ur=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div> \n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Rr,control:Br,information:Mr,currentColorSets:Ir,colorSetsChooser:Ar,contextMenu:Tr}}}]),e}(yr),Fr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"components",value:function(){return{Hue:Dr,Opacity:Cr}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Hue" ></div>\n <div target="Opacity" ></div>\n </div>\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),e}(gr),Lr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div>\n <div target="control"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Rr,control:Fr}}}]),e}(yr),Hr=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.source="vertical-slider",r}return x(e,t),b(e,[{key:"getMaxDist",value:function(){return this.state.get("$container.height")}},{key:"setMousePosition",value:function(t){this.refs.$bar.css({top:t+"px"})}},{key:"getMousePosition",value:function(t){return sr.pos(t).pageY}},{key:"getMinPosition",value:function(){return this.refs.$container.offset().top}},{key:"getCaculatedDist",value:function(t){var e=t?this.getMousePosition(t):this.getCurrent(this.getDefaultValue()/this.maxValue);return 100-this.getDist(e)}},{key:"setColorUI",value:function(t){(t=t||this.getDefaultValue())<=this.minValue?this.refs.$bar.addClass("first").removeClass("last"):t>=this.maxValue?this.refs.$bar.addClass("last").removeClass("first"):this.refs.$bar.removeClass("last").removeClass("first");var e=1-(t||0)/this.maxValue;this.setMousePosition(this.getMaxDist()*e)}}]),e}(br),Vr=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.minValue=0,r.maxValue=360,r.source="vertical-hue-control",r}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="hue">\n <div ref="$container" class="hue-container">\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({h:e/100*this.maxValue,type:"hsv"})}}]),e}(Hr),Nr=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.source="vertical-opacity-control",r}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="opacity">\n <div ref="$container" class="opacity-container">\n <div ref="$colorbar" class="color-bar"></div>\n <div ref="$bar" class="drag-bar2"></div>\n </div>\n </div>\n '}},{key:"refresh",value:function(){C(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=Object.assign({},this.$store.rgb);t.a=0;var e=Je.format(t,"rgb");t.a=1;var r=Je.format(t,"rgb");this.refs.$colorbar.css("background","linear-gradient(to top, "+e+", "+r+")")}},{key:"getDefaultValue",value:function(){return this.$store.alpha}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({a:Math.floor(e)/100*this.maxValue})}}]),e}(Hr),Gr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"components",value:function(){return{Hue:Vr,Opacity:Nr}}},{key:"template",value:function(){return'<div class="control"><div target="Hue" ></div><div target="Opacity" ></div></div>'}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),e}(gr),zr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div><div target="control"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Rr,control:Gr}}}]),e}(yr),Xr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"components",value:function(){return{Value:kr,Opacity:Cr,Eyedropper:wr}}},{key:"template",value:function(){return'\n <div class="control '+(_r?"has-eyedropper":"")+'">\n <div target="Value" ></div>\n <div target="Opacity" ></div>\n <div ref="$controlPattern" class="empty"></div>\n <div ref="$controlColor" class="color"></div>\n '+(_r?'\n <div class="el-cp-color-control__left">\n <div target="Eyedropper"></div>\n </div>\n ':"")+" \n </div>\n "}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Value.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"macos-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),e}(gr),qr=function(t){function e(t){y(this,e);var r=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.width=214,r.height=214,r.thinkness=16,r.half_thinkness=r.thinkness/2,r.source="colorring",r}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class="wheel" data-type="ring">\n <canvas class="wheel-canvas" ref="$colorwheel" ></canvas>\n <div class="drag-pointer" ref="$drag_pointer"></div>\n </div>\n '}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.setHueColor(null,t)}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"setHueColor",value:function(t,e){if(this.state.get("$el.width")){var r=this.getRectangle(),n=r.minX,i=r.minY,o=r.radius,a=r.centerX,l=r.centerY,s=this.getCurrentXY(t,this.getDefaultValue(),o,a,l),u=h(s.x-a,s.y-l),c=this.getCurrentXY(null,u,o-this.half_thinkness,a,l),f=c.x,v=c.y;this.refs.$drag_pointer.css({left:f-n+"px",top:v-i+"px"}),e||this.changeColor({type:"hsv",h:u})}}}]),e}(Sr),Yr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="colorring"></div>\n <div target="palette"></div> \n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div>\n </div>\n '}},{key:"components",value:function(){return{colorring:qr,palette:Rr,control:Xr,information:Mr,currentColorSets:Ir,colorSetsChooser:Ar,contextMenu:Tr}}}]),e}(yr),Wr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"components",value:function(){return{Hue:Vr,Opacity:Nr}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Hue" ></div>\n <div target="Opacity" ></div>\n </div>\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(){this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),e}(gr),Kr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div> \n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Rr,control:Wr,information:Mr,currentColorSets:Ir,colorSetsChooser:Ar,contextMenu:Tr}}}]),e}(yr),Zr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"components",value:function(){return{Hue:Vr,Opacity:Nr}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Opacity" ></div> \n <div target="Hue" ></div>\n </div>\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),e}(gr),Jr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return"\n <div class='colorpicker-body'>\n <div class='color-view "+(_r?"has-eyedropper":"")+'\' >\n <div class=\'color-view-container\' >\n <div class="preview" ref="$colorview"></div>\n </div>\n '+(_r?'\n <div class="el-cp-color-control__left">\n <div target="Eyedropper"></div>\n </div>\n ':"")+' \n </div>\n <div class=\'color-tool\'>\n <div target="palette"></div>\n <div target="control"></div>\n </div>\n </div>\n '}},{key:"components",value:function(){return{palette:Rr,control:Zr,Eyedropper:wr}}},{key:"initColorWithoutChangeEvent",value:function(t){this.$store.dispatch("/initColor",t),this.refresh()}},{key:"setBackgroundColor",value:function(){var t=this.$store.dispatch("/toColor"),e=this.$store.rgb,r=Je.brightness(e.r,e.g,e.b);this.refs.$colorview.css({"background-color":t,color:r>127?"black":"white"}),this.refs.$colorview.html(t)}},{key:"click $colorview",value:function(t){this.nextFormat()}},{key:"nextFormat",value:function(){var t=this.$store.format||"hex",e="hex";"hex"==t?e="rgb":"rgb"==t?e="hsl":"hsl"==t&&(e="hex"),this.$store.dispatch("/changeFormat",e),this.$store.emit("lastUpdateColor"),this.refresh()}},{key:"refresh",value:function(){this.setBackgroundColor()}},{key:"@changeColor",value:function(){this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),e}(yr),Qr=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"components",value:function(){return{Hue:Dr,Opacity:Cr,Eyedropper:wr}}},{key:"template",value:function(){return'\n <div class="control '+(_r?"has-eyedropper":"")+'">\n <div>\n '+(_r?'\n <div class="el-cp-color-control__left">\n <div target="Eyedropper"></div>\n </div>\n ':"")+' \n <div class="color-info">\n <div ref="$controlPattern" class="empty"></div>\n <div ref="$controlColor" class="color"></div> \n </div>\n </div>\n <div target="Hue" ></div>\n <div target="Opacity" ></div>\n\n </div>\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"chromedevtool-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),e}(gr),tn=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,t),b(e,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div> \n <div>\n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div>\n </div>\n </div>\n '}},{key:"components",value:function(){return{palette:Rr,control:Qr,information:Mr,currentColorSets:Ir,colorSetsChooser:Ar,contextMenu:Tr}}}]),e}(yr),en={create:function(t){switch(t.type){case"box":return new tn(t);case"macos":return new Pr(t);case"xd":return new Kr(t);case"ring":return new Yr(t);case"mini":return new Lr(t);case"vscode":return new Jr(t);case"mini-vertical":return new zr(t);default:return new Ur(t)}},ColorPicker:Ur,ChromeDevToolColorPicker:Ur,MacOSColorPicker:Pr,RingColorPicker:Yr,MiniColorPicker:Lr,VSCodePicker:Jr,MiniVerticalColorPicker:zr},rn="codemirror-colorview",nn="codemirror-colorview-background",on=["comment","builtin","qualifier","tag","property","property error","variable","variable-2"];function an(t,e){"setValue"==e.origin?(t.state.colorpicker.init_color_update(),t.state.colorpicker.style_color_update()):t.state.colorpicker.style_color_update(t.getCursor().line)}function ln(t,e){t.state.colorpicker.isUpdate||(t.state.colorpicker.isUpdate=!0,t.state.colorpicker.close_color_picker(),t.state.colorpicker.init_color_update(),t.state.colorpicker.style_color_update())}function sn(t,e){an(t,{origin:"setValue"})}function un(t,e){t.state.colorpicker.keyup(e)}function cn(t,e){t.state.colorpicker.is_edit_mode()&&t.state.colorpicker.check_mousedown(e)}function hn(t,e){an(t,{origin:"setValue"})}function fn(t){t.state.colorpicker.close_color_picker()}function vn(t){t.state.colorpicker.hide_delay_color_picker(t.state.colorpicker.opt.hideDelay||1e3)}var dn=function(){function t(e,r){y(this,t),r="boolean"==typeof r?{mode:"edit"}:Object.assign({mode:"edit"},r||{}),this.opt=r,this.cm=e,this.markers={},this.excluded_token=this.opt.excluded_token||on,this.opt.colorpicker?this.colorpicker=this.opt.colorpicker(this.opt):this.colorpicker=en.create(this.opt),this.init_event()}return b(t,[{key:"init_event",value:function(){var t,e;this.cm.on("mousedown",cn),this.cm.on("keyup",un),this.cm.on("change",an),this.cm.on("update",ln),this.cm.on("refresh",sn),this.cm.on("blur",vn),this.onPasteCallback=(t=this.cm,e=hn,function(r){e.call(this,t,r)}),this.onScrollEvent=function(t,e){var r=void 0;return function(n,i){r&&clearTimeout(r),r=setTimeout((function(){t(n,i)}),e||300)}}(fn,50),this.cm.getWrapperElement().addEventListener("paste",this.onPasteCallback),this.is_edit_mode()&&this.cm.on("scroll",this.onScrollEvent)}},{key:"is_edit_mode",value:function(){return"edit"==this.opt.mode}},{key:"is_view_mode",value:function(){return"view"==this.opt.mode}},{key:"destroy",value:function(){this.cm.off("mousedown",cn),this.cm.off("keyup",un),this.cm.off("change",an),this.cm.off("blur",vn),this.cm.getWrapperElement().removeEventListener("paste",this.onPasteCallback),this.is_edit_mode()&&this.cm.off("scroll",this.onScrollEvent)}},{key:"hasClass",value:function(t,e){return!!t.className&&(" "+t.className+" ").indexOf(" "+e+" ")>-1}},{key:"check_mousedown",value:function(t){this.hasClass(t.target,nn)?this.open_color_picker(t.target.parentNode):this.close_color_picker()}},{key:"popup_color_picker",value:function(t){var e=this.cm.getCursor(),r=this,n={lineNo:e.line,ch:e.ch,color:t||"#FFFFFF",isShortCut:!0};Object.keys(this.markers).forEach((function(t){if(("#"+t).indexOf("#"+n.lineNo+":")>-1){var e=r.markers[t];e.ch<=n.ch&&n.ch<=e.ch+e.color.length&&(n.ch=e.ch,n.color=e.color,n.nameColor=e.nameColor)}})),this.open_color_picker(n)}},{key:"open_color_picker",value:function(t){var e=this,r=t.lineNo,n=t.ch,i=t.nameColor,o=t.color;if(this.colorpicker){var a=o,l=this.cm.charCoords({line:r,ch:n});this.colorpicker.show({left:l.left,top:l.bottom,isShortCut:t.isShortCut||!1,hideDelay:this.opt.hideDelay||2e3},i||o,(function(t){e.cm.replaceRange(t,{line:r,ch:n},{line:r,ch:n+a.length},"*colorpicker"),e.cm.focus(),a=t}))}}},{key:"close_color_picker",value:function(){this.colorpicker&&this.colorpicker.hide()}},{key:"hide_delay_color_picker",value:function(){this.colorpicker&&this.colorpicker.runHideDelay()}},{key:"key",value:function(t,e){return[t,e].join(":")}},{key:"keyup",value:function(t){this.colorpicker&&("Escape"==t.key||0==this.colorpicker.isShortCut)&&this.colorpicker.hide()}},{key:"init_color_update",value:function(){this.markers={}}},{key:"style_color_update",value:function(t){if(t)this.match(t);else for(var e=this.cm.lineCount(),r=0;r<e;r++)this.match(r)}},{key:"empty_marker",value:function(t,e){for(var r=e.markedSpans||[],n=0,i=r.length;n<i;n++){var o=this.key(t,r[n].from);o&&(a=r[n].marker.replacedWith,l=rn,a&&a.className&&(" "+a.className+" ").indexOf(" "+l+" ")>-1)&&(delete this.markers[o],r[n].marker.clear())}var a,l}},{key:"match_result",value:function(t){return Je.matches(t.text)}},{key:"submatch",value:function(t,e){var r=this;this.empty_marker(t,e);var n=this.match_result(e),i={next:0};n.forEach((function(n){r.render(i,t,e,n.color,n.nameColor)}))}},{key:"match",value:function(t){var e=this.cm.getLineHandle(t),r=this;this.cm.operation((function(){r.submatch(t,e)}))}},{key:"make_element",value:function(){var t=document.createElement("div");return t.className=rn,this.is_edit_mode()?t.title="open color picker":t.title="",t.back_element=this.make_background_element(),t.appendChild(t.back_element),t}},{key:"make_background_element",value:function(){var t=document.createElement("div");return t.className=nn,t}},{key:"set_state",value:function(t,e,r,n){var i=this.create_marker(t,e);return i.lineNo=t,i.ch=e,i.color=r,i.nameColor=n,i}},{key:"create_marker",value:function(t,e){return this.has_marker(t,e)||this.init_marker(t,e),this.get_marker(t,e)}},{key:"init_marker",value:function(t,e){this.markers[this.key(t,e)]=this.make_element()}},{key:"has_marker",value:function(t,e){return!!this.get_marker(t,e)}},{key:"get_marker",value:function(t,e){var r=this.key(t,e);return this.markers[r]}},{key:"update_element",value:function(t,e){t.back_element.style.backgroundColor=e}},{key:"set_mark",value:function(t,e,r){this.cm.setBookmark({line:t,ch:e},{widget:r,handleMouseEvents:!0})}},{key:"is_excluded_token",value:function(t,e){var r=this.cm.getTokenAt({line:t,ch:e},!0),n=r.type,i=r.state.state;return null==n&&"block"==i||null==n&&"top"==i||this.excluded_token.includes(n)}},{key:"render",value:function(t,e,r,n,i){var o=r.text.indexOf(n,t.next);if(!0!==this.is_excluded_token(e,o+1)){if(t.next=o+n.length,this.has_marker(e,o))return this.update_element(this.create_marker(e,o),i||n),void this.set_state(e,o,n,i);var a=this.create_marker(e,o);this.update_element(a,i||n),this.set_state(e,o,n,i||n),this.set_mark(e,o,a)}else t.next=o+n.length}}]),t}();try{var gn=r(3204)}catch(t){}function pn(){var t=gn||window.CodeMirror;t&&t.defineOption("colorpicker",!1,(function(e,r,n){n&&n!=t.Init&&e.state.colorpicker&&(e.state.colorpicker.destroy(),e.state.colorpicker=null),r&&(e.state.colorpicker=new dn(e,r))}))}return pn(),k({},rr,en,{load:pn})}()},1002:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}r.d(e,{Z:()=>n})}},t=>{t(t.s=8042)}]);