UNPKG

s2-dbi

Version:

effective spreadsheet render core lib

30 lines (26 loc) 593 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).S2={})}(this,(function(t){"use strict";var e=Object.freeze({__proto__:null,get Base(){return Ei},get Circle(){return _i},get Ellipse(){return Ii},get Image(){return Mi},get Line(){return Ni},get Marker(){return ki},get Path(){return Xi},get Polygon(){return Zi},get Polyline(){return Qi},get Rect(){return to},get Text(){return no}}),n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i.apply(this,arguments)};var o=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},a={}.toString,l=function(t,e){return a.call(t)==="[object "+e+"]"},s=function(t){return l(t,"Function")},u=function(t){return null==t},c=function(t){return Array.isArray?Array.isArray(t):l(t,"Array")},h=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function d(t,e){if(t)if(c(t))for(var n=0,r=t.length;n<r&&!1!==e(t[n],n);n++);else if(h(t))for(var i in t)if(t.hasOwnProperty(i)&&!1===e(t[i],i))break}var f=function(t){return"object"==typeof t&&null!==t},p=function(t){if(c(t))return t.reduce((function(t,e){return Math.max(t,e)}),t[0])},v=function(t){if(c(t))return t.reduce((function(t,e){return Math.min(t,e)}),t[0])},g=function(t){return l(t,"String")},y=function(t){return l(t,"Number")};var m=function(t,e){return(t%e+e)%e},C=Math.PI/180,w=function(t){return C*t},x=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return d(t,(function(n,r){s(t)&&"prototype"===r||e.push(n)})),e},S=function(t){var e=function(t){return u(t)?"":t.toString()}(t);return e.charAt(0).toUpperCase()+e.substring(1)};function E(t,e){for(var n in e)e.hasOwnProperty(n)&&"constructor"!==n&&void 0!==e[n]&&(t[n]=e[n])}function T(t,e,n,r){return e&&E(t,e),n&&E(t,n),r&&E(t,r),t}var _,b=function(t,e){if(t===e)return!0;if(!t||!e)return!1;if(g(t)||g(e))return!1;if(o(t)||o(e)){if(t.length!==e.length)return!1;for(var n=!0,r=0;r<t.length&&(n=b(t[r],e[r]));r++);return n}if(f(t)||f(e)){var i=Object.keys(t),a=Object.keys(e);if(i.length!==a.length)return!1;for(n=!0,r=0;r<i.length&&(n=b(t[i[r]],e[i[r]]));r++);return n}return!1},L={},I=function(t){return L[t=t||"g"]?L[t]+=1:L[t]=1,t+L[t]},O=function(){};!function(t,e){if(!s(t))throw new TypeError("Expected a function");var n=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var l=t.apply(this,r);return a.set(o,l),l};n.cache=new Map}((function(t,e){void 0===e&&(e={});var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return _||(_=document.createElement("canvas").getContext("2d")),_.font=[o,a,i,n+"px",r].join(" "),_.measureText(g(t)?t:"").width}),(function(t,e){return void 0===e&&(e={}), /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,l=o.length;a<l;a++,i++)r[i]=o[a];return r}([t],x(e)).join("")}));var R="\t\n\v\f\r   ᠎              \u2028\u2029",M=new RegExp("([a-z])["+R+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+R+"]*,?["+R+"]*)+)","ig"),A=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+R+"]*,?["+R+"]*","ig"),B=function(t){if(!t)return null;if(c(t))return t;var e={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},n=[];return String(t).replace(M,(function(r,i,o){var a=[],l=i.toLowerCase();if(o.replace(A,(function(t,e){e&&a.push(+e)})),"m"===l&&a.length>2&&(n.push([i].concat(a.splice(0,2))),l="l",i="m"===i?"l":"L"),"o"===l&&1===a.length&&n.push([i,a[0]]),"r"===l)n.push([i].concat(a));else for(;a.length>=e[l]&&(n.push([i].concat(a.splice(0,e[l]))),e[l]););return t})),n},N=function(t,e){for(var n=[],r=0,i=t.length;i-2*!e>r;r+=2){var o=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?i-4===r?o[3]={x:+t[0],y:+t[1]}:i-2===r&&(o[2]={x:+t[0],y:+t[1]},o[3]={x:+t[2],y:+t[3]}):o[0]={x:+t[i-2],y:+t[i-1]}:i-4===r?o[3]=o[2]:r||(o[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n},D=function(t,e,n,r,i){var o=[];if(null===i&&null===r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!==i){var a=Math.PI/180,l=t+n*Math.cos(-r*a),s=t+n*Math.cos(-i*a);o=[["M",l,e+n*Math.sin(-r*a)],["A",n,n,0,+(i-r>180),0,s,e+n*Math.sin(-i*a)]]}else o=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return o},P=function(t){if(!(t=B(t))||!t.length)return[["M",0,0]];var e,n,r=[],i=0,o=0,a=0,l=0,s=0;"M"===t[0][0]&&(a=i=+t[0][1],l=o=+t[0][2],s++,r[0]=["M",i,o]);for(var u=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase(),c=void 0,h=void 0,d=s,f=t.length;d<f;d++){if(r.push(c=[]),(e=(h=t[d])[0])!==e.toUpperCase())switch(c[0]=e.toUpperCase(),c[0]){case"A":c[1]=h[1],c[2]=h[2],c[3]=h[3],c[4]=h[4],c[5]=h[5],c[6]=+h[6]+i,c[7]=+h[7]+o;break;case"V":c[1]=+h[1]+o;break;case"H":c[1]=+h[1]+i;break;case"R":for(var p=2,v=(n=[i,o].concat(h.slice(1))).length;p<v;p++)n[p]=+n[p]+i,n[++p]=+n[p]+o;r.pop(),r=r.concat(N(n,u));break;case"O":r.pop(),(n=D(i,o,h[1],h[2])).push(n[0]),r=r.concat(n);break;case"U":r.pop(),r=r.concat(D(i,o,h[1],h[2],h[3])),c=["U"].concat(r[r.length-1].slice(-2));break;case"M":a=+h[1]+i,l=+h[2]+o;break;default:for(p=1,v=h.length;p<v;p++)c[p]=+h[p]+(p%2?i:o)}else if("R"===e)n=[i,o].concat(h.slice(1)),r.pop(),r=r.concat(N(n,u)),c=["R"].concat(h.slice(-2));else if("O"===e)r.pop(),(n=D(i,o,h[1],h[2])).push(n[0]),r=r.concat(n);else if("U"===e)r.pop(),r=r.concat(D(i,o,h[1],h[2],h[3])),c=["U"].concat(r[r.length-1].slice(-2));else for(var g=0,y=h.length;g<y;g++)c[g]=h[g];if("O"!==(e=e.toUpperCase()))switch(c[0]){case"Z":i=+a,o=+l;break;case"H":i=c[1];break;case"V":o=c[1];break;case"M":a=c[c.length-2],l=c[c.length-1];break;default:i=c[c.length-2],o=c[c.length-1]}}return r},k=function(t,e,n,r){return[t,e,n,r,n,r]},z=function(t,e,n,r,i,o){var a=1/3,l=2/3;return[a*t+l*n,a*e+l*r,a*i+l*n,a*o+l*r,i,o]},F=function(t,e,n,r,i,o,a,l,s,u){n===r&&(n+=1);var c,h,d,f,p,v=120*Math.PI/180,g=Math.PI/180*(+i||0),y=[],m=function(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}};if(u)h=u[0],d=u[1],f=u[2],p=u[3];else{t=(c=m(t,e,-g)).x,e=c.y,l=(c=m(l,s,-g)).x,s=c.y,t===l&&e===s&&(l+=1,s+=1);var C=(t-l)/2,w=(e-s)/2,x=C*C/(n*n)+w*w/(r*r);x>1&&(n*=x=Math.sqrt(x),r*=x);var S=n*n,E=r*r,T=(o===a?-1:1)*Math.sqrt(Math.abs((S*E-S*w*w-E*C*C)/(S*w*w+E*C*C)));f=T*n*w/r+(t+l)/2,p=T*-r*C/n+(e+s)/2,h=Math.asin(((e-p)/r).toFixed(9)),d=Math.asin(((s-p)/r).toFixed(9)),h=t<f?Math.PI-h:h,d=l<f?Math.PI-d:d,h<0&&(h=2*Math.PI+h),d<0&&(d=2*Math.PI+d),a&&h>d&&(h-=2*Math.PI),!a&&d>h&&(d-=2*Math.PI)}var _=d-h;if(Math.abs(_)>v){var b=d,L=l,I=s;d=h+v*(a&&d>h?1:-1),l=f+n*Math.cos(d),s=p+r*Math.sin(d),y=F(l,s,n,r,i,0,a,L,I,[d,b,f,p])}_=d-h;var O=Math.cos(h),R=Math.sin(h),M=Math.cos(d),A=Math.sin(d),B=Math.tan(_/4),N=4/3*n*B,D=4/3*r*B,P=[t,e],k=[t+N*R,e-D*O],z=[l+N*A,s-D*M],H=[l,s];if(k[0]=2*P[0]-k[0],k[1]=2*P[1]-k[1],u)return[k,z,H].concat(y);for(var W=[],G=0,U=(y=[k,z,H].concat(y).join().split(",")).length;G<U;G++)W[G]=G%2?m(y[G-1],y[G],g).y:m(y[G],y[G+1],g).x;return W},H=function(t,e){var n,r=P(t),i=e&&P(e),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},l=[],s=[],u="",c="",h=function(t,e,n){var r,i;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in{T:1,Q:1})&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"].concat(F.apply(0,[e.x,e.y].concat(t.slice(1))));break;case"S":"C"===n||"S"===n?(r=2*e.x-e.bx,i=2*e.y-e.by):(r=e.x,i=e.y),t=["C",r,i].concat(t.slice(1));break;case"T":"Q"===n||"T"===n?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"].concat(z(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"].concat(z(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"].concat(k(e.x,e.y,t[1],t[2]));break;case"H":t=["C"].concat(k(e.x,e.y,t[1],e.y));break;case"V":t=["C"].concat(k(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"].concat(k(e.x,e.y,e.X,e.Y))}return t},d=function(t,e){if(t[e].length>7){t[e].shift();for(var o=t[e];o.length;)l[e]="A",i&&(s[e]="A"),t.splice(e++,0,["C"].concat(o.splice(0,6)));t.splice(e,1),n=Math.max(r.length,i&&i.length||0)}},f=function(t,e,o,a,l){t&&e&&"M"===t[l][0]&&"M"!==e[l][0]&&(e.splice(l,0,["M",a.x,a.y]),o.bx=0,o.by=0,o.x=t[l][1],o.y=t[l][2],n=Math.max(r.length,i&&i.length||0))};n=Math.max(r.length,i&&i.length||0);for(var p=0;p<n;p++){r[p]&&(u=r[p][0]),"C"!==u&&(l[p]=u,p&&(c=l[p-1])),r[p]=h(r[p],o,c),"A"!==l[p]&&"C"===u&&(l[p]="C"),d(r,p),i&&(i[p]&&(u=i[p][0]),"C"!==u&&(s[p]=u,p&&(c=s[p-1])),i[p]=h(i[p],a,c),"A"!==s[p]&&"C"===u&&(s[p]="C"),d(i,p)),f(r,i,o,a,p),f(i,r,a,o,p);var v=r[p],g=i&&i[p],y=v.length,m=i&&g.length;o.x=v[y-2],o.y=v[y-1],o.bx=parseFloat(v[y-4])||o.x,o.by=parseFloat(v[y-3])||o.y,a.bx=i&&(parseFloat(g[m-4])||a.x),a.by=i&&(parseFloat(g[m-3])||a.y),a.x=i&&g[m-2],a.y=i&&g[m-1]}return i?[r,i]:r},W=/,?([a-z]),?/gi,G=function(t){return t.join(",").replace(W,"$1")},U=function(t,e,n,r,i){return t*(t*(-3*e+9*n-9*r+3*i)+6*e-12*n+6*r)-3*e+3*n},Y=function(t,e,n,r,i,o,a,l,s){null===s&&(s=1);for(var u=(s=s>1?1:s<0?0:s)/2,c=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,f=0;f<12;f++){var p=u*c[f]+u,v=U(p,t,n,i,a),g=U(p,e,r,o,l),y=v*v+g*g;d+=h[f]*Math.sqrt(y)}return u*d},V=function(t,e,n,r,i,o,a,l){for(var s,u,c,h,d=[],f=[[],[]],p=0;p<2;++p)if(0===p?(u=6*t-12*n+6*i,s=-3*t+9*n-9*i+3*a,c=3*n-3*t):(u=6*e-12*r+6*o,s=-3*e+9*r-9*o+3*l,c=3*r-3*e),Math.abs(s)<1e-12){if(Math.abs(u)<1e-12)continue;(h=-c/u)>0&&h<1&&d.push(h)}else{var v=u*u-4*c*s,g=Math.sqrt(v);if(!(v<0)){var y=(-u+g)/(2*s);y>0&&y<1&&d.push(y);var m=(-u-g)/(2*s);m>0&&m<1&&d.push(m)}}for(var C,w=d.length,x=w;w--;)C=1-(h=d[w]),f[0][w]=C*C*C*t+3*C*C*h*n+3*C*h*h*i+h*h*h*a,f[1][w]=C*C*C*e+3*C*C*h*r+3*C*h*h*o+h*h*h*l;return f[0][x]=t,f[1][x]=e,f[0][x+1]=a,f[1][x+1]=l,f[0].length=f[1].length=x+2,{min:{x:Math.min.apply(0,f[0]),y:Math.min.apply(0,f[1])},max:{x:Math.max.apply(0,f[0]),y:Math.max.apply(0,f[1])}}},j=function(t,e,n,r,i,o,a,l){if(!(Math.max(t,n)<Math.min(i,a)||Math.min(t,n)>Math.max(i,a)||Math.max(e,r)<Math.min(o,l)||Math.min(e,r)>Math.max(o,l))){var s=(t-n)*(o-l)-(e-r)*(i-a);if(s){var u=((t*r-e*n)*(i-a)-(t-n)*(i*l-o*a))/s,c=((t*r-e*n)*(o-l)-(e-r)*(i*l-o*a))/s,h=+u.toFixed(2),d=+c.toFixed(2);if(!(h<+Math.min(t,n).toFixed(2)||h>+Math.max(t,n).toFixed(2)||h<+Math.min(i,a).toFixed(2)||h>+Math.max(i,a).toFixed(2)||d<+Math.min(e,r).toFixed(2)||d>+Math.max(e,r).toFixed(2)||d<+Math.min(o,l).toFixed(2)||d>+Math.max(o,l).toFixed(2)))return{x:u,y:c}}}},X=function(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height},K=function(t,e,n,r,i){if(i)return[["M",+t+ +i,e],["l",n-2*i,0],["a",i,i,0,0,1,i,i],["l",0,r-2*i],["a",i,i,0,0,1,-i,i],["l",2*i-n,0],["a",i,i,0,0,1,-i,-i],["l",0,2*i-r],["a",i,i,0,0,1,i,-i],["z"]];var o=[["M",t,e],["l",n,0],["l",0,r],["l",-n,0],["z"]];return o.parsePathArray=G,o},q=function(t,e,n,r){return null===t&&(t=e=n=r=0),null===e&&(e=t.y,n=t.width,r=t.height,t=t.x),{x:t,y:e,width:n,w:n,height:r,h:r,x2:t+n,y2:e+r,cx:t+n/2,cy:e+r/2,r1:Math.min(n,r)/2,r2:Math.max(n,r)/2,r0:Math.sqrt(n*n+r*r)/2,path:K(t,e,n,r),vb:[t,e,n,r].join(" ")}},Z=function(t,e,n,r,i,o,a,l){c(t)||(t=[t,e,n,r,i,o,a,l]);var s=V.apply(null,t);return q(s.min.x,s.min.y,s.max.x-s.min.x,s.max.y-s.min.y)},$=function(t,e,n,r,i,o,a,l,s){var u=1-s,c=Math.pow(u,3),h=Math.pow(u,2),d=s*s,f=d*s,p=t+2*s*(n-t)+d*(i-2*n+t),v=e+2*s*(r-e)+d*(o-2*r+e),g=n+2*s*(i-n)+d*(a-2*i+n),y=r+2*s*(o-r)+d*(l-2*o+r);return{x:c*t+3*h*s*n+3*u*s*s*i+f*a,y:c*e+3*h*s*r+3*u*s*s*o+f*l,m:{x:p,y:v},n:{x:g,y:y},start:{x:u*t+s*n,y:u*e+s*r},end:{x:u*i+s*a,y:u*o+s*l},alpha:90-180*Math.atan2(p-g,v-y)/Math.PI}},Q=function(t,e,n){if(!function(t,e){return t=q(t),e=q(e),X(e,t.x,t.y)||X(e,t.x2,t.y)||X(e,t.x,t.y2)||X(e,t.x2,t.y2)||X(t,e.x,e.y)||X(t,e.x2,e.y)||X(t,e.x,e.y2)||X(t,e.x2,e.y2)||(t.x<e.x2&&t.x>e.x||e.x<t.x2&&e.x>t.x)&&(t.y<e.y2&&t.y>e.y||e.y<t.y2&&e.y>t.y)}(Z(t),Z(e)))return n?0:[];for(var r=~~(Y.apply(0,t)/8),i=~~(Y.apply(0,e)/8),o=[],a=[],l={},s=n?0:[],u=0;u<r+1;u++){var c=$.apply(0,t.concat(u/r));o.push({x:c.x,y:c.y,t:u/r})}for(u=0;u<i+1;u++){c=$.apply(0,e.concat(u/i));a.push({x:c.x,y:c.y,t:u/i})}for(u=0;u<r;u++)for(var h=0;h<i;h++){var d=o[u],f=o[u+1],p=a[h],v=a[h+1],g=Math.abs(f.x-d.x)<.001?"y":"x",y=Math.abs(v.x-p.x)<.001?"y":"x",m=j(d.x,d.y,f.x,f.y,p.x,p.y,v.x,v.y);if(m){if(l[m.x.toFixed(4)]===m.y.toFixed(4))continue;l[m.x.toFixed(4)]=m.y.toFixed(4);var C=d.t+Math.abs((m[g]-d[g])/(f[g]-d[g]))*(f.t-d.t),w=p.t+Math.abs((m[y]-p[y])/(v[y]-p[y]))*(v.t-p.t);C>=0&&C<=1&&w>=0&&w<=1&&(n?s+=1:s.push({x:m.x,y:m.y,t1:C,t2:w}))}}return s};function J(t,e){var n=[],r=[];return t.length&&function t(e,i){if(1===e.length)n.push(e[0]),r.push(e[0]);else{for(var o=[],a=0;a<e.length-1;a++)0===a&&n.push(e[0]),a===e.length-2&&r.push(e[a+1]),o[a]=[(1-i)*e[a][0]+i*e[a+1][0],(1-i)*e[a][1]+i*e[a+1][1]];t(o,i)}}(t,e),{left:n,right:r.reverse()}}var tt=function(t,e,n){if(1===n)return[[].concat(t)];var r=[];if("L"===e[0]||"C"===e[0]||"Q"===e[0])r=r.concat(function(t,e,n){var r=[[t[1],t[2]]];n=n||2;var i=[];"A"===e[0]?(r.push(e[6]),r.push(e[7])):"C"===e[0]?(r.push([e[1],e[2]]),r.push([e[3],e[4]]),r.push([e[5],e[6]])):"S"===e[0]||"Q"===e[0]?(r.push([e[1],e[2]]),r.push([e[3],e[4]])):r.push([e[1],e[2]]);for(var o=r,a=1/n,l=0;l<n-1;l++){var s=J(o,a/(1-a*l));i.push(s.left),o=s.right}return i.push(o),i.map((function(t){var e=[];return 4===t.length&&(e.push("C"),e=e.concat(t[2])),t.length>=3&&(3===t.length&&e.push("Q"),e=e.concat(t[1])),2===t.length&&e.push("L"),e.concat(t[t.length-1])}))}(t,e,n));else{var i=[].concat(t);"M"===i[0]&&(i[0]="L");for(var o=0;o<=n-1;o++)r.push(i)}return r},et=function(t,e){if(t.length!==e.length)return!1;var n=!0;return d(t,(function(t,r){if(t!==e[r])return n=!1,!1})),n};function nt(t,e,n){var r=null,i=n;return e<i&&(i=e,r="add"),t<i&&(i=t,r="del"),{type:r,min:i}}var rt=function(t,e){var n=function(t,e){var n,r,i=t.length,o=e.length,a=0;if(0===i||0===o)return null;for(var l=[],s=0;s<=i;s++)l[s]=[],l[s][0]={min:s};for(var u=0;u<=o;u++)l[0][u]={min:u};for(s=1;s<=i;s++)for(n=t[s-1],u=1;u<=o;u++){r=e[u-1],a=et(n,r)?0:1;var c=l[s-1][u].min+1,h=l[s][u-1].min+1,d=l[s-1][u-1].min+a;l[s][u]=nt(c,h,d)}return l}(t,e),r=t.length,i=e.length,o=[],a=1,l=1;if(n[r][i].min!==r){for(var s=1;s<=r;s++){var u=n[s][s].min;l=s;for(var c=a;c<=i;c++)n[s][c].min<u&&(u=n[s][c].min,l=c);a=l,n[s][a].type&&o.push({index:s-1,type:n[s][a].type})}for(s=o.length-1;s>=0;s--)a=o[s].index,"add"===o[s].type?t.splice(a,0,[].concat(t[a])):t.splice(a,1)}var h=i-(r=t.length);if(r<i)for(s=0;s<h;s++)"z"===t[r-1][0]||"Z"===t[r-1][0]?t.splice(r-2,0,t[r-2]):t.push(t[r-1]),r+=1;return t};function it(t,e,n){for(var r,i=[].concat(t),o=1/(n+1),a=ot(e)[0],l=1;l<=n;l++)o*=l,0===(r=Math.floor(t.length*o))?i.unshift([a[0]*o+t[r][0]*(1-o),a[1]*o+t[r][1]*(1-o)]):i.splice(r,0,[a[0]*o+t[r][0]*(1-o),a[1]*o+t[r][1]*(1-o)]);return i}function ot(t){var e=[];switch(t[0]){case"M":case"L":case"T":e.push([t[1],t[2]]);break;case"A":e.push([t[6],t[7]]);break;case"Q":case"S":e.push([t[3],t[4]]),e.push([t[1],t[2]]);break;case"C":e.push([t[5],t[6]]),e.push([t[1],t[2]]),e.push([t[3],t[4]]);break;case"H":case"V":e.push([t[1],t[1]])}return e}var at=function(t,e){if(t.length<=1)return t;for(var n,r=0;r<e.length;r++)if(t[r][0]!==e[r][0])switch(n=ot(t[r]),e[r][0]){case"M":t[r]=["M"].concat(n[0]);break;case"L":t[r]=["L"].concat(n[0]);break;case"A":t[r]=[].concat(e[r]),t[r][6]=n[0][0],t[r][7]=n[0][1];break;case"Q":if(n.length<2){if(!(r>0)){t[r]=e[r];break}n=it(n,t[r-1],1)}t[r]=["Q"].concat(n.reduce((function(t,e){return t.concat(e)}),[]));break;case"T":t[r]=["T"].concat(n[0]);break;case"C":if(n.length<3){if(!(r>0)){t[r]=e[r];break}n=it(n,t[r-1],2)}t[r]=["C"].concat(n.reduce((function(t,e){return t.concat(e)}),[]));break;case"S":if(n.length<2){if(!(r>0)){t[r]=e[r];break}n=it(n,t[r-1],1)}t[r]=["S"].concat(n.reduce((function(t,e){return t.concat(e)}),[]));break;default:t[r]=e[r]}return t},lt=Object.freeze({__proto__:null,catmullRomToBezier:N,fillPath:function(t,e){if(1===t.length)return t;var n=t.length-1,r=e.length-1,i=n/r,o=[];if(1===t.length&&"M"===t[0][0]){for(var a=0;a<r-n;a++)t.push(t[0]);return t}for(a=0;a<r;a++){var l=Math.floor(i*a);o[l]=(o[l]||0)+1}var s=o.reduce((function(e,r,i){return i===n?e.concat(t[n]):e.concat(tt(t[i],t[i+1],r))}),[]);return s.unshift(t[0]),"Z"!==e[r]&&"z"!==e[r]||s.push("Z"),s},fillPathByDiff:rt,formatPath:at,intersection:function(t,e){return function(t,e,n){var r,i,o,a,l,s,u,c,h,d;t=H(t),e=H(e);for(var f=n?0:[],p=0,v=t.length;p<v;p++){var g=t[p];if("M"===g[0])r=l=g[1],i=s=g[2];else{"C"===g[0]?(h=[r,i].concat(g.slice(1)),r=h[6],i=h[7]):(h=[r,i,r,i,l,s,l,s],r=l,i=s);for(var y=0,m=e.length;y<m;y++){var C=e[y];if("M"===C[0])o=u=C[1],a=c=C[2];else{"C"===C[0]?(d=[o,a].concat(C.slice(1)),o=d[6],a=d[7]):(d=[o,a,o,a,u,c,u,c],o=u,a=c);var w=Q(h,d,n);if(n)f+=w;else{for(var x=0,S=w.length;x<S;x++)w[x].segment1=p,w[x].segment2=y,w[x].bez1=h,w[x].bez2=d;f=f.concat(w)}}}}}return f}(t,e)},parsePathArray:G,parsePathString:B,pathToAbsolute:P,pathToCurve:H,rectPath:K}),st=function(){function t(t,e){this.bubbles=!0,this.target=null,this.currentTarget=null,this.delegateTarget=null,this.delegateObject=null,this.defaultPrevented=!1,this.propagationStopped=!1,this.shape=null,this.fromShape=null,this.toShape=null,this.propagationPath=[],this.type=t,this.name=t,this.originalEvent=e,this.timeStamp=e.timeStamp}return t.prototype.preventDefault=function(){this.defaultPrevented=!0,this.originalEvent.preventDefault&&this.originalEvent.preventDefault()},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t.prototype.toString=function(){return"[Event (type="+this.type+")]"},t.prototype.save=function(){},t.prototype.restore=function(){},t}(),ut=function(t,e){return ut=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},ut(t,e)};function ct(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}ut(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var ht=function(){function t(){this._events={}}return t.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this._events[t]||[],o=this._events["*"]||[],a=function(r){for(var i=r.length,o=0;o<i;o++)if(r[o]){var a=r[o],l=a.callback;a.once&&(r.splice(o,1),0===r.length&&delete e._events[t],i--,o--),l.apply(e,n)}};a(i),a(o)},t.prototype.off=function(t,e){if(t)if(e){for(var n=this._events[t]||[],r=n.length,i=0;i<r;i++)n[i].callback===e&&(n.splice(i,1),r--,i--);0===n.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function dt(t,e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}var ft="undefined"!=typeof window&&void 0!==window.document;function pt(t,e){if(t.isCanvas())return!0;for(var n=e.getParent(),r=!1;n;){if(n===t){r=!0;break}n=n.getParent()}return r}function vt(t){return t.cfg.visible&&t.cfg.capture}var gt=function(t){function e(e){var n=t.call(this)||this;n.destroyed=!1;var r=n.getDefaultCfg();return n.cfg=T(r,e),n}return ct(e,t),e.prototype.getDefaultCfg=function(){return{}},e.prototype.get=function(t){return this.cfg[t]},e.prototype.set=function(t,e){this.cfg[t]=e},e.prototype.destroy=function(){this.cfg={destroyed:!0},this.off(),this.destroyed=!0},e}(ht),yt=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},mt=function(t,e,n){this.name=t,this.version=e,this.os=n,this.type="browser"},Ct=function(t){this.version=t,this.type="node",this.name="node",this.os=process.platform},wt=function(t,e,n,r){this.name=t,this.version=e,this.os=n,this.bot=r,this.type="bot-device"},xt=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},St=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},Et=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Tt=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],_t=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function bt(t){var e=function(t){return""!==t&&Tt.reduce((function(e,n){var r=n[0],i=n[1];if(e)return e;var o=i.exec(t);return!!o&&[r,o]}),!1)}(t);if(!e)return null;var n=e[0],r=e[1];if("searchbot"===n)return new xt;var i=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);i?i.length<3&&(i=yt(yt([],i,!0),function(t){for(var e=[],n=0;n<t;n++)e.push("0");return e}(3-i.length),!0)):i=[];var o=i.join("."),a=function(t){for(var e=0,n=_t.length;e<n;e++){var r=_t[e],i=r[0];if(r[1].exec(t))return i}return null}(t),l=Et.exec(t);return l&&l[1]?new wt(n,o,a,l[1]):new mt(n,o,a)}var Lt,It="undefined"!=typeof Float32Array?Float32Array:Array;function Ot(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],l=e[4],s=e[5],u=e[6],c=e[7],h=e[8],d=n[0],f=n[1],p=n[2],v=n[3],g=n[4],y=n[5],m=n[6],C=n[7],w=n[8];return t[0]=d*r+f*a+p*u,t[1]=d*i+f*l+p*c,t[2]=d*o+f*s+p*h,t[3]=v*r+g*a+y*u,t[4]=v*i+g*l+y*c,t[5]=v*o+g*s+y*h,t[6]=m*r+C*a+w*u,t[7]=m*i+C*l+w*c,t[8]=m*o+C*s+w*h,t}function Rt(t,e,n){var r=e[0],i=e[1],o=e[2];return t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8],t}function Mt(t,e,n){var r=[0,0,0,0,0,0,0,0,0];return function(t,e){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1}(r,n),Ot(t,r,e)}function At(t,e,n){var r=[0,0,0,0,0,0,0,0,0];return function(t,e){var n=Math.sin(e),r=Math.cos(e);t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(r,n),Ot(t,r,e)}function Bt(t,e,n){var r=[0,0,0,0,0,0,0,0,0];return function(t,e){t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1}(r,n),Ot(t,r,e)}function Nt(t,e,n){return Ot(t,n,e)}function Dt(t,e){for(var n=t?[].concat(t):[1,0,0,0,1,0,0,0,1],r=0,i=e.length;r<i;r++){var o=e[r];switch(o[0]){case"t":Mt(n,n,[o[1],o[2]]);break;case"s":Bt(n,n,[o[1],o[2]]);break;case"r":At(n,n,o[1]);break;case"m":Nt(n,n,o[1])}}return n}function Pt(t,e){var n=[],r=t[0],i=t[1],o=t[2],a=t[3],l=t[4],s=t[5],u=t[6],c=t[7],h=t[8],d=e[0],f=e[1],p=e[2],v=e[3],g=e[4],y=e[5],m=e[6],C=e[7],w=e[8];return n[0]=d*r+f*a+p*u,n[1]=d*i+f*l+p*c,n[2]=d*o+f*s+p*h,n[3]=v*r+g*a+y*u,n[4]=v*i+g*l+y*c,n[5]=v*o+g*s+y*h,n[6]=m*r+C*a+w*u,n[7]=m*i+C*l+w*c,n[8]=m*o+C*s+w*h,n}function kt(t,e){var n=[],r=e[0],i=e[1];return n[0]=t[0]*r+t[3]*i+t[6],n[1]=t[1]*r+t[4]*i+t[7],n}function zt(t){var e=[],n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],l=t[5],s=t[6],u=t[7],c=t[8],h=c*a-l*u,d=-c*o+l*s,f=u*o-a*s,p=n*h+r*d+i*f;return p?(p=1/p,e[0]=h*p,e[1]=(-c*r+i*u)*p,e[2]=(l*r-i*a)*p,e[3]=d*p,e[4]=(c*n-i*s)*p,e[5]=(-l*n+i*o)*p,e[6]=f*p,e[7]=(-u*n+r*s)*p,e[8]=(a*n-r*o)*p,e):null}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Lt=new It(3),It!=Float32Array&&(Lt[0]=0,Lt[1]=0,Lt[2]=0),function(){var t=function(){var t=new It(2);return It!=Float32Array&&(t[0]=0,t[1]=0),t}()}();var Ft=Dt,Ht="matrix",Wt=["zIndex","capture","visible","type"],Gt=["repeat"];function Ut(t,e){var n={},r=e.attrs;for(var i in t)n[i]=r[i];return n}function Yt(t,e){var n={},r=e.attr();return d(t,(function(t,e){-1!==Gt.indexOf(e)||b(r[e],t)||(n[e]=t)})),n}function Vt(t,e){if(e.onFrame)return t;var n=e.startTime,r=e.delay,i=e.duration,o=Object.prototype.hasOwnProperty;return d(t,(function(t){n+r<t.startTime+t.delay+t.duration&&i>t.delay&&d(e.toAttrs,(function(e,n){o.call(t.toAttrs,n)&&(delete t.toAttrs[n],delete t.fromAttrs[n])}))})),t}var jt=function(t){function e(e){var n=t.call(this,e)||this;n.attrs={};var r=n.getDefaultAttrs();return T(r,e.attrs),n.attrs=r,n.initAttrs(r),n.initAnimate(),n}return ct(e,t),e.prototype.getDefaultCfg=function(){return{visible:!0,capture:!0,zIndex:0}},e.prototype.getDefaultAttrs=function(){return{matrix:this.getDefaultMatrix(),opacity:1}},e.prototype.onCanvasChange=function(t){},e.prototype.initAttrs=function(t){},e.prototype.initAnimate=function(){this.set("animable",!0),this.set("animating",!1)},e.prototype.isGroup=function(){return!1},e.prototype.getParent=function(){return this.get("parent")},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.attr=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=e[0],i=e[1];if(!r)return this.attrs;if(h(r)){for(var o in r)this.setAttr(o,r[o]);return this.afterAttrsChange(r),this}return 2===e.length?(this.setAttr(r,i),this.afterAttrsChange(((t={})[r]=i,t)),this):this.attrs[r]},e.prototype.isClipped=function(t,e){var n=this.getClip();return n&&!n.isHit(t,e)},e.prototype.setAttr=function(t,e){var n=this.attrs[t];n!==e&&(this.attrs[t]=e,this.onAttrChange(t,e,n))},e.prototype.onAttrChange=function(t,e,n){"matrix"===t&&this.set("totalMatrix",null)},e.prototype.afterAttrsChange=function(t){if(this.cfg.isClipShape){var e=this.cfg.applyTo;e&&e.onCanvasChange("clip")}else this.onCanvasChange("attr")},e.prototype.show=function(){return this.set("visible",!0),this.onCanvasChange("show"),this},e.prototype.hide=function(){return this.set("visible",!1),this.onCanvasChange("hide"),this},e.prototype.setZIndex=function(t){this.set("zIndex",t);var e=this.getParent();return e&&e.sort(),this},e.prototype.toFront=function(){var t=this.getParent();if(t){var e=t.getChildren();this.get("el");var n=e.indexOf(this);e.splice(n,1),e.push(this),this.onCanvasChange("zIndex")}},e.prototype.toBack=function(){var t=this.getParent();if(t){var e=t.getChildren();this.get("el");var n=e.indexOf(this);e.splice(n,1),e.unshift(this),this.onCanvasChange("zIndex")}},e.prototype.remove=function(t){void 0===t&&(t=!0);var e=this.getParent();e?(dt(e.getChildren(),this),e.get("clearing")||this.onCanvasChange("remove")):this.onCanvasChange("remove"),t&&this.destroy()},e.prototype.resetMatrix=function(){this.attr(Ht,this.getDefaultMatrix()),this.onCanvasChange("matrix")},e.prototype.getMatrix=function(){return this.attr(Ht)},e.prototype.setMatrix=function(t){this.attr(Ht,t),this.onCanvasChange("matrix")},e.prototype.getTotalMatrix=function(){var t=this.cfg.totalMatrix;if(!t){var e=this.attr("matrix"),n=this.cfg.parentMatrix;t=n&&e?Pt(n,e):e||n,this.set("totalMatrix",t)}return t},e.prototype.applyMatrix=function(t){var e=this.attr("matrix"),n=null;n=t&&e?Pt(t,e):e||t,this.set("totalMatrix",n),this.set("parentMatrix",t)},e.prototype.getDefaultMatrix=function(){return null},e.prototype.applyToMatrix=function(t){var e=this.attr("matrix");return e?kt(e,t):t},e.prototype.invertFromMatrix=function(t){var e=this.attr("matrix");if(e){var n=zt(e);if(n)return kt(n,t)}return t},e.prototype.setClip=function(t){var e=this.getCanvas(),n=null;if(t){var r=this.getShapeBase()[S(t.type)];r&&(n=new r({type:t.type,isClipShape:!0,applyTo:this,attrs:t.attrs,canvas:e}))}return this.set("clipShape",n),this.onCanvasChange("clip"),n},e.prototype.getClip=function(){var t=this.cfg.clipShape;return t||null},e.prototype.clone=function(){var t=this,e=this.attrs,n={};d(e,(function(t,r){c(e[r])?n[r]=function(t){for(var e=[],n=0;n<t.length;n++)c(t[n])?e.push([].concat(t[n])):e.push(t[n]);return e}(e[r]):n[r]=e[r]}));var r=new(0,this.constructor)({attrs:n});return d(Wt,(function(e){r.set(e,t.get(e))})),r},e.prototype.destroy=function(){this.destroyed||(this.attrs={},t.prototype.destroy.call(this))},e.prototype.isAnimatePaused=function(){return this.get("_pause").isPaused},e.prototype.animate=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this.get("timeline")||this.get("canvas")){this.set("animating",!0);var n=this.get("timeline");n||(n=this.get("canvas").get("timeline"),this.set("timeline",n));var r=this.get("animations")||[];n.timer||n.initTimer();var i,o,a,l,u,c=t[0],d=t[1],f=t[2],p=void 0===f?"easeLinear":f,v=t[3],g=void 0===v?O:v,m=t[4],C=void 0===m?0:m;s(c)?(i=c,c={}):h(c)&&c.onFrame&&(i=c.onFrame,o=c.repeat),h(d)?(d=(u=d).duration,p=u.easing||"easeLinear",C=u.delay||0,o=u.repeat||o||!1,g=u.callback||O,a=u.pauseCallback||O,l=u.resumeCallback||O):(y(g)&&(C=g,g=null),s(p)?(g=p,p="easeLinear"):p=p||"easeLinear");var w=Yt(c,this),x={fromAttrs:Ut(w,this),toAttrs:w,duration:d,easing:p,repeat:o,callback:g,pauseCallback:a,resumeCallback:l,delay:C,startTime:n.getTime(),id:I(),onFrame:i,pathFormatted:!1};r.length>0?r=Vt(r,x):n.addAnimator(this),r.push(x),this.set("animations",r),this.set("_pause",{isPaused:!1})}},e.prototype.stopAnimate=function(t){var e=this;void 0===t&&(t=!0),d(this.get("animations"),(function(n){t&&(n.onFrame?e.attr(n.onFrame(1)):e.attr(n.toAttrs)),n.callback&&n.callback()})),this.set("animating",!1),this.set("animations",[])},e.prototype.pauseAnimate=function(){var t=this.get("timeline"),e=this.get("animations"),n=t.getTime();return d(e,(function(t){t._paused=!0,t._pauseTime=n,t.pauseCallback&&t.pauseCallback()})),this.set("_pause",{isPaused:!0,pauseTime:n}),this},e.prototype.resumeAnimate=function(){var t=this.get("timeline").getTime(),e=this.get("animations"),n=this.get("_pause").pauseTime;return d(e,(function(e){e.startTime=e.startTime+(t-n),e._paused=!1,e._pauseTime=null,e.resumeCallback&&e.resumeCallback()})),this.set("_pause",{isPaused:!1}),this.set("animations",e),this},e.prototype.emitDelegation=function(t,e){var n,r=this,i=e.propagationPath;this.getEvents(),"mouseenter"===t?n=e.fromShape:"mouseleave"===t&&(n=e.toShape);for(var o=function(t){var o=i[t],l=o.get("name");if(l){if((o.isGroup()||o.isCanvas&&o.isCanvas())&&n&&pt(o,n))return"break";c(l)?d(l,(function(t){r.emitDelegateEvent(o,t,e)})):a.emitDelegateEvent(o,l,e)}},a=this,l=0;l<i.length;l++){if("break"===o(l))break}},e.prototype.emitDelegateEvent=function(t,e,n){var r=this.getEvents(),i=e+":"+n.type;(r[i]||r["*"])&&(n.name=i,n.currentTarget=t,n.delegateTarget=this,n.delegateObject=t.get("delegateObject"),this.emit(i,n))},e.prototype.translate=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0);var n=this.getMatrix(),r=Ft(n,[["t",t,e]]);return this.setMatrix(r),this},e.prototype.move=function(t,e){var n=this.attr("x")||0,r=this.attr("y")||0;return this.translate(t-n,e-r),this},e.prototype.moveTo=function(t,e){return this.move(t,e)},e.prototype.scale=function(t,e){var n=this.getMatrix(),r=Ft(n,[["s",t,e||t]]);return this.setMatrix(r),this},e.prototype.rotate=function(t){var e=this.getMatrix(),n=Ft(e,[["r",t]]);return this.setMatrix(n),this},e.prototype.rotateAtStart=function(t){var e=this.attr(),n=e.x,r=e.y,i=this.getMatrix(),o=Ft(i,[["t",-n,-r],["r",t],["t",n,r]]);return this.setMatrix(o),this},e.prototype.rotateAtPoint=function(t,e,n){var r=this.getMatrix(),i=Ft(r,[["t",-t,-e],["r",n],["t",t,e]]);return this.setMatrix(i),this},e}(gt),Xt={};function Kt(t,e){if(t.set("canvas",e),t.isGroup()){var n=t.get("children");n.length&&n.forEach((function(t){Kt(t,e)}))}}function qt(t,e){if(t.set("timeline",e),t.isGroup()){var n=t.get("children");n.length&&n.forEach((function(t){qt(t,e)}))}}var Zt,$t,Qt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ct(e,t),e.prototype.isCanvas=function(){return!1},e.prototype.getBBox=function(){var t=1/0,e=-1/0,n=1/0,r=-1/0,i=[],o=[],a=this.getChildren().filter((function(t){return t.get("visible")&&(!t.isGroup()||t.isGroup()&&t.getChildren().length>0)}));return a.length>0?(d(a,(function(t){var e=t.getBBox();i.push(e.minX,e.maxX),o.push(e.minY,e.maxY)})),t=v(i),e=p(i),n=v(o),r=p(o)):(t=0,e=0,n=0,r=0),{x:t,y:n,minX:t,minY:n,maxX:e,maxY:r,width:e-t,height:r-n}},e.prototype.getCanvasBBox=function(){var t=1/0,e=-1/0,n=1/0,r=-1/0,i=[],o=[],a=this.getChildren().filter((function(t){return t.get("visible")&&(!t.isGroup()||t.isGroup()&&t.getChildren().length>0)}));return a.length>0?(d(a,(function(t){var e=t.getCanvasBBox();i.push(e.minX,e.maxX),o.push(e.minY,e.maxY)})),t=v(i),e=p(i),n=v(o),r=p(o)):(t=0,e=0,n=0,r=0),{x:t,y:n,minX:t,minY:n,maxX:e,maxY:r,width:e-t,height:r-n}},e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.children=[],e},e.prototype.onAttrChange=function(e,n,r){if(t.prototype.onAttrChange.call(this,e,n,r),"matrix"===e){var i=this.getTotalMatrix();this._applyChildrenMarix(i)}},e.prototype.applyMatrix=function(e){var n=this.getTotalMatrix();t.prototype.applyMatrix.call(this,e);var r=this.getTotalMatrix();r!==n&&this._applyChildrenMarix(r)},e.prototype._applyChildrenMarix=function(t){d(this.getChildren(),(function(e){e.applyMatrix(t)}))},e.prototype.addShape=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],r=t[1];h(n)?r=n:r.type=n;var i=Xt[r.type];i||(i=S(r.type),Xt[r.type]=i);var o=this.getShapeBase(),a=new o[i](r);return this.add(a),a},e.prototype.addGroup=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n,r=t[0],i=t[1];if(s(r))n=new r(i||{parent:this});else{var o=r||{},a=this.getGroupBase();n=new a(o)}return this.add(n),n},e.prototype.getCanvas=function(){return this.isCanvas()?this:this.get("canvas")},e.prototype.getShape=function(t,e,n){if(!vt(this))return null;var r,i=this.getChildren();if(this.isCanvas())r=this._findShape(i,t,e,n);else{var o=[t,e,1];o=this.invertFromMatrix(o),this.isClipped(o[0],o[1])||(r=this._findShape(i,o[0],o[1],n))}return r},e.prototype._findShape=function(t,e,n,r){for(var i=null,o=t.length-1;o>=0;o--){var a=t[o];if(vt(a)&&(a.isGroup()?i=a.getShape(e,n,r):a.isHit(e,n)&&(i=a)),i)break}return i},e.prototype.add=function(t){var e=this.getCanvas(),n=this.getChildren(),r=this.get("timeline"),i=t.getParent();i&&function(t,e,n){void 0===n&&(n=!0),n?e.destroy():(e.set("parent",null),e.set("canvas",null)),dt(t.getChildren(),e)}(i,t,!1),t.set("parent",this),e&&Kt(t,e),r&&qt(t,r),n.push(t),t.onCanvasChange("add"),this._applyElementMatrix(t)},e.prototype._applyElementMatrix=function(t){var e=this.getTotalMatrix();e&&t.applyMatrix(e)},e.prototype.getChildren=function(){return this.get("children")},e.prototype.sort=function(){var t,e=this.getChildren();d(e,(function(t,e){return t._INDEX=e,t})),e.sort((t=function(t,e){return t.get("zIndex")-e.get("zIndex")},function(e,n){var r=t(e,n);return 0===r?e._INDEX-n._INDEX:r})),this.onCanvasChange("sort")},e.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var t=this.getChildren(),e=t.length-1;e>=0;e--)t[e].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},e.prototype.destroy=function(){this.get("destroyed")||(this.clear(),t.prototype.destroy.call(this))},e.prototype.getFirst=function(){return this.getChildByIndex(0)},e.prototype.getLast=function(){var t=this.getChildren();return this.getChildByIndex(t.length-1)},e.prototype.getChildByIndex=function(t){return this.getChildren()[t]},e.prototype.getCount=function(){return this.getChildren().length},e.prototype.contain=function(t){return this.getChildren().indexOf(t)>-1},e.prototype.removeChild=function(t,e){void 0===e&&(e=!0),this.contain(t)&&t.remove(e)},e.prototype.findAll=function(t){var e=[];return d(this.getChildren(),(function(n){t(n)&&e.push(n),n.isGroup()&&(e=e.concat(n.findAll(t)))})),e},e.prototype.find=function(t){var e=null;return d(this.getChildren(),(function(n){if(t(n)?e=n:n.isGroup()&&(e=n.find(t)),e)return!1})),e},e.prototype.findById=function(t){return this.find((function(e){return e.get("id")===t}))},e.prototype.findByClassName=function(t){return this.find((function(e){return e.get("className")===t}))},e.prototype.findAllByName=function(t){return this.findAll((function(e){return e.get("name")===t}))},e}(jt),Jt=0,te=0,ee=0,ne=0,re=0,ie=0,oe="object"==typeof performance&&performance.now?performance:Date,ae="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function le(){return re||(ae(se),re=oe.now()+ie)}function se(){re=0}function ue(){this._call=this._time=this._next=null}function ce(t,e,n){var r=new ue;return r.restart(t,e,n),r}function he(){re=(ne=oe.now())+ie,Jt=te=0;try{!function(){le(),++Jt;for(var t,e=Zt;e;)(t=re-e._time)>=0&&e._call.call(null,t),e=e._next;--Jt}()}finally{Jt=0,function(){var t,e,n=Zt,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Zt=e);$t=t,fe(r)}(),re=0}}function de(){var t=oe.now(),e=t-ne;e>1e3&&(ie-=e,ne=t)}function fe(t){Jt||(te&&(te=clearTimeout(te)),t-re>24?(t<1/0&&(te=setTimeout(he,t-oe.now()-ie)),ee&&(ee=clearInterval(ee))):(ee||(ne=oe.now(),ee=setInterval(de,1e3)),Jt=1,ae(he)))}function pe(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ve(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ge(){}ue.prototype=ce.prototype={constructor:ue,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?le():+n)+(null==e?0:+e),this._next||$t===this||($t?$t._next=this:Zt=this,$t=this),this._call=t,this._time=n,fe()},stop:function(){this._call&&(this._call=null,this._time=1/0,fe())}};var ye=.7,me=1/ye,Ce="\\s*([+-]?\\d+)\\s*",we="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",xe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Se=/^#([0-9a-f]{3,8})$/,Ee=new RegExp("^rgb\\("+[Ce,Ce,Ce]+"\\)$"),Te=new RegExp("^rgb\\("+[xe,xe,xe]+"\\)$"),_e=new RegExp("^rgba\\("+[Ce,Ce,Ce,we]+"\\)$"),be=new RegExp("^rgba\\("+[xe,xe,xe,we]+"\\)$"),Le=new RegExp("^hsl\\("+[we,xe,xe]+"\\)$"),Ie=new RegExp("^hsla\\("+[we,xe,xe,we]+"\\)$"),Oe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Re(){return this.rgb().formatHex()}function Me(){return this.rgb().formatRgb()}function Ae(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Se.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Be(e):3===n?new ke(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Ne(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Ne(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Ee.exec(t))?new ke(e[1],e[2],e[3],1):(e=Te.exec(t))?new ke(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=_e.exec(t))?Ne(e[1],e[2],e[3],e[4]):(e=be.exec(t))?Ne(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Le.exec(t))?We(e[1],e[2]/100,e[3]/100,1):(e=Ie.exec(t))?We(e[1],e[2]/100,e[3]/100,e[4]):Oe.hasOwnProperty(t)?Be(Oe[t]):"transparent"===t?new ke(NaN,NaN,NaN,0):null}function Be(t){return new ke(t>>16&255,t>>8&255,255&t,1)}function Ne(t,e,n,r){return r<=0&&(t=e=n=NaN),new ke(t,e,n,r)}function De(t){return t instanceof ge||(t=Ae(t)),t?new ke((t=t.rgb()).r,t.g,t.b,t.opacity):new ke}function Pe(t,e,n,r){return 1===arguments.length?De(t):new ke(t,e,n,null==r?1:r)}function ke(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function ze(){return"#"+He(this.r)+He(this.g)+He(this.b)}function Fe(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function He(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function We(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ue(t,e,n,r)}function Ge(t){if(t instanceof Ue)return new Ue(t.h,t.s,t.l,t.opacity);if(t instanceof ge||(t=Ae(t)),!t)return new Ue;if(t instanceof Ue)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,l=o-i,s=(o+i)/2;return l?(a=e===o?(n-r)/l+6*(n<r):n===o?(r-e)/l+2:(e-n)/l+4,l/=s<.5?o+i:2-o-i,a*=60):l=s>0&&s<1?0:a,new Ue(a,l,s,t.opacity)}function Ue(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ye(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Ve(t){return function(){return t}}function je(t){return 1==(t=+t)?Xe:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Ve(isNaN(e)?n:e)}}function Xe(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Ve(isNaN(t)?e:t)}pe(ge,Ae,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Re,formatHex:Re,formatHsl:function(){return Ge(this).formatHsl()},formatRgb:Me,toString:Me}),pe(ke,Pe,ve(ge,{brighter:function(t){return t=null==t?me:Math.pow(me,t),new ke(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?ye:Math.pow(ye,t),new ke(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ze,formatHex:ze,formatRgb:Fe,toString:Fe})),pe(Ue,(function(t,e,n,r){return 1===arguments.length?Ge(t):new Ue(t,e,n,null==r?1:r)}),ve(ge,{brighter:function(t){return t=null==t?me:Math.pow(me,t),new Ue(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?ye:Math.pow(ye,t),new Ue(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new ke(Ye(t>=240?t-240:t+120,i,r),Ye(t,i,r),Ye(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Ke=function t(e){var n=je(e);function r(t,e){var r=n((t=Pe(t)).r,(e=Pe(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Xe(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function qe(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}}function Ze(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function $e(t,e){return(Ze(e)?qe:Qe)(t,e)}function Qe(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=an(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}function Je(t,e){var n=new Date;return t=+t,e=