diff --git a/client/chunk_15.min.js b/client/chunk_15.min.js index 54c4a4f5..8d93b37d 100644 --- a/client/chunk_15.min.js +++ b/client/chunk_15.min.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{686:function(e,t,i){"use strict";const n=new Int32Array(15),a={_get_init_state:(e,t,i,n,a,r)=>({canvas_event_target:"CANVAS_WRAPPER_OVERFLOW",canvas_container:{top:0,left:0,height:0,width:0},sizes:{width:0|e,height:0|t},screen_zoom_ratio:1,canvas_wrapper:{padding:0|n,border_width:0|a},scale:{default:i,current:i,move_x:0,move_y:0,moves_speeds:[],move_speed_timestamp:0|Date.now(),moves_speed_average_now:16},device_pixel_ratio:window.devicePixelRatio,perspective:r}),_get_screen_zoom_ratio:e=>e.canvas_container.width>e.canvas_container.height?(e.canvas_container.height-e.canvas_wrapper.padding/e.device_pixel_ratio*2)/e.sizes.height:(e.canvas_container.width-e.canvas_wrapper.padding/e.device_pixel_ratio*2)/e.sizes.width,_get_pos:(e,t,i)=>(n[0]=2*Math.round(e.canvas_wrapper.padding/e.device_pixel_ratio*e.scale.current+e.canvas_wrapper.border_width)|0,n[1]=Math.round(e.sizes.width*t*e.scale.current)+n[0]|0,n[2]=Math.round(e.sizes.height*t*e.scale.current)+n[0]|0,n[3]=0|e.scale.move_x,n[4]=0|e.scale.move_y,n[5]=e.canvas_container.left+n[3]|0,n[6]=e.canvas_container.top+n[4]|0,n[7]=n[5]+n[1]|0,n[8]=n[6]+n[2]|0,n[9]=n[0]/2|0,n[10]=n[0]/2|0,n[11]=n[5]+n[9]|0,n[12]=n[6]+n[10]|0,n[13]=n[7]-n[0]/2|0,n[14]=n[8]-n[0]/2|0,void 0===i&&(i={}),void 0===i.canvas&&(i.canvas={}),i.canvas.offset_left=n[9],i.canvas.offset_top=n[10],i.canvas.left=n[11],i.canvas.top=n[12],i.canvas.right=n[13],i.canvas.bottom=n[14],i.canvas.width=n[13]-n[11]|0,i.canvas.height=n[14]-n[12]|0,void 0===i.canvas_wrapper&&(i.canvas_wrapper={}),i.canvas_wrapper.offset_left=n[3],i.canvas_wrapper.offset_top=n[4],i.canvas_wrapper.left=n[5],i.canvas_wrapper.top=n[6],i.canvas_wrapper.right=n[7],i.canvas_wrapper.bottom=n[8],i.canvas_wrapper.width=n[7]-n[5]|0,i.canvas_wrapper.height=n[8]-n[6]|0,void 0===i.canvas_container&&(i.canvas_container={}),i.canvas_container.offset_left=0|e.canvas_container.left,i.canvas_container.offset_top=0|e.canvas_container.top,i.canvas_container.left=0|e.canvas_container.left,i.canvas_container.top=0|e.canvas_container.top,i.canvas_container.right=e.canvas_container.left+e.canvas_container.width|0,i.canvas_container.bottom=e.canvas_container.top+e.canvas_container.height|0,i.canvas_container.width=0|e.canvas_container.width,i.canvas_container.height=0|e.canvas_container.height,i),_get_init_pointer_state:()=>({event_button:null,mouse_down:!1,pointer_events:new Map,previous_single_pointer_down_timestamp:0,previous_double_pointer_down_timestamp:0,latest_pointers_distance:0,latest_pointers_client_x_center:0,latest_pointers_client_y_center:0,previous_double_pointer_move_timestamp:0}),_copy_event:e=>({pointerId:0|e.pointerId,clientX:0|e.clientX,clientY:0|e.clientY,pageX:0|e.pageX,pageY:0|e.pageY,button:0|e.button}),_get_shadows(e){function t(t){const n=i.to_rgba_from_hex(i.format_hex_color(e));let a=i.to_hex_from_rgba(Uint8ClampedArray.of(n[0],n[1],n[2],parseInt(142.8))),r=i.to_hex_from_rgba(Uint8ClampedArray.of(n[0],n[1],n[2],parseInt(91.8))),s=i.to_hex_from_rgba(Uint8ClampedArray.of(n[0],n[1],n[2],parseInt(.24*255)));return Array.of(`${t[0]}px ${t[1]}px ${t[2]}px ${t[3]}px ${a}`,`${t[4]}px ${t[5]}px ${t[6]}px ${t[7]}px ${r}`,`${t[8]}px ${t[9]}px ${t[10]}px ${t[11]}px ${s}`).join(",")}const i={format_hex_color(e){const t=0|e.length;if(void 0===e)return"#00000000";{let i="",n="",a="",r="",s="#12345678";switch(t){case 9:s=e;break;case 7:s=e.concat("ff");break;case 5:i=e.charAt(1),n=e.charAt(2),a=e.charAt(3),r=e.charAt(4),s="#".concat(i,i,n,n,a,a,r,r);break;case 4:i=e.charAt(1),n=e.charAt(2),a=e.charAt(3),s="#".concat(i,i,n,n,a,a,"ff")}return s}},to_hex_from_rgba:e=>"#".concat("00000000".concat(new Uint32Array(e.reverse().buffer)[0].toString(16)).slice(-8)),to_rgba_from_hex:e=>new Uint8ClampedArray(Uint32Array.of(parseInt(e.slice(1),16)).buffer).reverse()};return Array.of("",t([0,2,1,-1,0,1,1,0,0,1,3,0]),t([0,3,1,-2,0,2,2,0,0,1,5,0]),t([0,3,3,-2,0,3,4,0,0,1,8,0]),t([0,2,4,-1,0,4,5,0,0,1,10,0]),t([0,3,5,-1,0,5,8,0,0,1,14,0]),t([0,3,5,-1,0,6,10,0,0,1,18,0]),t([0,4,5,-2,0,7,10,1,0,2,16,1]),t([0,5,5,-3,0,8,10,1,0,3,14,2]),t([0,5,6,-3,0,9,12,1,0,3,16,2]),t([0,6,6,-3,0,10,14,1,0,4,18,3]),t([0,6,7,-4,0,11,15,1,0,4,20,3]),t([0,7,8,-4,0,12,17,2,0,5,22,4]),t([0,7,8,-4,0,13,19,2,0,5,24,4]),t([0,7,9,-4,0,14,21,2,0,5,26,4]),t([0,8,9,-5,0,15,22,2,0,6,28,5]),t([0,8,10,-5,0,16,24,2,0,6,30,5]),t([0,8,11,-5,0,17,26,2,0,6,32,5]),t([0,9,11,-5,0,18,28,2,0,7,34,6]),t([0,9,12,-6,0,19,29,2,0,7,36,6]),t([0,10,13,-6,0,20,31,3,0,8,38,7]),t([0,10,13,-6,0,21,33,3,0,8,40,7]),t([0,10,14,-6,0,22,35,3,0,8,42,7]),t([0,11,14,-7,0,23,36,3,0,9,44,8]),t([0,11,15,-7,0,24,38,3,0,9,46,8]))},from(e,t,i,n,a,r){const s=this._get_screen_zoom_ratio,o=this._get_init_state,_=this._get_init_pointer_state,l=this._get_pos,h=this._get_shadows;this._copy_event;let c=!1,p=h("#020529"),d=_(),u=o(e,t,i,n,a,r),m=s(u),f=l(u,m),g={update(){},menu(){},move(){},up(){},down(){},middle(){},ripple(){}},A=null,y=null,x={box_shadow:"",will_change:!1};return{init_speed_interval:function(){null!==A?setTimeout(this.set_move_speed_average_now,5):A=setInterval(this.set_move_speed_average_now,20)},set_canvas_wrapper:function(e,t){u.canvas_wrapper={padding:e,border_width:t},m=s(u),f=l(u,m),this.set_current_scale_default()},set_canvas_container:function(e,t,i,n){u.canvas_container={top:e,left:t,height:i,width:n},m=s(u),f=l(u,m),this.set_current_scale_default()},set_sizes:function(e,t){u.sizes={width:e,height:t},u.scale.moves_speed_average_now=16,m=s(u),f=l(u,m)},set_perspective:function(e){u.perspective=e},get_pointer_state:function(){return d},get_perspective_state:function(){return y||{}},get_screen_zoom_ratio:function(){return Math.fround(parseFloat(m)).toFixed(2)},compute_perspective_from_pointer_event:function(e,t){if(e|=0,t|=0,!(u.perspective>0))return;const i=e-f.canvas_container.left|0,n=t-f.canvas_container.top|0,a=u.perspective*(i-f.canvas_container.width/2)/(f.canvas_container.width/2),r=-u.perspective*(n-f.canvas_container.height/2)/(f.canvas_container.height/2),s=a>u.perspective?a:2*a,o=r<0?r:2*r,_=255-s/2*255,l=o/2*255,h=(1.25*s/u.scale.current*1e3|0)/1e3,c=(1.25*o/u.scale.current*1e3|0)/1e3,p=!(!c&&!h),d=p?`rotateX(${c}deg) rotateY(${h}deg)`:"",m=p?`linear-gradient(to right, rgba(\n ${_.toFixed(3)},\n ${_.toFixed(3)},\n ${_.toFixed(3)}, \n ${(Math.abs(.1*s)/(2*u.perspective)).toFixed(2)}\n ), rgba(\n ${_.toFixed(3)},\n ${_.toFixed(3)},\n ${_.toFixed(3)}, \n ${(Math.abs(.6*s)/(2*u.perspective)).toFixed(2)}\n )), linear-gradient(to top, rgba(\n ${l.toFixed(3)},\n ${l.toFixed(3)},\n ${l.toFixed(3)}, \n ${(Math.abs(.75*o)/(2*u.perspective)).toFixed(2)}\n ), rgba(\n ${l.toFixed(3)},\n ${l.toFixed(3)},\n ${l.toFixed(3)}, \n ${(Math.abs(.25*o)/(2*u.perspective)).toFixed(2)}\n ))`:"",g=(1+(-h+c)/80).toFixed(2);y={transform_rotate:d,background_image:m,filter:p?`brightness(${g}) contrast(${g})`:""}},set_pointer_state:function(e){var t="",i=!1;for(t in"mouse_down"in e&&d.mouse_down!==e.mouse_down&&(i=!0),e)d[t]=e[t];i&&this.notify_cursor()},set_moves:function(e,t,i,n){i=i||null,n=n||function(){};let a=Date.now();const{scale:r,canvas_event_target:o}=u,_="CANVAS_WRAPPER_OVERFLOW"!==o?18:24;let{move_x:h,move_y:c,moves_speeds:p,move_speed_timestamp:d,current:g}=r;const A=a-d|0,y=h-e|0,x=c-t|0,w=0|Math.min(Math.round((0|Math.sqrt(y*y+x*x))/A*200),200);p.push(w),p.length>=_&&p.shift();let b=p.slice(-_).reduce(((e,t,i,n)=>e+t/n.length),0);b=Math.max(1,Math.round(Math.floor(b*_/200)));const v=!(null===i);u.scale.default=Math.fround(parseFloat(r.default)),u.scale.current=Math.fround(parseFloat(v?i:g)),u.scale.move_x=0|e,u.scale.move_y=0|t,u.scale.move_speed_timestamp=Date.now(),u.scale.moves_speeds=p,u.scale.moves_speed_average_now=null!==i&&i>g?_:null!==i&&i6||p<1/6)){let e,s,d=1-l/p,u=p/l;if(t&&i?(e=t-o.left|0,s=i-o.top|0):(e=o.width/2|0,s=o.height/2|0),0===n&&0===a)this.set_moves(c,h,p,r);else{let t=(c-e*d)*u+n|0,i=(h-s*d)*u+a|0;const l=(o.width-_.width)/2|0,m=(o.height-_.height)/2|0,f=3/4*_.width+l,g=3/4*_.height+m;i-=m,t-=l;let A=Math.min(Math.abs(t),f)*(t<0?-1:1)+l,y=Math.min(Math.abs(i),g)*(i<0?-1:1)+m;this.set_moves(A,y,p,r)}}},handle_wheel:function({deltaY:e,pageY:t,pageX:i,movementX:n=0,movementY:a=0}){const{canvas_container:r,canvas_wrapper:s}=this.get_pos(),{move_x:o,move_y:_,current:l}=u.scale;let h=Math.max(Math.min(.125,Math.abs(-.01*e)),.25);h=-.01*e>0?h:-h;let c=l+h*l*(.9/Math.pow(l<1?1/l:l,1.6));if(!(c>6||c<1/6)){let e,h,p=1-l/c,d=c/l;i&&t?(e=i-r.left|0,h=t-r.top|0):(e=r.width/2|0,h=r.height/2|0);let u=(o-e*p)*d+n|0,m=(_-h*p)*d+a|0;const f=(r.width-s.width)/2|0,g=(r.height-s.height)/2|0,A=3/4*s.width+f,y=3/4*s.height+g;m-=g,u-=f;let x=Math.min(Math.abs(u),A)*(u<0?-1:1)+f,w=Math.min(Math.abs(m),y)*(m<0?-1:1)+g;this.set_moves(x,w,c)}},handle_move:function(e,t,i,n){const{canvas_container:a,canvas_wrapper:r}=this.get_pos(),{move_x:s,move_y:o}=u.scale,_=(a.width-r.width)/2|0,l=(a.height-r.height)/2|0,h=3/4*r.width+_|0,c=3/4*r.height+l|0,p=s+(i-e|0)-l|0,d=o+(n-t|0)-_|0,m=p<0?-1:1,f=Math.min(Math.abs(p),h)*m+_|0,g=Math.min(Math.abs(d),c)*m+l|0;this.set_moves(f,g)},set_boolean_move_on_click:function(e){c=e},handle_pointer_down:function(e){e.preventDefault();const{canvas_event_target:t}=u;let{latest_pointers_distance:i,latest_pointers_client_x_center:n,latest_pointers_client_y_center:a,previous_single_pointer_down_timestamp:r,previous_double_pointer_down_timestamp:s,pointer_events:o}=this.get_pointer_state();const _=parseInt(r),l=parseInt(s);o.set(""+e.pointerId,e);const h=!(1!==o.size),c=!(2!==o.size);r=h?Date.now():_,s=c?Date.now():l,this.set_pointer_state({pointer_events:o,mouse_down:!0,event_button:parseInt(e.button),latest_pointers_distance:c?0:parseFloat(i),previous_single_pointer_down_timestamp:parseInt(r),previous_double_pointer_down_timestamp:parseInt(s),latest_pointers_client_x_center:parseInt(e.clientX),latest_pointers_client_y_center:parseInt(e.clientY)}),2===parseInt(e.button||0)||Math.abs(r-_)<200&&Math.abs(n-e.clientX)<20&&Math.abs(a-e.clientY)<20?this.notify_menu(e,180):h&&l+200>Date.now()||!h&&"mouse"!==e.pointerType||"CANVAS"!==t||this.notify_down(e),"CANVAS_WRAPPER_OVERFLOW"===t&&this.notify_ripple(e)},handle_pointer_up:function(e){e.preventDefault();const{canvas_event_target:t}=u;let{pointer_events:i}=this.get_pointer_state();i.delete(""+e.pointerId),this.set_pointer_state({pointer_events:i,mouse_down:!(0===i.size)}),this.notify_up(e),("CANVAS_WRAPPER_OVERFLOW"===t&&1===e.which||"CANVAS"!==t)&&this.notify_moved()},handle_pointer_move:function(e){e.preventDefault();const t=""+u.canvas_event_target;this.compute_canvas_event_target(parseInt(e.pageX),parseInt(e.pageY));const i=""+u.canvas_event_target;let{mouse_down:n,event_button:a,pointer_events:r,latest_pointers_distance:s,latest_pointers_client_x_center:o,latest_pointers_client_y_center:_,previous_double_pointer_move_timestamp:l,previous_single_pointer_down_timestamp:h}=this.get_pointer_state();if(r.set(""+e.pointerId,e),2===r.size){const e=Array.from(r.values()),t=e[0].clientX-e[1].clientX,i=e[0].clientY-e[1].clientY,n=Math.sqrt(t*t+i*i),a=parseInt(e[0].clientX+e[1].clientX)/2,l=parseInt(e[0].clientY+e[1].clientY)/2,c=parseInt(e[0].pageX+e[1].pageX)/2,p=parseInt(e[0].pageY+e[1].pageY)/2,d=a-o,m=l-_,f=u.scale.move_x+d,g=u.scale.move_y+m,A=s>0?parseFloat(n/s):1,y={pointer_events:r,latest_pointers_distance:parseFloat(n),latest_pointers_client_x_center:parseInt(a),latest_pointers_client_y_center:parseInt(l),previous_double_pointer_move_timestamp:Date.now()};if(h+306||n<1/6)){let a,r,s=1-i/n,o=n/i;a=c-e.left|0,r=p-e.top|0;let _=(f-a*s)*o+d|0,l=(g-r*s)*o+m|0;const h=(e.width-t.width)/2|0,u=(e.height-t.height)/2|0,A=3/4*t.width+h,y=3/4*t.height+u;l-=u,_-=h;let x=Math.min(Math.abs(_),A)*(_<0?-1:1)+h,w=Math.min(Math.abs(l),y)*(l<0?-1:1)+u;this.set_moves(x,w,n)}this.set_pointer_state(y)}else this.set_pointer_state(y)}else if(n&&1===r.size){const t={pointer_events:r,latest_pointers_client_x_center:parseInt(e.clientX),latest_pointers_client_y_center:parseInt(e.clientY),previous_double_pointer_move_timestamp:parseInt(l)};"CANVAS"!==i||"CANVAS"===i&&0===a&&c||1===a?l+200=i.left&&t>=i.top&&e<=i.right&&t<=i.bottom?a="CANVAS":e>=n.left&&t>=n.top&&e<=n.right&&t<=n.bottom&&(a="CANVAS_WRAPPER"),u.canvas_event_target!==a&&(r=!0,u.canvas_event_target=a),r&&this.notify_cursor()},set_move_speed_average_now:function(){if(!u)return;const e="CANVAS_WRAPPER_OVERFLOW"!==u.canvas_event_target?18:24,t=Date.now();if(t-u.scale.move_speed_timestamp>=20&&u.scale.moves_speed_average_now>-e){const i=Math.max(u.scale.moves_speed_average_now-1,-e);u.scale.moves_speed_average_now=i,u.scale.move_speed_timestamp=0|t,g.update(!0,!0)}else t-u.scale.move_speed_timestamp>=20&&u.scale.moves_speed_average_now<-e&&e<24?(u.scale.moves_speed_average_now=0|Math.max(u.scale.moves_speed_average_now+1,-e),u.scale.move_speed_timestamp=0|t,g.update(!0,!0)):u.perspective>0&&g.update(!0,!0)}}}};e.exports=a},687:function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t,i){return((e=((e|=0)-(e-(i=(0|i)>>>0)&i-e>>31)|0)>>>0)-(e-(t=(0|t)>>>0)&e-t>>31)|0)>>>0}function r(e){var t=o(e/255);return 255-S(e+e-Math.round(t*t*255|0)|0,0,255)}function s(e){return R(B(e,e))}var o,_,l,h,c,p,d,u,m,f,g,A,y=i(647),x=i(653),w=i(715),b=n(w),v=i(716),C=n(v);const{Color:E,Colors:U,simdops:I}=(0,y.SIMDopeCreate)({create:{new_uint32:!0,new_zero:!0},properties:{},methods:{get_use_element:!0,blend_first_with:!0,blend_with:!0}});var{abs_int:R,clamp_int:S,minus_int:B}=I;o=Math.fround,_=Object.create({_get_64_js:()=>({xxh_f:{hasher:b.default,create:function(e){return this.hasher.h64(e)}},xxh_v:"64",xxh_t:"js",xxh_tt:Date.now()}),_get_64_wasm:()=>new Promise((function(e,t){try{(0,C.default)().then((function(t){e({xxh_f:{hasher:t,create:function(e){return this.hasher.create64(BigInt(e))}},xxh_v:"64",xxh_t:"wasm",xxh_tt:Date.now()})})).catch((function(e){t()}))}catch(i){t()}})),new(){const e=Uint8Array.from("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((function(e){return e.charCodeAt(0)}))),t=BigInt(e.length);let i=new Uint8Array(14),n=this._get_64_js,a=this._get_64_wasm,r=n();return a().then((function(e){r=e})),{get_info:function(){return{version:r.xxh_v,type:r.xxh_t,timestamp:r.xxh_tt}},base58_that:function(n){let a=0,s=BigInt(0),o=r.xxh_f.create(62675);n instanceof Uint8Array||n instanceof Uint8ClampedArray?o.update(n):n.forEach((function(e){o.update(e)}));let _=BigInt(o.digest());for(;_>0;)s=Number(_%t),_=BigInt(_/t),i[0|a]=65535&e[s],a=a+1&15;return String.fromCharCode.apply(null,i.slice(0,0|a))}}}}).new(),(l=function(e,t,i,n,a){return this instanceof l?(t=(0|parseInt(t||0))>>>0,i=(0|parseInt(i||0))>>>0,this.with_plain_data_=void 0!==n&&!!n&&!0,2===e.length?(this.width_=0|t,this.height_=0|i,this.bitmap_=void 0===a?{height:this.height_,width:this.width_,destroy:function(){},hash:""}:a,this.force_update_data(e[0],e[1])):(e.data8 instanceof Uint8ClampedArray?(this.width_=0|e.width,this.height_=0|e.height,this.populate_data(new Uint32Array(e.data8.buffer))):e instanceof Uint8Array||e instanceof Uint8ClampedArray?(this.width_=0|t,this.height_=0|i,this.populate_data(new Uint32Array(e.buffer))):(this.width_=0|t,this.height_=0|i,this.populate_data(Uint32Array.from(e))),this.bitmap_=void 0===a?{height:this.height_,width:this.width_,destroy:function(){},hash:""}:a,this.populate_colors(this.uint32_pixel_color_),this.populate_indexes(),this.changes_.charge()),this):new l(e,t,i,n)}).new_from_colors_and_indexes=function(e,t,i,n,a,r){return new l(Array.of(e,t),parseInt(i),parseInt(n),!!a,r)},Object.defineProperty(l.prototype,"force_update_data",{get:function(){return function(e,t){var i=void 0!==e,n=void 0!==t;i&&n?(this.populate_colors(e),this.populate_indexes(t),this.populate_data()):n?(this.populate_indexes(t),this.compute_data()):i&&(this.populate_colors(e),this.compute_data())}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"populate_data",{get:function(){return function(e){if(void 0===e){this.uint32_pixel_color_=new Uint32Array(this.width_*this.height_),this.changes_=new x.SetFixed(this.uint32_pixel_color_.length),this.uint8c_pixel_color_=new Uint8ClampedArray(this.uint32_pixel_color_.buffer),this.simdope_pixel_color_=new U(this.uint32_pixel_color_.buffer);for(var t=0,i=0|this.uint32_pixel_color_.length;(0|t)<(0|i);t=(t+1|0)>>>0)this.uint32_pixel_color_[t]=(0|this.colors[this.indexes[t]])>>>0;this.changes_.charge()}else this.uint32_pixel_color_=e instanceof Uint32Array?e:Uint32Array.from(e),this.changes_=new x.SetFixed(this.uint32_pixel_color_.length),this.uint8c_pixel_color_=new Uint8ClampedArray(this.uint32_pixel_color_.buffer),this.simdope_pixel_color_=new U(this.uint32_pixel_color_.buffer),this.changes_.charge()}}}),Object.defineProperty(l.prototype,"compute_data",{get:function(){return function(){var e,t;for(e=0,t=0|this.uint32_pixel_color_.length;(0|e)<(0|t);e=(e+1|0)>>>0)(0|(0|this.uint32_pixel_color_[(0|e)>>>0])>>>0)>>>0!=(0|(0|this.colors[this.indexes[(0|e)>>>0]])>>>0)>>>0&&(this.uint32_pixel_color_[(0|e)>>>0]=(0|this.colors[this.indexes[(0|e)>>>0]])>>>0,this.changes_.add((0|e)>>>0))}}}),Object.defineProperty(l.prototype,"populate_colors",{get:function(){return function(e){this.uint32_colors_=e instanceof Uint32Array?e.slice(0,0|e.length):Uint32Array.from(e),this.uint32_colors_length_=this.uint32_colors_.length,this.uint32_colors_map_={};for(var t=0;(0|t)<(0|this.uint32_colors_length_);t=(t+1|0)>>>0)this.uint32_colors_map_[this.uint32_colors_[t]]=t}}}),Object.defineProperty(l.prototype,"populate_indexes",{get:function(){return function(e){if(void 0!==e)this.color_indexes_length_=e.length,this.color_indexes_constructor_=this.uint32_colors_length_<256?Uint8Array:(this.uint32_colors_length_+1|0)<65536?Uint16Array:Uint32Array,this.color_indexes_=e instanceof this.color_indexes_constructor_?e:this.color_indexes_constructor_.from(e);else{this.color_indexes_length_=this.uint32_pixel_color_.length,this.color_indexes_constructor_=this.uint32_colors_length_<256?Uint8Array:(this.uint32_colors_length_+1|0)<65536?Uint16Array:Uint32Array,this.color_indexes_=new this.color_indexes_constructor_(this.color_indexes_length_);for(var t=0,i=0|this.color_indexes_length_;(0|t)<(0|i);t=(t+1|0)>>>0)this.color_indexes_[0|t]=(0|this.get_color_index(this.uint32_pixel_color_[0|t]))>>>0}}}}),Object.defineProperty(l.prototype,"get_color_index",{get:function(){return function(e){return this.uint32_colors_map_[(0|e)>>>0]}}}),Object.defineProperty(l.prototype,"has_color",{get:function(){return function(e){return void 0!==this.uint32_colors_map_[(0|e)>>>0]}}}),Object.defineProperty(l.prototype,"data8",{get:function(){return this.uint8c_pixel_color_}}),Object.defineProperty(l.prototype,"image_data",{get:function(){return new ImageData(this.data8,0|this.width_,0|this.height_)}}),Object.defineProperty(l.prototype,"width",{get:function(){return 0|this.width_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"height",{get:function(){return 0|this.height_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"set_bitmap",{get:function(){return function(e){return this.bitmap_.hash!==e.hash&&(this.bitmap_.destroy(),this.bitmap_=e),this.bitmap_}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"get_bitmap",{get:function(){return function(){return this.bitmap_}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"bitmap_async",{get:function(){return function(e){var t,i,n,a,r,s;return e=void 0!==e&&!!e&&!0,t=this.hash_hex_async.bind(this),i=this.get_bitmap.bind(this),n=this.set_bitmap.bind(this),a=this.image_data,r=function(e,i){Promise.all([createImageBitmap(a),t()]).then((function(t){var i=t[0];i.hash=""+t[1],e(n(i))})).catch(i)},e?(s=i(),t().then((function(e){return""!==s.hash&&""+e==""+s.hash?Promise.resolve(s):new Promise(r)}))):new Promise(r)}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"hash_hex_async",{get:function(){return function(e){var t=_.base58_that(e||this.data8);return Promise.resolve(t)}}}),Object.defineProperty(l.prototype,"data",{get:function(){return this.uint32_pixel_color_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"get_index",{get:function(){return function(e){return e=(0|e)>>>0,this.color_indexes_[0|e]}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"indexes",{get:function(){return this.color_indexes_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"indexes_copy",{get:function(){return this.indexes.slice(0,0|this.indexes.length)},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"set_indexes",{get:function(){return function(e){this.force_update_data(void 0,e)}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"get_color",{get:function(){return function(e){return e=(0|e)>>>0,this.uint32_colors_[0|e]}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"colors",{get:function(){return this.uint32_colors_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"colors_copy",{get:function(){var e=0|this.uint32_colors_length_;return this.uint32_colors_.slice(0,0|e)},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"set_colors",{get:function(){return function(e){this.force_update_data(e,void 0)}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"set_colors_and_indexes",{get:function(){return function(e,t){this.force_update_data(e,t)}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"changes",{get:function(){return this.changes_.indexes},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"changes_has",{get:function(){return function(e){return this.changes_.has((0|e)>>>0)}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"setFixed",{get:function(){return this.changes_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"clear_changes",{get:function(){return function(){this.changes_.clear()}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"charge_changes",{get:function(){return function(){this.changes_.charge()}}}),Object.defineProperty(l.prototype,"get_uint32",{get:function(){return function(e){return e=(0|e)>>>0,this.uint32_pixel_color_[e]}}}),Object.defineProperty(l.prototype,"set_uint32",{get:function(){return function(e,t){if(e=(0|e)>>>0,t=void 0===t?this.uint32_pixel_color_[e]:(0|t)>>>0,this.changes_.add(e),this.uint32_pixel_color_[e]=t,this.has_color(t))return this.color_indexes_[e]=this.get_color_index(t),!1;switch(this.uint32_colors_length_+1|0){case 255:this.color_indexes_=Uint16Array.from(this.color_indexes_);break;case 65535:this.color_indexes_=Uint32Array.from(this.color_indexes_)}var i=new Uint32Array(this.uint32_colors_length_+1|0);return i.set(this.uint32_colors_,0),i[(0|this.uint32_colors_length_)>>>0]=t,this.populate_colors(i),this.color_indexes_[e]=this.get_color_index(t),!0}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"paint_uint32a",{get:function(){return function(e,t,i){t=(0|t)>>>0,i=Math.round(255*parseFloat(i));let n=0|e.length;if(n>0){let a=E.new_uint32(t),r=new E(new ArrayBuffer(4)),s=0;for(;(0|s)<(0|n);s=(s+1|0)>>>0)this.simdope_pixel_color_.get_use_element(e[s],r).blend_first_with(a,i,!1,!1),this.set_uint32(e[s])}}},enumerable:!1,configurable:!1}),h=function(e,t,i,n){var a;if(!(this instanceof h))return new h(e,t,i,n);for(i=(0|i)>>>0,n=(0|n)>>>0,this.layers_=Array(e.length),this.metadata_=Array(t.length),a=0;a>>0)a[0|s]=a[s+1|0]=a[s+2|0]=((i[0|s]+i[s+1|0]+i[s+2|0]|0)/3|0)>>>0,a[s+3|0]=i[s+3|0];for(o=new U(e),_=new U(r),l=new E(new ArrayBuffer(4)),h=new E(new ArrayBuffer(4)),c=0|r.length,p=0;(0|p)<(0|c);p=(p+1|0)>>>0)o.get_use_element(0|p,l).blend_with(_.get_use_element(0|p,h),t,!1,!1);return e}},enumerable:!1,configurable:!1}),u=Float32Array.of(.393,.769,.189,.349,.686,.168,.272,.534,.131),Object.defineProperty((m=function(){if(!(this instanceof m))return new m}).prototype,"filter_colors",{get:function(){return function(e,t){var i,n,a,s,o,_,l,h,c,p,d;for(t=0|Math.round(parseFloat(t)/4*255),n=0|(i=new Uint8Array(e.buffer)).length,a=new Uint8Array(0|n),s=new Uint32Array(a.buffer),o=0;(0|o)<(0|n);o=(o+4|0)>>>0)a[0|o]=r(a[0|o]),a[o+1|0]=r(a[o+1|0]),a[o+2|0]=r(a[o+2|0]),a[o+3|0]=i[o+3|0];for(_=new U(e),l=new U(s),h=new E(new ArrayBuffer(4)),c=new E(new ArrayBuffer(4)),p=0|s.length,d=0;(0|d)<(0|p);d=(d+1|0)>>>0)_.get_use_element(0|d,h).blend_with(l.get_use_element(0|d,c),t,!1,!1);return e}},enumerable:!1,configurable:!1}),Object.defineProperty((f=function(){if(!(this instanceof f))return new f}).prototype,"filter_colors",{get:function(){return function(e,t){var i,n,a,r,o,_,l,h,c,p,d;for(t=0|Math.round(parseFloat(t)/2*255),n=0|(i=new Uint8Array(e.buffer)).length,a=new Uint8Array(0|n),r=new Uint32Array(a.buffer),o=0;(0|o)<(0|n);o=(o+4|0)>>>0)a[0|o]=s(a[0|o]),a[o+1|0]=s(a[o+1|0]),a[o+2|0]=s(a[o+2|0]),a[o+3|0]=i[o+3|0];for(_=new U(e),l=new U(r),h=new E(new ArrayBuffer(4)),c=new E(new ArrayBuffer(4)),p=0|r.length,d=0;(0|d)<(0|p);d=(d+1|0)>>>0)_.get_use_element(0|d,h).blend_with(l.get_use_element(0|d,c),t,!1,!1);return e}},enumerable:!1,configurable:!1}),Object.defineProperty((g=function(){if(!(this instanceof g))return new g}).prototype,"filter_colors",{get:function(){return function(e,t){var i,n,r,s,o,_,l,h,c,p,d;for(t=0|Math.round(255*parseFloat(t)),n=0|(i=new Uint8Array(e.buffer)).length,r=new Uint8Array(0|n),s=new Uint32Array(r.buffer),o=0;(0|o)<(0|n);o=(o+4|0)>>>0)r[o+3|0]=i[o+3|0],r[0|o]=255&a(i[0|o]*u[0]+i[o+1|0]*u[1]+i[o+2|0]*u[2]|0,0,255),r[o+1|0]=255&a(i[0|o]*u[3]+i[o+1|0]*u[4]+i[o+2|0]*u[5]|0,0,255),r[o+2|0]=255&a(i[0|o]*u[6]+i[o+1|0]*u[7]+i[o+2|0]*u[8]|0,0,255);for(_=new U(e),l=new U(s),h=new E(new ArrayBuffer(4)),c=new E(new ArrayBuffer(4)),p=0|s.length,d=0;(0|d)<(0|p);d=(d+1|0)>>>0)_.get_use_element(0|d,h).blend_with(l.get_use_element(0|d,c),t,!1,!1);return e}},enumerable:!1,configurable:!1}),Object.defineProperty(p.prototype,"filter_colors",{get:function(){return function(e,t){var i,n,a,r,s,o,_,l,h,c,p;for(t=0|Math.round(255*parseFloat(t)),n=0|(i=new Uint8Array(e.buffer)).length,a=new Uint8Array(0|n),r=new Uint32Array(a.buffer),s=0;(0|s)<(0|n);s=(s+4|0)>>>0)a[s+3|0]=i[s+3|0],a[0|s]=this.ar_[i[0|s]],a[s+1|0]=this.ag_[i[s+1|0]],a[s+2|0]=this.ab_[i[s+2|0]];for(o=new U(e),_=new U(r),l=new E(new ArrayBuffer(4)),h=new E(new ArrayBuffer(4)),c=0|r.length,p=0;(0|p)<(0|c);p=(p+1|0)>>>0)o.get_use_element(0|p,l).blend_with(_.get_use_element(0|p,h),t,!1,!1);return e}},enumerable:!1,configurable:!1}),A=function(e){if(!(this instanceof A))return new A(e);e=e||c,this.names_=Object.keys(e),this.filters_=Object.values(e).map((function(e){return p(e)})),this.special_names_=Array.of("Greyscale","Sepia","Screen","Difference"),this.filter_sepia_=new g,this.filter_greyscale_=new d,this.filter_screen_=new m,this.filter_difference_=new f},Object.defineProperty(A.prototype,"names",{get:function(){return this.names_.concat(this.special_names_)},enumerable:!1,configurable:!1}),Object.defineProperty(A.prototype,"use",{get:function(){return function(e,t,i,n){n=void 0!==n&&!!n;var a=this.names_.indexOf(e);if(void 0!==t){if(!(a<0))return n?l.new_from_colors_and_indexes(this.filters_[a].filter_colors(t.colors_copy,i),t.indexes,t.width,t.height):(t.set_colors(this.filters_[a].filter_colors(t.colors_copy,i)),t);if(n)switch(e){case"Sepia":return l.new_from_colors_and_indexes(this.filter_sepia_.filter_colors(t.colors_copy,i),t.indexes,t.width,t.height);case"Screen":return l.new_from_colors_and_indexes(this.filter_screen_.filter_colors(t.colors_copy,i),t.indexes,t.width,t.height);case"Difference":return l.new_from_colors_and_indexes(this.filter_difference_.filter_colors(t.colors_copy,i),t.indexes,t.width,t.height);default:return l.new_from_colors_and_indexes(this.filter_greyscale_.filter_colors(t.colors_copy,i),t.indexes,t.width,t.height)}else switch(e){case"Sepia":return t.set_colors(this.filter_sepia_.filter_colors(t.colors_copy,i)),t;case"Screen":return t.set_colors(this.filter_screen_.filter_colors(t.colors_copy,i)),t;case"Difference":return t.set_colors(this.filter_difference_.filter_colors(t.colors_copy,i)),t;default:return t.set_colors(this.filter_greyscale_.filter_colors(t.colors_copy,i)),t}}}},enumerable:!1,configurable:!1}),e.exports={Layer:l,Layers:h,Filters:A}},715:function(e,t,i){"use strict";!function(t){function n(e){var t,i,n,a=[];for(t=0,i=e.length;(0|t)<(0|i);t=(t+1|0)>>>0)(n=e.charCodeAt(t))<128?a.push(n):n<2048?a.push(192|n>>6,128|63&n):n<55296||n>=57344?a.push(224|n>>12,128|n>>6&63,128|63&n):(t++,n=65536+((1023&n)<<10|1023&e.charCodeAt(t)),a.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n));return new Uint8Array(a)}function a(){return 2==arguments.length?new a(arguments[1]).update(arguments[0]).digest():this instanceof a?void this.init.call(this,arguments[0]):new a(arguments[0])}function r(){return 2==arguments.length?new r(arguments[1]).update(arguments[0]).digest():this instanceof r?void this.init.call(this,arguments[0]):new r(arguments[0])}var s,o,_,l,h,c,p,d,u,m,f=i(923);f.UINT32.prototype.xxh_update=function(e,t){var i,n,a,r=o._low,_=o._high,l=e*r,h=l>>>16;h+=t*r,h&=65535,h+=e*_,n=(i=this._low+(65535&l))>>>16,n=(a=(a=(n+=this._high+(65535&h))<<16|65535&i)<<13|a>>>19)>>>16,h=(l=(i=65535&a)*(r=s._low))>>>16,h+=n*r,h&=65535,h+=i*(_=s._high),this._low=65535&l,this._high=65535&h},s=(0,f.UINT32)("2654435761"),o=(0,f.UINT32)("2246822519"),_=(0,f.UINT32)("3266489917"),l=(0,f.UINT32)("668265263"),h=(0,f.UINT32)("374761393"),a.prototype.init=function(e){return this.seed=e instanceof f.UINT32?e.clone():(0,f.UINT32)(e),this.v1=this.seed.clone().add(s).add(o),this.v2=this.seed.clone().add(o),this.v3=this.seed.clone(),this.v4=this.seed.clone().subtract(s),this.total_len=0,this.memsize=0,this.memory=null,this},a.prototype.update=function(e){var i,a,r,s,o,_=!1;if("buffer"in e&&(e=e.buffer,e=new Uint8Array(e),_=!0),"string"==typeof e&&(e=n(e),_=!0),"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer&&(_=!0,e=new Uint8Array(e)),r=(i=0)+(a=e.length)|0,0==a)return this;if(this.total_len=this.total_len+a|0,0==this.memsize&&(this.memory=_?new Uint8Array(16):new t(16)),(this.memsize+a|0)<16)return _?this.memory.set(e.subarray(0,a),this.memsize):e.copy(this.memory,this.memsize,0,a),this.memsize=this.memsize+a|0,this;if((0|this.memsize)>0&&(_?this.memory.set(e.subarray(0,16-this.memsize|0),this.memsize):e.copy(this.memory,this.memsize,0,16-this.memsize),s=0,this.v1.xxh_update(this.memory[s+1|0]<<8|this.memory[0|s],this.memory[s+3|0]<<8|this.memory[s+2|0]),s=(s+4|0)>>>0,this.v2.xxh_update(this.memory[s+1|0]<<8|this.memory[0|s],this.memory[s+3|0]<<8|this.memory[s+2|0]),s=(s+4|0)>>>0,this.v3.xxh_update(this.memory[s+1|0]<<8|this.memory[0|s],this.memory[s+3|0]<<8|this.memory[s+2|0]),s=(s+4|0)>>>0,this.v4.xxh_update(this.memory[s+1|0]<<8|this.memory[0|s],this.memory[s+3|0]<<8|this.memory[s+2]),i=i+16-this.memsize|0,this.memsize=0),(0|i)<=(r-16|0)){o=r-16|0;do{this.v1.xxh_update(e[i+1|0]<<8|e[0|i],e[i+3|0]<<8|e[i+2|0]),i=(i+4|0)>>>0,this.v2.xxh_update(e[i+1|0]<<8|e[0|i],e[i+3|0]<<8|e[i+2|0]),i=(i+4|0)>>>0,this.v3.xxh_update(e[i+1|0]<<8|e[0|i],e[i+3|0]<<8|e[i+2|0]),i=(i+4|0)>>>0,this.v4.xxh_update(e[i+1|0]<<8|e[0|i],e[i+3|0]<<8|e[i+2|0]),i=(i+4|0)>>>0}while((0|i)<=(0|o))}return(0|i)<(0|r)&&(_?this.memory.set(e.subarray(i,r),this.memsize):e.copy(this.memory,this.memsize,i,r),this.memsize=r-i|0),this},a.prototype.digest=function(){var e,t,i=this.memory,n=0,a=this.memsize,r=new f.UINT32;for((e=(0|this.total_len)>=16?this.v1.rotl(1).add(this.v2.rotl(7).add(this.v3.rotl(12).add(this.v4.rotl(18)))):this.seed.clone().add(h)).add(r.fromNumber(this.total_len));(0|n)<=(a-4|0);)r.fromBits(i[n+1]<<8|i[n],i[n+3]<<8|i[n+2]),e.add(r.multiply(_)).rotl(17).multiply(l),n=(n+4|0)>>>0;for(;(0|n)<(0|a);)r.fromBits(i[n++],0),e.add(r.multiply(h)).rotl(11).multiply(s);return t=e.clone().shiftRight(15),e.xor(t).multiply(o),t=e.clone().shiftRight(13),e.xor(t).multiply(_),t=e.clone().shiftRight(16),e.xor(t),this.init(this.seed),e},c=(0,f.UINT64)("11400714785074694791"),p=(0,f.UINT64)("14029467366897019727"),d=(0,f.UINT64)("1609587929392839161"),u=(0,f.UINT64)("9650029242287828579"),m=(0,f.UINT64)("2870177450012600261"),r.prototype.init=function(e){return this.seed=e instanceof f.UINT64?e.clone():(0,f.UINT64)(e),this.v1=this.seed.clone().add(c).add(p),this.v2=this.seed.clone().add(p),this.v3=this.seed.clone(),this.v4=this.seed.clone().subtract(c),this.total_len=0,this.memsize=0,this.memory=null,this},r.prototype.update=function(e){var i,a,r,s,o,_,l;if("buffer"in e&&(e=e.buffer,i=!0),"string"==typeof e&&(e=n(e),i=!0),"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer&&(i=!0,e=new Uint8Array(e)),s=(a=0)+(r=0|e.length)|0,0==r)return this;if(this.total_len+=r,0==this.memsize&&(this.memory=i?new Uint8Array(32):new t(32)),this.memsize+r<32)return i?this.memory.set(e.subarray(0,r),this.memsize):e.copy(this.memory,this.memsize,0,r),this.memsize+=r,this;if(this.memsize>0&&(i?this.memory.set(e.subarray(0,32-this.memsize),this.memsize):e.copy(this.memory,this.memsize,0,32-this.memsize),o=0,_=(0,f.UINT64)(this.memory[o+1|0]<<8|this.memory[0|o],this.memory[o+3|0]<<8|this.memory[o+2|0],this.memory[o+5|0]<<8|this.memory[o+4|0],this.memory[o+7|0]<<8|this.memory[o+6|0]),this.v1.add(_.multiply(p)).rotl(31).multiply(c),o=(o+8|0)>>>0,_=(0,f.UINT64)(this.memory[o+1|0]<<8|this.memory[0|o],this.memory[o+3|0]<<8|this.memory[o+2|0],this.memory[o+5|0]<<8|this.memory[o+4|0],this.memory[o+7|0]<<8|this.memory[o+6|0]),this.v2.add(_.multiply(p)).rotl(31).multiply(c),o=(o+8|0)>>>0,_=(0,f.UINT64)(this.memory[o+1|0]<<8|this.memory[0|o],this.memory[o+3|0]<<8|this.memory[o+2|0],this.memory[o+5|0]<<8|this.memory[o+4|0],this.memory[o+7|0]<<8|this.memory[o+6|0]),this.v3.add(_.multiply(p)).rotl(31).multiply(c),o=(o+8|0)>>>0,_=(0,f.UINT64)(this.memory[o+1|0]<<8|this.memory[0|o],this.memory[o+3|0]<<8|this.memory[o+2|0],this.memory[o+5|0]<<8|this.memory[o+4|0],this.memory[o+7|0]<<8|this.memory[o+6|0]),this.v4.add(_.multiply(p)).rotl(31).multiply(c),a=a+32-this.memsize|0,this.memsize=0),(0|a)<=(s-32|0)){l=s-32|0;do{_=(0,f.UINT64)(e[a+1|0]<<8|e[0|a],e[a+3|0]<<8|e[a+2|0],e[a+5|0]<<8|e[a+4|0],e[a+7|0]<<8|e[a+6|0]),this.v1.add(_.multiply(p)).rotl(31).multiply(c),a=(a+8|0)>>>0,_=(0,f.UINT64)(e[a+1|0]<<8|e[0|a],e[a+3|0]<<8|e[a+2|0],e[a+5|0]<<8|e[a+4|0],e[a+7|0]<<8|e[a+6|0]),this.v2.add(_.multiply(p)).rotl(31).multiply(c),a=(a+8|0)>>>0,_=(0,f.UINT64)(e[a+1|0]<<8|e[0|a],e[a+3|0]<<8|e[a+2|0],e[a+5|0]<<8|e[a+4|0],e[a+7|0]<<8|e[a+6|0]),this.v3.add(_.multiply(p)).rotl(31).multiply(c),a=(a+8|0)>>>0,_=(0,f.UINT64)(e[a+1|0]<<8|e[0|a],e[a+3|0]<<8|e[a+2|0],e[a+5|0]<<8|e[a+4|0],e[a+7|0]<<8|e[a+6|0]),this.v4.add(_.multiply(p)).rotl(31).multiply(c),a=(a+8|0)>>>0}while(a<=l)}return a=32?((e=this.v1.clone().rotl(1)).add(this.v2.clone().rotl(7)),e.add(this.v3.clone().rotl(12)),e.add(this.v4.clone().rotl(18)),e.xor(this.v1.multiply(p).rotl(31).multiply(c)),e.multiply(c).add(u),e.xor(this.v2.multiply(p).rotl(31).multiply(c)),e.multiply(c).add(u),e.xor(this.v3.multiply(p).rotl(31).multiply(c)),e.multiply(c).add(u),e.xor(this.v4.multiply(p).rotl(31).multiply(c)),e.multiply(c).add(u)):e=this.seed.clone().add(m),e.add(r.fromNumber(this.total_len));(0|n)<=(a-8|0);)r.fromBits(i[n+1|0]<<8|i[0|n],i[n+3|0]<<8|i[n+2|0],i[n+5|0]<<8|i[n+4|0],i[n+7|0]<<8|i[n+6|0]),r.multiply(p).rotl(31).multiply(c),e.xor(r).rotl(27).multiply(c).add(u),n=(n+8|0)>>>0;for((n+4|0)<=(0|a)&&(r.fromBits(i[n+1|0]<<8|i[0|n],i[n+3|0]<<8|i[n+2|0],0,0),e.xor(r.multiply(c)).rotl(23).multiply(p).add(d),n=(n+4|0)>>>0);(0|n)<(0|a);)r.fromBits(i[n++],0,0,0),e.xor(r.multiply(m)).rotl(11).multiply(c);return t=e.clone().shiftRight(33),e.xor(t).multiply(p),t=e.clone().shiftRight(29),e.xor(t).multiply(d),t=e.clone().shiftRight(32),e.xor(t),this.init(this.seed),e},e.exports={h32:a,h64:r}}(i(210).Buffer)},717:function(e,t,i){"use strict";function n(e,t,i){e|=0,t|=0;var n=new Uint8Array(e);void 0!==i?(n.fill(255),n.set(i,0)):n.fill(255);let a={number_length_index_byte:Uint32Array.of(e,t,0,0),hover_data_in_layer:new Uint8Array(t),indexes_data_for_layers:new Uint32Array(t),colors_data_in_layers_uint32:new Uint32Array(t*e),layers_opacity_255:n};return a.colors_data_in_layers_uint32_SIMDope=new h(a.colors_data_in_layers_uint32.buffer),a}function a(e,t,i,a){if(t|=0,i|=0,void 0===e)return n(t,i,a);if(null===e)return n(t,i,a);{let r=c(t,e.layer_number);return p(r,0)||b(e.max_length,i)?n(t,i,a):(e.number_length_index_byte[0]=0|t,e.number_length_index_byte[1]=0|i,e.number_length_index_byte[2]=0,e.number_length_index_byte[3]=0,void 0!==a?(e.layers_opacity_255.fill(255),e.layers_opacity_255.set(a)):e.layers_opacity_255.fill(255),e)}}var r,s=i(647),o=(0,s.SIMDopeCreateConfAdd)({create:{new_of:!0},properties:{buffer:!0},methods:{get_use_element:!0,set_tail:!0,set_from_simdope:!0,set_from_buffer:!0,get_tail:!0,get_tail_opacity:!0,reset_tail:!0,is_dark:!0,blend_first_with:!0,blend_first_with_tails:!0}});const{simdops:_,Color:l,Colors:h}=(0,s.SIMDopeCreate)(o),{minus_int:c,int_not_equal:p,plus_int:d,plus_uint:u,minus_uint:m,multiply_int:f,multiply_uint:g,divide_uint:A,clamp_uint8:y,clamp_uint32:x,int_equal:w,uint_less:b,int_less:v,int_greater_equal:C,uint_not_equal:E,uint_less_equal:U,min_uint:I}=_;Object.defineProperty((r=function(e){return e=e||{},this instanceof r?(this.state_=n(e.layer_number||1,e.max_length||1,e.layers_opacity_255||new Uint8Array(0)),this.number_length_index_byte_=this.state_.number_length_index_byte,this.hover_data_in_layer_=this.state_.hover_data_in_layer,this.indexes_data_for_layers_=this.state_.indexes_data_for_layers,this.colors_data_in_layers_uint32_=this.state_.colors_data_in_layers_uint32,this.shadow_state_=((t=t||{base_rgba_colors_for_blending:new Uint32Array(0),color_less_uint8x4:l.new_of(255,255,255,255),color_full_uint8x4:l.new_of(0,0,0,255),layers_color:[],all_layers_length:0,used_colors_length:0}).base_rgba_colors_for_blending_SIMDope=new h(t.base_rgba_colors_for_blending.buffer),t),this.data_array_=[],this.destination_rgba_colors_for_blending_,this.destination_rgba_colors_for_blending_SIMDope_,this):new r(e);var t}).prototype,"state",{get:function(){return this.state_},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"set_state",{get:function(){return function(e){return this.state_=e,this.number_length_index_byte_=this.state_.number_length_index_byte,this.hover_data_in_layer_=this.state_.hover_data_in_layer,this.indexes_data_for_layers_=this.state_.indexes_data_for_layers,this.colors_data_in_layers_uint32_=this.state_.colors_data_in_layers_uint32,this.state_}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"set_shadow_state",{get:function(){return function(e){return this.shadow_state_=e}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"get_updated_shadow_state",{get:function(){return function(){return this.shadow_state_.layers_color.length=this.number_length_index_byte_[2]?this.shadow_state_.base_rgba_colors_for_blending.fill(0,0,this.shadow_state_.used_colors_length):(this.shadow_state_.base_rgba_colors_for_blending=new Uint32Array(0|this.number_length_index_byte_[2]),this.shadow_state_.base_rgba_colors_for_blending_SIMDope=new h(this.shadow_state_.base_rgba_colors_for_blending.buffer))),this.shadow_state_.all_layers_length=0|this.number_length_index_byte_[0],this.shadow_state_.max_used_colors_length=0|this.number_length_index_byte_[1],this.shadow_state_.used_colors_length=0|this.number_length_index_byte_[2],this.shadow_state_}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"shadow_state",{get:function(){return this.shadow_state_},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"set_bytes_index",{get:function(){return function(e){return this.number_length_index_byte_[3]=0|e}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"data_array",{get:function(){return this.data_array_},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"set_data_array",{get:function(){return function(e,t){this.data_array_=e,t&&(this.destination_rgba_colors_for_blending_=t,this.destination_rgba_colors_for_blending_SIMDope_=new h(this.destination_rgba_colors_for_blending_.buffer))}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"bytes_index",{get:function(){return function(){return 0|this.number_length_index_byte_[3]}},enumerable:!1,configurable:!1}),r.init=function(e,t,i){return new r({layer_number:e,max_length:t,layers_opacity_255:i})},Object.defineProperty(r.prototype,"for",{get:function(){return function(e,t){this.indexes_data_for_layers_[this.number_length_index_byte_[2]]=x(e),this.hover_data_in_layer_[this.number_length_index_byte_[2]]=y(t),this.number_length_index_byte_[2]=u(this.number_length_index_byte_[2],1)}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"next",{get:function(){return function(){this.number_length_index_byte_[3]=u(this.number_length_index_byte_[3],1)}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"stack",{get:function(){return function(e,t){this.colors_data_in_layers_uint32_[u(g(this.number_length_index_byte_[0],this.number_length_index_byte_[3]),y(e))]=x(t)}},enumerable:!1,configurable:!1}),r.prototype.blend=function(e,t){var i,n,a,r,s;t|=0;var{base_rgba_colors_for_blending:o,base_rgba_colors_for_blending_SIMDope:_,all_layers_length:c,used_colors_length:p,layers_colors:m,color_less_uint8x4:g,color_full_uint8x4:A}=this.get_updated_shadow_state(),{colors_data_in_layers_uint32_SIMDope:y,hover_data_in_layer:x,layers_opacity_255:w,indexes_data_for_layers:C}=this.state;return i=this.destination_rgba_colors_for_blending_SIMDope_,n=this.data_array.map((function(e){return new h(e.data.buffer)})),a=n.length||0,r=m[0],s=new l(new ArrayBuffer(4)),new Promise((function(e){var l=0,h=new Uint32Array(2),E=0;if(i){for(;b(0|l,p);l=u(l,1)){for(i.get_use_element(C[0|l],r),r.set_from_simdope(s),h[0]=f(l,c),E=0;v(E,a);E=d(E,1))n[0|E].get_use_element(C[0|l],m[E+1|0]),m[0|E].set_tail(m[E+1|0],w[0|E]);for(E=a;v(E,c);E=d(E,1))h[1]=d(h[0],E),y.get_use_element(h[1],m[E+1|0]),m[0|E].set_tail(m[E+1|0],w[0|E]);m[0|E].reset_tail(),(0|x[0|l])>0?(r.blend_first_with_tails(t),r.blend_first_with(r.is_dark()?g:A,x[0|l],!1,!1)):r.blend_first_with_tails(t)}e(Array.of(C.subarray(0,p)))}else{for(;b(0|l,p);l=u(l,1)){for(_.get_use_element(0|l,r),r.set_from_simdope(s),h[0]=f(l,c),E=0;v(E,a);E=d(E,1))n[0|E].get_use_element(C[0|l],m[E+1|0]),m[0|E].set_tail(m[E+1|0],w[0|E]);for(E=a;v(E,c);E=d(E,1))h[1]=d(h[0],E),y.get_use_element(h[1],m[E+1|0]),m[0|E].set_tail(m[E+1|0],w[0|E]);m[0|E].reset_tail(),(0|x[0|l])>0?(r.blend_first_with_tails(t),r.blend_first_with(r.is_dark()?g:A,x[0|l],!1,!1)):r.blend_first_with_tails(t)}e(Array.of(C.subarray(0,p),o.subarray(0,p)))}}))},r.prototype.build=function(e,t,i,a,r){e=(0|e)>>>0,t=(0|t)>>>0,a=a||[],this.set_bytes_index(0),this.set_state(n(e,t,i)),this.set_data_array(a,r)},r.prototype.update=function(e,t,i,n,r){e=(0|e)>>>0,t=(0|t)>>>0,n=n||[],this.set_bytes_index(0),this.set_state(a(this.state,e,t,i)),this.set_data_array(n,r)},r.prototype.clear=function(){this.set_bytes_index(0),this.set_state(a(this.state,1,1)),this.set_data_array([],new Uint32Array(0))},e.exports=r},927:function(e,t,i){"use strict";const n={_create_state:function(e,t,i,n){return{w:e,h:t,p:i,pc:n}},_create_func:function(){return new(0,Object.getPrototypeOf((function(){})).constructor)('\n return function(\n pxl_width,\n pxl_height,\n pxls,\n pxl_colors,\n ) {\n "use strict";\n pxl_width = pxl_width | 0;\n pxl_height = pxl_height | 0;\n \n const full_pxls_length = pxls.length | 0;\n const full_pxls = new Uint32Array(full_pxls_length|0);\n for(var i = 0; (i|0) < (full_pxls_length|0); i = (i + 1 | 0) >>> 0) { full_pxls[i|0] = (pxl_colors[pxls[i|0]] | 0) >>> 0; }\n let image_data = new ImageData(new Uint8ClampedArray(full_pxls.buffer), pxl_width, pxl_height);\n \n return new Promise(function(resolve, reject) {\n createImageBitmap(image_data).then(function(r){resolve(r);});\n });\n };\n ')()},from:function(e){let t=this._create_func(),i=this._create_state,n=e||null;return{render(e,a,r,s,o){var _=i(e,a,r,s);n?n.exec(t,[_.w,_.h,_.p,_.pc]).catch((function(){return t(_.w,_.h,_.p,_.pc)})).then((function(e){o(e)})):t(_.w,_.h,_.p,_.pc).then((function(e){o(e)}))}}}};e.exports=n},928:function(e,t,i){"use strict";var n=i(653),a=i(647),r=i(687),s=i(929);n.SetFixed.compute=function(e,t,i,n){var a,r=t.bitArrayData,s=[0].concat(i.map((function(e){return e.bitArrayData})));for(a=0;(0|a)<(0|e);a=(a+1|0)>>>0)s[0]=0|a,r[0|a]=n.apply(null,s)};const o={init(e,t,i,o,_,l){let h,{clamp_uint32:c,plus_uint:p,int_less:d,uint_equal:u,uint_not_equal:m,clamp_uint8:f}=a.simdops,g={index_changes:new Uint32Array(0),color_changes:new Uint32Array(0),_pxl_indexes_updated:new n.SetFixed(0),_pxl_indexes_of_selection_drawn:new n.SetFixed(0),_pxl_indexes_of_current_shape:new n.SetFixed(0),_pxl_indexes_of_old_shape:new n.SetFixed(0),_old_pxls_hovered:new n.SetFixed(0),_old_selection_pair_highlight:!0,_old_layers_string_id:"",_old_pxl_width:0,_old_pxl_height:0,_last_paint_timestamp:0,_is_there_new_dimension:!0,_did_hide_canvas_content:!1,_previous_imported_image_pxls_positioned_keyset:new n.SetFixed(0)},A={super_state:e,super_canvas:t,super_blend:i,canvas_pos:o,color_conversion:_,sraf:l},y={position(){},selection(){},color(){},action(){},update(){}},x=(new Uint32Array(0),new Uint32Array(0),""),w=A.canvas_pos.get_state().sizes,b=function(e,t,i,n){if(g._last_paint_timestamp>=n)e();else{let{_old_pxl_width:a,_old_pxl_height:r}=g,{pxl_width:s,pxl_height:o}=A.super_state.get_state();if(A.super_canvas.ok()){w=A.canvas_pos.get_state().sizes;let _=!(parseInt(a)===parseInt(s)&&parseInt(r)===parseInt(o)),l=parseInt(w.width)!==parseInt(s)||parseInt(w.height)!==parseInt(o);l||_?(A.super_state.set_state({pxl_width:parseInt(w.width),pxl_height:parseInt(w.height)}),g._is_there_new_dimension=!0,y.update(!1,!1).then((function(){setTimeout((()=>{g._is_there_new_dimension=!1,y.update(!1,!1)}),500),h(_,l,i,n).catch((function(){setTimeout(b,1,e,t,i,n)}))})).catch((function(){setTimeout(b,2,e,t,i,n)}))):h(_,l,i,n).catch((function(){setTimeout(b,1,e,t,i,n)}))}else setTimeout(b,3,e,t,i,n)}},v=new n.SetFixed(w.width*w.height),C=function(e,i,a,r,s,o){var _,l,h,c,u,m,f,y,x,w,C;if(g._last_paint_timestamp>=o)e();else{let{_is_there_new_dimension:E,_did_hide_canvas_content:U,_old_pxls_hovered:I,_old_layers_string_id:R,_pxl_indexes_of_old_shape:S,_pxl_indexes_of_current_shape:B,_pxl_indexes_of_selection_drawn:T,_previous_imported_image_pxls_positioned_keyset:F,_old_selection_pair_highlight:P}=g,{_s_layers:M,_layer_index:Q,_layers:O,select_mode:k,hide_canvas_content:L,pxl_width:N,pxl_height:D,_pxls_hovered:Y,tool:G,_shape_index_a:V,_select_shape_index_a:z,_pxl_indexes_of_selection:j,_paint_or_select_hover_pxl_indexes:K,_selection_pair_highlight:X}=A.super_state.get_state();const{imported_image_pxls_positioned:J,imported_image_pxl_colors:q,imported_image_pxls_positioned_keyset:W,image_imported_resizer_index:H}=A.super_state.get_imported_image_data(),Z=W.size>0,$=0|M.length,ee=M[0].indexes.length;l=(_=$+(Z?1:0))-1;const te=""+Array.from(O).map((function(e,t){return t+"-id-"+e.id+"-v-"+(e.hidden||L?"0":"1")+"-o-"+parseInt(255*e.opacity).toString(16)+"-w-"+e.width+"-h-"+e.height+"-end"})).join("+"),ie=U!==L||R!==te||E||a||s,ne=Uint8Array.from(O.map((function(e){return parseInt(e.hidden||L?0:Math.round(255*parseFloat(e.opacity)))})).concat(Z?[196]:[]));if("LINE"!==G&&"RECTANGLE"!==G&&"ELLIPSE"!==G&&"TRIANGLE"!==G||-1===V||-1===Y)if("SELECT LINE"!==G&&"SELECT RECTANGLE"!==G&&"SELECT ELLIPSE"!==G||-1===z||-1===Y){if(("SELECT PATH"===G||"CONTOUR"===G)&&K.size>0){const ue=K[0],me=K[K.size-1],fe=A.super_state.shape_creator.from_line(ue,me);"REMOVE"===k&&"SELECT PATH"===G?fe.forEach((e=>{j.delete(e)})):"SELECT PATH"===G?fe.forEach((e=>{j.add(e)})):fe.forEach((e=>{B.add(e)}))}}else B="SELECT LINE"===G?A.super_state.shape_creator.from_line(z,Y,B):"SELECT RECTANGLE"===G?A.super_state.shape_creator.from_rectangle(z,Y,B):"SELECT ELLIPSE"===G?A.super_state.shape_creator.from_ellipse(z,Y,B):B;else B="LINE"===G?A.super_state.shape_creator.from_line(V,Y,B):"RECTANGLE"===G?A.super_state.shape_creator.from_rectangle(V,Y,B):"ELLIPSE"===G?A.super_state.shape_creator.from_ellipse(V,Y,B):B;let ae=0,re=0,se=0,oe=M[Q]||{},_e=A.super_canvas.render.bind(A.super_canvas),le=A.super_blend;function he(){setTimeout(b,1,e,i,s,o)}function ce(e,t){return((e=(0|e)>>>0)^(t=(0|t)>>>0))>>>0}function pe(e,t){return((e=(0|e)>>>0)|(t=(0|t)>>>0))>>>0}function de(e,t,i,n,a,r,s,o,_){return pe(pe(pe(t[e=(0|e)>>>0],i[e]),ce(n[e],a[e])),pe(pe(ce(r[e],s[e]),((0|r[e])>>>0&(0|w[e])>>>0)>>>0),pe(o[e],_[e])))}for(h=le.for.bind(le),c=le.next.bind(le),u=le.stack.bind(le),m=X!==P,le.update(0|_,0|ee,ne,M,t.getUint32()),f=B.has.bind(B),y=j.has.bind(j),x=W.has.bind(W),w=m?4294967295:0,H>=0&&B.add(H),B.add(Y),v.length!==ee&&(v=new n.SetFixed(ee)),n.SetFixed.compute(ee,v,Array.of(oe.setFixed,I,S,B,T,j,F,W),de),C=v.has.bind(v);d(se,ee);se=p(se,1))(ie||C(se))&&(f(se)?h((0|se)>>>0,128):y(se)?(ae=se%N|0,re=(se-ae)/N|0,h((0|se)>>>0,72+48*(ae+re+(X?1:0)&1)|0)):h((0|se)>>>0,0),x(se)&&u((0|l)>>>0,(0|q[0|J[(0|se)>>>0]])>>>0),c());le.blend(!1,!1).then((function(t){t[0].length>0||ie||a||s?A.super_canvas.check(N,D).catch(he).then((function(){A.super_canvas.prender().finally((function(){I.clearAndBulkAdd(Uint32Array.of(H,Y)),oe.clear_changes(),T.setFromSetFixed(j),F.setFromSetFixed(W),A.sraf.run_frame((()=>(g._old_selection_pair_highlight=X,g._old_layers_string_id=""+te,g._did_hide_canvas_content=!!L,g._old_pxl_width=parseInt(N),g._old_pxl_height=parseInt(D),g._last_paint_timestamp=+o,B.clear(),S.setFromSetFixed(B),_e())),!1,ie||a||s,Date.now(),"render").finally(e)}))})):e()}))}};return{get:function(){return g},set:function(e){for(x in e)g[x]=e[x];return Promise.resolve()},set_notifiers:function(e=function(){},t=function(){},i=function(){},n=function(){},a=function(){}){y={position:e,selection:t,color:i,action:n,update:a}},is_there_new_dimension:function(){return g._is_there_new_dimension&&!0},update_canvas:function(e,t){return e=e||!1,t=t||Date.now(),void 0===h&&this&&(h=this.render_canvas),new Promise(b)},render_canvas:function(e,t,i,n){return new Promise(C)},_should_remove_not_perfect_second_latest_pixel_from_array(e){const t=A.super_state.get_state().pxl_width;if(e.size>=3){const i=0|e[e.size-1],n=i%t|0,a=(i-n)/t,r=0|e[e.size-2],s=r%t|0,o=(r-s)/t,_=0|e[e.size-3],l=_%t|0,h=(_-l)/t;if(1==(0|Math.abs(n-l))&&1==(0|Math.abs(a-h))&&(n===s&&o===h||a===o&&s===l))return!0}return!1},_handle_canvas_mouse_move(e){let{_pxl_indexes_of_selection:t,_imported_image_pxls:i,pxl_current_color_uint32:a,tool:r,pxl_width:o,pxl_height:_,_pxls_hovered:l,hide_canvas_content:h,_is_on_resize_element:c,_paint_or_select_hover_pxl_indexes:p,_paint_hover_old_pxls_snapshot:d,_last_action_timestamp:u,_paint_or_select_hover_pxl_indexes_exception:m,_paint_or_select_hover_actions_latest_index:f,_s_layers:g,_layer_index:y,pxl_current_opacity:x,_select_hover_old_pxls_snapshot:w,select_mode:b}=A.super_state.get_state();const{event_button:v,mouse_down:C}=A.canvas_pos.get_pointer_state(),E=v+1|0,U=g[y]||{},[I,R]=A.canvas_pos.get_canvas_pos_from_event(e.pageX,e.pageY),S=R*o+I|0;if(-1==(0|I)||-1==(0|R))this._notify_position_change({x:I,y:R});else if((0|S)==(0|l)||h)l!==S&&A.super_state.set_state({_pxls_hovered:0|S,_mouse_inside:!0}).then((()=>{this.update_canvas(),this._notify_position_change({x:I,y:R})}));else if(i.length>0){let{_imported_image_move_from:e,_imported_image_scale_delta_x:t,_imported_image_scale_delta_y:i,_imported_image_start_x:n,_imported_image_start_y:a,_imported_image_width:r,_imported_image_height:s}=A.super_state.get_state();const h=r+t,p=s+i,d=n+h+(a+p)*o,u=(0|S)==(0|d)||(0|l)==(0|d);let m=0,f=0;const g=I-e[0],y=R-e[1];e=Array.of(I,R),1===E&&C?u||c?(m=t+g|0,f=i+y|0,m=0|Math.max(m,-(r-1)),f=0|Math.max(f,-(s-1)),t=0|m,i=0|f,A.super_state.set_state({_pxls_hovered:0|S,_is_on_resize_element:u,_mouse_inside:!0,_imported_image_scale_delta_x:t,_imported_image_scale_delta_y:i,_imported_image_move_from:Array.of(e[0],e[1])}).then((()=>{this.update_canvas(),this._notify_position_change({x:I,y:R})}))):(n=n+g|0,n=n<-h?-h:0|n,n=n>=o?o:0|n,a=a+y|0,a=a<-p?-p:0|a,a=a>=_?_:0|a,A.super_state.set_state({_pxls_hovered:0|S,_is_on_resize_element:u,_mouse_inside:!0,_imported_image_start_x:n,_imported_image_start_y:a,_imported_image_move_from:Array.of(e[0],e[1])}).then((()=>{this.update_canvas(),this._notify_position_change({x:I,y:R})}))):A.super_state.set_state({_pxls_hovered:0|S,_is_on_resize_element:u,_mouse_inside:!0}).then((()=>{this._notify_position_change({x:I,y:R})}))}else if("PENCIL"!==r&&"PENCIL PERFECT"!==r&&"CONTOUR"!==r||1!==E||!C)if("SELECT PIXEL"!==r&&"SELECT PIXEL PERFECT"!==r&&"SELECT PATH"!==r||1!==E||!C){const{_s_layers:e,_layer_index:t}=A.super_state.get_state();p.clear(),A.super_state.set_state({_pxls_hovered:0|S,_mouse_inside:!0,_paint_or_select_hover_actions_latest_index:-1,_paint_or_select_hover_pxl_indexes:p}).then((()=>{this.update_canvas(),this._notify_position_change({x:I,y:R})}))}else{-1===f&&(f=S);const e=A.super_state.shape_creator.from_line(f,S);if("SELECT PATH"===r)u=1/0,e.forEach((function(e){p.add(0|e)}));else if("SELECT PIXEL"===r)u=Date.now(),e.forEach((function(e){p.add(0|e)}));else if("SELECT PIXEL PERFECT"===r){u=Date.now(),e.forEach((function(e){p.add(0|e)}));const i=p.indexes;if(this._should_remove_not_perfect_second_latest_pixel_from_array(i)){const e=i[i.length-2];w.includes(e)||"ADD"!==b&&"REPLACE"!==b||t.delete(e),p.delete(e)}}"REPLACE"===b&&t.clear(),p.forEach((e=>{"ADD"===b||"REPLACE"===b?t.add(e):t.delete(e)})),A.super_state.set_state({_pxls_hovered:0|S,_mouse_inside:!0,_pxl_indexes_of_selection:t,_paint_or_select_hover_pxl_indexes:p,_paint_or_select_hover_actions_latest_index:S,_last_action_timestamp:u}).then((()=>{this.update_canvas(),this._notify_is_something_selected(),this._notify_position_change({x:I,y:R})}))}else{-1===f&&(f=0|S),p=A.super_state.shape_creator.from_line(f,S,p);const{pencil_mirror_mode:e,_pencil_mirror_index:t}=A.super_state.get_state(),i=t%o,l=(t-i)/o;if("CONTOUR"===r)u=1/0;else if("PENCIL"===r)u=Date.now();else if("PENCIL PERFECT"===r&&(u=Date.now(),m.forEach((function(e){p.delete(e)})),this._should_remove_not_perfect_second_latest_pixel_from_array(p.indexes))){const e=p[p.size-2];p.delete(e),m.add(e);let t=new s.Set(Array.of(e));t.forEach((e=>{const[n,a]=e,r=a,s=n-2*(n-i);s>=0&&s=0&&r<=_&&t.add(r*o+s)})),t.forEach((e=>{U.set_uint32(e,d[e])}))}if("NONE"!==e){const t=new n.SetFixed(p);let r=new s.Set(p.filter((function(e){return!t.has(0|e)&&!m.has(0|e)})).map((function(e){var t=e%o|0;return[0|t,0|(e-t)/o]})));"VERTICAL"!==e&&"BOTH"!==e||r.forEach((e=>{const[t,i]=e,n=i-2*(i-l),a=t;a>=0&&a=0&&n<=_&&r.add([a,n])})),"HORIZONTAL"!==e&&"BOTH"!==e||r.forEach((e=>{const t=e[1],n=e[0]-2*(e[0]-i);n>=0&&n=0&&t<=_&&r.add([n,t])}));let h=new n.SetFixed(o*_);r.forEach((e=>{var t=e[1],i=e[0];h.add(t*o+i|0)})),A.super_state.paint_shape(h,a,x,{_pxls_hovered:0|S,_mouse_inside:!0,_paint_or_select_hover_pxl_indexes:p,_paint_or_select_hover_pxl_indexes_exception:m,_paint_or_select_hover_actions_latest_index:0|S,_last_action_timestamp:u},(()=>{this.update_canvas()}))}else A.super_state.paint_shape(p.indexes,0|a,x,{_pxls_hovered:0|S,_mouse_inside:!0,_paint_or_select_hover_pxl_indexes:p,_paint_or_select_hover_pxl_indexes_exception:m,_paint_or_select_hover_actions_latest_index:0|S,_last_action_timestamp:u},(()=>{this.update_canvas()}));this._notify_position_change({x:0|I,y:0|R})}},_notify_position_change(e,t){t=t||Date.now();const i=0|A.super_state.get_notified_pos_at(),n=0|Date.now();(n-i|0)>=100&&null==t||(0|t)>(0|i)&&(n-t|0)>=100?(e={x:void 0===e.x?-1:e.x,y:void 0===e.y?-1:e.y},A.super_state.set_state({_notified_position_at:n}).then((function(){y.position(e,A.sraf.get_state().previous_cpaf_fps)}))):(0|n)<(t+100|0)&&setTimeout(this._notify_position_change,100-(t-n|0)|0,{x:e.x,y:e.y},0|n)},_handle_canvas_mouse_up(){let{_paint_or_select_hover_pxl_indexes:e,tool:t,_imported_image_pxls:i,_pxl_indexes_of_selection:a,select_mode:r}=A.super_state.get_state();if(i.length>0)A.super_state.set_state({_imported_image_move_from:[-1,-1]});else if(e.size>0&&"CONTOUR"===t){let{pxl_current_opacity:t,pxl_current_color_uint32:i}=A.super_state.get_state();const a=e[0],r=e[e.size-1],s=A.super_state.shape_creator.from_line(a,r);e=new n.SetFixed(Array.from(e.indexes).concat(s)),e=A.super_state.shape_creator.from_path(e,e),e.clear(),A.super_state.paint_shape(e.indexes,i,t,{_last_action_timestamp:Date.now()},(()=>{this.update_canvas()}))}else if(e.size>0&&"SELECT PATH"===t){const t=e[0],i=e[e.size-1],s=A.super_state.shape_creator.from_line(t,i);e=new n.SetFixed(Array.from(e.indexes).concat(s)),e=A.super_state.shape_creator.from_path(e,e),"REPLACE"===r&&a.clear(),"ADD"===r||"REPLACE"===r?e.forEach((function(e){a.add(e)})):e.forEach((function(e){a.delete(e)}))}},_handle_canvas_mouse_down(e){const{pxl_current_color:t,pxl_current_color_uint32:i,hide_canvas_content:a,tool:o,pxl_width:_,pxl_height:l,pxl_current_opacity:h,bucket_threshold:c,select_mode:p}=A.super_state.get_state(),d=e.button+1;let[u,m]=[-1,-1];if(-1!==A.super_state.get_state()._pxls_hovered&&null===e){const e=A.super_state.get_state()._pxls_hovered%_,t=(A.super_state.get_state()._pxls_hovered-e)/_;[u,m]=[e,t]}else e&&([u,m]=A.canvas_pos.get_canvas_pos_from_event(e.pageX,e.pageY));if(-1===u||-1===m)return;let{_shape_index_a:f,_select_shape_index_a:g,_shape_index_b:y,_select_shape_index_b:x,_pxl_indexes_of_selection:w,_s_layers:b,_layer_index:v,hue:C}=A.super_state.get_state();const E=m*_+u,U=b[v]||{},I=void 0!==U?U.indexes:void 0,R=void 0!==I?I[E]:-1;if(-1===d)return void A.super_state.set_state({_pxls_hovered:E}).then((()=>{this.update_canvas()}));3===d&&(f=-1,g=-1,y=-1,x=-1);const{_imported_image_pxls:S}=A.super_state.get_state();if(A.super_state.set_state({_pxls_hovered:0|E,_mouse_inside:!0,_paint_or_select_hover_actions_latest_index:-1,_paint_hover_old_pxls_snapshot:U.indexes_copy||new Uint8Array(0),_select_hover_old_pxls_snapshot:new n.SetFixed(w)}),!a){let a=U.indexes||new Uint8Array(0),y=Array.from(U.colors);if(S.length>0&&1===d)A.super_state.set_state({_imported_image_move_from:[u,m]});else if(2===d||"MOVE"===o&&S.length<=0&&(1===d||-1===d))A.super_state.set_state({_imported_image_move_from:[e.x,e.y]});else if("PICKER"===o&&1===d){const t=this.get_pixel_color_from_pos(u,m);this._notify_current_color_change(t),this._notify_relevant_action_event(e,t,1)}else if("EXCHANGE"===o&&1===d){const t=U.colors[R];this.exchange_pixel_color(t,i),this._notify_relevant_action_event(e,i,1)}else if("LINE"===o||"RECTANGLE"===o||"ELLIPSE"===o)if(-1===f)1===d?A.super_state.set_state({_shape_index_a:E}).then((()=>{this.update_canvas()})):A.super_state.set_state({_shape_index_a:f}).then((()=>{this.update_canvas()}));else{let t;switch(o){case"LINE":t=A.super_state.shape_creator.from_line(f,E);break;case"RECTANGLE":t=A.super_state.shape_creator.from_rectangle(f,E);break;case"ELLIPSE":t=A.super_state.shape_creator.from_ellipse(f,E)}A.super_state.paint_shape(t.indexes,i,h,{_shape_index_a:-1,_last_action_timestamp:Date.now()},(()=>{this.update_canvas()})),this._notify_relevant_action_event(e,"#ffffffff",.6)}else if("SELECT LINE"===o||"SELECT RECTANGLE"===o||"SELECT ELLIPSE"===o)if(-1===g)1===d?A.super_state.set_state({_select_shape_index_a:E}).then((()=>{this.update_canvas()})):A.super_state.set_state({_select_shape_index_a:g}).then((()=>{this.update_canvas()}));else{let e="SELECT LINE"===o?A.super_state.shape_creator.from_line(g,E):"SELECT RECTANGLE"===o?A.super_state.shape_creator.from_rectangle(g,E):A.super_state.shape_creator.from_ellipse(g,E);"REPLACE"===p&&w.clear(),"ADD"===p||"REPLACE"===p?e.forEach((function(e){w.add(e)})):e.forEach((function(e){w.delete(e)})),e.clear(),A.super_state.set_state({_pxl_indexes_of_selection:w,_select_shape_index_a:-1,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas(),this._notify_is_something_selected()}))}else if("SELECT PIXEL"!==o&&"SELECT PATH"!==o||1!==d)if("SET PENCIL MIRROR"===o&&1===d)A.super_state.set_state({_pencil_mirror_index:E,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas()}));else if("PENCIL"!==o&&"PENCIL PERFECT"!==o&&"CONTOUR"!==o||1!==d)if("BUCKET"!==o&&"HUE BUCKET"!==o&&"SELECT COLOR THRESHOLD"!==o&&"BORDER"!==o||1!==d){if("SELECT COLOR"===o&&1===d){const{_s_layers:e}=A.super_state.get_state(),t=U.indexes[E];"REPLACE"===p&&w.clear(),U.indexes.forEach(((e,i)=>{e===t&&("ADD"===p||"REPLACE"===p?w.add(i):w.delete(i))})),A.super_state.set_state({_pxl_indexes_of_selection:w,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas(),this._notify_is_something_selected()}))}}else{const{_s_layers:s,_layer_index:d}=A.super_state.get_state(),f=U.indexes,g=[u,m],x=f[E],b=y[x];let v=[];const[I,R,S,B]=A.color_conversion.to_rgba_from_uint32(b),[T,F,P,M]=A.color_conversion.to_hsla_from_rgba(Uint8ClampedArray.of(I,R,S,B)),Q=T{if(0===c)return x===f[e];if(!k.has(e)&&e>=0&&e<_*l){const t=b||0,i=y[f[e]]||0;return A.color_conversion.match_color(t,i,c)}return!1},N=(e,t)=>{if(t=t||!1,(!k.has(e)||t)&&e>=0&&e<_*l)if("HUE BUCKET"===o){if(t){const t=y[a[e]];if(void 0===v[t]){let[i,n,r,s]=A.color_conversion.to_rgba_from_uint32(t),[o,_,l,h]=A.color_conversion.to_hsla_from_rgba(Uint8ClampedArray.of(i,n,r,s));o=(o+Q)%360,[i,n,r,s]=A.color_conversion.to_rgba_from_hsla(Array.of(o,_,l,h));const c=A.color_conversion.to_uint32_from_rgba(Uint8ClampedArray.of(i,n,r,s));y.includes(c)||y.push(c);let p=y.indexOf(c);-1===p&&(p=y.push(c)),v[t]=p,a[e]=p}else a[e]=v[t]}k.add(e)}else if("BUCKET"===o||"BORDER"===o){if(t){const t=A.color_conversion.blend_colors(y[a[e]],i,h,!1,!1);let n=y.indexOf(t);-1===n&&(n=y.push(t)),a[e]=n}k.add(e)}else"SELECT COLOR THRESHOLD"===o&&k.add(e)};let D=!1,Y=!1;for(;O.length;){let[e,t]=O.pop(),i=t*_+e;for(;t>=0&&L(i);)i-=_,t--;for(i+=_,t++,D=!1,Y=!1;t0&&(L(i-1)?D||(O.push([e-1,t-1]),D=!0):D&&(D=!1)),e+1<_&&(L(i+1)?Y||(O.push([e+1,t-1]),Y=!0):Y&&(Y=!1)),i+=_}if("BORDER"===o){A.super_state.shape_creator.from_border(k,!0,!0).forEach((e=>{N(e,!0)}));let{_s_layers:e,pxl_width:t,pxl_height:i}=A.super_state.get_state(),n=A.color_conversion.clean_duplicate_colors(a,y);e[d]=r.Layer.new_from_colors_and_indexes(n[1],n[0],t,i,!0),A.super_state.set_state({_s_layers:e,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas()}))}else if("SELECT COLOR THRESHOLD"===o)"REPLACE"===p&&w.clear(),k.forEach((e=>{"ADD"===p||"REPLACE"===p?w.add(e):w.delete(e)})),A.super_state.set_state({_pxl_indexes_of_selection:w,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas(),this._notify_is_something_selected()}));else if("BUCKET"===o||"HUE BUCKET"===o){let{_s_layers:i,pxl_width:n,pxl_height:s}=A.super_state.get_state(),o=A.color_conversion.clean_duplicate_colors(a,y);i[d]=r.Layer.new_from_colors_and_indexes(o[1],o[0],n,s,!0),A.super_state.set_state({_s_layers:i,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas(),this._notify_relevant_action_event(e,t,1)}))}}else{const{pencil_mirror_mode:e,_pencil_mirror_index:t}=A.super_state.get_state(),r=t%_,o=(t-r)/_;let c=new s.Set(Array.of(Array.of(u,m)));if("VERTICAL"===e||"BOTH"===e){const e=m-2*(m-o),t=u;if(t>=0&&t<_&&e>=0&&e<=l){c.add(Array.of(t,e));const n=e*_+t,r=U.indexes[n],s=y[r],o=A.color_conversion.blend_colors(s,i,h,!0,!1);let l=y.indexOf(o);-1===l&&(l=y.push(o)),a[n]=l}}"HORIZONTAL"!==e&&"BOTH"!==e||c.forEach((e=>{const t=e[1],n=e[0]-2*(e[0]-r);if(n>=0&&n<_&&t>=0&&t<=l){const e=t*_+n,r=U.indexes[e],s=y[r],o=A.color_conversion.blend_colors(s,i,h,!0,!1);let l=y.indexOf(o);-1===l&&(l=y.push(o)),a[e]=l}})),A.super_state.paint_shape([E],i,h,{_paint_or_select_hover_pxl_indexes:new n.SetFixed([E]),_paint_or_select_hover_actions_latest_index:E,_paint_hover_old_pxls_snapshot:U.indexes_copy||new Uint8Array(0),_last_action_timestamp:Date.now()},(()=>{this.update_canvas()}))}else"REPLACE"===p&&w.clear(),"ADD"===p||"REPLACE"===p?w.add(E):w.delete(E),"SELECT PIXEL"===o?A.super_state.set_state({_pxl_indexes_of_selection:w,_paint_or_select_hover_actions_latest_index:E,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas(),this._notify_is_something_selected()})):"SELECT PATH"===o&&A.super_state.set_state({_pxl_indexes_of_selection:w,_paint_or_select_hover_actions_latest_index:E,_last_action_timestamp:1/0}).then((()=>{this.update_canvas(),this._notify_is_something_selected()}))}},_notify_is_something_selected(){const e=A.super_state.get_state()._pxl_indexes_of_selection;!!A.super_state.get_state()._previous_pxl_indexes_of_selection.size!=!!e.size&&A.super_state.set_state({_is_something_selected:!!e.size,_previous_pxl_indexes_of_selection:new n.SetFixed(e)}).then((()=>{y.selection(!!e.size)}))},get_pixel_color_from_pos(e,t){const{pxl_height:i,pxl_width:n,_s_layers:r,_layers:s}=A.super_state.get_state(),o=t*n+e;if(e>n||t>i||e<0||t<0)return"#00000000";let _=a.Color.new_zero();for(let l=0;l>>0,o.set_colors(e,!0)}const h=o.colors.indexOf(t);_=_.map((e=>e===l?h:e));const[c,p]=A.color_conversion.clean_duplicate_colors(_,o.colors);i[s]=r.Layer.new_from_colors_and_indexes(p,c,n,a,!0),A.super_state.set_state({_s_layers:i,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas()}))}}}};e.exports=o},933:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,i){this.state=this.template(e,t,i)}template(e,t,i){let n={s:((e,t,i)=>{e||(e=document.createElement("canvas")),e.width=t,e.height=i;const n=/android|bb\d+|meego|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(navigator.userAgent||navigator.vendor||window.opera);let a,r,s,o="createImageBitmap"in window,_="OffscreenCanvas"in window;if(_)try{r=new OffscreenCanvas(t,i),s=r.getContext("2d",{willReadFrequently:!0,powerPreference:"high-performance",desynchronized:!n}),this.setImageSmoothing(s,!1)}catch(l){_=!1}if(_)try{a=r.transferControlToOffscreen()}catch(l){try{a=e.getContext("2d",{willReadFrequently:!0,powerPreference:"high-performance",desynchronized:!n})}catch(l){a=e.getContext("2d")}}else try{a=e.getContext("2d",{willReadFrequently:!0,powerPreference:"high-performance",desynchronized:!n})}catch(l){a=e.getContext("2d")}return this.setImageSmoothing(a,!1),{isBitmap:o,isOffscreen:_,width:t,height:i,canvasContext:a,offscreenCanvasContext:s}})(e,t|=0,i|=0),enablePaintType:"",fpBuffer:new ArrayBuffer(i*t*4),b:{bmpX:0,bmpY:0,bmpT:0,bmp:{close(){},width:0,height:0},oldBmp:{close(){},width:0,height:0}}};return n.fp=new Uint32Array(n.fpBuffer),n.prUint8a=new Uint8ClampedArray(n.fpBuffer),n}setImageSmoothing(e,t){e.imageSmoothingEnabled=t,["webkit","moz","ms"].forEach((i=>{e[i+"ImageSmoothingEnabled"]=t}))}ok(){return!!this.state.s.canvasContext.canvas}getUint32(){return this.state.fp}new(e,t,i){return this.state=this.template(e,t,i),Promise.resolve()}clear(){return new Promise((e=>{this.state.s.canvasContext.clearRect(0,0,this.state.s.width,this.state.s.height),e()}))}render(){const{b:e,enablePaintType:t,s:i}=this.state;return new Promise((function(n){"bitmap"===t&&e?(i.canvasContext.globalCompositeOperation="copy",i.canvasContext.drawImage(e.bmp,0,0,e.bmp.width,e.bmp.height)):"offscreen"===t?(i.canvasContext.globalCompositeOperation="copy",i.canvasContext.drawImage(i.offscreenCanvasContext.canvas,0,0)):i.canvasContext.putImageData(new ImageData(this.state.prUint8a,i.width,i.height),0,0),n()}))}prender(){return this.state.enablePaintType=this.state.s.isBitmap?"bitmap":this.state.s.isOffscreen?"offscreen":"","bitmap"===this.state.enablePaintType?createImageBitmap(new ImageData(this.state.prUint8a,this.state.s.width,this.state.s.height)).then((e=>(this.state.b.oldBmp.close(),this.state.b.oldBmp=this.state.b.bmp,this.state.b.bmp=e,Promise.resolve()))).catch((()=>(this.state.s.isBitmap=!1,Promise.reject()))):"offscreen"===this.state.enablePaintType?(this.state.s.offscreenCanvasContext.putImageData(new ImageData(this.state.prUint8a,this.state.s.width,this.state.s.height),0,0),Promise.resolve()):Promise.resolve()}check(e,t){const{width:i,height:n}=this.state.s;return i!==e||n!==t?this.setDimensions(e,t):Promise.resolve()}setDimensions(e,t){return this.state.s.width!==e||this.state.s.height!==t?(this.state=this.template(this.state.s.canvasContext.canvas,e,t),Promise.resolve()):Promise.reject(Error("Dimensions are already set to the requested size"))}}},934:function(e,t,i){"use strict";var n=i(653),a=i(647),r=i(687),s=i(667);const o=function(e,t){t=t instanceof n.SetFixed||void 0!==t?t:new n.SetFixed(e.canvas.width*e.canvas.height);let i=e.getImageData(0,0,e.canvas.width,e.canvas.height).data,a=i.length>>2;if(t instanceof n.SetFixed||t instanceof Set)for(let n=0;(0|n)<(0|a);n=(n+1|0)>>>0)(0|i[n<<2])>128&&t.add(0|n);else for(let n=0;(0|n)<(0|a);n=(n+1|0)>>>0)(0|i[n<<2])>128&&(t[0|n]=1);return t},_=function(e,t,i){let n=void 0!==i?i.canvas:void 0;if(void 0===n){"OffscreenCanvas"in window?n=new OffscreenCanvas(e,t):(n=document.createElement("canvas"),n.width=e,n.height=t);let i=n.getContext("2d",{willReadFrequently:!0});return i.imageSmoothingEnabled=!1,i}return n.height===t&&n.width===e||(n.width=e,n.height=t),i},l=function(e,t,i){e|=0,t|=0,i|=0;let n={x:0,y:0},a={x:0,y:0};return a.x=i%e|0,n.x=t%e|0,n.y=(t-n.x)/e|0,a.y=(i-a.y)/e|0,{primary:n,secondary:a}};class h{constructor(e,t){this.new_canvas_context_2d=_,this.get_shadow_indexes_from_canvas_context=o,this.get_opposite_coordinates=l,this.width=0|e,this.height=0|t,this.context=this.new_canvas_context_2d(this.width,this.height)}from_text(e,t,i){return this.context.clearRect(0,0,this.width,this.height),this.context.font=e+'px "Industry Book"',this.context.fillStyle="#ffffffff",this.context.textAlign="center",this.context.fillText(t,this.width/2,this.height/2),this.get_shadow_indexes_from_canvas_context(this.context,i)}from_border(e,t,i,a){t=t||!0,i=i||!1;let r=new n.SetFixed(this.width*this.height);return e.forEach(((n,a)=>{let s,o,_,l,h,c,p,d;s=n-this.width,s=s<0?-1:s,o=n+1,o=o%this.width==0?-1:o,_=n+this.width,_=_>this.width*this.height?-1:_,l=n-1,l=l%this.width==this.width-1?-1:l,h=s-1,h=-1===s||-1===l?-1:h,c=s+1,c=-1===s||-1===o?-1:c,p=_-1,p=-1===_||-1===l?-1:p,d=_+1,d=-1===_||-1===o?-1:d,t?(e.has(s)&&-1!==s&&e.has(o)&&-1!==o&&e.has(_)&&-1!==_&&e.has(l)&&-1!==l||r.add(0|n),i&&(e.has(h)&&-1!==h&&e.has(c)&&-1!==c&&e.has(p)&&-1!==p&&e.has(d)&&-1!==d||r.add(0|n))):(e.has(s)||r.add(s),e.has(o)||r.add(o),e.has(_)||r.add(_),e.has(l)||r.add(l),i&&(e.has(h)||r.add(h),e.has(c)||r.add(c),e.has(p)||r.add(p),e.has(d)||r.add(d)))})),r}from_path(e,t){t=void 0===t?new n.SetFixed(this.width*this.height):t,this.context.clearRect(0,0,this.width,this.height),this.context.linewidth=1;let i=0,a=0;return e.forEach(((e,t)=>{const n=e%this.width|0,r=(e-n|0)/this.width|0;0|t?this.context.lineTo(0|n,0|r):(this.context.moveTo(0|n,0|r),this.context.beginPath(),i=0|n,a=0|r)})),this.context.strokeStyle="#ffffffff",this.context.fillStyle="#ffffffff",this.context.stroke(),this.context.fill(),this.get_shadow_indexes_from_canvas_context(this.context,t)}from_line(e,t,i){e|=0,t|=0,i=void 0===i?new n.SetFixed(this.width*this.height):i;let a=this.get_opposite_coordinates(this.width,e,t),r=0|Math.abs(a.secondary.x-a.primary.x),s=0|Math.abs(a.secondary.y-a.primary.y),o=(0|a.primary.x)<(0|a.secondary.x)?1:-1,_=(0|a.primary.y)<(0|a.secondary.y)?1:-1,l=r-s|0,h=0;if(i instanceof n.SetFixed)for(;i.add(a.primary.y*this.width+a.primary.x|0),(0|a.primary.x)!=(0|a.secondary.x)||(0|a.primary.y)!=(0|a.secondary.y);)h=2*l|0,(0|h)>(0|-s)&&(l=l-s|0,a.primary.x=a.primary.x+o|0),(0|h)<(0|r)&&(l=l+r|0,a.primary.y=a.primary.y+_|0);else for(;i[a.primary.y*this.width+a.primary.x|0]=1,(0|a.primary.x)!=(0|a.secondary.x)||(0|a.primary.y)!=(0|a.secondary.y);)h=2*l|0,(0|h)>(0|-s)&&(l=l-s|0,a.primary.x=a.primary.x+o|0),(0|h)<(0|r)&&(l=l+r|0,a.primary.y=a.primary.y+_|0);return i}from_rectangle(e,t,i){e|=0,t|=0;let a=void 0===i?new n.SetFixed(this.width*this.height):i,r=this.get_opposite_coordinates(this.width,e,t);const s=Math.abs(r.primary.x-r.secondary.x|0)+1|0,o=Math.abs(r.primary.y-r.secondary.y|0)+1|0,_=Math.max(r.primary.x,0|r.secondary.x)-(s-1|0)|0,l=Math.max(r.primary.y,0|r.secondary.y)-(o-1|0)|0,h=s*o|0;let c=0,p=0;if(a instanceof n.SetFixed)for(let n=0;n>>0)c=n%s|0,p=(n-c|0)/s|0,a.add((l+p|0)*this.width+(_+c|0)|0);else for(let n=0;n>>0)c=n%s|0,p=(n-c|0)/s|0,a[(l+p|0)*this.width+(_+c)|0]=1;return a}from_ellipse(e,t,i){e|=0,t|=0,i=void 0===i?new n.SetFixed(this.width*this.height):i;let a=this.get_opposite_coordinates(0|this.width,0|e,0|t),r=Math.abs(a.primary.x-a.secondary.x|0)+1|0,s=Math.abs(a.primary.y-a.secondary.y|0)+1|0,o=r/2,_=s/2;const l=o+(Math.max(a.primary.x,0|a.secondary.x)-(r-1|0)|0),h=_+(Math.max(a.primary.y,0|a.secondary.y)-(s-1|0)|0);return this.context.lineWidth=1,this.context.clearRect(0,0,0|this.width,0|this.height),this.context.translate(l,h),this.context.rotate(0),this.context.scale(o,_),this.context.arc(0,0,1,0,2*Math.PI),this.context.fillStyle="#ffffffff",this.context.strokeStyle="#ffffffff",this.context.stroke(),this.context.fill(),this.get_shadow_indexes_from_canvas_context(this.context,i)}}e.exports=class{constructor(e,t){this.shape_creator=new h(e.pxl_width,e.pxl_height),this.state_={_id:parseInt(1e3*Math.random()*1e3).toString(16)+"",className:e.className||null,perspective:e.perspective||0,animation:e.animation||!0,animation_duration:e.animation_duration||60,move_using_full_container:e.move_using_full_container,dont_compute_base64_original_image:e.dont_compute_base64_original_image||!1,dont_change_img_size_onload:e.dont_change_img_size_onload||!1,dont_show_canvas_until_img_set:e.dont_show_canvas_until_img_set||!1,show_image_only_before_canvas_set:e.show_image_only_before_canvas_set||!1,dont_show_canvas:e.dont_show_canvas||!1,but_show_canvas_once:e.but_show_canvas_once||!1,has_shown_canvas_once:!1,tool:e.tool||"PENCIL",select_mode:e.select_mode||"REPLACE",pencil_mirror_mode:e.pencil_mirror_mode||"NONE",hue:e.hue||0,pxl_width:32,pxl_height:32,pxl_current_color:e.pxl_current_color||"#00000000",pxl_current_color_uint32:a.Color.new_hex(e.pxl_current_color||"#00000000").uint32,pxl_current_opacity:e.pxl_current_opacity||1,bucket_threshold:e.bucket_threshold||0,color_loss:e.color_loss||.25,default_size:e.default_size||96,ideal_size:e.ideal_size||e.default_size||96,max_size:e.max_size||2*e.default_size||192,px_per_px:e.px_per_px||1,fast_drawing:e.fast_drawing||!1,canvas_border_radius:e.canvas_border_radius||0,canvas_wrapper_background_color:e.canvas_wrapper_background_color||"#020529",canvas_wrapper_background_color_focused:e.canvas_wrapper_background_color_focused||"#000000",canvas_wrapper_border_radius:e.canvas_wrapper_border_radius||4,show_original_image_in_background:e.show_original_image_in_background||!1,show_transparent_image_in_background:e.show_transparent_image_in_background||!1,hide_canvas_content:e.hide_canvas_content||!1,_pencil_mirror_index:-1,_previous_pencil_mirror_axes_indexes:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_previous_pencil_mirror_axes_hover_indexes:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_base64_original_images:[],_original_image_index:-1,_layers:[{id:Date.now(),name:"Layer 0",hidden:!1,opacity:1}],_layers_defined_at:0,_layer_index:0,_current_layer:new r.Layer(Uint32Array.of(0),1,1),_s_layers:[new r.Layer(Uint32Array.of(0),new Uint16Array((e.pxl_width||32)*(e.pxl_height||32)).fill(0),e.pxl_width||32,e.pxl_height||32,!0)],_json_state_history:{history_position:0,state_history:[]},_saving_json_state_history_running:!1,_pxls_hovered:-1,_canvas_container:null,_canvas_wrapper:null,_canvas_wrapper_overflow:null,_state_history_length:100,_last_action_timestamp:Date.now(),_lazy_lazy_compute_time_ms:1e4,_undo_buffer_time_ms:parseInt(parseInt(e.pxl_width||32)+parseInt(e.pxl_height||32)+1e3),_mouse_inside:!1,_paint_hover_old_pxls_snapshot:new Uint16Array((e.pxl_width||32)*(e.pxl_height||32)).fill(0),_select_hover_old_pxls_snapshot:new Uint16Array,_paint_or_select_hover_actions_latest_index:-1,_paint_or_select_hover_pxl_indexes:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_pxl_indexes_newly_painted:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_paint_or_select_hover_pxl_indexes_exception:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_shape_index_a:-1,_select_shape_index_a:-1,_shape_index_b:-1,_select_shape_index_b:-1,_pxl_indexes_of_selection:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_previous_pxl_indexes_of_selection:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_imported_image_previous_start_x:0,_imported_image_previous_start_y:0,_imported_image_start_x:0,_imported_image_start_y:0,_imported_image_pxls:[],_imported_image_width:0,_imported_image_height:0,_imported_image_scale_delta_x:0,_imported_image_scale_delta_y:0,_imported_image_previous_scale_delta_x:0,_imported_image_previous_scale_delta_y:0,_is_on_resize_element:!1,_imported_image_pxl_colors:[],_is_image_import_mode:!1,_previous_image_imported_resizer_index:-1,_selection_pair_highlight:!0,_imported_image_move_from:[-1,-1],_updated_at:Date.now(),_notified_position_at:0,_force_updated_timestamp:0,_loading_base64_img:"",_loading_base64_img_changed:0,_intervals:[],_kb:0,export_state_every_ms:e.export_state_every_ms||6e4,_last_filters_hash:"",_saving_json_state_history_ran_timestamp:0,_processing_filters:!1,canvas_event_target:"CANVAS_WRAPPER_OVERFLOW",mouse_down:!1,cached_background_image_url:"",cached_background_image:""},this.imported_img_data={imported_image_pxls_positioned:[],imported_image_pxl_colors:new Uint32Array(0),image_imported_resizer_index:-1,imported_image_pxls_positioned_keyset:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32))},this.state_.cursor="",this.images_=Array(25),this.images_[0]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA9ElEQVRYR+3X0Q6FIAgGYDjn/R/5xBmtmjMTmIBd2G3WvsE/VISXPfgyDyyQ1JFbhYiIpI/q94joVukmyPJ/9i+Q1MUpFTpa8wWAzZoxy/puhg7E9b8MlAhiTRnyaJQIQsQPEW1ZKA2I12AWSgvaO5eBsoBSUFZQOErcyx6GHgf9FxH0kU0xJFMjoJD2jYIYZWpffbypI+EBMlWKQWf2WkcXL5AalQlSobJBImoGqIsq51d0hm5n/9beVx5nskG9kbDjZ4Ca7TtLGQ6S7nT19SoFNHqn8xyMnIlrCmtuGikV0kDKNVF7mdXxuN61ZR6qBZKq+Aeqdig0aelV6gAAAABJRU5ErkJggg=="),this.images_[1]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABFUlEQVRYR+2Y2w6EIAxEl///aDYYa7C2dFqryyb4qsBhOr3E8kl4aq2Vb1NKKZGtQ4v4QQ2oP7/xTQckqYNAuhTSQiMp1IAiqrmBpEMWEPlBMy+qEOKrV0OG+GoBWZm3FFoKtUyiXsvV+P8sk3rVfqvN/BmF0eUhfiDJT136J0BSnEklrUUM1hzdQvMVH0kudWikkvQuMhV2vfEyyMFAtElwMhW5pclSBOIhYDe6I8ppLQQkZdMUQJpKafLsBdQ0tTaMZYK4TD010NNhg039lkohoKdU6ir3qfSYE2N2dR4Zeru8lT1TAmWHTQsXpBBV7iyoEQwMlAVlwbiA7kIhMG6gHsoTQhQmBNQXTStD+/fIz6r2/RftLsg0XDwDiAAAAABJRU5ErkJggg=="),this.images_[2]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA80lEQVRYR+3X4Q6DIAwEYHn/h2bBQIJNoXcVHEb2c3PZx11hGo7FXmExz7FBViM7oe8lFGOMctUhBPcouL4oEfXvK77TiyJpUMEURALIQOR7DJICSUxaOQLSritImRwNstJwIC+G94K0uhxpXDZkrptPqIX5C6iHsU7d+vPO8OMJjcK04FRlszFV3XZCT2Bo0I2/I3i04MpSQhuUc1VP6uVmKA/c9NrgGVoWlG+s4F3DXkgl9ERKLtCslNw3aLPOJC2dc/FW70uCRtfWqgtKqAz3KFQPA4NGoSwMBbqLQjA0qEYxFaIYF6jsSu2Zvrdj0UfpHwMA+yX+QNKuAAAAAElFTkSuQmCC"),this.images_[3]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAv0lEQVRYR+2X3Q6AIAiF5f0fmuaFG6OSH9F00a0IX+dAKZTNHtiMpySQ5Mg/FUJEpMoAwKsQSxSqQI2hsiUQb9whhbjf0lS0dWrDUw5qGc9J9956iL6NFob3hSUH33sWEJvWrmBLLJNG1GCpf+wtE5FAkZa5fx0zLNNaW+O6Yx+lUAJJCgwdP2b0kCXnkh5KIE0PuU+MXF6pmHY9BEhbzBInfdtCzkPTgSwFPLGf3zos0EvuZQlkUUCKTcuOU+gCTnb3JcS3RYIAAAAASUVORK5CYII="),this.images_[4]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABH0lEQVRYR+2X4Q7CIAyEy0x8//c1WoNhCWOFawvo1PnTAf24HqUEOtgvzORhZs7XDyHAeHBAD3AEWhki2wlUqvmfCpVGRR7LPSSNLX1lMnWeAiE90bSIb/NdMrp6hRZMjJIWfw+QBFOUmCrI8JTVYDQ1Zfgp64FJaRxbGEsgbbVd8zdaoYWZ79bSn5tpKJCw2JWIbpZjNPRy9ezOAlsbW61DPwl0uJR5VJ6ashMInapToY8plPU77v5Jew+2AnTdZYJ/ltjHIVWbO/be9t55ERYCvQalXjnJfiGiR22nvT0U9IS02wS5m9sLAxWSGq3sv51I5atDa+TN+x+ZrAXVmuuBUStkhfLCmIHWxh2pqnmRmBs0FHTWd3jKZgX+GoWe1olaNCjYBWEAAAAASUVORK5CYII="),this.images_[5]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA+klEQVRYR+3Y0Q6DIAwFUOr+/5NdTY1dkJS1YIsmstexcLhArYP0sA88zJN+IERECw4AQhdxAmlzkXmCaNvK3ePkbkson5jO1gQd23RKIr9xtydUu/7HVn5SSl9LiegZ03Tt+cADwEJnv2dC7TfmwpjXqMikrFV3QcRVQLknZQVR0kNQLaAhqFZQOKoHFIrqBYWhroBCUFdB7igPUBX1ryrXGj0vkIhSnoni3J4gM4r7rbKPp9S8QdRtmtsYqfkLB/GipcknSHtZGJ6QdsveC9LaVPqeDvuQhCwYHjMU1PDnxe7jYuleh6TVW1J7J8iSTPGG7P8sa0WU4zdwA0Y04iTpEgAAAABJRU5ErkJggg=="),this.images_[6]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA7UlEQVRYR+3X2w6EIAwEUPv/H82GRDYE6dUO8KCvEntSBgG6DnvoMM/1gbQZWdKhUkppECISa8JBFdMbqk1CQUEjpnVJQsFAHEZDwUC1cASVDmoBbjmRULOpSwX1xftiniylgWZFJRQX7BSQdVraOOgq04J7h/v/77nHs4141SELRlvm41YSBnkwY5ek/SwEQmEq1A1CYtwgNMYFWoExg1ZhTKCVGBW0GiOCdmBY0C7MFLQT8xqkHdi1K8/s/eNPbe0QAhPuEAoTAiExbhAaw4K4MGrX4EiI0w5oGcVNqwxVyPpd9wHN+uHouONAP0LJ2yWtxGVEAAAAAElFTkSuQmCC"),this.images_[7]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA/0lEQVRYR+3XSw7DIAwE0Pj+h6ZCqiNE/cHAGBbttg1+GagBei770GWe5w/yZiQloVJKYQgRmTXhoIppDdVmoaCgHsMpWSgYSMN4KBioFp5BbQfxAuZ1YqGkqdsKaou3xSJraRtIKmqhtIW9BTQ6Lfw76L/MSOZtykJSahBLCVnTFG2Ibyf39hbt+wjm2wLMDr0EQmEqKjxlSEwYhMaEQBmYYVAWZgiUiXFB2RgTdAKjgk5hRNBJzBCIN0bveDG7BfXP/XRq6ZCVhXET4utUf5XyrjIraZkJSQMjMW5CPQiNUUFa5N41eGWqls5DOwqrL40cfGbs8AFtpkjkmetAH9mVQzQQt8P4AAAAAElFTkSuQmCC"),this.images_[8]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABTUlEQVRYR+2W4RKEIAiEpd7/kS9ubLQxFCGUq5upv5X7uYsghIc98DCe8AJJifzEIUTEDAIAXU13oAhTMkS2HtQUoCS6hhC2MhIKk9/1oIaBsmgSOaA4GAlqCIiJY0XEj1AqO1fLqSGgEMJCxZOIdJjcgOLCFZSKxsmhqA2IuGkiIgXfPG2jkU2F2Xentbfxnal+vPpQ5UwSipBsfBKM1SHOmSXWaTrOp+5cHPGqeVLnr0YmwiSBZm3R5tkqlytAXEx0191Cl6C0QGZn8qDXDlgNkNmZwo04ZfZilwpbAhpyBgDKOPNa5vvQDGdO1xFNz+Nob4Hh+tBtME0g7o5DboNcbYmNT4qtiqwEYnqGG8wVhzK4Nk7JCPZ91yFy/60Gp9R1LVQqoGI4HhoeMKrIWrv0gjEBecKwQL3syTiwlEn3H2mWTReUFnyB/s6hL1JSZjT7s1UhAAAAAElFTkSuQmCC"),this.images_[9]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABoklEQVRYR+2Y61IDMQiFoa2+//tqxdmdJAMJ5JBMR6tTf7ob9gMOl5Tpyf74yXjoXwBdReQzG1lm1k5fiOhrdjYdIRGRash+Y46mjg0vdrDn8xTQAbMCkY3eAdtDIaCLiNx7mJnXGgY5sQoUwjDzjYjuIBI3EfnQUAWgHVsC6tNUo+LlPQLTNurHnf+9EVErEjdlHgwzX1GF9GCBnbUIPQrm+CoqhlTKAiAk/ihrg470ixmgs+lVIXoHqkHdlzwapbUTCrzTHhvPHcG51YRSUdI19JhMf0JAQ6oyMCqKy1AvoBI9oyvd234lQl7DbIO7K8NziJbqeieioToeoaElILVimJauyx0NTSTqNFCmLH80Qn8SKDOjQGM046SfBuG0D1p909XC6DCmHP2YLWKpExdvXLHvpDszXLdWhgwMEQ0b6BZQZu1MAKVgDjt9ylzBzfoGgqlac3ZrV79QQ0GEMjpyl7NiL1yHIZAXgd1rEILxUgZFjVIUPZ9tn/rMUh86PTBX9TmejmT2+pRZ3s0PBKghGm83rk4ZoN0sbZ17AaGwfQNzJa40/U9w+QAAAABJRU5ErkJggg=="),this.images_[10]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABMklEQVRYR+2XwRLDIAhEpen/f3FTOmaajrUgC5jpxVyD+lwXUCoXfszM5/RERMhSUBAyUR9TYVqGyoZAXQLUw1TYvwFlYCr4VIWyMFOBZsBMA5JgTpOj3vlkYySD2jEjmAhUykPaMR3Sd2UHVSoMZHnG+q+dTAgIXQyNa+HcQN5FvPEuIO/kjam/2siocsNAURgvFAQ0yiZv2bCyLwzkBdHi+3IAAb3P/McHWSipNo2Absy8E9FWSnnOhtIKpQp0+qYfiLQKS7lR1RaBrNteBspqIRLQxswP4fp5L6XsozTOKKN2e2330s48SlnKTAFCjY7CiBc0j0LI8Xlg1BujZWrJK9nWYt4YI4+8FsqrjAlkZcygFRyvVeRRKM0Bt44ooHfcArIUWwothSwFrP/LQ5ZCL65vGzRTMXdZAAAAAElFTkSuQmCC"),this.images_[11]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABMklEQVRYR+2XwRLDIAhEpen/f3FTOmaajrUgC5jpxVyD+lwXUCoXfszM5/RERMhSUBAyUR9TYVqGyoZAXQLUw1TYvwFlYCr4VIWyMFOBZsBMA5JgTpOj3vlkYySD2jEjmAhUykPaMR3Sd2UHVSoMZHnG+q+dTAgIXQyNa+HcQN5FvPEuIO/kjam/2siocsNAURgvFAQ0yiZv2bCyLwzkBdHi+3IAAb3P/McHWSipNo2Absy8E9FWSnnOhtIKpQp0+qYfiLQKS7lR1RaBrNteBspqIRLQxswP4fp5L6XsozTOKKN2e2330s48SlnKTAFCjY7CiBc0j0LI8Xlg1BujZWrJK9nWYt4YI4+8FsqrjAlkZcygFRyvVeRRKM0Bt44ooHfcArIUWwothSwFrP/LQ5ZCL65vGzRTMXdZAAAAAElFTkSuQmCC"),this.images_[12]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA/klEQVRYR+XX7Q6FIAgG4Lz/i/bMlo2ZIB++zO30t1xPgEjlOuwqh3mu/wPVWuuYhVIKGwhohBpm9u5m5FAwEIfp0eJQENAM0zNHIzZDbQdxmJ4ieh8O0tRMGkiqGbrRUlK2KmCu+UJSthPT4KGi3o0JgRAYNwiFcYGQGDMIjTGBMjBqUBbGBLof5seYT++TRgxpSjX1oT5srWBejCpCBPHiJVgEswSNJ3MPNR0laCqjGBOI5p0MW3fUZlH0/s2INbTaXSPMi6DrwiDpD8IDdIN21MsM7AKhMK6iRmLMIDTGBMrAqEFZGBXo6cSmM8+z3d9TILIYsTbty7X440A/uhPvJTjQhwcAAAAASUVORK5CYII="),this.images_[13]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAk0lEQVRYR+2YwQ6AIAxD2f9/9AgHDyixrs5kxHotHeVtB9Basc+K5WkKhDpyIeTujkyZuplNGZaBTmsy959qjbPvHeir7h0dCBNaGd72b8yoAt1RFCE0YyIkQogA0jVDIoQIIF0zJEKIANI1Q/8jhE7M6PSdmtks4gm/OiLFmbWPAzHFWQ98ubKFs3z6HYNIliPUAQ/FUDSiymd+AAAAAElFTkSuQmCC"),this.images_[14]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABR0lEQVRYR+3X3Q6CMAwF4DUY3v91NeIxEGYGbv1jXbzQW2R8nI5uo/RjP/J4AEBzHxGZxzffsGK0z1ndVpQJZMHkBK0oNeiMkapWpmhBqUA1jFCKGcDdgxJBDkyulgvFgi5g3KgmqAPGhVKBLJOy0Z8O5ePG6wGaADylflMmHgnKmAeAmUONAGXMViWprNEgFrM/fEopvYqO/VlyepdMg8mJfVBhCXEDV67Fg/b5sm0/yknMYfI9eSnpXbKvViNhhoI0mGGgCuaWUlpq3TpsUjOfcRMTnpC2TGVSoQntgy8AJiJikxnRGPNSsXZeFSa8ZJoj0Pk/oSX7g84112wvuNQs2+HoTf666h9OutK+KfIYZMZsC7Zmglrf8krJVaDWA7iX8Zxa1QnVuq0mWc/HoE7Ig5ImcO2lzKByxyilJJ3VuoEkyJXrb6IrI0OmlalfAAAAAElFTkSuQmCC"),this.images_[15]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABeklEQVRYR82W2w7DIAxDQfv/P57GREWqNM3FlAh1j2trDokdqOVlv/oynnICtdZah6u13iC9Z3JDqzoXoM7SuThUX0D736qs9T6qc6kG/4gWnIGhbyyd/lxuWG5MbY/sWiSiVYug+DNEJwRCRBAgVAcF+pRSfjOJlBUaQKGO6iHq9Uhd2HctadT2Ed4eFEhHTRmL/6e19rXERhXMKrM2uTp8Q/AcklBejK1ZhMwzeFJzMcMfsJbnxWkRDjNacuijKYqCMQWkwFTtv2jRlAp5C2dCQRVCFkTeQSoHAQ2PHIes5Zcso8NAHpR2bj01+hSQBkXT3LmOqHcs6/1pIAmF+GJmJMCTmh0n5KPTU5lQSzdGyzsr7YNujJ5Bs6HC+xCSlkyoEAg1ZBYUChTe9LLSl35jXK3ULWXCM/BNjydrBSqMPW8F6qeV9kGDkRaQwzEaiI8qFYmuPkehqPqPzrJZyAiKW2ELkOcp6cttQBqUFpKtQEhitwMxKHXtP/Eo9zDGipjdAAAAAElFTkSuQmCC"),this.images_[16]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA/klEQVRYR+XX7Q6FIAgG4Lz/i/bMlo2ZIB++zO30t1xPgEjlOuwqh3mu/wPVWuuYhVIKGwhohBpm9u5m5FAwEIfp0eJQENAM0zNHIzZDbQdxmJ4ieh8O0tRMGkiqGbrRUlK2KmCu+UJSthPT4KGi3o0JgRAYNwiFcYGQGDMIjTGBMjBqUBbGBLof5seYT++TRgxpSjX1oT5srWBejCpCBPHiJVgEswSNJ3MPNR0laCqjGBOI5p0MW3fUZlH0/s2INbTaXSPMi6DrwiDpD8IDdIN21MsM7AKhMK6iRmLMIDTGBMrAqEFZGBXo6cSmM8+z3d9TILIYsTbty7X440A/uhPvJTjQhwcAAAAASUVORK5CYII="),this.images_[17]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABBElEQVRYR+3XyxLCIAwF0PL/H43DIk7EvG5KoOPoGuVwk1jarod92sM8lwnqvXcObq2VH8AFkWHYfgbEk/YOVZ7QwPBKe0mXgmYM9aOFeoPmBqYv8x6SJlIrgYbxUB8gdIi8+DOo5SBKmpKzUNKBlpaMb843Q3ppWVNLm1oordxLQNGy0LrQlEkTpJWAr/Uad6wVklKDuJVQBOON+RyEC9IerghmTsm6YaSe3lWYAYVBlRgYVI2BQDswYdAuTAi0E+OCdmNM0AmMCjqFEUEnMbdB3o0x8xL69U8dTagCk06oCpMCVWJgUDVGBWnN6L0GZ5oYuqCt2AD9Dfg+hG6Arv+DvMReyBw3NCzTf+YAAAAASUVORK5CYII="),this.key="",this.notifiers_update=t,this.new_canvas_context_2d=_}set_cursor(e,t){var i,n,a,r,s;this.state_.mouse_down=0|e,this.state_.canvas_event_target=t+"",i=""+this.state_.tool,n=""+this.state_.select_mode,a=this.state_._is_image_import_mode,r=this.state_._is_on_resize_element,s=this.state_.cursor+"",a?r?this.state_.cursor=`url("${this.images_[0]}") 18 18, auto`:this.state_.mouse_down?this.state_.cursor=`url("${this.images_[2]}") 20 24, auto`:this.state_.cursor=`url("${this.images_[1]}") 20 18, auto`:"MOVE"!=i&&!this.state_.canvas_event_target.includes("CANVAS_WRAPPER")||this.state_.mouse_down?("MOVE"==i||this.state_.canvas_event_target.includes("CANVAS_WRAPPER"))&&this.state_.mouse_down?this.state_.cursor="grabbing":"RECTANGLE"==i?this.state_.cursor='url("'+this.images_[3]+'") 27 12, auto':"ELLIPSE"==i?this.state_.cursor='url("'+this.images_[4]+'") 25 9, auto':"LINE"==i?this.state_.cursor='url("'+this.images_[5]+'") 32 32, auto':"PENCIL"==i?this.state_.cursor='url("'+this.images_[6]+'") 5 32, auto':"PENCIL PERFECT"==i?this.state_.cursor='url("'+this.images_[7]+'") 5 32, auto':"PICKER"==i?this.state_.cursor='url("'+this.images_[8]+'") 5 32, auto':"EXCHANGE"==i?this.state_.cursor='url("'+this.images_[9]+'") 18 18, auto':"BUCKET"==i?this.state_.cursor='url("'+this.images_[10]+'") 6 25, auto':"HUE BUCKET"==i?this.state_.cursor='url("'+this.images_[11]+'") 6 25, auto':"CONTOUR"==i?this.state_.cursor='url("'+this.images_[12]+'") 8 33, auto':"BORDER"==i?this.state_.cursor='url("'+this.images_[13]+'") 18 18, auto':"SET PENCIL MIRROR"==i?this.state_.cursor='url("'+this.images_[14]+'") 18 18, auto':"SELECT COLOR THRESHOLD"==i?this.state_.cursor='url("'+this.images_[15]+'") 7 7, auto':"SELECT PATH"==i?this.state_.cursor='url("'+this.images_[16]+'") 8 33, auto':"SELECT PIXEL"==i?"ADD"==n||"REPLACE"==n?this.state_.cursor='url("'+this.images_[17]+'") 5 32, auto':"REMOVE"==n?this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA9klEQVRYR+3XQRKDMAgFUHP/Q6eTBR2MgQ8I0YXdmpHnh2jajpf92ss8xwdCHdmSUO+9E6S1ptYsBw0MNwybhioFzRhKSUP9QTxW1Gd+XXpaCYNQJxBo78WJ4o+g0kGUNCWnoVYPlNoyXpwX88xS2lCvimooqd0pIGtbaJ1pl3l2Fl+LBnesXSQlBnErIQsGbfM5iDDIg5lT0roRAlVhBtQNqsS4QdUYF2gHxgzahTGBdmIgaDdGBT2BEUFPYZagJzG3QejEGPlgX97U1oQqMOGEqjAhUCXGDarGiCBpGNHf4MgQpx3QMoqv7uE+D1VB6L4fCCX8A+VV8SWc4ctzAAAAAElFTkSuQmCC") 5 32, auto':"REPLACE"==n&&(this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABNUlEQVRYR+3X4Q6EIAgAYLn3f+a42aIZgYCFddv165aXfiKYQXnZBS/zlN8AISICwKeUgiyCgIgLAKRN5NTxhimIWBiKMNTmRtU+aWLWZA6dEoYeblAVUSOzB2xrM1FKn+pzvGGPQouqvwWMtKSHFeYYNlERJd08odpRhKUUC1XDWCgtdCLKi2kGrcWh7izSst8OogSm5O1FygsaXrJ28HawSC7dltTSoD2UVqW3lL13Wdge56uy6MZoVVPNaCFS7n1orQjvq8ODscqcl6C502o1G8HwKPVOGEOgLMz6RoiehzIxYVA2JgSagXGDZmFcoJkYEzQb0wU9gVFBT2FE0JOYyyDvQT+y+aqfQVYnGZjhCGVhhkCZmDAoG6OCtPyxPoOtvPO0h48fnk6v/OcPsqL3ugh9ATjCXTQqEhJmAAAAAElFTkSuQmCC") 18 18, auto'):"SELECT PIXEL PERFECT"==i?"ADD"==n?this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABFUlEQVRYR+3XWQ7DIAwE0HD/QxNRycil3oZigqrmm4jHmLVch33lMM9lgmqtlYNLKekDcEFkaLafAfGkvUGlJ9QwvNJe0qmgEUPz0UJ10DiB6Wc+h6QVqZVAw3ioNxC6iLz4Z1DLQZQ0JWehpAEtLRnvnHeGzKVlk1rq1EJp5V4CipaF2oVWmbSCtBLwtkYyvZmQlBrEVwlZZUI3xL7NWKe9dbgimNaHt0WEQBo2C9P6g68TmRgYlI2BQDswYdAuTAi0E+OCdmNM0BMYFfQURgQ9iQmBaMv3rherHpwfO7V0wu/CuAnRw3W8a0cPypnUzISUO1LqCxYCZSajXj+099mrvug7aaJm8PVjog/olz/Ii+u4hG5e9580PRb9NQAAAABJRU5ErkJggg==") 5 32, auto':"REMOVE"==n?this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABBklEQVRYR+3Xyw6EMAgFUPn/j+6kCwwqj14t1Emc7TRyvFSqtL3sRy/zbB8o6khJQq21xhAicmumgzpGGrrNQ6WCzhhOyUPtIBlr1Gf5v3W3FiZCHUBBey/OKP47qOkgTpqT81DaDU1tmSwuiyF7adqm1op6KKvdU0CjbeF1Q08Z8mTJtU4y+zIlKTOIRwl5bUIH4j7JE5KhaD95NW8lhCTTi0fz6jBo0YQyMd0CJZSNgUAVmGFQFWYIVIkJQdUYF7QCY4JWYVTQSswQiKfsk+MAGb6Xwai9ZFVhwoT4c+r8ro2cTUg6IUi7WCYGBmVjTJAVc/QZjLZHWw+d9jMKRtf4QH+X0A98MFk0IsucOwAAAABJRU5ErkJggg==") 5 32, auto':"REPLACE"==n&&(this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABUklEQVRYR9WX7RKEIAhFZd//mZcdG2mIQMDS2v3VbAbHi3wI5WU/eBlP+Q8gREQA+JRSUCgIiPgFgGkbORluMAURi4AiGHoXhqo2aWPeZg5GCYY+ZlAVoiqzC9beuVCGTfM7+WJXgUPVZwVGC+khwhJGbFSF0v48QXEvSijVRLVgPChLOhUqCsOc1uQwK4sW9tuB6ADT4e0pFQUaDhl3zp1lztJth1pz2oOysvSWtI+GRdS4WJZlC2NHGbVmtfXhOrQZibaOXpiyBXGv5KPdPgPTNlmLq1vZ3QUa8CyYrSNkFZoJkwaaDZMCWgETBloFEwJaCeMCrYbpAj0BYwI9BaMCPQkTAqIxwRsvsgXWWm9eg3j/WQXjKkTXKdkTo1egEdW6ChmNNdS1R2BchaTRmcqY8xC/9kqgyDwzqszlAe2q43CWzXIUtZse0KKGR9e9DugHz47FNAGTbH0AAAAASUVORK5CYII=") 5 32, auto'):i.includes("SELECT")?"ADD"==n?this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAkElEQVRYR+2XQQqAMAwEm/8/OpKDUApmUwoScbwmpdNpXNRGs8ea8QyA1I1g6H+G3N3nU5vZ0RgcLQ6QALoZgg2gdSgxpF5TDGEoM7CG3lPvnEPKaNSzrEqDcR7YykaVHhWe3wOqnPq1K6vAkEPKEoYwpAyoOjNUMdTqI18B79aP/zp2N1T9AGFIGVD1djN0AfXGlCWHImsNAAAAAElFTkSuQmCC") 18 18, auto':"REMOVE"==n?this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAb0lEQVRYR+2UQQrAIBDEdv7/6C0+oAYWClriNbiOcTB12MphecpA9CIa0hAZIG6HNEQGiNshDZEB4tsOdXfTgAlP8nouBtrsnWSpdcd/BRppgE1jQ1+EoZl+jBoiA8TtkIbIAHE7pCEyQNwOXWfoAYpLFiWYvOCxAAAAAElFTkSuQmCC") 18 18, auto':"REPLACE"==n&&(this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABCElEQVRYR+2X3Q6DMAiFwb3/I8+zYFbj5ixwmixsqTdeWNqPw09RpdijxXhkAnkRmQr9p0IAoKo3EVk9Dy++LwDuquqmiLvgCbMCWEgoBbCq2sv86kN1gRqMiCzmOQBJQjVlmnDNsctzPYWad3skElCUrQdkIMzGjM3mdAQoC0XDZICiUEMwWSAPymrAqonJt90mGrJje3mvnK36NtpBGEahBnYKzZE4UYmnPsoo1IUagRlR6GM+kc3zRSVWoVIhK5XUvT7z9bKPNL3Imu4EE82hzEGZtVTZMwcwNqHLld6YnBL6t33FAc3uKZs7a4ywLeNKDfnkXwZtFi17+oCs4QTyFJsK/ZxCD73aLDSws54nAAAAAElFTkSuQmCC") 18 18, auto'):this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAq0lEQVRYR+1WQQrAIAxb///oDmUOkc3W2kEG2XHQGpPURg6wTzLwqKr2fUQk3Ddc2AMogBqGgo2ARpkhGaKHZtMIKRmnjJLtrBBIU0O9QzvsjrUpyzUd0BgfvAdYWz3StzLUm7KBuWLEKzZPzHjqO8SWElXuX7UnLCCvTCvTFJYsAuarGswp270tQ77FIOQuY0BjQLOM+zuGVlbK7HIpLzXH3vIXGfIwlGXqE9034xUtxdxDAAAAAElFTkSuQmCC") 18 18, auto':this.state_.cursor="grab",s!==this.state_.cursor&&this.notifiers_update()}paint_shape(e,t,i,a,r){a=void 0===a?{}:a,r=void 0===r?function(){}:r,this.state_._s_layers[this.state_._layer_index].paint_uint32a(e instanceof n.SetFixed?e.indexes:e,(0|t)>>>0,Math.fround(i)),this.set_state(a).then(r)}set_state(e,t){t=t||!1;var i=!1;if("pxl_width"in(e="object"!=typeof e?{}:e)&&"pxl_height"in e&&(this.state_.pxl_width===e.pxl_width&&this.state_.pxl_height===e.pxl_height||(this.shape_creator=new h(e.pxl_width,e.pxl_height))),"tool"in e&&this.state_.tool!==e.tool&&(i=!0),"select_mode"in e&&this.state_.select_mode===e.select_mode&&(i=!0),"_is_image_import_mode"in e&&this.state_._is_image_import_mode===e._is_image_import_mode&&(i=!0),""in e&&this.state_._is_on_resize_element===e._is_on_resize_element&&(i=!0),"pxl_current_color"in e&&(this.state_.pxl_current_color_uint32=a.Color.new_hex(e.pxl_current_color).uint32),("show_original_image_in_background"in e||"_base64_original_images"in e||"_original_image_index"in e||"show_transparent_image_in_background"in e||"pxl_width"in e||"pxl_height"in e)&&(!this.state_.cached_background_image_url||void 0!==e._original_image_index&&this.state_._original_image_index!==e._original_image_index||void 0!==e.show_original_image_in_background&&this.state_.show_original_image_in_background!==e.show_original_image_in_background||void 0!==e.show_transparent_image_in_background&&this.state_.show_transparent_image_in_background!==e.show_transparent_image_in_background||e._base64_original_images&&this.state_._base64_original_images.length!==e._base64_original_images.length)&&(this.state_.show_original_image_in_background&&void 0!==this.state_._base64_original_images[this.state_._original_image_index]?(this.state_.cached_background_image_url&&URL.revokeObjectURL(this.state_.cached_background_image_url),this.state_.cached_background_image_url=(0,s.createLocalBlob)(this.state_._base64_original_images[this.state_._original_image_index]),this.state_.cached_background_image=`center / cover no-repeat url("${this.state_.cached_background_image_url}")${this.state_.show_transparent_image_in_background?`, repeating-conic-gradient(rgb(248 248 248 / 100%) 0% 25%, rgb(235 235 235 / 100%) 0% 50%) left top 50% / calc(200% / ${this.state_.pxl_width}) calc(200% / ${this.state_.pxl_height})`:""}`):this.state_.show_transparent_image_in_background?this.state_.cached_background_image=`repeating-conic-gradient(rgb(248 248 248 / 100%) 0% 25%, rgb(235 235 235 / 100%) 0% 50%) left top 50% / calc(200% / ${this.state_.pxl_width}) calc(200% / ${this.state_.pxl_height})`:this.state_.cached_background_image=""),t)this.state_=Object.assign(this.state_,e);else for(this.key in e)this.state_[this.key]=e[this.key];return i&&this.set_cursor(),Promise.resolve()}get_state(){return this.state_}get_notified_pos_at(){return 0|this.state_._notified_position_at}get_imported_image_data(){var e,t,i,r;if(this.state_._imported_image_pxls.length>0){let s=this.new_canvas_context_2d(this.state_._imported_image_width,this.state_._imported_image_height);this.state_._imported_image_pxls.forEach(((e,t)=>{const i=t%this.state_._imported_image_width,n=(t-i)/this.state_._imported_image_width;s.fillStyle=a.Color.new_uint32(this.state_._imported_image_pxl_colors[e]).hex,s.fillRect(i,n,1,1)}));const o=this.state_._imported_image_width+this.state_._imported_image_scale_delta_x,_=this.state_._imported_image_height+this.state_._imported_image_scale_delta_y;let l=this.new_canvas_context_2d(o,_);l.drawImage(s.canvas,0,0,this.state_._imported_image_width,this.state_._imported_image_height,0,0,o,_);let h=l.getImageData(0,0,o,_);const{new_pxls:c,new_pxl_colors:p}=this.get_pixels_palette_and_list_from_image_data(h);let d={},u=new n.SetFixed(this.state_.pxl_width*this.state_.pxl_height),m=-1;if(c.length>0)for(m=this.state_._imported_image_start_x+o+(this.state_._imported_image_start_y+_)*this.state_.pxl_width|0,e=Uint32Array.of(o,this.state_._imported_image_start_x,this.state_._imported_image_start_y,this.state_.pxl_width,this.state_.pxl_height),t=Uint32Array.of(0,0,0,0,0),i=0,r=c.length;(0|i)<(0|r);i=i+1|0)t[0]=i%e[0],t[1]=(i-t[0])/e[0],t[2]=t[0]+e[1],t[3]=t[1]+e[2],t[4]=t[3]*e[3]+t[2],t[2]>=0&&t[2]=0&&t[3]0&&_>0){h=a?_+o:1-(1-_)*(1-o);const e=_/h,t=o*(1-_)/h;l.set(Uint8ClampedArray.of(s[0]*e+r[0]*t,s[1]*e+r[1]*t,s[2]*e+r[2]*t),0)}else _>0?(h=s[3]/255,l.set(s,0)):(h=r[3]/255,l.set(r,0));return a&&(h/=2),l[3]=255*h|0,this.to_uint32_from_rgba(l)},blend_rgba_colors:function(e,t,i,n){i|=0,n|=0;let a=e[0].length/4|0,r=0|e.length,s=new Uint8ClampedArray(e[0].length),o=new Uint8ClampedArray(4),_=new ArrayBuffer(4),l=new Uint8ClampedArray(_),h=new ArrayBuffer(4),c=new DataView(h),p=new Uint8ClampedArray(h),d=new DataView(new ArrayBuffer(24));d.setFloat32(20,(65535*t|0)/65535);let u=0;for(let m=0,f=0;(0|m)<(0|a);m=(m+1|0)>>>0,f=(f+4|0)>>>0){u=0,o.set(e[0].slice(f,f+4|0),0);for(let t=1;(0|t)<(0|r);t=t+1|0)l.set(e[t].slice(f,f+4|0),0),0!==i&&0===l[3]&&1===d.getFloat32(20)?o.fill(0):255===l[3]&&1===d.getFloat32(20)?o.set(l,0):(d.setFloat32(0,o[3]/255),d.setFloat32(4,l[3]/255*d.getFloat32(20)),p.fill(0),d.setFloat32(8,0),d.getFloat32(0)>0&&d.getFloat32(4)>0?(n>0?d.setFloat32(8,d.getFloat32(0)+d.getFloat32(4)):d.setFloat32(8,1-(1-d.getFloat32(4))*(1-d.getFloat32(0))),d.setFloat32(12,d.getFloat32(4)/d.getFloat32(8)),d.setFloat32(16,d.getFloat32(0)*(1-d.getFloat32(4))/d.getFloat32(8)),c.setUint8(0,l[0]*d.getFloat32(12)+o[0]*d.getFloat32(16)),c.setUint8(1,l[1]*d.getFloat32(12)+o[1]*d.getFloat32(16)),c.setUint8(2,l[2]*d.getFloat32(12)+o[2]*d.getFloat32(16))):d.getFloat32(4)>0?(d.setFloat32(2,l[3]/255),p.set(l,0)):(d.setFloat32(2,o[3]/255),p.set(o,0)),n&&d.setFloat32(2,d.getFloat32(8)/2),p.fill(255*d.getFloat32(8),3,4),o.set(p));s.set(o,f)}return s},to_hex_from_uint32:function(e){return e=(0|e)>>>0,"#".concat("00000000".concat(new Uint32Array(new Uint8Array(Uint32Array.of(e).buffer).reverse().buffer).toString(16)).slice(-8))},to_hex_from_rgba:function(e){return"#".concat("00000000".concat(new Uint32Array(e.buffer)[0].toString(16)).slice(-8))},to_rgba_from_hex:function(e){return new Uint8ClampedArray(Uint32Array.of(parseInt(e.slice(1),16)).buffer)},to_rgba_from_uint32:function(e){return e=(0|e)>>>0,new Uint8ClampedArray(Uint32Array.of(e).buffer)},to_uint32_from_rgba:function(e){return(0|new Uint32Array(e.buffer)[0])>>>0},to_uint32_from_hex:function(e){return new Uint32Array(new Uint8Array(Uint32Array.of((0|parseInt(e.slice(1),16))>>>0).buffer).reverse().buffer)},to_hsla_from_rgba:function(e){let[t,i,n,a]=e;t/=255,i/=255,n/=255,a/=255;const r=Math.max(t,i,n),s=Math.min(t,i,n);let o,_,l=(r+s)/2;if(r==s)o=_=0;else{var h=r-s;switch(_=l>.5?h/(2-r-s):h/(r+s),r){case t:o=(i-n)/h+(i1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}const l=s<.5?s*(1+r):s+r-s*r,h=2*s-l;t=_(h,l,a+1/3),i=_(h,l,a),n=_(h,l,a-1/3)}return Uint8ClampedArray.of(255*t|0,255*i|0,255*n|0,255*o|0)},invert_uint32:function(e){e=(0|e)>>>0;const[t,i,n,a]=this.to_rgba_from_uint32(e);return this.to_uint32_from_rgba(Uint8ClampedArray.of(255-t|0,255-i|0,255-n|0,0|a))},match_color:function(e,t,i){if(e&=4294967295,t&=4294967295,1===(i=void 0===i?null:i))return!0;if(0===i)return e===t;{const n=255*i|0,a=this.to_rgba_from_uint32(e),r=this.to_rgba_from_uint32(t),s=0|Math.abs(a[3]-r[3]),o=0|Math.abs(a[0]-r[0]),_=0|Math.abs(a[1]-r[1]),l=0|Math.abs(a[2]-r[2]);return null!==i?o>>0)l=4294967295&t[(0|e[(0|i)>>>0])>>>0],void 0===(n=s.get(l))&&(n=(0|s.size)>>>0,s.set(l,n)),_[i]=(0|n)>>>0;for(r of(a=new Uint32Array(s.size),s))a[r[1]]=4294967295&r[0];return Array.of(_,a)}}}};e.exports=a},936:function(e,t,i){"use strict";!function(t){function n(e){return e&&e.__esModule?e:{default:e}}var a=n(i(715)),r=n(i(716));const s={_get_64_js:()=>({xxh_f:{create64:function(e){return a.default.h64(e)}},xxh_v:"64",xxh_t:"js",xxh_tt:Date.now()}),_get_64_wasm:()=>new Promise((function(e,t){try{(0,r.default)().then((function(t){e({xxh_f:{hasher:t,create64:function(e){return this.hasher.create64(BigInt(e))}},xxh_v:"64",xxh_t:"wasm",xxh_tt:Date.now()})})).catch((function(e){t()}))}catch(i){t()}})),new(){const e=Uint8Array.from("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((function(e){return e.charCodeAt(0)}))),i=BigInt(e.length);let n=new Uint8Array(14),a=this._get_64_js,r=this._get_64_wasm,s=a();return r().then((function(e){s=e})),{get_info:function(){return{version:s.xxh_v,type:s.xxh_t,timestamp:s.xxh_tt}},base58_that:function(a){let r=0,o=BigInt(0),_=BigInt(s.xxh_f.create64(64222).update(a instanceof Uint8Array||a instanceof Uint8ClampedArray?a:new Uint8Array("string"==typeof a?t.from(a):"buffer"in a?a.buffer:a)).digest());for(;_>0;)o=_%i,_/=i,n[0|r]=65535&e[o],r=r+1&15;return""+String.fromCharCode.apply(null,n.slice(0,0|r))}}}};e.exports=s}(i(210).Buffer)}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{686:function(e,t,i){"use strict";const n=new Int32Array(15),a={_get_init_state:(e,t,i,n,a,r)=>({canvas_event_target:"CANVAS_WRAPPER_OVERFLOW",canvas_container:{top:0,left:0,height:0,width:0},sizes:{width:0|e,height:0|t},screen_zoom_ratio:1,canvas_wrapper:{padding:0|n,border_width:0|a},scale:{default:i,current:i,move_x:0,move_y:0,moves_speeds:[],move_speed_timestamp:0|Date.now(),moves_speed_average_now:16},device_pixel_ratio:window.devicePixelRatio,perspective:r}),_get_screen_zoom_ratio:e=>e.canvas_container.width>e.canvas_container.height?(e.canvas_container.height-e.canvas_wrapper.padding/e.device_pixel_ratio*2)/e.sizes.height:(e.canvas_container.width-e.canvas_wrapper.padding/e.device_pixel_ratio*2)/e.sizes.width,_get_pos:(e,t,i)=>(n[0]=2*Math.round(e.canvas_wrapper.padding/e.device_pixel_ratio*e.scale.current+e.canvas_wrapper.border_width)|0,n[1]=Math.round(e.sizes.width*t*e.scale.current)+n[0]|0,n[2]=Math.round(e.sizes.height*t*e.scale.current)+n[0]|0,n[3]=0|e.scale.move_x,n[4]=0|e.scale.move_y,n[5]=e.canvas_container.left+n[3]|0,n[6]=e.canvas_container.top+n[4]|0,n[7]=n[5]+n[1]|0,n[8]=n[6]+n[2]|0,n[9]=n[0]/2|0,n[10]=n[0]/2|0,n[11]=n[5]+n[9]|0,n[12]=n[6]+n[10]|0,n[13]=n[7]-n[0]/2|0,n[14]=n[8]-n[0]/2|0,void 0===i&&(i={}),void 0===i.canvas&&(i.canvas={}),i.canvas.offset_left=n[9],i.canvas.offset_top=n[10],i.canvas.left=n[11],i.canvas.top=n[12],i.canvas.right=n[13],i.canvas.bottom=n[14],i.canvas.width=n[13]-n[11]|0,i.canvas.height=n[14]-n[12]|0,void 0===i.canvas_wrapper&&(i.canvas_wrapper={}),i.canvas_wrapper.offset_left=n[3],i.canvas_wrapper.offset_top=n[4],i.canvas_wrapper.left=n[5],i.canvas_wrapper.top=n[6],i.canvas_wrapper.right=n[7],i.canvas_wrapper.bottom=n[8],i.canvas_wrapper.width=n[7]-n[5]|0,i.canvas_wrapper.height=n[8]-n[6]|0,void 0===i.canvas_container&&(i.canvas_container={}),i.canvas_container.offset_left=0|e.canvas_container.left,i.canvas_container.offset_top=0|e.canvas_container.top,i.canvas_container.left=0|e.canvas_container.left,i.canvas_container.top=0|e.canvas_container.top,i.canvas_container.right=e.canvas_container.left+e.canvas_container.width|0,i.canvas_container.bottom=e.canvas_container.top+e.canvas_container.height|0,i.canvas_container.width=0|e.canvas_container.width,i.canvas_container.height=0|e.canvas_container.height,i),_get_init_pointer_state:()=>({event_button:null,mouse_down:!1,pointer_events:new Map,previous_single_pointer_down_timestamp:0,previous_double_pointer_down_timestamp:0,latest_pointers_distance:0,latest_pointers_client_x_center:0,latest_pointers_client_y_center:0,previous_double_pointer_move_timestamp:0}),_copy_event:e=>({pointerId:0|e.pointerId,clientX:0|e.clientX,clientY:0|e.clientY,pageX:0|e.pageX,pageY:0|e.pageY,button:0|e.button}),_get_shadows(e){function t(t){const n=i.to_rgba_from_hex(i.format_hex_color(e));let a=i.to_hex_from_rgba(Uint8ClampedArray.of(n[0],n[1],n[2],parseInt(142.8))),r=i.to_hex_from_rgba(Uint8ClampedArray.of(n[0],n[1],n[2],parseInt(91.8))),s=i.to_hex_from_rgba(Uint8ClampedArray.of(n[0],n[1],n[2],parseInt(.24*255)));return Array.of(`${t[0]}px ${t[1]}px ${t[2]}px ${t[3]}px ${a}`,`${t[4]}px ${t[5]}px ${t[6]}px ${t[7]}px ${r}`,`${t[8]}px ${t[9]}px ${t[10]}px ${t[11]}px ${s}`).join(",")}const i={format_hex_color(e){const t=0|e.length;if(void 0===e)return"#00000000";{let i="",n="",a="",r="",s="#12345678";switch(t){case 9:s=e;break;case 7:s=e.concat("ff");break;case 5:i=e.charAt(1),n=e.charAt(2),a=e.charAt(3),r=e.charAt(4),s="#".concat(i,i,n,n,a,a,r,r);break;case 4:i=e.charAt(1),n=e.charAt(2),a=e.charAt(3),s="#".concat(i,i,n,n,a,a,"ff")}return s}},to_hex_from_rgba:e=>"#".concat("00000000".concat(new Uint32Array(e.reverse().buffer)[0].toString(16)).slice(-8)),to_rgba_from_hex:e=>new Uint8ClampedArray(Uint32Array.of(parseInt(e.slice(1),16)).buffer).reverse()};return Array.of("",t([0,2,1,-1,0,1,1,0,0,1,3,0]),t([0,3,1,-2,0,2,2,0,0,1,5,0]),t([0,3,3,-2,0,3,4,0,0,1,8,0]),t([0,2,4,-1,0,4,5,0,0,1,10,0]),t([0,3,5,-1,0,5,8,0,0,1,14,0]),t([0,3,5,-1,0,6,10,0,0,1,18,0]),t([0,4,5,-2,0,7,10,1,0,2,16,1]),t([0,5,5,-3,0,8,10,1,0,3,14,2]),t([0,5,6,-3,0,9,12,1,0,3,16,2]),t([0,6,6,-3,0,10,14,1,0,4,18,3]),t([0,6,7,-4,0,11,15,1,0,4,20,3]),t([0,7,8,-4,0,12,17,2,0,5,22,4]),t([0,7,8,-4,0,13,19,2,0,5,24,4]),t([0,7,9,-4,0,14,21,2,0,5,26,4]),t([0,8,9,-5,0,15,22,2,0,6,28,5]),t([0,8,10,-5,0,16,24,2,0,6,30,5]),t([0,8,11,-5,0,17,26,2,0,6,32,5]),t([0,9,11,-5,0,18,28,2,0,7,34,6]),t([0,9,12,-6,0,19,29,2,0,7,36,6]),t([0,10,13,-6,0,20,31,3,0,8,38,7]),t([0,10,13,-6,0,21,33,3,0,8,40,7]),t([0,10,14,-6,0,22,35,3,0,8,42,7]),t([0,11,14,-7,0,23,36,3,0,9,44,8]),t([0,11,15,-7,0,24,38,3,0,9,46,8]))},from(e,t,i,n,a,r){const s=this._get_screen_zoom_ratio,o=this._get_init_state,_=this._get_init_pointer_state,l=this._get_pos,h=this._get_shadows;this._copy_event;let c=!1,p=h("#020529"),d=_(),u=o(e,t,i,n,a,r),m=s(u),f=l(u,m),g={update(){},menu(){},move(){},up(){},down(){},middle(){},ripple(){}},A=null,y=null,x={box_shadow:"",will_change:!1};return{init_speed_interval:function(){null!==A?setTimeout(this.set_move_speed_average_now,5):A=setInterval(this.set_move_speed_average_now,20)},set_canvas_wrapper:function(e,t){u.canvas_wrapper={padding:e,border_width:t},m=s(u),f=l(u,m),this.set_current_scale_default()},set_canvas_container:function(e,t,i,n){u.canvas_container={top:e,left:t,height:i,width:n},m=s(u),f=l(u,m),this.set_current_scale_default()},set_sizes:function(e,t){u.sizes={width:e,height:t},u.scale.moves_speed_average_now=16,m=s(u),f=l(u,m)},set_perspective:function(e){u.perspective=e},get_pointer_state:function(){return d},get_perspective_state:function(){return y||{}},get_screen_zoom_ratio:function(){return Math.fround(parseFloat(m)).toFixed(2)},compute_perspective_from_pointer_event:function(e,t){if(e|=0,t|=0,!(u.perspective>0))return;const i=e-f.canvas_container.left|0,n=t-f.canvas_container.top|0,a=u.perspective*(i-f.canvas_container.width/2)/(f.canvas_container.width/2),r=-u.perspective*(n-f.canvas_container.height/2)/(f.canvas_container.height/2),s=a>u.perspective?a:2*a,o=r<0?r:2*r,_=255-s/2*255,l=o/2*255,h=(1.25*s/u.scale.current*1e3|0)/1e3,c=(1.25*o/u.scale.current*1e3|0)/1e3,p=!(!c&&!h),d=p?`rotateX(${c}deg) rotateY(${h}deg)`:"",m=p?`linear-gradient(to right, rgba(\n ${_.toFixed(3)},\n ${_.toFixed(3)},\n ${_.toFixed(3)}, \n ${(Math.abs(.1*s)/(2*u.perspective)).toFixed(2)}\n ), rgba(\n ${_.toFixed(3)},\n ${_.toFixed(3)},\n ${_.toFixed(3)}, \n ${(Math.abs(.6*s)/(2*u.perspective)).toFixed(2)}\n )), linear-gradient(to top, rgba(\n ${l.toFixed(3)},\n ${l.toFixed(3)},\n ${l.toFixed(3)}, \n ${(Math.abs(.75*o)/(2*u.perspective)).toFixed(2)}\n ), rgba(\n ${l.toFixed(3)},\n ${l.toFixed(3)},\n ${l.toFixed(3)}, \n ${(Math.abs(.25*o)/(2*u.perspective)).toFixed(2)}\n ))`:"",g=(1+(-h+c)/80).toFixed(2);y={transform_rotate:d,background_image:m,filter:p?`brightness(${g}) contrast(${g})`:""}},set_pointer_state:function(e){var t="",i=!1;for(t in"mouse_down"in e&&d.mouse_down!==e.mouse_down&&(i=!0),e)d[t]=e[t];i&&this.notify_cursor()},set_moves:function(e,t,i,n){i=i||null,n=n||function(){};let a=Date.now();const{scale:r,canvas_event_target:o}=u,_="CANVAS_WRAPPER_OVERFLOW"!==o?18:24;let{move_x:h,move_y:c,moves_speeds:p,move_speed_timestamp:d,current:g}=r;const A=a-d|0,y=h-e|0,x=c-t|0,w=0|Math.min(Math.round((0|Math.sqrt(y*y+x*x))/A*200),200);p.push(w),p.length>=_&&p.shift();let b=p.slice(-_).reduce(((e,t,i,n)=>e+t/n.length),0);b=Math.max(1,Math.round(Math.floor(b*_/200)));const v=!(null===i);u.scale.default=Math.fround(parseFloat(r.default)),u.scale.current=Math.fround(parseFloat(v?i:g)),u.scale.move_x=0|e,u.scale.move_y=0|t,u.scale.move_speed_timestamp=Date.now(),u.scale.moves_speeds=p,u.scale.moves_speed_average_now=null!==i&&i>g?_:null!==i&&i6||p<1/6)){let e,s,d=1-l/p,u=p/l;if(t&&i?(e=t-o.left|0,s=i-o.top|0):(e=o.width/2|0,s=o.height/2|0),0===n&&0===a)this.set_moves(c,h,p,r);else{let t=(c-e*d)*u+n|0,i=(h-s*d)*u+a|0;const l=(o.width-_.width)/2|0,m=(o.height-_.height)/2|0,f=3/4*_.width+l,g=3/4*_.height+m;i-=m,t-=l;let A=Math.min(Math.abs(t),f)*(t<0?-1:1)+l,y=Math.min(Math.abs(i),g)*(i<0?-1:1)+m;this.set_moves(A,y,p,r)}}},handle_wheel:function({deltaY:e,pageY:t,pageX:i,movementX:n=0,movementY:a=0}){const{canvas_container:r,canvas_wrapper:s}=this.get_pos(),{move_x:o,move_y:_,current:l}=u.scale;let h=Math.max(Math.min(.125,Math.abs(-.01*e)),.25);h=-.01*e>0?h:-h;let c=l+h*l*(.9/Math.pow(l<1?1/l:l,1.6));if(!(c>6||c<1/6)){let e,h,p=1-l/c,d=c/l;i&&t?(e=i-r.left|0,h=t-r.top|0):(e=r.width/2|0,h=r.height/2|0);let u=(o-e*p)*d+n|0,m=(_-h*p)*d+a|0;const f=(r.width-s.width)/2|0,g=(r.height-s.height)/2|0,A=3/4*s.width+f,y=3/4*s.height+g;m-=g,u-=f;let x=Math.min(Math.abs(u),A)*(u<0?-1:1)+f,w=Math.min(Math.abs(m),y)*(m<0?-1:1)+g;this.set_moves(x,w,c)}},handle_move:function(e,t,i,n){const{canvas_container:a,canvas_wrapper:r}=this.get_pos(),{move_x:s,move_y:o}=u.scale,_=(a.width-r.width)/2|0,l=(a.height-r.height)/2|0,h=3/4*r.width+_|0,c=3/4*r.height+l|0,p=s+(i-e|0)-l|0,d=o+(n-t|0)-_|0,m=p<0?-1:1,f=Math.min(Math.abs(p),h)*m+_|0,g=Math.min(Math.abs(d),c)*m+l|0;this.set_moves(f,g)},set_boolean_move_on_click:function(e){c=e},handle_pointer_down:function(e){e.preventDefault();const{canvas_event_target:t}=u;let{latest_pointers_distance:i,latest_pointers_client_x_center:n,latest_pointers_client_y_center:a,previous_single_pointer_down_timestamp:r,previous_double_pointer_down_timestamp:s,pointer_events:o}=this.get_pointer_state();const _=parseInt(r),l=parseInt(s);o.set(""+e.pointerId,e);const h=!(1!==o.size),c=!(2!==o.size);r=h?Date.now():_,s=c?Date.now():l,this.set_pointer_state({pointer_events:o,mouse_down:!0,event_button:parseInt(e.button),latest_pointers_distance:c?0:parseFloat(i),previous_single_pointer_down_timestamp:parseInt(r),previous_double_pointer_down_timestamp:parseInt(s),latest_pointers_client_x_center:parseInt(e.clientX),latest_pointers_client_y_center:parseInt(e.clientY)}),2===parseInt(e.button||0)||Math.abs(r-_)<200&&Math.abs(n-e.clientX)<20&&Math.abs(a-e.clientY)<20?this.notify_menu(e,180):h&&l+200>Date.now()||!h&&"mouse"!==e.pointerType||"CANVAS"!==t||this.notify_down(e),"CANVAS_WRAPPER_OVERFLOW"===t&&this.notify_ripple(e)},handle_pointer_up:function(e){e.preventDefault();const{canvas_event_target:t}=u;let{pointer_events:i}=this.get_pointer_state();i.delete(""+e.pointerId),this.set_pointer_state({pointer_events:i,mouse_down:!(0===i.size)}),this.notify_up(e),("CANVAS_WRAPPER_OVERFLOW"===t&&1===e.which||"CANVAS"!==t)&&this.notify_moved()},handle_pointer_move:function(e){e.preventDefault();const t=""+u.canvas_event_target;this.compute_canvas_event_target(parseInt(e.pageX),parseInt(e.pageY));const i=""+u.canvas_event_target;let{mouse_down:n,event_button:a,pointer_events:r,latest_pointers_distance:s,latest_pointers_client_x_center:o,latest_pointers_client_y_center:_,previous_double_pointer_move_timestamp:l,previous_single_pointer_down_timestamp:h}=this.get_pointer_state();if(r.set(""+e.pointerId,e),2===r.size){const e=Array.from(r.values()),t=e[0].clientX-e[1].clientX,i=e[0].clientY-e[1].clientY,n=Math.sqrt(t*t+i*i),a=parseInt(e[0].clientX+e[1].clientX)/2,l=parseInt(e[0].clientY+e[1].clientY)/2,c=parseInt(e[0].pageX+e[1].pageX)/2,p=parseInt(e[0].pageY+e[1].pageY)/2,d=a-o,m=l-_,f=u.scale.move_x+d,g=u.scale.move_y+m,A=s>0?parseFloat(n/s):1,y={pointer_events:r,latest_pointers_distance:parseFloat(n),latest_pointers_client_x_center:parseInt(a),latest_pointers_client_y_center:parseInt(l),previous_double_pointer_move_timestamp:Date.now()};if(h+306||n<1/6)){let a,r,s=1-i/n,o=n/i;a=c-e.left|0,r=p-e.top|0;let _=(f-a*s)*o+d|0,l=(g-r*s)*o+m|0;const h=(e.width-t.width)/2|0,u=(e.height-t.height)/2|0,A=3/4*t.width+h,y=3/4*t.height+u;l-=u,_-=h;let x=Math.min(Math.abs(_),A)*(_<0?-1:1)+h,w=Math.min(Math.abs(l),y)*(l<0?-1:1)+u;this.set_moves(x,w,n)}this.set_pointer_state(y)}else this.set_pointer_state(y)}else if(n&&1===r.size){const t={pointer_events:r,latest_pointers_client_x_center:parseInt(e.clientX),latest_pointers_client_y_center:parseInt(e.clientY),previous_double_pointer_move_timestamp:parseInt(l)};"CANVAS"!==i||"CANVAS"===i&&0===a&&c||1===a?l+200=i.left&&t>=i.top&&e<=i.right&&t<=i.bottom?a="CANVAS":e>=n.left&&t>=n.top&&e<=n.right&&t<=n.bottom&&(a="CANVAS_WRAPPER"),u.canvas_event_target!==a&&(r=!0,u.canvas_event_target=a),r&&this.notify_cursor()},set_move_speed_average_now:function(){if(!u)return;const e="CANVAS_WRAPPER_OVERFLOW"!==u.canvas_event_target?18:24,t=Date.now();if(t-u.scale.move_speed_timestamp>=20&&u.scale.moves_speed_average_now>-e){const i=Math.max(u.scale.moves_speed_average_now-1,-e);u.scale.moves_speed_average_now=i,u.scale.move_speed_timestamp=0|t,g.update(!0,!0)}else t-u.scale.move_speed_timestamp>=20&&u.scale.moves_speed_average_now<-e&&e<24?(u.scale.moves_speed_average_now=0|Math.max(u.scale.moves_speed_average_now+1,-e),u.scale.move_speed_timestamp=0|t,g.update(!0,!0)):u.perspective>0&&g.update(!0,!0)}}}};e.exports=a},687:function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t,i){return((e=((e|=0)-(e-(i=(0|i)>>>0)&i-e>>31)|0)>>>0)-(e-(t=(0|t)>>>0)&e-t>>31)|0)>>>0}function r(e){var t=o(e/255);return 255-S(e+e-Math.round(t*t*255|0)|0,0,255)}function s(e){return R(B(e,e))}var o,_,l,h,c,p,d,u,m,f,g,A,y=i(647),x=i(653),w=i(715),b=n(w),v=i(716),C=n(v);const{Color:E,Colors:U,simdops:I}=(0,y.SIMDopeCreate)({create:{new_uint32:!0,new_zero:!0},properties:{},methods:{get_use_element:!0,blend_first_with:!0,blend_with:!0}});var{abs_int:R,clamp_int:S,minus_int:B}=I;o=Math.fround,_=Object.create({_get_64_js:()=>({xxh_f:{hasher:b.default,create:function(e){return this.hasher.h64(e)}},xxh_v:"64",xxh_t:"js",xxh_tt:Date.now()}),_get_64_wasm:()=>new Promise((function(e,t){try{(0,C.default)().then((function(t){e({xxh_f:{hasher:t,create:function(e){return this.hasher.create64(BigInt(e))}},xxh_v:"64",xxh_t:"wasm",xxh_tt:Date.now()})})).catch((function(e){t()}))}catch(i){t()}})),new(){const e=Uint8Array.from("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((function(e){return e.charCodeAt(0)}))),t=BigInt(e.length);let i=new Uint8Array(14),n=this._get_64_js,a=this._get_64_wasm,r=n();return a().then((function(e){r=e})),{get_info:function(){return{version:r.xxh_v,type:r.xxh_t,timestamp:r.xxh_tt}},base58_that:function(n){let a=0,s=BigInt(0),o=r.xxh_f.create(62675);n instanceof Uint8Array||n instanceof Uint8ClampedArray?o.update(n):n.forEach((function(e){o.update(e)}));let _=BigInt(o.digest());for(;_>0;)s=Number(_%t),_=BigInt(_/t),i[0|a]=65535&e[s],a=a+1&15;return String.fromCharCode.apply(null,i.slice(0,0|a))}}}}).new(),(l=function(e,t,i,n,a){return this instanceof l?(t=(0|parseInt(t||0))>>>0,i=(0|parseInt(i||0))>>>0,this.with_plain_data_=void 0!==n&&!!n&&!0,2===e.length?(this.width_=0|t,this.height_=0|i,this.bitmap_=void 0===a?{height:this.height_,width:this.width_,destroy:function(){},hash:""}:a,this.force_update_data(e[0],e[1])):(e.data8 instanceof Uint8ClampedArray?(this.width_=0|e.width,this.height_=0|e.height,this.populate_data(new Uint32Array(e.data8.buffer))):e instanceof Uint8Array||e instanceof Uint8ClampedArray?(this.width_=0|t,this.height_=0|i,this.populate_data(new Uint32Array(e.buffer))):(this.width_=0|t,this.height_=0|i,this.populate_data(Uint32Array.from(e))),this.bitmap_=void 0===a?{height:this.height_,width:this.width_,destroy:function(){},hash:""}:a,this.populate_colors(this.uint32_pixel_color_),this.populate_indexes(),this.changes_.charge()),this):new l(e,t,i,n)}).new_from_colors_and_indexes=function(e,t,i,n,a,r){return new l(Array.of(e,t),parseInt(i),parseInt(n),!!a,r)},Object.defineProperty(l.prototype,"force_update_data",{get:function(){return function(e,t){var i=void 0!==e,n=void 0!==t;i&&n?(this.populate_colors(e),this.populate_indexes(t),this.populate_data()):n?(this.populate_indexes(t),this.compute_data()):i&&(this.populate_colors(e),this.compute_data())}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"populate_data",{get:function(){return function(e){if(void 0===e){this.uint32_pixel_color_=new Uint32Array(this.width_*this.height_),this.changes_=new x.SetFixed(this.uint32_pixel_color_.length),this.uint8c_pixel_color_=new Uint8ClampedArray(this.uint32_pixel_color_.buffer),this.simdope_pixel_color_=new U(this.uint32_pixel_color_.buffer);for(var t=0,i=0|this.uint32_pixel_color_.length;(0|t)<(0|i);t=(t+1|0)>>>0)this.uint32_pixel_color_[t]=(0|this.colors[this.indexes[t]])>>>0;this.changes_.charge()}else this.uint32_pixel_color_=e instanceof Uint32Array?e:Uint32Array.from(e),this.changes_=new x.SetFixed(this.uint32_pixel_color_.length),this.uint8c_pixel_color_=new Uint8ClampedArray(this.uint32_pixel_color_.buffer),this.simdope_pixel_color_=new U(this.uint32_pixel_color_.buffer),this.changes_.charge()}}}),Object.defineProperty(l.prototype,"compute_data",{get:function(){return function(){var e,t;for(e=0,t=0|this.uint32_pixel_color_.length;(0|e)<(0|t);e=(e+1|0)>>>0)(0|(0|this.uint32_pixel_color_[(0|e)>>>0])>>>0)>>>0!=(0|(0|this.colors[this.indexes[(0|e)>>>0]])>>>0)>>>0&&(this.uint32_pixel_color_[(0|e)>>>0]=(0|this.colors[this.indexes[(0|e)>>>0]])>>>0,this.changes_.add((0|e)>>>0))}}}),Object.defineProperty(l.prototype,"populate_colors",{get:function(){return function(e){this.uint32_colors_=e instanceof Uint32Array?e.slice(0,0|e.length):Uint32Array.from(e),this.uint32_colors_length_=this.uint32_colors_.length,this.uint32_colors_map_={};for(var t=0;(0|t)<(0|this.uint32_colors_length_);t=(t+1|0)>>>0)this.uint32_colors_map_[this.uint32_colors_[t]]=t}}}),Object.defineProperty(l.prototype,"populate_indexes",{get:function(){return function(e){if(void 0!==e)this.color_indexes_length_=e.length,this.color_indexes_constructor_=this.uint32_colors_length_<256?Uint8Array:(this.uint32_colors_length_+1|0)<65536?Uint16Array:Uint32Array,this.color_indexes_=e instanceof this.color_indexes_constructor_?e:this.color_indexes_constructor_.from(e);else{this.color_indexes_length_=this.uint32_pixel_color_.length,this.color_indexes_constructor_=this.uint32_colors_length_<256?Uint8Array:(this.uint32_colors_length_+1|0)<65536?Uint16Array:Uint32Array,this.color_indexes_=new this.color_indexes_constructor_(this.color_indexes_length_);for(var t=0,i=0|this.color_indexes_length_;(0|t)<(0|i);t=(t+1|0)>>>0)this.color_indexes_[0|t]=(0|this.get_color_index(this.uint32_pixel_color_[0|t]))>>>0}}}}),Object.defineProperty(l.prototype,"get_color_index",{get:function(){return function(e){return this.uint32_colors_map_[(0|e)>>>0]}}}),Object.defineProperty(l.prototype,"has_color",{get:function(){return function(e){return void 0!==this.uint32_colors_map_[(0|e)>>>0]}}}),Object.defineProperty(l.prototype,"data8",{get:function(){return this.uint8c_pixel_color_}}),Object.defineProperty(l.prototype,"image_data",{get:function(){return new ImageData(this.data8,0|this.width_,0|this.height_)}}),Object.defineProperty(l.prototype,"width",{get:function(){return 0|this.width_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"height",{get:function(){return 0|this.height_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"set_bitmap",{get:function(){return function(e){return this.bitmap_.hash!==e.hash&&(this.bitmap_.destroy(),this.bitmap_=e),this.bitmap_}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"get_bitmap",{get:function(){return function(){return this.bitmap_}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"bitmap_async",{get:function(){return function(e){var t,i,n,a,r,s;return e=void 0!==e&&!!e&&!0,t=this.hash_hex_async.bind(this),i=this.get_bitmap.bind(this),n=this.set_bitmap.bind(this),a=this.image_data,r=function(e,i){Promise.all([createImageBitmap(a),t()]).then((function(t){var i=t[0];i.hash=""+t[1],e(n(i))})).catch(i)},e?(s=i(),t().then((function(e){return""!==s.hash&&""+e==""+s.hash?Promise.resolve(s):new Promise(r)}))):new Promise(r)}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"hash_hex_async",{get:function(){return function(e){var t=_.base58_that(e||this.data8);return Promise.resolve(t)}}}),Object.defineProperty(l.prototype,"data",{get:function(){return this.uint32_pixel_color_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"get_index",{get:function(){return function(e){return e=(0|e)>>>0,this.color_indexes_[0|e]}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"indexes",{get:function(){return this.color_indexes_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"indexes_copy",{get:function(){return this.indexes.slice(0,0|this.indexes.length)},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"set_indexes",{get:function(){return function(e){this.force_update_data(void 0,e)}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"get_color",{get:function(){return function(e){return e=(0|e)>>>0,this.uint32_colors_[0|e]}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"colors",{get:function(){return this.uint32_colors_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"colors_copy",{get:function(){var e=0|this.uint32_colors_length_;return this.uint32_colors_.slice(0,0|e)},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"set_colors",{get:function(){return function(e){this.force_update_data(e,void 0)}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"set_colors_and_indexes",{get:function(){return function(e,t){this.force_update_data(e,t)}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"changes",{get:function(){return this.changes_.indexes},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"changes_has",{get:function(){return function(e){return this.changes_.has((0|e)>>>0)}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"setFixed",{get:function(){return this.changes_},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"clear_changes",{get:function(){return function(){this.changes_.clear()}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"charge_changes",{get:function(){return function(){this.changes_.charge()}}}),Object.defineProperty(l.prototype,"get_uint32",{get:function(){return function(e){return e=(0|e)>>>0,this.uint32_pixel_color_[e]}}}),Object.defineProperty(l.prototype,"set_uint32",{get:function(){return function(e,t){if(e=(0|e)>>>0,t=void 0===t?this.uint32_pixel_color_[e]:(0|t)>>>0,this.changes_.add(e),this.uint32_pixel_color_[e]=t,this.has_color(t))return this.color_indexes_[e]=this.get_color_index(t),!1;switch(this.uint32_colors_length_+1|0){case 255:this.color_indexes_=Uint16Array.from(this.color_indexes_);break;case 65535:this.color_indexes_=Uint32Array.from(this.color_indexes_)}var i=new Uint32Array(this.uint32_colors_length_+1|0);return i.set(this.uint32_colors_,0),i[(0|this.uint32_colors_length_)>>>0]=t,this.populate_colors(i),this.color_indexes_[e]=this.get_color_index(t),!0}},enumerable:!1,configurable:!1}),Object.defineProperty(l.prototype,"paint_uint32a",{get:function(){return function(e,t,i){t=(0|t)>>>0,i=Math.round(255*parseFloat(i));let n=0|e.length;if(n>0){let a=E.new_uint32(t),r=new E(new ArrayBuffer(4)),s=0;for(;(0|s)<(0|n);s=(s+1|0)>>>0)this.simdope_pixel_color_.get_use_element(e[s],r).blend_first_with(a,i,!1,!1),this.set_uint32(e[s])}}},enumerable:!1,configurable:!1}),h=function(e,t,i,n){var a;if(!(this instanceof h))return new h(e,t,i,n);for(i=(0|i)>>>0,n=(0|n)>>>0,this.layers_=Array(e.length),this.metadata_=Array(t.length),a=0;a>>0)a[0|s]=a[s+1|0]=a[s+2|0]=((i[0|s]+i[s+1|0]+i[s+2|0]|0)/3|0)>>>0,a[s+3|0]=i[s+3|0];for(o=new U(e),_=new U(r),l=new E(new ArrayBuffer(4)),h=new E(new ArrayBuffer(4)),c=0|r.length,p=0;(0|p)<(0|c);p=(p+1|0)>>>0)o.get_use_element(0|p,l).blend_with(_.get_use_element(0|p,h),t,!1,!1);return e}},enumerable:!1,configurable:!1}),u=Float32Array.of(.393,.769,.189,.349,.686,.168,.272,.534,.131),Object.defineProperty((m=function(){if(!(this instanceof m))return new m}).prototype,"filter_colors",{get:function(){return function(e,t){var i,n,a,s,o,_,l,h,c,p,d;for(t=0|Math.round(parseFloat(t)/4*255),n=0|(i=new Uint8Array(e.buffer)).length,a=new Uint8Array(0|n),s=new Uint32Array(a.buffer),o=0;(0|o)<(0|n);o=(o+4|0)>>>0)a[0|o]=r(a[0|o]),a[o+1|0]=r(a[o+1|0]),a[o+2|0]=r(a[o+2|0]),a[o+3|0]=i[o+3|0];for(_=new U(e),l=new U(s),h=new E(new ArrayBuffer(4)),c=new E(new ArrayBuffer(4)),p=0|s.length,d=0;(0|d)<(0|p);d=(d+1|0)>>>0)_.get_use_element(0|d,h).blend_with(l.get_use_element(0|d,c),t,!1,!1);return e}},enumerable:!1,configurable:!1}),Object.defineProperty((f=function(){if(!(this instanceof f))return new f}).prototype,"filter_colors",{get:function(){return function(e,t){var i,n,a,r,o,_,l,h,c,p,d;for(t=0|Math.round(parseFloat(t)/2*255),n=0|(i=new Uint8Array(e.buffer)).length,a=new Uint8Array(0|n),r=new Uint32Array(a.buffer),o=0;(0|o)<(0|n);o=(o+4|0)>>>0)a[0|o]=s(a[0|o]),a[o+1|0]=s(a[o+1|0]),a[o+2|0]=s(a[o+2|0]),a[o+3|0]=i[o+3|0];for(_=new U(e),l=new U(r),h=new E(new ArrayBuffer(4)),c=new E(new ArrayBuffer(4)),p=0|r.length,d=0;(0|d)<(0|p);d=(d+1|0)>>>0)_.get_use_element(0|d,h).blend_with(l.get_use_element(0|d,c),t,!1,!1);return e}},enumerable:!1,configurable:!1}),Object.defineProperty((g=function(){if(!(this instanceof g))return new g}).prototype,"filter_colors",{get:function(){return function(e,t){var i,n,r,s,o,_,l,h,c,p,d;for(t=0|Math.round(255*parseFloat(t)),n=0|(i=new Uint8Array(e.buffer)).length,r=new Uint8Array(0|n),s=new Uint32Array(r.buffer),o=0;(0|o)<(0|n);o=(o+4|0)>>>0)r[o+3|0]=i[o+3|0],r[0|o]=255&a(i[0|o]*u[0]+i[o+1|0]*u[1]+i[o+2|0]*u[2]|0,0,255),r[o+1|0]=255&a(i[0|o]*u[3]+i[o+1|0]*u[4]+i[o+2|0]*u[5]|0,0,255),r[o+2|0]=255&a(i[0|o]*u[6]+i[o+1|0]*u[7]+i[o+2|0]*u[8]|0,0,255);for(_=new U(e),l=new U(s),h=new E(new ArrayBuffer(4)),c=new E(new ArrayBuffer(4)),p=0|s.length,d=0;(0|d)<(0|p);d=(d+1|0)>>>0)_.get_use_element(0|d,h).blend_with(l.get_use_element(0|d,c),t,!1,!1);return e}},enumerable:!1,configurable:!1}),Object.defineProperty(p.prototype,"filter_colors",{get:function(){return function(e,t){var i,n,a,r,s,o,_,l,h,c,p;for(t=0|Math.round(255*parseFloat(t)),n=0|(i=new Uint8Array(e.buffer)).length,a=new Uint8Array(0|n),r=new Uint32Array(a.buffer),s=0;(0|s)<(0|n);s=(s+4|0)>>>0)a[s+3|0]=i[s+3|0],a[0|s]=this.ar_[i[0|s]],a[s+1|0]=this.ag_[i[s+1|0]],a[s+2|0]=this.ab_[i[s+2|0]];for(o=new U(e),_=new U(r),l=new E(new ArrayBuffer(4)),h=new E(new ArrayBuffer(4)),c=0|r.length,p=0;(0|p)<(0|c);p=(p+1|0)>>>0)o.get_use_element(0|p,l).blend_with(_.get_use_element(0|p,h),t,!1,!1);return e}},enumerable:!1,configurable:!1}),A=function(e){if(!(this instanceof A))return new A(e);e=e||c,this.names_=Object.keys(e),this.filters_=Object.values(e).map((function(e){return p(e)})),this.special_names_=Array.of("Greyscale","Sepia","Screen","Difference"),this.filter_sepia_=new g,this.filter_greyscale_=new d,this.filter_screen_=new m,this.filter_difference_=new f},Object.defineProperty(A.prototype,"names",{get:function(){return this.names_.concat(this.special_names_)},enumerable:!1,configurable:!1}),Object.defineProperty(A.prototype,"use",{get:function(){return function(e,t,i,n){n=void 0!==n&&!!n;var a=this.names_.indexOf(e);if(void 0!==t){if(!(a<0))return n?l.new_from_colors_and_indexes(this.filters_[a].filter_colors(t.colors_copy,i),t.indexes,t.width,t.height):(t.set_colors(this.filters_[a].filter_colors(t.colors_copy,i)),t);if(n)switch(e){case"Sepia":return l.new_from_colors_and_indexes(this.filter_sepia_.filter_colors(t.colors_copy,i),t.indexes,t.width,t.height);case"Screen":return l.new_from_colors_and_indexes(this.filter_screen_.filter_colors(t.colors_copy,i),t.indexes,t.width,t.height);case"Difference":return l.new_from_colors_and_indexes(this.filter_difference_.filter_colors(t.colors_copy,i),t.indexes,t.width,t.height);default:return l.new_from_colors_and_indexes(this.filter_greyscale_.filter_colors(t.colors_copy,i),t.indexes,t.width,t.height)}else switch(e){case"Sepia":return t.set_colors(this.filter_sepia_.filter_colors(t.colors_copy,i)),t;case"Screen":return t.set_colors(this.filter_screen_.filter_colors(t.colors_copy,i)),t;case"Difference":return t.set_colors(this.filter_difference_.filter_colors(t.colors_copy,i)),t;default:return t.set_colors(this.filter_greyscale_.filter_colors(t.colors_copy,i)),t}}}},enumerable:!1,configurable:!1}),e.exports={Layer:l,Layers:h,Filters:A}},715:function(e,t,i){"use strict";!function(t){function n(e){var t,i,n,a=[];for(t=0,i=e.length;(0|t)<(0|i);t=(t+1|0)>>>0)(n=e.charCodeAt(t))<128?a.push(n):n<2048?a.push(192|n>>6,128|63&n):n<55296||n>=57344?a.push(224|n>>12,128|n>>6&63,128|63&n):(t++,n=65536+((1023&n)<<10|1023&e.charCodeAt(t)),a.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n));return new Uint8Array(a)}function a(){return 2==arguments.length?new a(arguments[1]).update(arguments[0]).digest():this instanceof a?void this.init.call(this,arguments[0]):new a(arguments[0])}function r(){return 2==arguments.length?new r(arguments[1]).update(arguments[0]).digest():this instanceof r?void this.init.call(this,arguments[0]):new r(arguments[0])}var s,o,_,l,h,c,p,d,u,m,f=i(923);f.UINT32.prototype.xxh_update=function(e,t){var i,n,a,r=o._low,_=o._high,l=e*r,h=l>>>16;h+=t*r,h&=65535,h+=e*_,n=(i=this._low+(65535&l))>>>16,n=(a=(a=(n+=this._high+(65535&h))<<16|65535&i)<<13|a>>>19)>>>16,h=(l=(i=65535&a)*(r=s._low))>>>16,h+=n*r,h&=65535,h+=i*(_=s._high),this._low=65535&l,this._high=65535&h},s=(0,f.UINT32)("2654435761"),o=(0,f.UINT32)("2246822519"),_=(0,f.UINT32)("3266489917"),l=(0,f.UINT32)("668265263"),h=(0,f.UINT32)("374761393"),a.prototype.init=function(e){return this.seed=e instanceof f.UINT32?e.clone():(0,f.UINT32)(e),this.v1=this.seed.clone().add(s).add(o),this.v2=this.seed.clone().add(o),this.v3=this.seed.clone(),this.v4=this.seed.clone().subtract(s),this.total_len=0,this.memsize=0,this.memory=null,this},a.prototype.update=function(e){var i,a,r,s,o,_=!1;if("buffer"in e&&(e=e.buffer,e=new Uint8Array(e),_=!0),"string"==typeof e&&(e=n(e),_=!0),"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer&&(_=!0,e=new Uint8Array(e)),r=(i=0)+(a=e.length)|0,0==a)return this;if(this.total_len=this.total_len+a|0,0==this.memsize&&(this.memory=_?new Uint8Array(16):new t(16)),(this.memsize+a|0)<16)return _?this.memory.set(e.subarray(0,a),this.memsize):e.copy(this.memory,this.memsize,0,a),this.memsize=this.memsize+a|0,this;if((0|this.memsize)>0&&(_?this.memory.set(e.subarray(0,16-this.memsize|0),this.memsize):e.copy(this.memory,this.memsize,0,16-this.memsize),s=0,this.v1.xxh_update(this.memory[s+1|0]<<8|this.memory[0|s],this.memory[s+3|0]<<8|this.memory[s+2|0]),s=(s+4|0)>>>0,this.v2.xxh_update(this.memory[s+1|0]<<8|this.memory[0|s],this.memory[s+3|0]<<8|this.memory[s+2|0]),s=(s+4|0)>>>0,this.v3.xxh_update(this.memory[s+1|0]<<8|this.memory[0|s],this.memory[s+3|0]<<8|this.memory[s+2|0]),s=(s+4|0)>>>0,this.v4.xxh_update(this.memory[s+1|0]<<8|this.memory[0|s],this.memory[s+3|0]<<8|this.memory[s+2]),i=i+16-this.memsize|0,this.memsize=0),(0|i)<=(r-16|0)){o=r-16|0;do{this.v1.xxh_update(e[i+1|0]<<8|e[0|i],e[i+3|0]<<8|e[i+2|0]),i=(i+4|0)>>>0,this.v2.xxh_update(e[i+1|0]<<8|e[0|i],e[i+3|0]<<8|e[i+2|0]),i=(i+4|0)>>>0,this.v3.xxh_update(e[i+1|0]<<8|e[0|i],e[i+3|0]<<8|e[i+2|0]),i=(i+4|0)>>>0,this.v4.xxh_update(e[i+1|0]<<8|e[0|i],e[i+3|0]<<8|e[i+2|0]),i=(i+4|0)>>>0}while((0|i)<=(0|o))}return(0|i)<(0|r)&&(_?this.memory.set(e.subarray(i,r),this.memsize):e.copy(this.memory,this.memsize,i,r),this.memsize=r-i|0),this},a.prototype.digest=function(){var e,t,i=this.memory,n=0,a=this.memsize,r=new f.UINT32;for((e=(0|this.total_len)>=16?this.v1.rotl(1).add(this.v2.rotl(7).add(this.v3.rotl(12).add(this.v4.rotl(18)))):this.seed.clone().add(h)).add(r.fromNumber(this.total_len));(0|n)<=(a-4|0);)r.fromBits(i[n+1]<<8|i[n],i[n+3]<<8|i[n+2]),e.add(r.multiply(_)).rotl(17).multiply(l),n=(n+4|0)>>>0;for(;(0|n)<(0|a);)r.fromBits(i[n++],0),e.add(r.multiply(h)).rotl(11).multiply(s);return t=e.clone().shiftRight(15),e.xor(t).multiply(o),t=e.clone().shiftRight(13),e.xor(t).multiply(_),t=e.clone().shiftRight(16),e.xor(t),this.init(this.seed),e},c=(0,f.UINT64)("11400714785074694791"),p=(0,f.UINT64)("14029467366897019727"),d=(0,f.UINT64)("1609587929392839161"),u=(0,f.UINT64)("9650029242287828579"),m=(0,f.UINT64)("2870177450012600261"),r.prototype.init=function(e){return this.seed=e instanceof f.UINT64?e.clone():(0,f.UINT64)(e),this.v1=this.seed.clone().add(c).add(p),this.v2=this.seed.clone().add(p),this.v3=this.seed.clone(),this.v4=this.seed.clone().subtract(c),this.total_len=0,this.memsize=0,this.memory=null,this},r.prototype.update=function(e){var i,a,r,s,o,_,l;if("buffer"in e&&(e=e.buffer,i=!0),"string"==typeof e&&(e=n(e),i=!0),"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer&&(i=!0,e=new Uint8Array(e)),s=(a=0)+(r=0|e.length)|0,0==r)return this;if(this.total_len+=r,0==this.memsize&&(this.memory=i?new Uint8Array(32):new t(32)),this.memsize+r<32)return i?this.memory.set(e.subarray(0,r),this.memsize):e.copy(this.memory,this.memsize,0,r),this.memsize+=r,this;if(this.memsize>0&&(i?this.memory.set(e.subarray(0,32-this.memsize),this.memsize):e.copy(this.memory,this.memsize,0,32-this.memsize),o=0,_=(0,f.UINT64)(this.memory[o+1|0]<<8|this.memory[0|o],this.memory[o+3|0]<<8|this.memory[o+2|0],this.memory[o+5|0]<<8|this.memory[o+4|0],this.memory[o+7|0]<<8|this.memory[o+6|0]),this.v1.add(_.multiply(p)).rotl(31).multiply(c),o=(o+8|0)>>>0,_=(0,f.UINT64)(this.memory[o+1|0]<<8|this.memory[0|o],this.memory[o+3|0]<<8|this.memory[o+2|0],this.memory[o+5|0]<<8|this.memory[o+4|0],this.memory[o+7|0]<<8|this.memory[o+6|0]),this.v2.add(_.multiply(p)).rotl(31).multiply(c),o=(o+8|0)>>>0,_=(0,f.UINT64)(this.memory[o+1|0]<<8|this.memory[0|o],this.memory[o+3|0]<<8|this.memory[o+2|0],this.memory[o+5|0]<<8|this.memory[o+4|0],this.memory[o+7|0]<<8|this.memory[o+6|0]),this.v3.add(_.multiply(p)).rotl(31).multiply(c),o=(o+8|0)>>>0,_=(0,f.UINT64)(this.memory[o+1|0]<<8|this.memory[0|o],this.memory[o+3|0]<<8|this.memory[o+2|0],this.memory[o+5|0]<<8|this.memory[o+4|0],this.memory[o+7|0]<<8|this.memory[o+6|0]),this.v4.add(_.multiply(p)).rotl(31).multiply(c),a=a+32-this.memsize|0,this.memsize=0),(0|a)<=(s-32|0)){l=s-32|0;do{_=(0,f.UINT64)(e[a+1|0]<<8|e[0|a],e[a+3|0]<<8|e[a+2|0],e[a+5|0]<<8|e[a+4|0],e[a+7|0]<<8|e[a+6|0]),this.v1.add(_.multiply(p)).rotl(31).multiply(c),a=(a+8|0)>>>0,_=(0,f.UINT64)(e[a+1|0]<<8|e[0|a],e[a+3|0]<<8|e[a+2|0],e[a+5|0]<<8|e[a+4|0],e[a+7|0]<<8|e[a+6|0]),this.v2.add(_.multiply(p)).rotl(31).multiply(c),a=(a+8|0)>>>0,_=(0,f.UINT64)(e[a+1|0]<<8|e[0|a],e[a+3|0]<<8|e[a+2|0],e[a+5|0]<<8|e[a+4|0],e[a+7|0]<<8|e[a+6|0]),this.v3.add(_.multiply(p)).rotl(31).multiply(c),a=(a+8|0)>>>0,_=(0,f.UINT64)(e[a+1|0]<<8|e[0|a],e[a+3|0]<<8|e[a+2|0],e[a+5|0]<<8|e[a+4|0],e[a+7|0]<<8|e[a+6|0]),this.v4.add(_.multiply(p)).rotl(31).multiply(c),a=(a+8|0)>>>0}while(a<=l)}return a=32?((e=this.v1.clone().rotl(1)).add(this.v2.clone().rotl(7)),e.add(this.v3.clone().rotl(12)),e.add(this.v4.clone().rotl(18)),e.xor(this.v1.multiply(p).rotl(31).multiply(c)),e.multiply(c).add(u),e.xor(this.v2.multiply(p).rotl(31).multiply(c)),e.multiply(c).add(u),e.xor(this.v3.multiply(p).rotl(31).multiply(c)),e.multiply(c).add(u),e.xor(this.v4.multiply(p).rotl(31).multiply(c)),e.multiply(c).add(u)):e=this.seed.clone().add(m),e.add(r.fromNumber(this.total_len));(0|n)<=(a-8|0);)r.fromBits(i[n+1|0]<<8|i[0|n],i[n+3|0]<<8|i[n+2|0],i[n+5|0]<<8|i[n+4|0],i[n+7|0]<<8|i[n+6|0]),r.multiply(p).rotl(31).multiply(c),e.xor(r).rotl(27).multiply(c).add(u),n=(n+8|0)>>>0;for((n+4|0)<=(0|a)&&(r.fromBits(i[n+1|0]<<8|i[0|n],i[n+3|0]<<8|i[n+2|0],0,0),e.xor(r.multiply(c)).rotl(23).multiply(p).add(d),n=(n+4|0)>>>0);(0|n)<(0|a);)r.fromBits(i[n++],0,0,0),e.xor(r.multiply(m)).rotl(11).multiply(c);return t=e.clone().shiftRight(33),e.xor(t).multiply(p),t=e.clone().shiftRight(29),e.xor(t).multiply(d),t=e.clone().shiftRight(32),e.xor(t),this.init(this.seed),e},e.exports={h32:a,h64:r}}(i(210).Buffer)},717:function(e,t,i){"use strict";function n(e,t,i){e|=0,t|=0;var n=new Uint8Array(e);void 0!==i?(n.fill(255),n.set(i,0)):n.fill(255);let a={number_length_index_byte:Uint32Array.of(e,t,0,0),hover_data_in_layer:new Uint8Array(t),indexes_data_for_layers:new Uint32Array(t),colors_data_in_layers_uint32:new Uint32Array(t*e),layers_opacity_255:n};return a.colors_data_in_layers_uint32_SIMDope=new h(a.colors_data_in_layers_uint32.buffer),a}function a(e,t,i,a){if(t|=0,i|=0,void 0===e)return n(t,i,a);if(null===e)return n(t,i,a);{let r=c(t,e.layer_number);return p(r,0)||b(e.max_length,i)?n(t,i,a):(e.number_length_index_byte[0]=0|t,e.number_length_index_byte[1]=0|i,e.number_length_index_byte[2]=0,e.number_length_index_byte[3]=0,void 0!==a?(e.layers_opacity_255.fill(255),e.layers_opacity_255.set(a)):e.layers_opacity_255.fill(255),e)}}var r,s=i(647),o=(0,s.SIMDopeCreateConfAdd)({create:{new_of:!0},properties:{buffer:!0},methods:{get_use_element:!0,set_tail:!0,set_from_simdope:!0,set_from_buffer:!0,get_tail:!0,get_tail_opacity:!0,reset_tail:!0,is_dark:!0,blend_first_with:!0,blend_first_with_tails:!0}});const{simdops:_,Color:l,Colors:h}=(0,s.SIMDopeCreate)(o),{minus_int:c,int_not_equal:p,plus_int:d,plus_uint:u,minus_uint:m,multiply_int:f,multiply_uint:g,divide_uint:A,clamp_uint8:y,clamp_uint32:x,int_equal:w,uint_less:b,int_less:v,int_greater_equal:C,uint_not_equal:E,uint_less_equal:U,min_uint:I}=_;Object.defineProperty((r=function(e){return e=e||{},this instanceof r?(this.state_=n(e.layer_number||1,e.max_length||1,e.layers_opacity_255||new Uint8Array(0)),this.number_length_index_byte_=this.state_.number_length_index_byte,this.hover_data_in_layer_=this.state_.hover_data_in_layer,this.indexes_data_for_layers_=this.state_.indexes_data_for_layers,this.colors_data_in_layers_uint32_=this.state_.colors_data_in_layers_uint32,this.shadow_state_=((t=t||{base_rgba_colors_for_blending:new Uint32Array(0),color_less_uint8x4:l.new_of(255,255,255,255),color_full_uint8x4:l.new_of(0,0,0,255),layers_color:[],all_layers_length:0,used_colors_length:0}).base_rgba_colors_for_blending_SIMDope=new h(t.base_rgba_colors_for_blending.buffer),t),this.data_array_=[],this.destination_rgba_colors_for_blending_,this.destination_rgba_colors_for_blending_SIMDope_,this):new r(e);var t}).prototype,"state",{get:function(){return this.state_},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"set_state",{get:function(){return function(e){return this.state_=e,this.number_length_index_byte_=this.state_.number_length_index_byte,this.hover_data_in_layer_=this.state_.hover_data_in_layer,this.indexes_data_for_layers_=this.state_.indexes_data_for_layers,this.colors_data_in_layers_uint32_=this.state_.colors_data_in_layers_uint32,this.state_}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"set_shadow_state",{get:function(){return function(e){return this.shadow_state_=e}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"get_updated_shadow_state",{get:function(){return function(){return this.shadow_state_.layers_color.length=this.number_length_index_byte_[2]?this.shadow_state_.base_rgba_colors_for_blending.fill(0,0,this.shadow_state_.used_colors_length):(this.shadow_state_.base_rgba_colors_for_blending=new Uint32Array(0|this.number_length_index_byte_[2]),this.shadow_state_.base_rgba_colors_for_blending_SIMDope=new h(this.shadow_state_.base_rgba_colors_for_blending.buffer))),this.shadow_state_.all_layers_length=0|this.number_length_index_byte_[0],this.shadow_state_.max_used_colors_length=0|this.number_length_index_byte_[1],this.shadow_state_.used_colors_length=0|this.number_length_index_byte_[2],this.shadow_state_}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"shadow_state",{get:function(){return this.shadow_state_},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"set_bytes_index",{get:function(){return function(e){return this.number_length_index_byte_[3]=0|e}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"data_array",{get:function(){return this.data_array_},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"set_data_array",{get:function(){return function(e,t){this.data_array_=e,t&&(this.destination_rgba_colors_for_blending_=t,this.destination_rgba_colors_for_blending_SIMDope_=new h(this.destination_rgba_colors_for_blending_.buffer))}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"bytes_index",{get:function(){return function(){return 0|this.number_length_index_byte_[3]}},enumerable:!1,configurable:!1}),r.init=function(e,t,i){return new r({layer_number:e,max_length:t,layers_opacity_255:i})},Object.defineProperty(r.prototype,"for",{get:function(){return function(e,t){this.indexes_data_for_layers_[this.number_length_index_byte_[2]]=x(e),this.hover_data_in_layer_[this.number_length_index_byte_[2]]=y(t),this.number_length_index_byte_[2]=u(this.number_length_index_byte_[2],1)}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"next",{get:function(){return function(){this.number_length_index_byte_[3]=u(this.number_length_index_byte_[3],1)}},enumerable:!1,configurable:!1}),Object.defineProperty(r.prototype,"stack",{get:function(){return function(e,t){this.colors_data_in_layers_uint32_[u(g(this.number_length_index_byte_[0],this.number_length_index_byte_[3]),y(e))]=x(t)}},enumerable:!1,configurable:!1}),r.prototype.blend=function(e,t){var i,n,a,r,s;t|=0;var{base_rgba_colors_for_blending:o,base_rgba_colors_for_blending_SIMDope:_,all_layers_length:c,used_colors_length:p,layers_colors:m,color_less_uint8x4:g,color_full_uint8x4:A}=this.get_updated_shadow_state(),{colors_data_in_layers_uint32_SIMDope:y,hover_data_in_layer:x,layers_opacity_255:w,indexes_data_for_layers:C}=this.state;return i=this.destination_rgba_colors_for_blending_SIMDope_,n=this.data_array.map((function(e){return new h(e.data.buffer)})),a=n.length||0,r=m[0],s=new l(new ArrayBuffer(4)),new Promise((function(e){var l=0,h=new Uint32Array(2),E=0;if(i){for(;b(0|l,p);l=u(l,1)){for(i.get_use_element(C[0|l],r),r.set_from_simdope(s),h[0]=f(l,c),E=0;v(E,a);E=d(E,1))n[0|E].get_use_element(C[0|l],m[E+1|0]),m[0|E].set_tail(m[E+1|0],w[0|E]);for(E=a;v(E,c);E=d(E,1))h[1]=d(h[0],E),y.get_use_element(h[1],m[E+1|0]),m[0|E].set_tail(m[E+1|0],w[0|E]);m[0|E].reset_tail(),(0|x[0|l])>0?(r.blend_first_with_tails(t),r.blend_first_with(r.is_dark()?g:A,x[0|l],!1,!1)):r.blend_first_with_tails(t)}e(Array.of(C.subarray(0,p)))}else{for(;b(0|l,p);l=u(l,1)){for(_.get_use_element(0|l,r),r.set_from_simdope(s),h[0]=f(l,c),E=0;v(E,a);E=d(E,1))n[0|E].get_use_element(C[0|l],m[E+1|0]),m[0|E].set_tail(m[E+1|0],w[0|E]);for(E=a;v(E,c);E=d(E,1))h[1]=d(h[0],E),y.get_use_element(h[1],m[E+1|0]),m[0|E].set_tail(m[E+1|0],w[0|E]);m[0|E].reset_tail(),(0|x[0|l])>0?(r.blend_first_with_tails(t),r.blend_first_with(r.is_dark()?g:A,x[0|l],!1,!1)):r.blend_first_with_tails(t)}e(Array.of(C.subarray(0,p),o.subarray(0,p)))}}))},r.prototype.build=function(e,t,i,a,r){e=(0|e)>>>0,t=(0|t)>>>0,a=a||[],this.set_bytes_index(0),this.set_state(n(e,t,i)),this.set_data_array(a,r)},r.prototype.update=function(e,t,i,n,r){e=(0|e)>>>0,t=(0|t)>>>0,n=n||[],this.set_bytes_index(0),this.set_state(a(this.state,e,t,i)),this.set_data_array(n,r)},r.prototype.clear=function(){this.set_bytes_index(0),this.set_state(a(this.state,1,1)),this.set_data_array([],new Uint32Array(0))},e.exports=r},927:function(e,t,i){"use strict";const n={_create_state:function(e,t,i,n){return{w:e,h:t,p:i,pc:n}},_create_func:function(){return new(0,Object.getPrototypeOf((function(){})).constructor)('\n return function(\n pxl_width,\n pxl_height,\n pxls,\n pxl_colors,\n ) {\n "use strict";\n pxl_width = pxl_width | 0;\n pxl_height = pxl_height | 0;\n \n const full_pxls_length = pxls.length | 0;\n const full_pxls = new Uint32Array(full_pxls_length|0);\n for(var i = 0; (i|0) < (full_pxls_length|0); i = (i + 1 | 0) >>> 0) { full_pxls[i|0] = (pxl_colors[pxls[i|0]] | 0) >>> 0; }\n let image_data = new ImageData(new Uint8ClampedArray(full_pxls.buffer), pxl_width, pxl_height);\n \n return new Promise(function(resolve, reject) {\n createImageBitmap(image_data).then(function(r){resolve(r);});\n });\n };\n ')()},from:function(e){let t=this._create_func(),i=this._create_state,n=e||null;return{render(e,a,r,s,o){var _=i(e,a,r,s);n?n.exec(t,[_.w,_.h,_.p,_.pc]).catch((function(){return t(_.w,_.h,_.p,_.pc)})).then((function(e){o(e)})):t(_.w,_.h,_.p,_.pc).then((function(e){o(e)}))}}}};e.exports=n},928:function(e,t,i){"use strict";var n=i(653),a=i(647),r=i(687),s=i(929);n.SetFixed.compute=function(e,t,i,n){var a,r=t.bitArrayData,s=[0].concat(i.map((function(e){return e.bitArrayData})));for(a=0;(0|a)<(0|e);a=(a+1|0)>>>0)s[0]=0|a,r[0|a]=n.apply(null,s)};const o={init(e,t,i,o,_,l){let h,{clamp_uint32:c,plus_uint:p,int_less:d,uint_equal:u,uint_not_equal:m,clamp_uint8:f}=a.simdops,g={index_changes:new Uint32Array(0),color_changes:new Uint32Array(0),_pxl_indexes_updated:new n.SetFixed(0),_pxl_indexes_of_selection_drawn:new n.SetFixed(0),_pxl_indexes_of_current_shape:new n.SetFixed(0),_pxl_indexes_of_old_shape:new n.SetFixed(0),_old_pxls_hovered:new n.SetFixed(0),_old_selection_pair_highlight:!0,_old_layers_string_id:"",_old_pxl_width:0,_old_pxl_height:0,_last_paint_timestamp:0,_is_there_new_dimension:!0,_did_hide_canvas_content:!1,_previous_imported_image_pxls_positioned_keyset:new n.SetFixed(0)},A={super_state:e,super_canvas:t,super_blend:i,canvas_pos:o,color_conversion:_,sraf:l},y={position(){},selection(){},color(){},action(){},update(){}},x=(new Uint32Array(0),new Uint32Array(0),""),w=A.canvas_pos.get_state().sizes,b=function(e,t,i,n){if(g._last_paint_timestamp>=n)e();else{let{_old_pxl_width:a,_old_pxl_height:r}=g,{pxl_width:s,pxl_height:o}=A.super_state.get_state();if(A.super_canvas.ok()){w=A.canvas_pos.get_state().sizes;let _=!(parseInt(a)===parseInt(s)&&parseInt(r)===parseInt(o)),l=parseInt(w.width)!==parseInt(s)||parseInt(w.height)!==parseInt(o);l||_?(A.super_state.set_state({pxl_width:parseInt(w.width),pxl_height:parseInt(w.height)}),g._is_there_new_dimension=!0,y.update(!1,!1).then((function(){setTimeout((()=>{g._is_there_new_dimension=!1,y.update(!1,!1)}),500),h(_,l,i,n).catch((function(){setTimeout(b,1,e,t,i,n)}))})).catch((function(){setTimeout(b,2,e,t,i,n)}))):h(_,l,i,n).catch((function(){setTimeout(b,1,e,t,i,n)}))}else setTimeout(b,3,e,t,i,n)}},v=new n.SetFixed(w.width*w.height),C=function(e,i,a,r,s,o){var _,l,h,c,u,m,f,y,x,w,C;if(g._last_paint_timestamp>=o)e();else{let{_is_there_new_dimension:E,_did_hide_canvas_content:U,_old_pxls_hovered:I,_old_layers_string_id:R,_pxl_indexes_of_old_shape:S,_pxl_indexes_of_current_shape:B,_pxl_indexes_of_selection_drawn:T,_previous_imported_image_pxls_positioned_keyset:F,_old_selection_pair_highlight:P}=g,{_s_layers:M,_layer_index:Q,_layers:O,select_mode:k,hide_canvas_content:L,pxl_width:N,pxl_height:D,_pxls_hovered:Y,tool:G,_shape_index_a:V,_select_shape_index_a:z,_pxl_indexes_of_selection:j,_paint_or_select_hover_pxl_indexes:K,_selection_pair_highlight:X}=A.super_state.get_state();const{imported_image_pxls_positioned:J,imported_image_pxl_colors:q,imported_image_pxls_positioned_keyset:W,image_imported_resizer_index:H}=A.super_state.get_imported_image_data(),Z=W.size>0,$=0|M.length,ee=M[0].indexes.length;l=(_=$+(Z?1:0))-1;const te=""+Array.from(O).map((function(e,t){return t+"-id-"+e.id+"-v-"+(e.hidden||L?"0":"1")+"-o-"+parseInt(255*e.opacity).toString(16)+"-w-"+e.width+"-h-"+e.height+"-end"})).join("+"),ie=U!==L||R!==te||E||a||s,ne=Uint8Array.from(O.map((function(e){return parseInt(e.hidden||L?0:Math.round(255*parseFloat(e.opacity)))})).concat(Z?[196]:[]));if("LINE"!==G&&"RECTANGLE"!==G&&"ELLIPSE"!==G&&"TRIANGLE"!==G||-1===V||-1===Y)if("SELECT LINE"!==G&&"SELECT RECTANGLE"!==G&&"SELECT ELLIPSE"!==G||-1===z||-1===Y){if(("SELECT PATH"===G||"CONTOUR"===G)&&K.size>0){const ue=K[0],me=K[K.size-1],fe=A.super_state.shape_creator.from_line(ue,me);"REMOVE"===k&&"SELECT PATH"===G?fe.forEach((e=>{j.delete(e)})):"SELECT PATH"===G?fe.forEach((e=>{j.add(e)})):fe.forEach((e=>{B.add(e)}))}}else B="SELECT LINE"===G?A.super_state.shape_creator.from_line(z,Y,B):"SELECT RECTANGLE"===G?A.super_state.shape_creator.from_rectangle(z,Y,B):"SELECT ELLIPSE"===G?A.super_state.shape_creator.from_ellipse(z,Y,B):B;else B="LINE"===G?A.super_state.shape_creator.from_line(V,Y,B):"RECTANGLE"===G?A.super_state.shape_creator.from_rectangle(V,Y,B):"ELLIPSE"===G?A.super_state.shape_creator.from_ellipse(V,Y,B):B;let ae=0,re=0,se=0,oe=M[Q]||{},_e=A.super_canvas.render.bind(A.super_canvas),le=A.super_blend;function he(){setTimeout(b,1,e,i,s,o)}function ce(e,t){return((e=(0|e)>>>0)^(t=(0|t)>>>0))>>>0}function pe(e,t){return((e=(0|e)>>>0)|(t=(0|t)>>>0))>>>0}function de(e,t,i,n,a,r,s,o,_){return pe(pe(pe(t[e=(0|e)>>>0],i[e]),ce(n[e],a[e])),pe(pe(ce(r[e],s[e]),((0|r[e])>>>0&(0|w[e])>>>0)>>>0),pe(o[e],_[e])))}for(h=le.for.bind(le),c=le.next.bind(le),u=le.stack.bind(le),m=X!==P,le.update(0|_,0|ee,ne,M,t.getUint32()),f=B.has.bind(B),y=j.has.bind(j),x=W.has.bind(W),w=m?4294967295:0,H>=0&&B.add(H),B.add(Y),v.length!==ee&&(v=new n.SetFixed(ee)),n.SetFixed.compute(ee,v,Array.of(oe.setFixed,I,S,B,T,j,F,W),de),C=v.has.bind(v);d(se,ee);se=p(se,1))(ie||C(se))&&(f(se)?h((0|se)>>>0,128):y(se)?(ae=se%N|0,re=(se-ae)/N|0,h((0|se)>>>0,72+48*(ae+re+(X?1:0)&1)|0)):h((0|se)>>>0,0),x(se)&&u((0|l)>>>0,(0|q[0|J[(0|se)>>>0]])>>>0),c());le.blend(!1,!1).then((function(t){t[0].length>0||ie||a||s?A.super_canvas.check(N,D).catch(he).then((function(){A.super_canvas.prender().finally((function(){I.clearAndBulkAdd(Uint32Array.of(H,Y)),oe.clear_changes(),T.setFromSetFixed(j),F.setFromSetFixed(W),A.sraf.run_frame((()=>(g._old_selection_pair_highlight=X,g._old_layers_string_id=""+te,g._did_hide_canvas_content=!!L,g._old_pxl_width=parseInt(N),g._old_pxl_height=parseInt(D),g._last_paint_timestamp=+o,S.setFromSetFixed(B),B.clear(),_e())),!1,ie||a||s,Date.now(),"render").finally(e)}))})):e()}))}};return{get:function(){return g},set:function(e){for(x in e)g[x]=e[x];return Promise.resolve()},set_notifiers:function(e=function(){},t=function(){},i=function(){},n=function(){},a=function(){}){y={position:e,selection:t,color:i,action:n,update:a}},is_there_new_dimension:function(){return g._is_there_new_dimension&&!0},update_canvas:function(e,t){return e=e||!1,t=t||Date.now(),void 0===h&&this&&(h=this.render_canvas),new Promise(b)},render_canvas:function(e,t,i,n){return new Promise(C)},_should_remove_not_perfect_second_latest_pixel_from_array(e){const t=A.super_state.get_state().pxl_width;if(e.size>=3){const i=0|e[e.size-1],n=i%t|0,a=(i-n)/t,r=0|e[e.size-2],s=r%t|0,o=(r-s)/t,_=0|e[e.size-3],l=_%t|0,h=(_-l)/t;if(1==(0|Math.abs(n-l))&&1==(0|Math.abs(a-h))&&(n===s&&o===h||a===o&&s===l))return!0}return!1},_handle_canvas_mouse_move(e){let{_pxl_indexes_of_selection:t,_imported_image_pxls:i,pxl_current_color_uint32:a,tool:r,pxl_width:o,pxl_height:_,_pxls_hovered:l,hide_canvas_content:h,_is_on_resize_element:c,_paint_or_select_hover_pxl_indexes:p,_paint_hover_old_pxls_snapshot:d,_last_action_timestamp:u,_paint_or_select_hover_pxl_indexes_exception:m,_paint_or_select_hover_actions_latest_index:f,_s_layers:g,_layer_index:y,pxl_current_opacity:x,_select_hover_old_pxls_snapshot:w,select_mode:b}=A.super_state.get_state();const{event_button:v,mouse_down:C}=A.canvas_pos.get_pointer_state(),E=v+1|0,U=g[y]||{},[I,R]=A.canvas_pos.get_canvas_pos_from_event(e.pageX,e.pageY),S=R*o+I|0;if(-1==(0|I)||-1==(0|R))this._notify_position_change({x:I,y:R});else if((0|S)==(0|l)||h)l!==S&&A.super_state.set_state({_pxls_hovered:0|S,_mouse_inside:!0}).then((()=>{this.update_canvas(),this._notify_position_change({x:I,y:R})}));else if(i.length>0){let{_imported_image_move_from:e,_imported_image_scale_delta_x:t,_imported_image_scale_delta_y:i,_imported_image_start_x:n,_imported_image_start_y:a,_imported_image_width:r,_imported_image_height:s}=A.super_state.get_state();const h=r+t,p=s+i,d=n+h+(a+p)*o,u=(0|S)==(0|d)||(0|l)==(0|d);let m=0,f=0;const g=I-e[0],y=R-e[1];e=Array.of(I,R),1===E&&C?u||c?(m=t+g|0,f=i+y|0,m=0|Math.max(m,-(r-1)),f=0|Math.max(f,-(s-1)),t=0|m,i=0|f,A.super_state.set_state({_pxls_hovered:0|S,_is_on_resize_element:u,_mouse_inside:!0,_imported_image_scale_delta_x:t,_imported_image_scale_delta_y:i,_imported_image_move_from:Array.of(e[0],e[1])}).then((()=>{this.update_canvas(),this._notify_position_change({x:I,y:R})}))):(n=n+g|0,n=n<-h?-h:0|n,n=n>=o?o:0|n,a=a+y|0,a=a<-p?-p:0|a,a=a>=_?_:0|a,A.super_state.set_state({_pxls_hovered:0|S,_is_on_resize_element:u,_mouse_inside:!0,_imported_image_start_x:n,_imported_image_start_y:a,_imported_image_move_from:Array.of(e[0],e[1])}).then((()=>{this.update_canvas(),this._notify_position_change({x:I,y:R})}))):A.super_state.set_state({_pxls_hovered:0|S,_is_on_resize_element:u,_mouse_inside:!0}).then((()=>{this._notify_position_change({x:I,y:R})}))}else if("PENCIL"!==r&&"PENCIL PERFECT"!==r&&"CONTOUR"!==r||1!==E||!C)if("SELECT PIXEL"!==r&&"SELECT PIXEL PERFECT"!==r&&"SELECT PATH"!==r||1!==E||!C){const{_s_layers:e,_layer_index:t}=A.super_state.get_state();p.clear(),A.super_state.set_state({_pxls_hovered:0|S,_mouse_inside:!0,_paint_or_select_hover_actions_latest_index:-1,_paint_or_select_hover_pxl_indexes:p}).then((()=>{this.update_canvas(),this._notify_position_change({x:I,y:R})}))}else{-1===f&&(f=S);const e=A.super_state.shape_creator.from_line(f,S);if("SELECT PATH"===r)u=1/0,e.forEach((function(e){p.add(0|e)}));else if("SELECT PIXEL"===r)u=Date.now(),e.forEach((function(e){p.add(0|e)}));else if("SELECT PIXEL PERFECT"===r){u=Date.now(),e.forEach((function(e){p.add(0|e)}));const i=p.indexes;if(this._should_remove_not_perfect_second_latest_pixel_from_array(i)){const e=i[i.length-2];w.includes(e)||"ADD"!==b&&"REPLACE"!==b||t.delete(e),p.delete(e)}}"REPLACE"===b&&t.clear(),p.forEach((e=>{"ADD"===b||"REPLACE"===b?t.add(e):t.delete(e)})),A.super_state.set_state({_pxls_hovered:0|S,_mouse_inside:!0,_pxl_indexes_of_selection:t,_paint_or_select_hover_pxl_indexes:p,_paint_or_select_hover_actions_latest_index:S,_last_action_timestamp:u}).then((()=>{this.update_canvas(),this._notify_is_something_selected(),this._notify_position_change({x:I,y:R})}))}else{-1===f&&(f=0|S),p=A.super_state.shape_creator.from_line(f,S,p);const{pencil_mirror_mode:e,_pencil_mirror_index:t}=A.super_state.get_state(),i=t%o,l=(t-i)/o;if("CONTOUR"===r)u=1/0;else if("PENCIL"===r)u=Date.now();else if("PENCIL PERFECT"===r&&(u=Date.now(),m.forEach((function(e){p.delete(e)})),this._should_remove_not_perfect_second_latest_pixel_from_array(p.indexes))){const e=p[p.size-2];p.delete(e),m.add(e);let t=new s.Set(Array.of(e));t.forEach((e=>{const[n,a]=e,r=a,s=n-2*(n-i);s>=0&&s=0&&r<=_&&t.add(r*o+s)})),t.forEach((e=>{U.set_uint32(e,d[e])}))}if("NONE"!==e){const t=new n.SetFixed(p);let r=new s.Set(p.filter((function(e){return!t.has(0|e)&&!m.has(0|e)})).map((function(e){var t=e%o|0;return[0|t,0|(e-t)/o]})));"VERTICAL"!==e&&"BOTH"!==e||r.forEach((e=>{const[t,i]=e,n=i-2*(i-l),a=t;a>=0&&a=0&&n<=_&&r.add([a,n])})),"HORIZONTAL"!==e&&"BOTH"!==e||r.forEach((e=>{const t=e[1],n=e[0]-2*(e[0]-i);n>=0&&n=0&&t<=_&&r.add([n,t])}));let h=new n.SetFixed(o*_);r.forEach((e=>{var t=e[1],i=e[0];h.add(t*o+i|0)})),A.super_state.paint_shape(h,a,x,{_pxls_hovered:0|S,_mouse_inside:!0,_paint_or_select_hover_pxl_indexes:p,_paint_or_select_hover_pxl_indexes_exception:m,_paint_or_select_hover_actions_latest_index:0|S,_last_action_timestamp:u},(()=>{this.update_canvas()}))}else A.super_state.paint_shape(p.indexes,0|a,x,{_pxls_hovered:0|S,_mouse_inside:!0,_paint_or_select_hover_pxl_indexes:p,_paint_or_select_hover_pxl_indexes_exception:m,_paint_or_select_hover_actions_latest_index:0|S,_last_action_timestamp:u},(()=>{this.update_canvas()}));this._notify_position_change({x:0|I,y:0|R})}},_notify_position_change(e,t){t=t||Date.now();const i=0|A.super_state.get_notified_pos_at(),n=0|Date.now();(n-i|0)>=100&&null==t||(0|t)>(0|i)&&(n-t|0)>=100?(e={x:void 0===e.x?-1:e.x,y:void 0===e.y?-1:e.y},A.super_state.set_state({_notified_position_at:n}).then((function(){y.position(e,A.sraf.get_state().previous_cpaf_fps)}))):(0|n)<(t+100|0)&&setTimeout(this._notify_position_change,100-(t-n|0)|0,{x:e.x,y:e.y},0|n)},_handle_canvas_mouse_up(){let{_paint_or_select_hover_pxl_indexes:e,tool:t,_imported_image_pxls:i,_pxl_indexes_of_selection:a,select_mode:r}=A.super_state.get_state();if(i.length>0)A.super_state.set_state({_imported_image_move_from:[-1,-1]});else if(e.size>0&&"CONTOUR"===t){let{pxl_current_opacity:t,pxl_current_color_uint32:i}=A.super_state.get_state();const a=e[0],r=e[e.size-1],s=A.super_state.shape_creator.from_line(a,r);e=new n.SetFixed(Array.from(e.indexes).concat(s)),e=A.super_state.shape_creator.from_path(e,e),e.clear(),A.super_state.paint_shape(e.indexes,i,t,{_last_action_timestamp:Date.now()},(()=>{this.update_canvas()}))}else if(e.size>0&&"SELECT PATH"===t){const t=e[0],i=e[e.size-1],s=A.super_state.shape_creator.from_line(t,i);e=new n.SetFixed(Array.from(e.indexes).concat(s)),e=A.super_state.shape_creator.from_path(e,e),"REPLACE"===r&&a.clear(),"ADD"===r||"REPLACE"===r?e.forEach((function(e){a.add(e)})):e.forEach((function(e){a.delete(e)}))}},_handle_canvas_mouse_down(e){const{pxl_current_color:t,pxl_current_color_uint32:i,hide_canvas_content:a,tool:o,pxl_width:_,pxl_height:l,pxl_current_opacity:h,bucket_threshold:c,select_mode:p}=A.super_state.get_state(),d=e.button+1;let[u,m]=[-1,-1];if(-1!==A.super_state.get_state()._pxls_hovered&&null===e){const e=A.super_state.get_state()._pxls_hovered%_,t=(A.super_state.get_state()._pxls_hovered-e)/_;[u,m]=[e,t]}else e&&([u,m]=A.canvas_pos.get_canvas_pos_from_event(e.pageX,e.pageY));if(-1===u||-1===m)return;let{_shape_index_a:f,_select_shape_index_a:g,_shape_index_b:y,_select_shape_index_b:x,_pxl_indexes_of_selection:w,_s_layers:b,_layer_index:v,hue:C}=A.super_state.get_state();const E=m*_+u,U=b[v]||{},I=void 0!==U?U.indexes:void 0,R=void 0!==I?I[E]:-1;if(-1===d)return void A.super_state.set_state({_pxls_hovered:E}).then((()=>{this.update_canvas()}));3===d&&(f=-1,g=-1,y=-1,x=-1);const{_imported_image_pxls:S}=A.super_state.get_state();if(A.super_state.set_state({_pxls_hovered:0|E,_mouse_inside:!0,_paint_or_select_hover_actions_latest_index:-1,_paint_hover_old_pxls_snapshot:U.indexes_copy||new Uint8Array(0),_select_hover_old_pxls_snapshot:new n.SetFixed(w)}),!a){let a=U.indexes||new Uint8Array(0),y=Array.from(U.colors);if(S.length>0&&1===d)A.super_state.set_state({_imported_image_move_from:[u,m]});else if(2===d||"MOVE"===o&&S.length<=0&&(1===d||-1===d))A.super_state.set_state({_imported_image_move_from:[e.x,e.y]});else if("PICKER"===o&&1===d){const t=this.get_pixel_color_from_pos(u,m);this._notify_current_color_change(t),this._notify_relevant_action_event(e,t,1)}else if("EXCHANGE"===o&&1===d){const t=U.colors[R];this.exchange_pixel_color(t,i),this._notify_relevant_action_event(e,i,1)}else if("LINE"===o||"RECTANGLE"===o||"ELLIPSE"===o)if(-1===f)1===d?A.super_state.set_state({_shape_index_a:E}).then((()=>{this.update_canvas()})):A.super_state.set_state({_shape_index_a:f}).then((()=>{this.update_canvas()}));else{let t;switch(o){case"LINE":t=A.super_state.shape_creator.from_line(f,E);break;case"RECTANGLE":t=A.super_state.shape_creator.from_rectangle(f,E);break;case"ELLIPSE":t=A.super_state.shape_creator.from_ellipse(f,E)}A.super_state.paint_shape(t.indexes,i,h,{_shape_index_a:-1,_last_action_timestamp:Date.now()},(()=>{this.update_canvas()})),this._notify_relevant_action_event(e,"#ffffffff",.6)}else if("SELECT LINE"===o||"SELECT RECTANGLE"===o||"SELECT ELLIPSE"===o)if(-1===g)1===d?A.super_state.set_state({_select_shape_index_a:E}).then((()=>{this.update_canvas()})):A.super_state.set_state({_select_shape_index_a:g}).then((()=>{this.update_canvas()}));else{let e="SELECT LINE"===o?A.super_state.shape_creator.from_line(g,E):"SELECT RECTANGLE"===o?A.super_state.shape_creator.from_rectangle(g,E):A.super_state.shape_creator.from_ellipse(g,E);"REPLACE"===p&&w.clear(),"ADD"===p||"REPLACE"===p?e.forEach((function(e){w.add(e)})):e.forEach((function(e){w.delete(e)})),e.clear(),A.super_state.set_state({_pxl_indexes_of_selection:w,_select_shape_index_a:-1,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas(),this._notify_is_something_selected()}))}else if("SELECT PIXEL"!==o&&"SELECT PATH"!==o||1!==d)if("SET PENCIL MIRROR"===o&&1===d)A.super_state.set_state({_pencil_mirror_index:E,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas()}));else if("PENCIL"!==o&&"PENCIL PERFECT"!==o&&"CONTOUR"!==o||1!==d)if("BUCKET"!==o&&"HUE BUCKET"!==o&&"SELECT COLOR THRESHOLD"!==o&&"BORDER"!==o||1!==d){if("SELECT COLOR"===o&&1===d){const{_s_layers:e}=A.super_state.get_state(),t=U.indexes[E];"REPLACE"===p&&w.clear(),U.indexes.forEach(((e,i)=>{e===t&&("ADD"===p||"REPLACE"===p?w.add(i):w.delete(i))})),A.super_state.set_state({_pxl_indexes_of_selection:w,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas(),this._notify_is_something_selected()}))}}else{const{_s_layers:s,_layer_index:d}=A.super_state.get_state(),f=U.indexes,g=[u,m],x=f[E],b=y[x];let v=[];const[I,R,S,B]=A.color_conversion.to_rgba_from_uint32(b),[T,F,P,M]=A.color_conversion.to_hsla_from_rgba(Uint8ClampedArray.of(I,R,S,B)),Q=T{if(0===c)return x===f[e];if(!k.has(e)&&e>=0&&e<_*l){const t=b||0,i=y[f[e]]||0;return A.color_conversion.match_color(t,i,c)}return!1},N=(e,t)=>{if(t=t||!1,(!k.has(e)||t)&&e>=0&&e<_*l)if("HUE BUCKET"===o){if(t){const t=y[a[e]];if(void 0===v[t]){let[i,n,r,s]=A.color_conversion.to_rgba_from_uint32(t),[o,_,l,h]=A.color_conversion.to_hsla_from_rgba(Uint8ClampedArray.of(i,n,r,s));o=(o+Q)%360,[i,n,r,s]=A.color_conversion.to_rgba_from_hsla(Array.of(o,_,l,h));const c=A.color_conversion.to_uint32_from_rgba(Uint8ClampedArray.of(i,n,r,s));y.includes(c)||y.push(c);let p=y.indexOf(c);-1===p&&(p=y.push(c)),v[t]=p,a[e]=p}else a[e]=v[t]}k.add(e)}else if("BUCKET"===o||"BORDER"===o){if(t){const t=A.color_conversion.blend_colors(y[a[e]],i,h,!1,!1);let n=y.indexOf(t);-1===n&&(n=y.push(t)),a[e]=n}k.add(e)}else"SELECT COLOR THRESHOLD"===o&&k.add(e)};let D=!1,Y=!1;for(;O.length;){let[e,t]=O.pop(),i=t*_+e;for(;t>=0&&L(i);)i-=_,t--;for(i+=_,t++,D=!1,Y=!1;t0&&(L(i-1)?D||(O.push([e-1,t-1]),D=!0):D&&(D=!1)),e+1<_&&(L(i+1)?Y||(O.push([e+1,t-1]),Y=!0):Y&&(Y=!1)),i+=_}if("BORDER"===o){A.super_state.shape_creator.from_border(k,!0,!0).forEach((e=>{N(e,!0)}));let{_s_layers:e,pxl_width:t,pxl_height:i}=A.super_state.get_state(),n=A.color_conversion.clean_duplicate_colors(a,y);e[d]=r.Layer.new_from_colors_and_indexes(n[1],n[0],t,i,!0),A.super_state.set_state({_s_layers:e,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas()}))}else if("SELECT COLOR THRESHOLD"===o)"REPLACE"===p&&w.clear(),k.forEach((e=>{"ADD"===p||"REPLACE"===p?w.add(e):w.delete(e)})),A.super_state.set_state({_pxl_indexes_of_selection:w,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas(),this._notify_is_something_selected()}));else if("BUCKET"===o||"HUE BUCKET"===o){let{_s_layers:i,pxl_width:n,pxl_height:s}=A.super_state.get_state(),o=A.color_conversion.clean_duplicate_colors(a,y);i[d]=r.Layer.new_from_colors_and_indexes(o[1],o[0],n,s,!0),A.super_state.set_state({_s_layers:i,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas(),this._notify_relevant_action_event(e,t,1)}))}}else{const{pencil_mirror_mode:e,_pencil_mirror_index:t}=A.super_state.get_state(),r=t%_,o=(t-r)/_;let c=new s.Set(Array.of(Array.of(u,m)));if("VERTICAL"===e||"BOTH"===e){const e=m-2*(m-o),t=u;if(t>=0&&t<_&&e>=0&&e<=l){c.add(Array.of(t,e));const n=e*_+t,r=U.indexes[n],s=y[r],o=A.color_conversion.blend_colors(s,i,h,!0,!1);let l=y.indexOf(o);-1===l&&(l=y.push(o)),a[n]=l}}"HORIZONTAL"!==e&&"BOTH"!==e||c.forEach((e=>{const t=e[1],n=e[0]-2*(e[0]-r);if(n>=0&&n<_&&t>=0&&t<=l){const e=t*_+n,r=U.indexes[e],s=y[r],o=A.color_conversion.blend_colors(s,i,h,!0,!1);let l=y.indexOf(o);-1===l&&(l=y.push(o)),a[e]=l}})),A.super_state.paint_shape([E],i,h,{_paint_or_select_hover_pxl_indexes:new n.SetFixed([E]),_paint_or_select_hover_actions_latest_index:E,_paint_hover_old_pxls_snapshot:U.indexes_copy||new Uint8Array(0),_last_action_timestamp:Date.now()},(()=>{this.update_canvas()}))}else"REPLACE"===p&&w.clear(),"ADD"===p||"REPLACE"===p?w.add(E):w.delete(E),"SELECT PIXEL"===o?A.super_state.set_state({_pxl_indexes_of_selection:w,_paint_or_select_hover_actions_latest_index:E,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas(),this._notify_is_something_selected()})):"SELECT PATH"===o&&A.super_state.set_state({_pxl_indexes_of_selection:w,_paint_or_select_hover_actions_latest_index:E,_last_action_timestamp:1/0}).then((()=>{this.update_canvas(),this._notify_is_something_selected()}))}},_notify_is_something_selected(){const e=A.super_state.get_state()._pxl_indexes_of_selection;!!A.super_state.get_state()._previous_pxl_indexes_of_selection.size!=!!e.size&&A.super_state.set_state({_is_something_selected:!!e.size,_previous_pxl_indexes_of_selection:new n.SetFixed(e)}).then((()=>{y.selection(!!e.size)}))},get_pixel_color_from_pos(e,t){const{pxl_height:i,pxl_width:n,_s_layers:r,_layers:s}=A.super_state.get_state(),o=t*n+e;if(e>n||t>i||e<0||t<0)return"#00000000";let _=a.Color.new_zero();for(let l=0;l>>0,o.set_colors(e,!0)}const h=o.colors.indexOf(t);_=_.map((e=>e===l?h:e));const[c,p]=A.color_conversion.clean_duplicate_colors(_,o.colors);i[s]=r.Layer.new_from_colors_and_indexes(p,c,n,a,!0),A.super_state.set_state({_s_layers:i,_last_action_timestamp:Date.now()}).then((()=>{this.update_canvas()}))}}}};e.exports=o},933:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,i){this.state=this.template(e,t,i)}template(e,t,i){let n={s:((e,t,i)=>{e||(e=document.createElement("canvas")),e.width=t,e.height=i;const n=/android|bb\d+|meego|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(navigator.userAgent||navigator.vendor||window.opera);let a,r,s,o="createImageBitmap"in window,_="OffscreenCanvas"in window;if(_)try{r=new OffscreenCanvas(t,i),s=r.getContext("2d",{willReadFrequently:!0,powerPreference:"high-performance",desynchronized:!n}),this.setImageSmoothing(s,!1)}catch(l){_=!1}if(_)try{a=r.transferControlToOffscreen()}catch(l){try{a=e.getContext("2d",{willReadFrequently:!0,powerPreference:"high-performance",desynchronized:!n})}catch(l){a=e.getContext("2d")}}else try{a=e.getContext("2d",{willReadFrequently:!0,powerPreference:"high-performance",desynchronized:!n})}catch(l){a=e.getContext("2d")}return this.setImageSmoothing(a,!1),{isBitmap:o,isOffscreen:_,width:t,height:i,canvasContext:a,offscreenCanvasContext:s}})(e,t|=0,i|=0),enablePaintType:"",fpBuffer:new ArrayBuffer(i*t*4),b:{bmpX:0,bmpY:0,bmpT:0,bmp:{close(){},width:0,height:0},oldBmp:{close(){},width:0,height:0}}};return n.fp=new Uint32Array(n.fpBuffer),n.prUint8a=new Uint8ClampedArray(n.fpBuffer),n}setImageSmoothing(e,t){e.imageSmoothingEnabled=t,["webkit","moz","ms"].forEach((i=>{e[i+"ImageSmoothingEnabled"]=t}))}ok(){return!!this.state.s.canvasContext.canvas}getUint32(){return this.state.fp}new(e,t,i){return this.state=this.template(e,t,i),Promise.resolve()}clear(){return new Promise((e=>{this.state.s.canvasContext.clearRect(0,0,this.state.s.width,this.state.s.height),e()}))}render(){const{b:e,enablePaintType:t,s:i}=this.state;return new Promise((function(n){"bitmap"===t&&e?(i.canvasContext.globalCompositeOperation="copy",i.canvasContext.drawImage(e.bmp,0,0,e.bmp.width,e.bmp.height)):"offscreen"===t?(i.canvasContext.globalCompositeOperation="copy",i.canvasContext.drawImage(i.offscreenCanvasContext.canvas,0,0)):i.canvasContext.putImageData(new ImageData(this.state.prUint8a,i.width,i.height),0,0),n()}))}prender(){return this.state.enablePaintType=this.state.s.isBitmap?"bitmap":this.state.s.isOffscreen?"offscreen":"","bitmap"===this.state.enablePaintType?createImageBitmap(new ImageData(this.state.prUint8a,this.state.s.width,this.state.s.height)).then((e=>(this.state.b.oldBmp.close(),this.state.b.oldBmp=this.state.b.bmp,this.state.b.bmp=e,Promise.resolve()))).catch((()=>(this.state.s.isBitmap=!1,Promise.reject()))):"offscreen"===this.state.enablePaintType?(this.state.s.offscreenCanvasContext.putImageData(new ImageData(this.state.prUint8a,this.state.s.width,this.state.s.height),0,0),Promise.resolve()):Promise.resolve()}check(e,t){const{width:i,height:n}=this.state.s;return i!==e||n!==t?this.setDimensions(e,t):Promise.resolve()}setDimensions(e,t){return this.state.s.width!==e||this.state.s.height!==t?(this.state=this.template(this.state.s.canvasContext.canvas,e,t),Promise.resolve()):Promise.reject(Error("Dimensions are already set to the requested size"))}}},934:function(e,t,i){"use strict";var n=i(653),a=i(647),r=i(687),s=i(667);const o=function(e,t){t=t instanceof n.SetFixed||void 0!==t?t:new n.SetFixed(e.canvas.width*e.canvas.height);let i=e.getImageData(0,0,e.canvas.width,e.canvas.height).data,a=i.length>>2;if(t instanceof n.SetFixed||t instanceof Set)for(let n=0;(0|n)<(0|a);n=(n+1|0)>>>0)(0|i[n<<2])>128&&t.add(0|n);else for(let n=0;(0|n)<(0|a);n=(n+1|0)>>>0)(0|i[n<<2])>128&&(t[0|n]=1);return t},_=function(e,t,i){let n=void 0!==i?i.canvas:void 0;if(void 0===n){"OffscreenCanvas"in window?n=new OffscreenCanvas(e,t):(n=document.createElement("canvas"),n.width=e,n.height=t);let i=n.getContext("2d",{willReadFrequently:!0});return i.imageSmoothingEnabled=!1,i}return n.height===t&&n.width===e||(n.width=e,n.height=t),i},l=function(e,t,i){e|=0,t|=0,i|=0;let n={x:0,y:0},a={x:0,y:0};return a.x=i%e|0,n.x=t%e|0,n.y=(t-n.x)/e|0,a.y=(i-a.y)/e|0,{primary:n,secondary:a}};class h{constructor(e,t){this.new_canvas_context_2d=_,this.get_shadow_indexes_from_canvas_context=o,this.get_opposite_coordinates=l,this.width=0|e,this.height=0|t,this.context=this.new_canvas_context_2d(this.width,this.height)}from_text(e,t,i){return this.context.clearRect(0,0,this.width,this.height),this.context.font=e+'px "Industry Book"',this.context.fillStyle="#ffffffff",this.context.textAlign="center",this.context.fillText(t,this.width/2,this.height/2),this.get_shadow_indexes_from_canvas_context(this.context,i)}from_border(e,t,i,a){t=t||!0,i=i||!1;let r=new n.SetFixed(this.width*this.height);return e.forEach(((n,a)=>{let s,o,_,l,h,c,p,d;s=n-this.width,s=s<0?-1:s,o=n+1,o=o%this.width==0?-1:o,_=n+this.width,_=_>this.width*this.height?-1:_,l=n-1,l=l%this.width==this.width-1?-1:l,h=s-1,h=-1===s||-1===l?-1:h,c=s+1,c=-1===s||-1===o?-1:c,p=_-1,p=-1===_||-1===l?-1:p,d=_+1,d=-1===_||-1===o?-1:d,t?(e.has(s)&&-1!==s&&e.has(o)&&-1!==o&&e.has(_)&&-1!==_&&e.has(l)&&-1!==l||r.add(0|n),i&&(e.has(h)&&-1!==h&&e.has(c)&&-1!==c&&e.has(p)&&-1!==p&&e.has(d)&&-1!==d||r.add(0|n))):(e.has(s)||r.add(s),e.has(o)||r.add(o),e.has(_)||r.add(_),e.has(l)||r.add(l),i&&(e.has(h)||r.add(h),e.has(c)||r.add(c),e.has(p)||r.add(p),e.has(d)||r.add(d)))})),r}from_path(e,t){t=void 0===t?new n.SetFixed(this.width*this.height):t,this.context.clearRect(0,0,this.width,this.height),this.context.linewidth=1;let i=0,a=0;return e.forEach(((e,t)=>{const n=e%this.width|0,r=(e-n|0)/this.width|0;0|t?this.context.lineTo(0|n,0|r):(this.context.moveTo(0|n,0|r),this.context.beginPath(),i=0|n,a=0|r)})),this.context.strokeStyle="#ffffffff",this.context.fillStyle="#ffffffff",this.context.stroke(),this.context.fill(),this.get_shadow_indexes_from_canvas_context(this.context,t)}from_line(e,t,i){e|=0,t|=0,i=void 0===i?new n.SetFixed(this.width*this.height):i;let a=this.get_opposite_coordinates(this.width,e,t),r=0|Math.abs(a.secondary.x-a.primary.x),s=0|Math.abs(a.secondary.y-a.primary.y),o=(0|a.primary.x)<(0|a.secondary.x)?1:-1,_=(0|a.primary.y)<(0|a.secondary.y)?1:-1,l=r-s|0,h=0;if(i instanceof n.SetFixed)for(;i.add(a.primary.y*this.width+a.primary.x|0),(0|a.primary.x)!=(0|a.secondary.x)||(0|a.primary.y)!=(0|a.secondary.y);)h=2*l|0,(0|h)>(0|-s)&&(l=l-s|0,a.primary.x=a.primary.x+o|0),(0|h)<(0|r)&&(l=l+r|0,a.primary.y=a.primary.y+_|0);else for(;i[a.primary.y*this.width+a.primary.x|0]=1,(0|a.primary.x)!=(0|a.secondary.x)||(0|a.primary.y)!=(0|a.secondary.y);)h=2*l|0,(0|h)>(0|-s)&&(l=l-s|0,a.primary.x=a.primary.x+o|0),(0|h)<(0|r)&&(l=l+r|0,a.primary.y=a.primary.y+_|0);return i}from_rectangle(e,t,i){e|=0,t|=0;let a=void 0===i?new n.SetFixed(this.width*this.height):i,r=this.get_opposite_coordinates(this.width,e,t);const s=Math.abs(r.primary.x-r.secondary.x|0)+1|0,o=Math.abs(r.primary.y-r.secondary.y|0)+1|0,_=Math.max(r.primary.x,0|r.secondary.x)-(s-1|0)|0,l=Math.max(r.primary.y,0|r.secondary.y)-(o-1|0)|0,h=s*o|0;let c=0,p=0;if(a instanceof n.SetFixed)for(let n=0;n>>0)c=n%s|0,p=(n-c|0)/s|0,a.add((l+p|0)*this.width+(_+c|0)|0);else for(let n=0;n>>0)c=n%s|0,p=(n-c|0)/s|0,a[(l+p|0)*this.width+(_+c)|0]=1;return a}from_ellipse(e,t,i){e|=0,t|=0,i=void 0===i?new n.SetFixed(this.width*this.height):i;let a=this.get_opposite_coordinates(0|this.width,0|e,0|t),r=Math.abs(a.primary.x-a.secondary.x|0)+1|0,s=Math.abs(a.primary.y-a.secondary.y|0)+1|0,o=r/2,_=s/2;const l=o+(Math.max(a.primary.x,0|a.secondary.x)-(r-1|0)|0),h=_+(Math.max(a.primary.y,0|a.secondary.y)-(s-1|0)|0);return this.context.lineWidth=1,this.context.clearRect(0,0,0|this.width,0|this.height),this.context.translate(l,h),this.context.rotate(0),this.context.scale(o,_),this.context.arc(0,0,1,0,2*Math.PI),this.context.fillStyle="#ffffffff",this.context.strokeStyle="#ffffffff",this.context.stroke(),this.context.fill(),this.get_shadow_indexes_from_canvas_context(this.context,i)}}e.exports=class{constructor(e,t){this.shape_creator=new h(e.pxl_width,e.pxl_height),this.state_={_id:parseInt(1e3*Math.random()*1e3).toString(16)+"",className:e.className||null,perspective:e.perspective||0,animation:e.animation||!0,animation_duration:e.animation_duration||60,move_using_full_container:e.move_using_full_container,dont_compute_base64_original_image:e.dont_compute_base64_original_image||!1,dont_change_img_size_onload:e.dont_change_img_size_onload||!1,dont_show_canvas_until_img_set:e.dont_show_canvas_until_img_set||!1,show_image_only_before_canvas_set:e.show_image_only_before_canvas_set||!1,dont_show_canvas:e.dont_show_canvas||!1,but_show_canvas_once:e.but_show_canvas_once||!1,has_shown_canvas_once:!1,tool:e.tool||"PENCIL",select_mode:e.select_mode||"REPLACE",pencil_mirror_mode:e.pencil_mirror_mode||"NONE",hue:e.hue||0,pxl_width:32,pxl_height:32,pxl_current_color:e.pxl_current_color||"#00000000",pxl_current_color_uint32:a.Color.new_hex(e.pxl_current_color||"#00000000").uint32,pxl_current_opacity:e.pxl_current_opacity||1,bucket_threshold:e.bucket_threshold||0,color_loss:e.color_loss||.25,default_size:e.default_size||96,ideal_size:e.ideal_size||e.default_size||96,max_size:e.max_size||2*e.default_size||192,px_per_px:e.px_per_px||1,fast_drawing:e.fast_drawing||!1,canvas_border_radius:e.canvas_border_radius||0,canvas_wrapper_background_color:e.canvas_wrapper_background_color||"#020529",canvas_wrapper_background_color_focused:e.canvas_wrapper_background_color_focused||"#000000",canvas_wrapper_border_radius:e.canvas_wrapper_border_radius||4,show_original_image_in_background:e.show_original_image_in_background||!1,show_transparent_image_in_background:e.show_transparent_image_in_background||!1,hide_canvas_content:e.hide_canvas_content||!1,_pencil_mirror_index:-1,_previous_pencil_mirror_axes_indexes:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_previous_pencil_mirror_axes_hover_indexes:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_base64_original_images:[],_original_image_index:-1,_layers:[{id:Date.now(),name:"Layer 0",hidden:!1,opacity:1}],_layers_defined_at:0,_layer_index:0,_current_layer:new r.Layer(Uint32Array.of(0),1,1),_s_layers:[new r.Layer(Uint32Array.of(0),new Uint16Array((e.pxl_width||32)*(e.pxl_height||32)).fill(0),e.pxl_width||32,e.pxl_height||32,!0)],_json_state_history:{history_position:0,state_history:[]},_saving_json_state_history_running:!1,_pxls_hovered:-1,_canvas_container:null,_canvas_wrapper:null,_canvas_wrapper_overflow:null,_state_history_length:100,_last_action_timestamp:Date.now(),_lazy_lazy_compute_time_ms:1e4,_undo_buffer_time_ms:parseInt(parseInt(e.pxl_width||32)+parseInt(e.pxl_height||32)+1e3),_mouse_inside:!1,_paint_hover_old_pxls_snapshot:new Uint16Array((e.pxl_width||32)*(e.pxl_height||32)).fill(0),_select_hover_old_pxls_snapshot:new Uint16Array,_paint_or_select_hover_actions_latest_index:-1,_paint_or_select_hover_pxl_indexes:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_pxl_indexes_newly_painted:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_paint_or_select_hover_pxl_indexes_exception:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_shape_index_a:-1,_select_shape_index_a:-1,_shape_index_b:-1,_select_shape_index_b:-1,_pxl_indexes_of_selection:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_previous_pxl_indexes_of_selection:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32)),_imported_image_previous_start_x:0,_imported_image_previous_start_y:0,_imported_image_start_x:0,_imported_image_start_y:0,_imported_image_pxls:[],_imported_image_width:0,_imported_image_height:0,_imported_image_scale_delta_x:0,_imported_image_scale_delta_y:0,_imported_image_previous_scale_delta_x:0,_imported_image_previous_scale_delta_y:0,_is_on_resize_element:!1,_imported_image_pxl_colors:[],_is_image_import_mode:!1,_previous_image_imported_resizer_index:-1,_selection_pair_highlight:!0,_imported_image_move_from:[-1,-1],_updated_at:Date.now(),_notified_position_at:0,_force_updated_timestamp:0,_loading_base64_img:"",_loading_base64_img_changed:0,_intervals:[],_kb:0,export_state_every_ms:e.export_state_every_ms||6e4,_last_filters_hash:"",_saving_json_state_history_ran_timestamp:0,_processing_filters:!1,canvas_event_target:"CANVAS_WRAPPER_OVERFLOW",mouse_down:!1,cached_background_image_url:"",cached_background_image:""},this.imported_img_data={imported_image_pxls_positioned:[],imported_image_pxl_colors:new Uint32Array(0),image_imported_resizer_index:-1,imported_image_pxls_positioned_keyset:new n.SetFixed((e.pxl_width||32)*(e.pxl_height||32))},this.state_.cursor="",this.images_=Array(25),this.images_[0]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA9ElEQVRYR+3X0Q6FIAgGYDjn/R/5xBmtmjMTmIBd2G3WvsE/VISXPfgyDyyQ1JFbhYiIpI/q94joVukmyPJ/9i+Q1MUpFTpa8wWAzZoxy/puhg7E9b8MlAhiTRnyaJQIQsQPEW1ZKA2I12AWSgvaO5eBsoBSUFZQOErcyx6GHgf9FxH0kU0xJFMjoJD2jYIYZWpffbypI+EBMlWKQWf2WkcXL5AalQlSobJBImoGqIsq51d0hm5n/9beVx5nskG9kbDjZ4Ca7TtLGQ6S7nT19SoFNHqn8xyMnIlrCmtuGikV0kDKNVF7mdXxuN61ZR6qBZKq+Aeqdig0aelV6gAAAABJRU5ErkJggg=="),this.images_[1]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABFUlEQVRYR+2Y2w6EIAxEl///aDYYa7C2dFqryyb4qsBhOr3E8kl4aq2Vb1NKKZGtQ4v4QQ2oP7/xTQckqYNAuhTSQiMp1IAiqrmBpEMWEPlBMy+qEOKrV0OG+GoBWZm3FFoKtUyiXsvV+P8sk3rVfqvN/BmF0eUhfiDJT136J0BSnEklrUUM1hzdQvMVH0kudWikkvQuMhV2vfEyyMFAtElwMhW5pclSBOIhYDe6I8ppLQQkZdMUQJpKafLsBdQ0tTaMZYK4TD010NNhg039lkohoKdU6ir3qfSYE2N2dR4Zeru8lT1TAmWHTQsXpBBV7iyoEQwMlAVlwbiA7kIhMG6gHsoTQhQmBNQXTStD+/fIz6r2/RftLsg0XDwDiAAAAABJRU5ErkJggg=="),this.images_[2]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA80lEQVRYR+3X4Q6DIAwEYHn/h2bBQIJNoXcVHEb2c3PZx11hGo7FXmExz7FBViM7oe8lFGOMctUhBPcouL4oEfXvK77TiyJpUMEURALIQOR7DJICSUxaOQLSritImRwNstJwIC+G94K0uhxpXDZkrptPqIX5C6iHsU7d+vPO8OMJjcK04FRlszFV3XZCT2Bo0I2/I3i04MpSQhuUc1VP6uVmKA/c9NrgGVoWlG+s4F3DXkgl9ERKLtCslNw3aLPOJC2dc/FW70uCRtfWqgtKqAz3KFQPA4NGoSwMBbqLQjA0qEYxFaIYF6jsSu2Zvrdj0UfpHwMA+yX+QNKuAAAAAElFTkSuQmCC"),this.images_[3]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAv0lEQVRYR+2X3Q6AIAiF5f0fmuaFG6OSH9F00a0IX+dAKZTNHtiMpySQ5Mg/FUJEpMoAwKsQSxSqQI2hsiUQb9whhbjf0lS0dWrDUw5qGc9J9956iL6NFob3hSUH33sWEJvWrmBLLJNG1GCpf+wtE5FAkZa5fx0zLNNaW+O6Yx+lUAJJCgwdP2b0kCXnkh5KIE0PuU+MXF6pmHY9BEhbzBInfdtCzkPTgSwFPLGf3zos0EvuZQlkUUCKTcuOU+gCTnb3JcS3RYIAAAAASUVORK5CYII="),this.images_[4]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABH0lEQVRYR+2X4Q7CIAyEy0x8//c1WoNhCWOFawvo1PnTAf24HqUEOtgvzORhZs7XDyHAeHBAD3AEWhki2wlUqvmfCpVGRR7LPSSNLX1lMnWeAiE90bSIb/NdMrp6hRZMjJIWfw+QBFOUmCrI8JTVYDQ1Zfgp64FJaRxbGEsgbbVd8zdaoYWZ79bSn5tpKJCw2JWIbpZjNPRy9ezOAlsbW61DPwl0uJR5VJ6ashMInapToY8plPU77v5Jew+2AnTdZYJ/ltjHIVWbO/be9t55ERYCvQalXjnJfiGiR22nvT0U9IS02wS5m9sLAxWSGq3sv51I5atDa+TN+x+ZrAXVmuuBUStkhfLCmIHWxh2pqnmRmBs0FHTWd3jKZgX+GoWe1olaNCjYBWEAAAAASUVORK5CYII="),this.images_[5]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA+klEQVRYR+3Y0Q6DIAwFUOr+/5NdTY1dkJS1YIsmstexcLhArYP0sA88zJN+IERECw4AQhdxAmlzkXmCaNvK3ePkbkson5jO1gQd23RKIr9xtydUu/7HVn5SSl9LiegZ03Tt+cADwEJnv2dC7TfmwpjXqMikrFV3QcRVQLknZQVR0kNQLaAhqFZQOKoHFIrqBYWhroBCUFdB7igPUBX1ryrXGj0vkIhSnoni3J4gM4r7rbKPp9S8QdRtmtsYqfkLB/GipcknSHtZGJ6QdsveC9LaVPqeDvuQhCwYHjMU1PDnxe7jYuleh6TVW1J7J8iSTPGG7P8sa0WU4zdwA0Y04iTpEgAAAABJRU5ErkJggg=="),this.images_[6]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA7UlEQVRYR+3X2w6EIAwEUPv/H82GRDYE6dUO8KCvEntSBgG6DnvoMM/1gbQZWdKhUkppECISa8JBFdMbqk1CQUEjpnVJQsFAHEZDwUC1cASVDmoBbjmRULOpSwX1xftiniylgWZFJRQX7BSQdVraOOgq04J7h/v/77nHs4141SELRlvm41YSBnkwY5ek/SwEQmEq1A1CYtwgNMYFWoExg1ZhTKCVGBW0GiOCdmBY0C7MFLQT8xqkHdi1K8/s/eNPbe0QAhPuEAoTAiExbhAaw4K4MGrX4EiI0w5oGcVNqwxVyPpd9wHN+uHouONAP0LJ2yWtxGVEAAAAAElFTkSuQmCC"),this.images_[7]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA/0lEQVRYR+3XSw7DIAwE0Pj+h6ZCqiNE/cHAGBbttg1+GagBei770GWe5w/yZiQloVJKYQgRmTXhoIppDdVmoaCgHsMpWSgYSMN4KBioFp5BbQfxAuZ1YqGkqdsKaou3xSJraRtIKmqhtIW9BTQ6Lfw76L/MSOZtykJSahBLCVnTFG2Ibyf39hbt+wjm2wLMDr0EQmEqKjxlSEwYhMaEQBmYYVAWZgiUiXFB2RgTdAKjgk5hRNBJzBCIN0bveDG7BfXP/XRq6ZCVhXET4utUf5XyrjIraZkJSQMjMW5CPQiNUUFa5N41eGWqls5DOwqrL40cfGbs8AFtpkjkmetAH9mVQzQQt8P4AAAAAElFTkSuQmCC"),this.images_[8]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABTUlEQVRYR+2W4RKEIAiEpd7/kS9ubLQxFCGUq5upv5X7uYsghIc98DCe8AJJifzEIUTEDAIAXU13oAhTMkS2HtQUoCS6hhC2MhIKk9/1oIaBsmgSOaA4GAlqCIiJY0XEj1AqO1fLqSGgEMJCxZOIdJjcgOLCFZSKxsmhqA2IuGkiIgXfPG2jkU2F2Xentbfxnal+vPpQ5UwSipBsfBKM1SHOmSXWaTrOp+5cHPGqeVLnr0YmwiSBZm3R5tkqlytAXEx0191Cl6C0QGZn8qDXDlgNkNmZwo04ZfZilwpbAhpyBgDKOPNa5vvQDGdO1xFNz+Nob4Hh+tBtME0g7o5DboNcbYmNT4qtiqwEYnqGG8wVhzK4Nk7JCPZ91yFy/60Gp9R1LVQqoGI4HhoeMKrIWrv0gjEBecKwQL3syTiwlEn3H2mWTReUFnyB/s6hL1JSZjT7s1UhAAAAAElFTkSuQmCC"),this.images_[9]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABoklEQVRYR+2Y61IDMQiFoa2+//tqxdmdJAMJ5JBMR6tTf7ob9gMOl5Tpyf74yXjoXwBdReQzG1lm1k5fiOhrdjYdIRGRash+Y46mjg0vdrDn8xTQAbMCkY3eAdtDIaCLiNx7mJnXGgY5sQoUwjDzjYjuIBI3EfnQUAWgHVsC6tNUo+LlPQLTNurHnf+9EVErEjdlHgwzX1GF9GCBnbUIPQrm+CoqhlTKAiAk/ihrg470ixmgs+lVIXoHqkHdlzwapbUTCrzTHhvPHcG51YRSUdI19JhMf0JAQ6oyMCqKy1AvoBI9oyvd234lQl7DbIO7K8NziJbqeieioToeoaElILVimJauyx0NTSTqNFCmLH80Qn8SKDOjQGM046SfBuG0D1p909XC6DCmHP2YLWKpExdvXLHvpDszXLdWhgwMEQ0b6BZQZu1MAKVgDjt9ylzBzfoGgqlac3ZrV79QQ0GEMjpyl7NiL1yHIZAXgd1rEILxUgZFjVIUPZ9tn/rMUh86PTBX9TmejmT2+pRZ3s0PBKghGm83rk4ZoN0sbZ17AaGwfQNzJa40/U9w+QAAAABJRU5ErkJggg=="),this.images_[10]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABMklEQVRYR+2XwRLDIAhEpen/f3FTOmaajrUgC5jpxVyD+lwXUCoXfszM5/RERMhSUBAyUR9TYVqGyoZAXQLUw1TYvwFlYCr4VIWyMFOBZsBMA5JgTpOj3vlkYySD2jEjmAhUykPaMR3Sd2UHVSoMZHnG+q+dTAgIXQyNa+HcQN5FvPEuIO/kjam/2siocsNAURgvFAQ0yiZv2bCyLwzkBdHi+3IAAb3P/McHWSipNo2Absy8E9FWSnnOhtIKpQp0+qYfiLQKS7lR1RaBrNteBspqIRLQxswP4fp5L6XsozTOKKN2e2330s48SlnKTAFCjY7CiBc0j0LI8Xlg1BujZWrJK9nWYt4YI4+8FsqrjAlkZcygFRyvVeRRKM0Bt44ooHfcArIUWwothSwFrP/LQ5ZCL65vGzRTMXdZAAAAAElFTkSuQmCC"),this.images_[11]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABMklEQVRYR+2XwRLDIAhEpen/f3FTOmaajrUgC5jpxVyD+lwXUCoXfszM5/RERMhSUBAyUR9TYVqGyoZAXQLUw1TYvwFlYCr4VIWyMFOBZsBMA5JgTpOj3vlkYySD2jEjmAhUykPaMR3Sd2UHVSoMZHnG+q+dTAgIXQyNa+HcQN5FvPEuIO/kjam/2siocsNAURgvFAQ0yiZv2bCyLwzkBdHi+3IAAb3P/McHWSipNo2Absy8E9FWSnnOhtIKpQp0+qYfiLQKS7lR1RaBrNteBspqIRLQxswP4fp5L6XsozTOKKN2e2330s48SlnKTAFCjY7CiBc0j0LI8Xlg1BujZWrJK9nWYt4YI4+8FsqrjAlkZcygFRyvVeRRKM0Bt44ooHfcArIUWwothSwFrP/LQ5ZCL65vGzRTMXdZAAAAAElFTkSuQmCC"),this.images_[12]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA/klEQVRYR+XX7Q6FIAgG4Lz/i/bMlo2ZIB++zO30t1xPgEjlOuwqh3mu/wPVWuuYhVIKGwhohBpm9u5m5FAwEIfp0eJQENAM0zNHIzZDbQdxmJ4ieh8O0tRMGkiqGbrRUlK2KmCu+UJSthPT4KGi3o0JgRAYNwiFcYGQGDMIjTGBMjBqUBbGBLof5seYT++TRgxpSjX1oT5srWBejCpCBPHiJVgEswSNJ3MPNR0laCqjGBOI5p0MW3fUZlH0/s2INbTaXSPMi6DrwiDpD8IDdIN21MsM7AKhMK6iRmLMIDTGBMrAqEFZGBXo6cSmM8+z3d9TILIYsTbty7X440A/uhPvJTjQhwcAAAAASUVORK5CYII="),this.images_[13]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAk0lEQVRYR+2YwQ6AIAxD2f9/9AgHDyixrs5kxHotHeVtB9Basc+K5WkKhDpyIeTujkyZuplNGZaBTmsy959qjbPvHeir7h0dCBNaGd72b8yoAt1RFCE0YyIkQogA0jVDIoQIIF0zJEKIANI1Q/8jhE7M6PSdmtks4gm/OiLFmbWPAzHFWQ98ubKFs3z6HYNIliPUAQ/FUDSiymd+AAAAAElFTkSuQmCC"),this.images_[14]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABR0lEQVRYR+3X3Q6CMAwF4DUY3v91NeIxEGYGbv1jXbzQW2R8nI5uo/RjP/J4AEBzHxGZxzffsGK0z1ndVpQJZMHkBK0oNeiMkapWpmhBqUA1jFCKGcDdgxJBDkyulgvFgi5g3KgmqAPGhVKBLJOy0Z8O5ePG6wGaADylflMmHgnKmAeAmUONAGXMViWprNEgFrM/fEopvYqO/VlyepdMg8mJfVBhCXEDV67Fg/b5sm0/yknMYfI9eSnpXbKvViNhhoI0mGGgCuaWUlpq3TpsUjOfcRMTnpC2TGVSoQntgy8AJiJikxnRGPNSsXZeFSa8ZJoj0Pk/oSX7g84112wvuNQs2+HoTf666h9OutK+KfIYZMZsC7Zmglrf8krJVaDWA7iX8Zxa1QnVuq0mWc/HoE7Ig5ImcO2lzKByxyilJJ3VuoEkyJXrb6IrI0OmlalfAAAAAElFTkSuQmCC"),this.images_[15]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABeklEQVRYR82W2w7DIAxDQfv/P57GREWqNM3FlAh1j2trDokdqOVlv/oynnICtdZah6u13iC9Z3JDqzoXoM7SuThUX0D736qs9T6qc6kG/4gWnIGhbyyd/lxuWG5MbY/sWiSiVYug+DNEJwRCRBAgVAcF+pRSfjOJlBUaQKGO6iHq9Uhd2HctadT2Ed4eFEhHTRmL/6e19rXERhXMKrM2uTp8Q/AcklBejK1ZhMwzeFJzMcMfsJbnxWkRDjNacuijKYqCMQWkwFTtv2jRlAp5C2dCQRVCFkTeQSoHAQ2PHIes5Zcso8NAHpR2bj01+hSQBkXT3LmOqHcs6/1pIAmF+GJmJMCTmh0n5KPTU5lQSzdGyzsr7YNujJ5Bs6HC+xCSlkyoEAg1ZBYUChTe9LLSl35jXK3ULWXCM/BNjydrBSqMPW8F6qeV9kGDkRaQwzEaiI8qFYmuPkehqPqPzrJZyAiKW2ELkOcp6cttQBqUFpKtQEhitwMxKHXtP/Eo9zDGipjdAAAAAElFTkSuQmCC"),this.images_[16]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA/klEQVRYR+XX7Q6FIAgG4Lz/i/bMlo2ZIB++zO30t1xPgEjlOuwqh3mu/wPVWuuYhVIKGwhohBpm9u5m5FAwEIfp0eJQENAM0zNHIzZDbQdxmJ4ieh8O0tRMGkiqGbrRUlK2KmCu+UJSthPT4KGi3o0JgRAYNwiFcYGQGDMIjTGBMjBqUBbGBLof5seYT++TRgxpSjX1oT5srWBejCpCBPHiJVgEswSNJ3MPNR0laCqjGBOI5p0MW3fUZlH0/s2INbTaXSPMi6DrwiDpD8IDdIN21MsM7AKhMK6iRmLMIDTGBMrAqEFZGBXo6cSmM8+z3d9TILIYsTbty7X440A/uhPvJTjQhwcAAAAASUVORK5CYII="),this.images_[17]=(0,s.createLocalBlob)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABBElEQVRYR+3XyxLCIAwF0PL/H43DIk7EvG5KoOPoGuVwk1jarod92sM8lwnqvXcObq2VH8AFkWHYfgbEk/YOVZ7QwPBKe0mXgmYM9aOFeoPmBqYv8x6SJlIrgYbxUB8gdIi8+DOo5SBKmpKzUNKBlpaMb843Q3ppWVNLm1oordxLQNGy0LrQlEkTpJWAr/Uad6wVklKDuJVQBOON+RyEC9IerghmTsm6YaSe3lWYAYVBlRgYVI2BQDswYdAuTAi0E+OCdmNM0AmMCjqFEUEnMbdB3o0x8xL69U8dTagCk06oCpMCVWJgUDVGBWnN6L0GZ5oYuqCt2AD9Dfg+hG6Arv+DvMReyBw3NCzTf+YAAAAASUVORK5CYII="),this.key="",this.notifiers_update=t,this.new_canvas_context_2d=_}set_cursor(e,t){var i,n,a,r,s;this.state_.mouse_down=0|e,this.state_.canvas_event_target=t+"",i=""+this.state_.tool,n=""+this.state_.select_mode,a=this.state_._is_image_import_mode,r=this.state_._is_on_resize_element,s=this.state_.cursor+"",a?r?this.state_.cursor=`url("${this.images_[0]}") 18 18, auto`:this.state_.mouse_down?this.state_.cursor=`url("${this.images_[2]}") 20 24, auto`:this.state_.cursor=`url("${this.images_[1]}") 20 18, auto`:"MOVE"!=i&&!this.state_.canvas_event_target.includes("CANVAS_WRAPPER")||this.state_.mouse_down?("MOVE"==i||this.state_.canvas_event_target.includes("CANVAS_WRAPPER"))&&this.state_.mouse_down?this.state_.cursor="grabbing":"RECTANGLE"==i?this.state_.cursor='url("'+this.images_[3]+'") 27 12, auto':"ELLIPSE"==i?this.state_.cursor='url("'+this.images_[4]+'") 25 9, auto':"LINE"==i?this.state_.cursor='url("'+this.images_[5]+'") 32 32, auto':"PENCIL"==i?this.state_.cursor='url("'+this.images_[6]+'") 5 32, auto':"PENCIL PERFECT"==i?this.state_.cursor='url("'+this.images_[7]+'") 5 32, auto':"PICKER"==i?this.state_.cursor='url("'+this.images_[8]+'") 5 32, auto':"EXCHANGE"==i?this.state_.cursor='url("'+this.images_[9]+'") 18 18, auto':"BUCKET"==i?this.state_.cursor='url("'+this.images_[10]+'") 6 25, auto':"HUE BUCKET"==i?this.state_.cursor='url("'+this.images_[11]+'") 6 25, auto':"CONTOUR"==i?this.state_.cursor='url("'+this.images_[12]+'") 8 33, auto':"BORDER"==i?this.state_.cursor='url("'+this.images_[13]+'") 18 18, auto':"SET PENCIL MIRROR"==i?this.state_.cursor='url("'+this.images_[14]+'") 18 18, auto':"SELECT COLOR THRESHOLD"==i?this.state_.cursor='url("'+this.images_[15]+'") 7 7, auto':"SELECT PATH"==i?this.state_.cursor='url("'+this.images_[16]+'") 8 33, auto':"SELECT PIXEL"==i?"ADD"==n||"REPLACE"==n?this.state_.cursor='url("'+this.images_[17]+'") 5 32, auto':"REMOVE"==n?this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAA9klEQVRYR+3XQRKDMAgFUHP/Q6eTBR2MgQ8I0YXdmpHnh2jajpf92ss8xwdCHdmSUO+9E6S1ptYsBw0MNwybhioFzRhKSUP9QTxW1Gd+XXpaCYNQJxBo78WJ4o+g0kGUNCWnoVYPlNoyXpwX88xS2lCvimooqd0pIGtbaJ1pl3l2Fl+LBnesXSQlBnErIQsGbfM5iDDIg5lT0roRAlVhBtQNqsS4QdUYF2gHxgzahTGBdmIgaDdGBT2BEUFPYZagJzG3QejEGPlgX97U1oQqMOGEqjAhUCXGDarGiCBpGNHf4MgQpx3QMoqv7uE+D1VB6L4fCCX8A+VV8SWc4ctzAAAAAElFTkSuQmCC") 5 32, auto':"REPLACE"==n&&(this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABNUlEQVRYR+3X4Q6EIAgAYLn3f+a42aIZgYCFddv165aXfiKYQXnZBS/zlN8AISICwKeUgiyCgIgLAKRN5NTxhimIWBiKMNTmRtU+aWLWZA6dEoYeblAVUSOzB2xrM1FKn+pzvGGPQouqvwWMtKSHFeYYNlERJd08odpRhKUUC1XDWCgtdCLKi2kGrcWh7izSst8OogSm5O1FygsaXrJ28HawSC7dltTSoD2UVqW3lL13Wdge56uy6MZoVVPNaCFS7n1orQjvq8ODscqcl6C502o1G8HwKPVOGEOgLMz6RoiehzIxYVA2JgSagXGDZmFcoJkYEzQb0wU9gVFBT2FE0JOYyyDvQT+y+aqfQVYnGZjhCGVhhkCZmDAoG6OCtPyxPoOtvPO0h48fnk6v/OcPsqL3ugh9ATjCXTQqEhJmAAAAAElFTkSuQmCC") 18 18, auto'):"SELECT PIXEL PERFECT"==i?"ADD"==n?this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABFUlEQVRYR+3XWQ7DIAwE0HD/QxNRycil3oZigqrmm4jHmLVch33lMM9lgmqtlYNLKekDcEFkaLafAfGkvUGlJ9QwvNJe0qmgEUPz0UJ10DiB6Wc+h6QVqZVAw3ioNxC6iLz4Z1DLQZQ0JWehpAEtLRnvnHeGzKVlk1rq1EJp5V4CipaF2oVWmbSCtBLwtkYyvZmQlBrEVwlZZUI3xL7NWKe9dbgimNaHt0WEQBo2C9P6g68TmRgYlI2BQDswYdAuTAi0E+OCdmNM0BMYFfQURgQ9iQmBaMv3rherHpwfO7V0wu/CuAnRw3W8a0cPypnUzISUO1LqCxYCZSajXj+099mrvug7aaJm8PVjog/olz/Ii+u4hG5e9580PRb9NQAAAABJRU5ErkJggg==") 5 32, auto':"REMOVE"==n?this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABBklEQVRYR+3Xyw6EMAgFUPn/j+6kCwwqj14t1Emc7TRyvFSqtL3sRy/zbB8o6khJQq21xhAicmumgzpGGrrNQ6WCzhhOyUPtIBlr1Gf5v3W3FiZCHUBBey/OKP47qOkgTpqT81DaDU1tmSwuiyF7adqm1op6KKvdU0CjbeF1Q08Z8mTJtU4y+zIlKTOIRwl5bUIH4j7JE5KhaD95NW8lhCTTi0fz6jBo0YQyMd0CJZSNgUAVmGFQFWYIVIkJQdUYF7QCY4JWYVTQSswQiKfsk+MAGb6Xwai9ZFVhwoT4c+r8ro2cTUg6IUi7WCYGBmVjTJAVc/QZjLZHWw+d9jMKRtf4QH+X0A98MFk0IsucOwAAAABJRU5ErkJggg==") 5 32, auto':"REPLACE"==n&&(this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABUklEQVRYR9WX7RKEIAhFZd//mZcdG2mIQMDS2v3VbAbHi3wI5WU/eBlP+Q8gREQA+JRSUCgIiPgFgGkbORluMAURi4AiGHoXhqo2aWPeZg5GCYY+ZlAVoiqzC9beuVCGTfM7+WJXgUPVZwVGC+khwhJGbFSF0v48QXEvSijVRLVgPChLOhUqCsOc1uQwK4sW9tuB6ADT4e0pFQUaDhl3zp1lztJth1pz2oOysvSWtI+GRdS4WJZlC2NHGbVmtfXhOrQZibaOXpiyBXGv5KPdPgPTNlmLq1vZ3QUa8CyYrSNkFZoJkwaaDZMCWgETBloFEwJaCeMCrYbpAj0BYwI9BaMCPQkTAqIxwRsvsgXWWm9eg3j/WQXjKkTXKdkTo1egEdW6ChmNNdS1R2BchaTRmcqY8xC/9kqgyDwzqszlAe2q43CWzXIUtZse0KKGR9e9DugHz47FNAGTbH0AAAAASUVORK5CYII=") 5 32, auto'):i.includes("SELECT")?"ADD"==n?this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAkElEQVRYR+2XQQqAMAwEm/8/OpKDUApmUwoScbwmpdNpXNRGs8ea8QyA1I1g6H+G3N3nU5vZ0RgcLQ6QALoZgg2gdSgxpF5TDGEoM7CG3lPvnEPKaNSzrEqDcR7YykaVHhWe3wOqnPq1K6vAkEPKEoYwpAyoOjNUMdTqI18B79aP/zp2N1T9AGFIGVD1djN0AfXGlCWHImsNAAAAAElFTkSuQmCC") 18 18, auto':"REMOVE"==n?this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAb0lEQVRYR+2UQQrAIBDEdv7/6C0+oAYWClriNbiOcTB12MphecpA9CIa0hAZIG6HNEQGiNshDZEB4tsOdXfTgAlP8nouBtrsnWSpdcd/BRppgE1jQ1+EoZl+jBoiA8TtkIbIAHE7pCEyQNwOXWfoAYpLFiWYvOCxAAAAAElFTkSuQmCC") 18 18, auto':"REPLACE"==n&&(this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABCElEQVRYR+2X3Q6DMAiFwb3/I8+zYFbj5ixwmixsqTdeWNqPw09RpdijxXhkAnkRmQr9p0IAoKo3EVk9Dy++LwDuquqmiLvgCbMCWEgoBbCq2sv86kN1gRqMiCzmOQBJQjVlmnDNsctzPYWad3skElCUrQdkIMzGjM3mdAQoC0XDZICiUEMwWSAPymrAqonJt90mGrJje3mvnK36NtpBGEahBnYKzZE4UYmnPsoo1IUagRlR6GM+kc3zRSVWoVIhK5XUvT7z9bKPNL3Imu4EE82hzEGZtVTZMwcwNqHLld6YnBL6t33FAc3uKZs7a4ywLeNKDfnkXwZtFi17+oCs4QTyFJsK/ZxCD73aLDSws54nAAAAAElFTkSuQmCC") 18 18, auto'):this.state_.cursor='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAq0lEQVRYR+1WQQrAIAxb///oDmUOkc3W2kEG2XHQGpPURg6wTzLwqKr2fUQk3Ddc2AMogBqGgo2ARpkhGaKHZtMIKRmnjJLtrBBIU0O9QzvsjrUpyzUd0BgfvAdYWz3StzLUm7KBuWLEKzZPzHjqO8SWElXuX7UnLCCvTCvTFJYsAuarGswp270tQ77FIOQuY0BjQLOM+zuGVlbK7HIpLzXH3vIXGfIwlGXqE9034xUtxdxDAAAAAElFTkSuQmCC") 18 18, auto':this.state_.cursor="grab",s!==this.state_.cursor&&this.notifiers_update()}paint_shape(e,t,i,a,r){a=void 0===a?{}:a,r=void 0===r?function(){}:r,this.state_._s_layers[this.state_._layer_index].paint_uint32a(e instanceof n.SetFixed?e.indexes:e,(0|t)>>>0,Math.fround(i)),this.set_state(a).then(r)}set_state(e,t){t=t||!1;var i=!1;if("pxl_width"in(e="object"!=typeof e?{}:e)&&"pxl_height"in e&&(this.state_.pxl_width===e.pxl_width&&this.state_.pxl_height===e.pxl_height||(this.shape_creator=new h(e.pxl_width,e.pxl_height))),"tool"in e&&this.state_.tool!==e.tool&&(i=!0),"select_mode"in e&&this.state_.select_mode===e.select_mode&&(i=!0),"_is_image_import_mode"in e&&this.state_._is_image_import_mode===e._is_image_import_mode&&(i=!0),""in e&&this.state_._is_on_resize_element===e._is_on_resize_element&&(i=!0),"pxl_current_color"in e&&(this.state_.pxl_current_color_uint32=a.Color.new_hex(e.pxl_current_color).uint32),("show_original_image_in_background"in e||"_base64_original_images"in e||"_original_image_index"in e||"show_transparent_image_in_background"in e||"pxl_width"in e||"pxl_height"in e)&&(!this.state_.cached_background_image_url||void 0!==e._original_image_index&&this.state_._original_image_index!==e._original_image_index||void 0!==e.show_original_image_in_background&&this.state_.show_original_image_in_background!==e.show_original_image_in_background||void 0!==e.show_transparent_image_in_background&&this.state_.show_transparent_image_in_background!==e.show_transparent_image_in_background||e._base64_original_images&&this.state_._base64_original_images.length!==e._base64_original_images.length)&&(this.state_.show_original_image_in_background&&void 0!==this.state_._base64_original_images[this.state_._original_image_index]?(this.state_.cached_background_image_url&&URL.revokeObjectURL(this.state_.cached_background_image_url),this.state_.cached_background_image_url=(0,s.createLocalBlob)(this.state_._base64_original_images[this.state_._original_image_index]),this.state_.cached_background_image=`center / cover no-repeat url("${this.state_.cached_background_image_url}")${this.state_.show_transparent_image_in_background?`, repeating-conic-gradient(rgb(248 248 248 / 100%) 0% 25%, rgb(235 235 235 / 100%) 0% 50%) left top 50% / calc(200% / ${this.state_.pxl_width}) calc(200% / ${this.state_.pxl_height})`:""}`):this.state_.show_transparent_image_in_background?this.state_.cached_background_image=`repeating-conic-gradient(rgb(248 248 248 / 100%) 0% 25%, rgb(235 235 235 / 100%) 0% 50%) left top 50% / calc(200% / ${this.state_.pxl_width}) calc(200% / ${this.state_.pxl_height})`:this.state_.cached_background_image=""),t)this.state_=Object.assign(this.state_,e);else for(this.key in e)this.state_[this.key]=e[this.key];return i&&this.set_cursor(),Promise.resolve()}get_state(){return this.state_}get_notified_pos_at(){return 0|this.state_._notified_position_at}get_imported_image_data(){var e,t,i,r;if(this.state_._imported_image_pxls.length>0){let s=this.new_canvas_context_2d(this.state_._imported_image_width,this.state_._imported_image_height);this.state_._imported_image_pxls.forEach(((e,t)=>{const i=t%this.state_._imported_image_width,n=(t-i)/this.state_._imported_image_width;s.fillStyle=a.Color.new_uint32(this.state_._imported_image_pxl_colors[e]).hex,s.fillRect(i,n,1,1)}));const o=this.state_._imported_image_width+this.state_._imported_image_scale_delta_x,_=this.state_._imported_image_height+this.state_._imported_image_scale_delta_y;let l=this.new_canvas_context_2d(o,_);l.drawImage(s.canvas,0,0,this.state_._imported_image_width,this.state_._imported_image_height,0,0,o,_);let h=l.getImageData(0,0,o,_);const{new_pxls:c,new_pxl_colors:p}=this.get_pixels_palette_and_list_from_image_data(h);let d={},u=new n.SetFixed(this.state_.pxl_width*this.state_.pxl_height),m=-1;if(c.length>0)for(m=this.state_._imported_image_start_x+o+(this.state_._imported_image_start_y+_)*this.state_.pxl_width|0,e=Uint32Array.of(o,this.state_._imported_image_start_x,this.state_._imported_image_start_y,this.state_.pxl_width,this.state_.pxl_height),t=Uint32Array.of(0,0,0,0,0),i=0,r=c.length;(0|i)<(0|r);i=i+1|0)t[0]=i%e[0],t[1]=(i-t[0])/e[0],t[2]=t[0]+e[1],t[3]=t[1]+e[2],t[4]=t[3]*e[3]+t[2],t[2]>=0&&t[2]=0&&t[3]0&&_>0){h=a?_+o:1-(1-_)*(1-o);const e=_/h,t=o*(1-_)/h;l.set(Uint8ClampedArray.of(s[0]*e+r[0]*t,s[1]*e+r[1]*t,s[2]*e+r[2]*t),0)}else _>0?(h=s[3]/255,l.set(s,0)):(h=r[3]/255,l.set(r,0));return a&&(h/=2),l[3]=255*h|0,this.to_uint32_from_rgba(l)},blend_rgba_colors:function(e,t,i,n){i|=0,n|=0;let a=e[0].length/4|0,r=0|e.length,s=new Uint8ClampedArray(e[0].length),o=new Uint8ClampedArray(4),_=new ArrayBuffer(4),l=new Uint8ClampedArray(_),h=new ArrayBuffer(4),c=new DataView(h),p=new Uint8ClampedArray(h),d=new DataView(new ArrayBuffer(24));d.setFloat32(20,(65535*t|0)/65535);let u=0;for(let m=0,f=0;(0|m)<(0|a);m=(m+1|0)>>>0,f=(f+4|0)>>>0){u=0,o.set(e[0].slice(f,f+4|0),0);for(let t=1;(0|t)<(0|r);t=t+1|0)l.set(e[t].slice(f,f+4|0),0),0!==i&&0===l[3]&&1===d.getFloat32(20)?o.fill(0):255===l[3]&&1===d.getFloat32(20)?o.set(l,0):(d.setFloat32(0,o[3]/255),d.setFloat32(4,l[3]/255*d.getFloat32(20)),p.fill(0),d.setFloat32(8,0),d.getFloat32(0)>0&&d.getFloat32(4)>0?(n>0?d.setFloat32(8,d.getFloat32(0)+d.getFloat32(4)):d.setFloat32(8,1-(1-d.getFloat32(4))*(1-d.getFloat32(0))),d.setFloat32(12,d.getFloat32(4)/d.getFloat32(8)),d.setFloat32(16,d.getFloat32(0)*(1-d.getFloat32(4))/d.getFloat32(8)),c.setUint8(0,l[0]*d.getFloat32(12)+o[0]*d.getFloat32(16)),c.setUint8(1,l[1]*d.getFloat32(12)+o[1]*d.getFloat32(16)),c.setUint8(2,l[2]*d.getFloat32(12)+o[2]*d.getFloat32(16))):d.getFloat32(4)>0?(d.setFloat32(2,l[3]/255),p.set(l,0)):(d.setFloat32(2,o[3]/255),p.set(o,0)),n&&d.setFloat32(2,d.getFloat32(8)/2),p.fill(255*d.getFloat32(8),3,4),o.set(p));s.set(o,f)}return s},to_hex_from_uint32:function(e){return e=(0|e)>>>0,"#".concat("00000000".concat(new Uint32Array(new Uint8Array(Uint32Array.of(e).buffer).reverse().buffer).toString(16)).slice(-8))},to_hex_from_rgba:function(e){return"#".concat("00000000".concat(new Uint32Array(e.buffer)[0].toString(16)).slice(-8))},to_rgba_from_hex:function(e){return new Uint8ClampedArray(Uint32Array.of(parseInt(e.slice(1),16)).buffer)},to_rgba_from_uint32:function(e){return e=(0|e)>>>0,new Uint8ClampedArray(Uint32Array.of(e).buffer)},to_uint32_from_rgba:function(e){return(0|new Uint32Array(e.buffer)[0])>>>0},to_uint32_from_hex:function(e){return new Uint32Array(new Uint8Array(Uint32Array.of((0|parseInt(e.slice(1),16))>>>0).buffer).reverse().buffer)},to_hsla_from_rgba:function(e){let[t,i,n,a]=e;t/=255,i/=255,n/=255,a/=255;const r=Math.max(t,i,n),s=Math.min(t,i,n);let o,_,l=(r+s)/2;if(r==s)o=_=0;else{var h=r-s;switch(_=l>.5?h/(2-r-s):h/(r+s),r){case t:o=(i-n)/h+(i1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}const l=s<.5?s*(1+r):s+r-s*r,h=2*s-l;t=_(h,l,a+1/3),i=_(h,l,a),n=_(h,l,a-1/3)}return Uint8ClampedArray.of(255*t|0,255*i|0,255*n|0,255*o|0)},invert_uint32:function(e){e=(0|e)>>>0;const[t,i,n,a]=this.to_rgba_from_uint32(e);return this.to_uint32_from_rgba(Uint8ClampedArray.of(255-t|0,255-i|0,255-n|0,0|a))},match_color:function(e,t,i){if(e&=4294967295,t&=4294967295,1===(i=void 0===i?null:i))return!0;if(0===i)return e===t;{const n=255*i|0,a=this.to_rgba_from_uint32(e),r=this.to_rgba_from_uint32(t),s=0|Math.abs(a[3]-r[3]),o=0|Math.abs(a[0]-r[0]),_=0|Math.abs(a[1]-r[1]),l=0|Math.abs(a[2]-r[2]);return null!==i?o>>0)l=4294967295&t[(0|e[(0|i)>>>0])>>>0],void 0===(n=s.get(l))&&(n=(0|s.size)>>>0,s.set(l,n)),_[i]=(0|n)>>>0;for(r of(a=new Uint32Array(s.size),s))a[r[1]]=4294967295&r[0];return Array.of(_,a)}}}};e.exports=a},936:function(e,t,i){"use strict";!function(t){function n(e){return e&&e.__esModule?e:{default:e}}var a=n(i(715)),r=n(i(716));const s={_get_64_js:()=>({xxh_f:{create64:function(e){return a.default.h64(e)}},xxh_v:"64",xxh_t:"js",xxh_tt:Date.now()}),_get_64_wasm:()=>new Promise((function(e,t){try{(0,r.default)().then((function(t){e({xxh_f:{hasher:t,create64:function(e){return this.hasher.create64(BigInt(e))}},xxh_v:"64",xxh_t:"wasm",xxh_tt:Date.now()})})).catch((function(e){t()}))}catch(i){t()}})),new(){const e=Uint8Array.from("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((function(e){return e.charCodeAt(0)}))),i=BigInt(e.length);let n=new Uint8Array(14),a=this._get_64_js,r=this._get_64_wasm,s=a();return r().then((function(e){s=e})),{get_info:function(){return{version:s.xxh_v,type:s.xxh_t,timestamp:s.xxh_tt}},base58_that:function(a){let r=0,o=BigInt(0),_=BigInt(s.xxh_f.create64(64222).update(a instanceof Uint8Array||a instanceof Uint8ClampedArray?a:new Uint8Array("string"==typeof a?t.from(a):"buffer"in a?a.buffer:a)).digest());for(;_>0;)o=_%i,_/=i,n[0|r]=65535&e[o],r=r+1&15;return""+String.fromCharCode.apply(null,n.slice(0,0|r))}}}};e.exports=s}(i(210).Buffer)}}]); \ No newline at end of file diff --git a/service-worker.js b/service-worker.js index d036f897..a0018a64 100644 --- a/service-worker.js +++ b/service-worker.js @@ -32,10 +32,10 @@ var LOAD_FILES_USEFUL = ["/src/fonts/normative/index.css"].concat(["illusion.jpg var LOAD_FILES_STATIC = ["sfx/md/hero_decorative-celebration-02", "sfx/md/navigation_selection-complete-celebration", "sfx/md/navigation_transition-left", "sfx/md/state-change_confirm-down", "sfx/md/ui_lock", "sfx/md/ui_unlock", "sfx/md/ui_scan", "sfx/md/alert_high-intensity", "sfx/md/navigation_transition-right", "voice/cn/accessing_memory", "voice/cn/complete", "voice/cn/please_wait", "voice/cn/data_upload", "voice/cn/processing", "voice/cn/enhanced", "voice/cn/rewriting_deep_layer_protocols", "voice/cn/vision_activated", "voice/cn/vision_deactivated", "voice/cn/filtering", "music/redeclipse/track_09"].map(F_SND).concat(["presentation", "tutorial", "create", "enhanced", "pixelated", "upload", "share1", "joke1", "create", "enhanced", "pixelated", "presentation", "presentation2", "sponsors", "tutorial", "upload", "labintro", "share2", "share3", "share4", "share5", "share6", "share7", "joke2", "joke3", "joke4", "joke5", "joke6", "joke7", "joke8", "joke9", "joke10", "joke11"].map(F_VID)); // Cache names -var REQUIRED_CACHE = "unless-update-cache-v1024-required"; -var USEFUL_CACHE = "unless-update-cache-v1024-useful"; -var STATIC_CACHE = "unless-update-cache-v1024-static"; -var OTHER_CACHE = "unless-update-cache-v1024-other"; +var REQUIRED_CACHE = "unless-update-cache-v1025-required"; +var USEFUL_CACHE = "unless-update-cache-v1025-useful"; +var STATIC_CACHE = "unless-update-cache-v1025-static"; +var OTHER_CACHE = "unless-update-cache-v1025-other"; // Regular expressions for chunk matching var MAIN_CHILD_CHUNK_REGEX = /chunk_(main_[a-z0-9]+)\.min\.js$/i; diff --git a/src/js/components/canvaspixels/utils/SuperMasterMeta.js b/src/js/components/canvaspixels/utils/SuperMasterMeta.js index 169ba45c..823f5c49 100644 --- a/src/js/components/canvaspixels/utils/SuperMasterMeta.js +++ b/src/js/components/canvaspixels/utils/SuperMasterMeta.js @@ -348,8 +348,8 @@ const SuperMasterMeta = { state._old_pxl_width = parseInt(pxl_width); state._old_pxl_height = parseInt(pxl_height); state._last_paint_timestamp = +requested_at; - _pxl_indexes_of_current_shape.clear(); _pxl_indexes_of_old_shape.setFromSetFixed(_pxl_indexes_of_current_shape); + _pxl_indexes_of_current_shape.clear(); return render_binding(); }, false, clear_canvas || is_there_new_dimension || force_update, Date.now(), "render").finally(resolve0); });