tui-image-editor
Version:
TOAST UI ImageEditor
8 lines • 673 kB
JavaScript
/*!
* TOAST UI ImageEditor
* @version 3.15.3
* @license MIT
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("tui-color-picker")):"function"==typeof define&&define.amd?define(["tui-color-picker"],e):"object"==typeof exports?exports.tui=e(require("tui-color-picker")):(t.tui=t.tui||{},t.tui.ImageEditor=e(t.tui.colorPicker))}(self,(function(t){return function(){var e={2777:function(t,e,i){
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
var n,r,o,a,s,l,c,u,h,f,g,d,v,p,m,y,b,x,C,I,_,M,S=S||{version:"4.6.0"};if(e.fabric=S,"undefined"!=typeof document&&"undefined"!=typeof window)document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?S.document=document:S.document=document.implementation.createHTMLDocument(""),S.window=window;else{var w=new(i(4960).JSDOM)(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;S.document=w.document,S.jsdomImplForWrapper=i(6759).implForWrapper,S.nodeCanvas=i(6272).Canvas,S.window=w,DOMParser=S.window.DOMParser}function k(t,e){var i=t.canvas,n=e.targetCanvas,r=n.getContext("2d");r.translate(0,n.height),r.scale(1,-1);var o=i.height-n.height;r.drawImage(i,0,o,n.width,n.height,0,0,n.width,n.height)}function T(t,e){var i=e.targetCanvas.getContext("2d"),n=e.destinationWidth,r=e.destinationHeight,o=n*r*4,a=new Uint8Array(this.imageBuffer,0,o),s=new Uint8ClampedArray(this.imageBuffer,0,o);t.readPixels(0,0,n,r,t.RGBA,t.UNSIGNED_BYTE,a);var l=new ImageData(s,n,r);i.putImageData(l,0,0)}S.isTouchSupported="ontouchstart"in S.window||"ontouchstart"in S.document||S.window&&S.window.navigator&&S.window.navigator.maxTouchPoints>0,S.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window,S.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],S.DPI=96,S.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",S.commaWsp="(?:\\s+,?\\s*|,\\s*)",S.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,S.reNonWord=/[ \n\.,;!\?\-]/,S.fontPaths={},S.iMatrix=[1,0,0,1,0,0],S.svgNS="http://www.w3.org/2000/svg",S.perfLimitSizeTotal=2097152,S.maxCacheSideLimit=4096,S.minCacheSideLimit=256,S.charWidthsCache={},S.textureSize=2048,S.disableStyleCopyPaste=!1,S.enableGLFiltering=!0,S.devicePixelRatio=S.window.devicePixelRatio||S.window.webkitDevicePixelRatio||S.window.mozDevicePixelRatio||1,S.browserShadowBlurConstant=1,S.arcToSegmentsCache={},S.boundsOfCurveCache={},S.cachesBoundsOfCurve=!0,S.forceGLPutImageData=!1,S.initFilterBackend=function(){return S.enableGLFiltering&&S.isWebglSupported&&S.isWebglSupported(S.textureSize)?(console.log("max texture size: "+S.maxTextureSize),new S.WebglFilterBackend({tileSize:S.textureSize})):S.Canvas2dFilterBackend?new S.Canvas2dFilterBackend:void 0},"undefined"!=typeof document&&"undefined"!=typeof window&&(window.fabric=S),function(){function t(t,e){if(this.__eventListeners[t]){var i=this.__eventListeners[t];e?i[i.indexOf(e)]=!1:S.util.array.fill(i,!1)}}function e(t,e){var i=function(){e.apply(this,arguments),this.off(t,i)}.bind(this);this.on(t,i)}S.Observable={fire:function(t,e){if(!this.__eventListeners)return this;var i=this.__eventListeners[t];if(!i)return this;for(var n=0,r=i.length;n<r;n++)i[n]&&i[n].call(this,e||{});return this.__eventListeners[t]=i.filter((function(t){return!1!==t})),this},on:function(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var i in t)this.on(i,t[i]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this},once:function(t,i){if(1===arguments.length)for(var n in t)e.call(this,n,t[n]);else e.call(this,t,i);return this},off:function(e,i){if(!this.__eventListeners)return this;if(0===arguments.length)for(e in this.__eventListeners)t.call(this,e);else if(1===arguments.length&&"object"==typeof arguments[0])for(var n in e)t.call(this,n,e[n]);else t.call(this,e,i);return this}}}(),S.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var t=0,e=arguments.length;t<e;t++)this._onObjectAdded(arguments[t]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(t,e,i){var n=this._objects;return i?n[e]=t:n.splice(e,0,t),this._onObjectAdded&&this._onObjectAdded(t),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var t,e=this._objects,i=!1,n=0,r=arguments.length;n<r;n++)-1!==(t=e.indexOf(arguments[n]))&&(i=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[n]));return this.renderOnAddRemove&&i&&this.requestRenderAll(),this},forEachObject:function(t,e){for(var i=this.getObjects(),n=0,r=i.length;n<r;n++)t.call(e,i[n],n,i);return this},getObjects:function(t){return void 0===t?this._objects.concat():this._objects.filter((function(e){return e.type===t}))},item:function(t){return this._objects[t]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(t,e){return this._objects.indexOf(t)>-1||!!e&&this._objects.some((function(e){return"function"==typeof e.contains&&e.contains(t,!0)}))},complexity:function(){return this._objects.reduce((function(t,e){return t+=e.complexity?e.complexity():0}),0)}},S.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof S.Gradient||this.set(e,new S.Gradient(t))},_initPattern:function(t,e,i){!t||!t.source||t instanceof S.Pattern?i&&i():this.set(e,new S.Pattern(t,i))},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):this._set(t,e),this},_set:function(t,e){this[t]=e},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},get:function(t){return this[t]}},n=e,r=Math.sqrt,o=Math.atan2,a=Math.pow,s=Math.PI/180,l=Math.PI/2,S.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/l){case 1:case 3:return 0;case 2:return-1}return Math.cos(t)},sin:function(t){if(0===t)return 0;var e=1;switch(t<0&&(e=-1),t/l){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)},removeFromArray:function(t,e){var i=t.indexOf(e);return-1!==i&&t.splice(i,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*s},radiansToDegrees:function(t){return t/s},rotatePoint:function(t,e,i){var n=new S.Point(t.x-e.x,t.y-e.y),r=S.util.rotateVector(n,i);return new S.Point(r.x,r.y).addEquals(e)},rotateVector:function(t,e){var i=S.util.sin(e),n=S.util.cos(e);return{x:t.x*n-t.y*i,y:t.x*i+t.y*n}},transformPoint:function(t,e,i){return i?new S.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new S.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t,e){if(e)for(var i=0;i<t.length;i++)t[i]=S.util.transformPoint(t[i],e);var n=[t[0].x,t[1].x,t[2].x,t[3].x],r=S.util.array.min(n),o=S.util.array.max(n)-r,a=[t[0].y,t[1].y,t[2].y,t[3].y],s=S.util.array.min(a);return{left:r,top:s,width:o,height:S.util.array.max(a)-s}},invertTransform:function(t){var e=1/(t[0]*t[3]-t[1]*t[2]),i=[e*t[3],-e*t[1],-e*t[2],e*t[0]],n=S.util.transformPoint({x:t[4],y:t[5]},i,!0);return i[4]=-n.x,i[5]=-n.y,i},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t,e){var i=/\D{0,2}$/.exec(t),n=parseFloat(t);switch(e||(e=S.Text.DEFAULT_SVG_FONT_SIZE),i[0]){case"mm":return n*S.DPI/25.4;case"cm":return n*S.DPI/2.54;case"in":return n*S.DPI;case"pt":return n*S.DPI/72;case"pc":return n*S.DPI/72*12;case"em":return n*e;default:return n}},falseFunction:function(){return!1},getKlass:function(t,e){return t=S.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),S.util.resolveNamespace(e)[t]},getSvgAttributes:function(t){var e=["instantiated_by_use","style","id","class"];switch(t){case"linearGradient":e=e.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":e=e.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":e=e.concat(["offset","stop-color","stop-opacity"])}return e},resolveNamespace:function(t){if(!t)return S;var e,i=t.split("."),r=i.length,o=n||S.window;for(e=0;e<r;++e)o=o[i[e]];return o},loadImage:function(t,e,i,n){if(t){var r=S.util.createImage(),o=function(){e&&e.call(i,r,!1),r=r.onload=r.onerror=null};r.onload=o,r.onerror=function(){S.log("Error loading "+r.src),e&&e.call(i,null,!0),r=r.onload=r.onerror=null},0!==t.indexOf("data")&&null!=n&&(r.crossOrigin=n),"data:image/svg"===t.substring(0,14)&&(r.onload=null,S.util.loadImageInDom(r,o)),r.src=t}else e&&e.call(i,t)},loadImageInDom:function(t,e){var i=S.document.createElement("div");i.style.width=i.style.height="1px",i.style.left=i.style.top="-100%",i.style.position="absolute",i.appendChild(t),S.document.querySelector("body").appendChild(i),t.onload=function(){e(),i.parentNode.removeChild(i),i=null}},enlivenObjects:function(t,e,i,n){var r=[],o=0,a=(t=t||[]).length;function s(){++o===a&&e&&e(r.filter((function(t){return t})))}a?t.forEach((function(t,e){t&&t.type?S.util.getKlass(t.type,i).fromObject(t,(function(i,o){o||(r[e]=i),n&&n(t,i,o),s()})):s()})):e&&e(r)},enlivenPatterns:function(t,e){function i(){++r===o&&e&&e(n)}var n=[],r=0,o=(t=t||[]).length;o?t.forEach((function(t,e){t&&t.source?new S.Pattern(t,(function(t){n[e]=t,i()})):(n[e]=t,i())})):e&&e(n)},groupSVGElements:function(t,e,i){var n;return t&&1===t.length?t[0]:(e&&(e.width&&e.height?e.centerPoint={x:e.width/2,y:e.height/2}:(delete e.width,delete e.height)),n=new S.Group(t,e),void 0!==i&&(n.sourcePath=i),n)},populateWithProperties:function(t,e,i){if(i&&"[object Array]"===Object.prototype.toString.call(i))for(var n=0,r=i.length;n<r;n++)i[n]in t&&(e[i[n]]=t[i[n]])},drawDashedLine:function(t,e,i,n,a,s){var l=n-e,c=a-i,u=r(l*l+c*c),h=o(c,l),f=s.length,g=0,d=!0;for(t.save(),t.translate(e,i),t.moveTo(0,0),t.rotate(h),e=0;u>e;)(e+=s[g++%f])>u&&(e=u),t[d?"lineTo":"moveTo"](e,0),d=!d;t.restore()},createCanvasElement:function(){return S.document.createElement("canvas")},copyCanvasElement:function(t){var e=S.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e},toDataURL:function(t,e,i){return t.toDataURL("image/"+e,i)},createImage:function(){return S.document.createElement("img")},multiplyTransformMatrices:function(t,e,i){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],i?0:t[0]*e[4]+t[2]*e[5]+t[4],i?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var e=o(t[1],t[0]),i=a(t[0],2)+a(t[1],2),n=r(i),l=(t[0]*t[3]-t[2]*t[1])/n,c=o(t[0]*t[2]+t[1]*t[3],i);return{angle:e/s,scaleX:n,scaleY:l,skewX:c/s,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return S.iMatrix.concat();var e=S.util.degreesToRadians(t.angle),i=S.util.cos(e),n=S.util.sin(e);return[i,n,-n,i,0,0]},calcDimensionsMatrix:function(t){var e=void 0===t.scaleX?1:t.scaleX,i=void 0===t.scaleY?1:t.scaleY,n=[t.flipX?-e:e,0,0,t.flipY?-i:i,0,0],r=S.util.multiplyTransformMatrices,o=S.util.degreesToRadians;return t.skewX&&(n=r(n,[1,0,Math.tan(o(t.skewX)),1],!0)),t.skewY&&(n=r(n,[1,Math.tan(o(t.skewY)),0,1],!0)),n},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],i=S.util.multiplyTransformMatrices;return t.angle&&(e=i(e,S.util.calcRotateMatrix(t))),(1!==t.scaleX||1!==t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=i(e,S.util.calcDimensionsMatrix(t))),e},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},saveObjectTransform:function(t){return{scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}},isTransparent:function(t,e,i,n){n>0&&(e>n?e-=n:e=0,i>n?i-=n:i=0);var r,o=!0,a=t.getImageData(e,i,2*n||1,2*n||1),s=a.data.length;for(r=3;r<s&&!1!=(o=a.data[r]<=0);r+=4);return a=null,o},parsePreserveAspectRatioAttribute:function(t){var e,i="meet",n=t.split(" ");return n&&n.length&&("meet"!==(i=n.pop())&&"slice"!==i?(e=i,i="meet"):n.length&&(e=n.pop())),{meetOrSlice:i,alignX:"none"!==e?e.slice(1,4):"none",alignY:"none"!==e?e.slice(5,8):"none"}},clearFabricFontCache:function(t){(t=(t||"").toLowerCase())?S.charWidthsCache[t]&&delete S.charWidthsCache[t]:S.charWidthsCache={}},limitDimsByArea:function(t,e){var i=Math.sqrt(e*t),n=Math.floor(e/i);return{x:Math.floor(i),y:n}},capValue:function(t,e,i){return Math.max(t,Math.min(e,i))},findScaleToFit:function(t,e){return Math.min(e.width/t.width,e.height/t.height)},findScaleToCover:function(t,e){return Math.max(e.width/t.width,e.height/t.height)},matrixToSVG:function(t){return"matrix("+t.map((function(t){return S.util.toFixed(t,S.Object.NUM_FRACTION_DIGITS)})).join(" ")+")"},removeTransformFromObject:function(t,e){var i=S.util.invertTransform(e),n=S.util.multiplyTransformMatrices(i,t.calcOwnMatrix());S.util.applyTransformToObject(t,n)},addTransformToObject:function(t,e){S.util.applyTransformToObject(t,S.util.multiplyTransformMatrices(e,t.calcOwnMatrix()))},applyTransformToObject:function(t,e){var i=S.util.qrDecompose(e),n=new S.Point(i.translateX,i.translateY);t.flipX=!1,t.flipY=!1,t.set("scaleX",i.scaleX),t.set("scaleY",i.scaleY),t.skewX=i.skewX,t.skewY=i.skewY,t.angle=i.angle,t.setPositionByOrigin(n,"center","center")},sizeAfterTransform:function(t,e,i){var n=t/2,r=e/2,o=[{x:-n,y:-r},{x:n,y:-r},{x:-n,y:r},{x:n,y:r}],a=S.util.calcDimensionsMatrix(i),s=S.util.makeBoundingBoxFromPoints(o,a);return{x:s.width,y:s.height}}},function(){var t=Array.prototype.join,e={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},i={m:"l",M:"L"};function n(t,e,i,n,r,o,a,s,l,c,u){var h=S.util.cos(t),f=S.util.sin(t),g=S.util.cos(e),d=S.util.sin(e),v=i*r*g-n*o*d+a,p=n*r*g+i*o*d+s;return["C",c+l*(-i*r*f-n*o*h),u+l*(-n*r*f+i*o*h),v+l*(i*r*d+n*o*g),p+l*(n*r*d-i*o*g),v,p]}function r(t,e,i,r,a,s,l){var c=Math.PI,u=l*c/180,h=S.util.sin(u),f=S.util.cos(u),g=0,d=0,v=-f*t*.5-h*e*.5,p=-f*e*.5+h*t*.5,m=(i=Math.abs(i))*i,y=(r=Math.abs(r))*r,b=p*p,x=v*v,C=m*y-m*b-y*x,I=0;if(C<0){var _=Math.sqrt(1-C/(m*y));i*=_,r*=_}else I=(a===s?-1:1)*Math.sqrt(C/(m*b+y*x));var M=I*i*p/r,w=-I*r*v/i,k=f*M-h*w+.5*t,T=h*M+f*w+.5*e,D=o(1,0,(v-M)/i,(p-w)/r),A=o((v-M)/i,(p-w)/r,(-v-M)/i,(-p-w)/r);0===s&&A>0?A-=2*c:1===s&&A<0&&(A+=2*c);for(var j=Math.ceil(Math.abs(A/c*2)),O=[],E=A/j,L=8/3*Math.sin(E/4)*Math.sin(E/4)/Math.sin(E/2),N=D+E,P=0;P<j;P++)O[P]=n(D,N,f,h,i,r,k,T,L,g,d),g=O[P][5],d=O[P][6],D=N,N+=E;return O}function o(t,e,i,n){var r=Math.atan2(e,t),o=Math.atan2(n,i);return o>=r?o-r:2*Math.PI-(r-o)}function a(e,i,n,r,o,a,s,l){var c;if(S.cachesBoundsOfCurve&&(c=t.call(arguments),S.boundsOfCurveCache[c]))return S.boundsOfCurveCache[c];var u,h,f,g,d,v,p,m,y=Math.sqrt,b=Math.min,x=Math.max,C=Math.abs,I=[],_=[[],[]];h=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*s,f=3*n-3*e;for(var M=0;M<2;++M)if(M>0&&(h=6*i-12*r+6*a,u=-3*i+9*r-9*a+3*l,f=3*r-3*i),C(u)<1e-12){if(C(h)<1e-12)continue;0<(g=-f/h)&&g<1&&I.push(g)}else(p=h*h-4*f*u)<0||(0<(d=(-h+(m=y(p)))/(2*u))&&d<1&&I.push(d),0<(v=(-h-m)/(2*u))&&v<1&&I.push(v));for(var w,k,T,D=I.length,A=D;D--;)w=(T=1-(g=I[D]))*T*T*e+3*T*T*g*n+3*T*g*g*o+g*g*g*s,_[0][D]=w,k=T*T*T*i+3*T*T*g*r+3*T*g*g*a+g*g*g*l,_[1][D]=k;_[0][A]=e,_[1][A]=i,_[0][A+1]=s,_[1][A+1]=l;var j=[{x:b.apply(null,_[0]),y:b.apply(null,_[1])},{x:x.apply(null,_[0]),y:x.apply(null,_[1])}];return S.cachesBoundsOfCurve&&(S.boundsOfCurveCache[c]=j),j}function s(t,e,i){for(var n=i[1],o=i[2],a=i[3],s=i[4],l=i[5],c=r(i[6]-t,i[7]-e,n,o,s,l,a),u=0,h=c.length;u<h;u++)c[u][1]+=t,c[u][2]+=e,c[u][3]+=t,c[u][4]+=e,c[u][5]+=t,c[u][6]+=e;return c}function l(t,e,i,n){return Math.sqrt((i-t)*(i-t)+(n-e)*(n-e))}function c(t,e,i,n,r,o,a,s){return function(l){var c,u=(c=l)*c*c,h=function(t){return 3*t*t*(1-t)}(l),f=function(t){return 3*t*(1-t)*(1-t)}(l),g=function(t){return(1-t)*(1-t)*(1-t)}(l);return{x:a*u+r*h+i*f+t*g,y:s*u+o*h+n*f+e*g}}}function u(t,e,i,n,r,o,a,s){return function(l){var c=1-l,u=3*c*c*(i-t)+6*c*l*(r-i)+3*l*l*(a-r),h=3*c*c*(n-e)+6*c*l*(o-n)+3*l*l*(s-o);return Math.atan2(h,u)}}function h(t,e,i,n,r,o){return function(a){var s,l=(s=a)*s,c=function(t){return 2*t*(1-t)}(a),u=function(t){return(1-t)*(1-t)}(a);return{x:r*l+i*c+t*u,y:o*l+n*c+e*u}}}function f(t,e,i,n,r,o){return function(a){var s=1-a,l=2*s*(i-t)+2*a*(r-i),c=2*s*(n-e)+2*a*(o-n);return Math.atan2(c,l)}}function g(t,e,i){var n,r,o={x:e,y:i},a=0;for(r=1;r<=100;r+=1)n=t(r/100),a+=l(o.x,o.y,n.x,n.y),o=n;return a}function d(t,e){for(var i,n,r,o=0,a=0,s=t.iterator,c={x:t.x,y:t.y},u=.01,h=t.angleFinder;a<e&&o<=1&&u>1e-4;)i=s(o),r=o,(n=l(c.x,c.y,i.x,i.y))+a>e?o-=u/=2:(c=i,o+=u,a+=n);return i.angle=h(r),i}function v(t){for(var e,i,n,r,o=0,a=t.length,s=0,d=0,v=0,p=0,m=[],y=0;y<a;y++){switch(n={x:s,y:d,command:(e=t[y])[0]},e[0]){case"M":n.length=0,v=s=e[1],p=d=e[2];break;case"L":n.length=l(s,d,e[1],e[2]),s=e[1],d=e[2];break;case"C":i=c(s,d,e[1],e[2],e[3],e[4],e[5],e[6]),r=u(s,d,e[1],e[2],e[3],e[4],e[5],e[6]),n.iterator=i,n.angleFinder=r,n.length=g(i,s,d),s=e[5],d=e[6];break;case"Q":i=h(s,d,e[1],e[2],e[3],e[4]),r=f(s,d,e[1],e[2],e[3],e[4]),n.iterator=i,n.angleFinder=r,n.length=g(i,s,d),s=e[3],d=e[4];break;case"Z":case"z":n.destX=v,n.destY=p,n.length=l(s,d,v,p),s=v,d=p}o+=n.length,m.push(n)}return m.push({length:o,x:s,y:d}),m}S.util.joinPath=function(t){return t.map((function(t){return t.join(" ")})).join(" ")},S.util.parsePath=function(t){var n,r,o,a,s,l=[],c=[],u=S.rePathCommand,h="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",f="("+h+")"+S.commaWsp,g="([01])"+S.commaWsp+"?",d=new RegExp(f+"?"+f+"?"+f+g+g+f+"?("+h+")","g");if(!t||!t.match)return l;for(var v,p=0,m=(s=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;p<m;p++){a=(n=s[p]).slice(1).trim(),c.length=0;var y=n.charAt(0);if(v=[y],"a"===y.toLowerCase())for(var b;b=d.exec(a);)for(var x=1;x<b.length;x++)c.push(b[x]);else for(;o=u.exec(a);)c.push(o[0]);x=0;for(var C=c.length;x<C;x++)r=parseFloat(c[x]),isNaN(r)||v.push(r);var I=e[y.toLowerCase()],_=i[y]||y;if(v.length-1>I)for(var M=1,w=v.length;M<w;M+=I)l.push([y].concat(v.slice(M,M+I))),y=_;else l.push(v)}return l},S.util.makePathSimpler=function(t){var e,i,n,r,o,a,l=0,c=0,u=t.length,h=0,f=0,g=[];for(i=0;i<u;++i){switch(n=!1,(e=t[i].slice(0))[0]){case"l":e[0]="L",e[1]+=l,e[2]+=c;case"L":l=e[1],c=e[2];break;case"h":e[1]+=l;case"H":e[0]="L",e[2]=c,l=e[1];break;case"v":e[1]+=c;case"V":e[0]="L",c=e[1],e[1]=l,e[2]=c;break;case"m":e[0]="M",e[1]+=l,e[2]+=c;case"M":l=e[1],c=e[2],h=e[1],f=e[2];break;case"c":e[0]="C",e[1]+=l,e[2]+=c,e[3]+=l,e[4]+=c,e[5]+=l,e[6]+=c;case"C":o=e[3],a=e[4],l=e[5],c=e[6];break;case"s":e[0]="S",e[1]+=l,e[2]+=c,e[3]+=l,e[4]+=c;case"S":"C"===r?(o=2*l-o,a=2*c-a):(o=l,a=c),l=e[3],c=e[4],e[0]="C",e[5]=e[3],e[6]=e[4],e[3]=e[1],e[4]=e[2],e[1]=o,e[2]=a,o=e[3],a=e[4];break;case"q":e[0]="Q",e[1]+=l,e[2]+=c,e[3]+=l,e[4]+=c;case"Q":o=e[1],a=e[2],l=e[3],c=e[4];break;case"t":e[0]="T",e[1]+=l,e[2]+=c;case"T":"Q"===r?(o=2*l-o,a=2*c-a):(o=l,a=c),e[0]="Q",l=e[1],c=e[2],e[1]=o,e[2]=a,e[3]=l,e[4]=c;break;case"a":e[0]="A",e[6]+=l,e[7]+=c;case"A":n=!0,g=g.concat(s(l,c,e)),l=e[6],c=e[7];break;case"z":case"Z":l=h,c=f}n||g.push(e),r=e[0]}return g},S.util.getSmoothPathFromPoints=function(t,e){var i,n=[],r=new S.Point(t[0].x,t[0].y),o=new S.Point(t[1].x,t[1].y),a=t.length,s=1,l=0,c=a>2;for(e=e||0,c&&(s=t[2].x<o.x?-1:t[2].x===o.x?0:1,l=t[2].y<o.y?-1:t[2].y===o.y?0:1),n.push(["M",r.x-s*e,r.y-l*e]),i=1;i<a;i++){if(!r.eq(o)){var u=r.midPointFrom(o);n.push(["Q",r.x,r.y,u.x,u.y])}r=t[i],i+1<t.length&&(o=t[i+1])}return c&&(s=r.x>t[i-2].x?1:r.x===t[i-2].x?0:-1,l=r.y>t[i-2].y?1:r.y===t[i-2].y?0:-1),n.push(["L",r.x+s*e,r.y+l*e]),n},S.util.getPathSegmentsInfo=v,S.util.getBoundsOfCurve=a,S.util.getPointOnPath=function(t,e,i){i||(i=v(t));for(var n=0;e-i[n].length>0&&n<i.length-2;)e-=i[n].length,n++;var r,o=i[n],a=e/o.length,s=o.command,l=t[n];switch(s){case"M":return{x:o.x,y:o.y,angle:0};case"Z":case"z":return(r=new S.Point(o.x,o.y).lerp(new S.Point(o.destX,o.destY),a)).angle=Math.atan2(o.destY-o.y,o.destX-o.x),r;case"L":return(r=new S.Point(o.x,o.y).lerp(new S.Point(l[1],l[2]),a)).angle=Math.atan2(l[2]-o.y,l[1]-o.x),r;case"C":case"Q":return d(o,e)}},S.util.transformPath=function(t,e,i){return i&&(e=S.util.multiplyTransformMatrices(e,[1,0,0,1,-i.x,-i.y])),t.map((function(t){for(var i=t.slice(0),n={},r=1;r<t.length-1;r+=2)n.x=t[r],n.y=t[r+1],n=S.util.transformPoint(n,e),i[r]=n.x,i[r+1]=n.y;return i}))},S.util.fromArcToBeizers=s,S.util.getBoundsOfArc=function(t,e,i,n,o,s,l,c,u){for(var h,f=0,g=0,d=[],v=r(c-t,u-e,i,n,s,l,o),p=0,m=v.length;p<m;p++)h=a(f,g,v[p][1],v[p][2],v[p][3],v[p][4],v[p][5],v[p][6]),d.push({x:h[0].x+t,y:h[0].y+e}),d.push({x:h[1].x+t,y:h[1].y+e}),f=v[p][5],g=v[p][6];return d},S.util.drawArc=function(t,e,i,n){s(e,i,n=n.slice(0).unshift("X")).forEach((function(e){t.bezierCurveTo.apply(t,e.slice(1))}))}}(),function(){var t=Array.prototype.slice;function e(t,e,i){if(t&&0!==t.length){var n=t.length-1,r=e?t[n][e]:t[n];if(e)for(;n--;)i(t[n][e],r)&&(r=t[n][e]);else for(;n--;)i(t[n],r)&&(r=t[n]);return r}}S.util.array={fill:function(t,e){for(var i=t.length;i--;)t[i]=e;return t},invoke:function(e,i){for(var n=t.call(arguments,2),r=[],o=0,a=e.length;o<a;o++)r[o]=n.length?e[o][i].apply(e[o],n):e[o][i].call(e[o]);return r},min:function(t,i){return e(t,i,(function(t,e){return t<e}))},max:function(t,i){return e(t,i,(function(t,e){return t>=e}))}}}(),function(){function t(e,i,n){if(n)if(!S.isLikelyNode&&i instanceof Element)e=i;else if(i instanceof Array){e=[];for(var r=0,o=i.length;r<o;r++)e[r]=t({},i[r],n)}else if(i&&"object"==typeof i)for(var a in i)"canvas"===a||"group"===a?e[a]=null:i.hasOwnProperty(a)&&(e[a]=t({},i[a],n));else e=i;else for(var a in i)e[a]=i[a];return e}S.util.object={extend:t,clone:function(e,i){return t({},e,i)}},S.util.object.extend(S.util,S.Observable)}(),function(){function t(t,e){var i=t.charCodeAt(e);if(isNaN(i))return"";if(i<55296||i>57343)return t.charAt(e);if(55296<=i&&i<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";var n=t.charCodeAt(e+1);if(56320>n||n>57343)throw"High surrogate without following low surrogate";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw"Low surrogate without preceding high surrogate";var r=t.charCodeAt(e-1);if(55296>r||r>56319)throw"Low surrogate without preceding high surrogate";return!1}S.util.string={camelize:function(t){return t.replace(/-+(.)?/g,(function(t,e){return e?e.toUpperCase():""}))},capitalize:function(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:function(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")},graphemeSplit:function(e){var i,n=0,r=[];for(n=0;n<e.length;n++)!1!==(i=t(e,n))&&r.push(i);return r}}}(),function(){var t=Array.prototype.slice,e=function(){},i=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),n=function(t,e,n){for(var r in e)r in t.prototype&&"function"==typeof t.prototype[r]&&(e[r]+"").indexOf("callSuper")>-1?t.prototype[r]=function(t){return function(){var i=this.constructor.superclass;this.constructor.superclass=n;var r=e[t].apply(this,arguments);if(this.constructor.superclass=i,"initialize"!==t)return r}}(r):t.prototype[r]=e[r],i&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};function r(){}function o(e){for(var i=null,n=this;n.constructor.superclass;){var r=n.constructor.superclass.prototype[e];if(n[e]!==r){i=r;break}n=n.constructor.superclass.prototype}return i?arguments.length>1?i.apply(this,t.call(arguments,1)):i.call(this):console.log("tried to callSuper "+e+", method not found in prototype chain",this)}S.util.createClass=function(){var i=null,a=t.call(arguments,0);function s(){this.initialize.apply(this,arguments)}"function"==typeof a[0]&&(i=a.shift()),s.superclass=i,s.subclasses=[],i&&(r.prototype=i.prototype,s.prototype=new r,i.subclasses.push(s));for(var l=0,c=a.length;l<c;l++)n(s,a[l],i);return s.prototype.initialize||(s.prototype.initialize=e),s.prototype.constructor=s,s.prototype.callSuper=o,s}}(),c=!!S.document.createElement("div").attachEvent,u=["touchstart","touchmove","touchend"],S.util.addListener=function(t,e,i,n){t&&t.addEventListener(e,i,!c&&n)},S.util.removeListener=function(t,e,i,n){t&&t.removeEventListener(e,i,!c&&n)},S.util.getPointer=function(t){var e=t.target,i=S.util.getScrollLeftTop(e),n=function(t){var e=t.changedTouches;return e&&e[0]?e[0]:t}(t);return{x:n.clientX+i.left,y:n.clientY+i.top}},S.util.isTouchEvent=function(t){return u.indexOf(t.type)>-1||"touch"===t.pointerType},h=S.document.createElement("div"),f="string"==typeof h.style.opacity,g="string"==typeof h.style.filter,d=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,v=function(t){return t},f?v=function(t,e){return t.style.opacity=e,t}:g&&(v=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),d.test(i.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",i.filter=i.filter.replace(d,e)):i.filter+=" alpha(opacity="+100*e+")",t}),S.util.setStyle=function(t,e){var i=t.style;if(!i)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?v(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var n in e)"opacity"===n?v(t,e[n]):i["float"===n||"cssFloat"===n?void 0===i.styleFloat?"cssFloat":"styleFloat":n]=e[n];return t},function(){var t=Array.prototype.slice;var e,i,n,r,o=function(e){return t.call(e,0)};try{e=o(S.document.childNodes)instanceof Array}catch(t){}function a(t,e){var i=S.document.createElement(t);for(var n in e)"class"===n?i.className=e[n]:"for"===n?i.htmlFor=e[n]:i.setAttribute(n,e[n]);return i}function s(t){for(var e=0,i=0,n=S.document.documentElement,r=S.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===S.document?(e=r.scrollLeft||n.scrollLeft||0,i=r.scrollTop||n.scrollTop||0):(e+=t.scrollLeft||0,i+=t.scrollTop||0),1!==t.nodeType||"fixed"!==t.style.position););return{left:e,top:i}}e||(o=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e}),i=S.document.defaultView&&S.document.defaultView.getComputedStyle?function(t,e){var i=S.document.defaultView.getComputedStyle(t,null);return i?i[e]:void 0}:function(t,e){var i=t.style[e];return!i&&t.currentStyle&&(i=t.currentStyle[e]),i},n=S.document.documentElement.style,r="userSelect"in n?"userSelect":"MozUserSelect"in n?"MozUserSelect":"WebkitUserSelect"in n?"WebkitUserSelect":"KhtmlUserSelect"in n?"KhtmlUserSelect":"",S.util.makeElementUnselectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=S.util.falseFunction),r?t.style[r]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},S.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),r?t.style[r]="":"string"==typeof t.unselectable&&(t.unselectable=""),t},S.util.setImageSmoothing=function(t,e){t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=e},S.util.getById=function(t){return"string"==typeof t?S.document.getElementById(t):t},S.util.toArray=o,S.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},S.util.makeElement=a,S.util.wrapElement=function(t,e,i){return"string"==typeof e&&(e=a(e,i)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},S.util.getScrollLeftTop=s,S.util.getElementOffset=function(t){var e,n,r=t&&t.ownerDocument,o={left:0,top:0},a={left:0,top:0},l={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!r)return a;for(var c in l)a[l[c]]+=parseInt(i(t,c),10)||0;return e=r.documentElement,void 0!==t.getBoundingClientRect&&(o=t.getBoundingClientRect()),n=s(t),{left:o.left+n.left-(e.clientLeft||0)+a.left,top:o.top+n.top-(e.clientTop||0)+a.top}},S.util.getNodeCanvas=function(t){var e=S.jsdomImplForWrapper(t);return e._canvas||e._image},S.util.cleanUpJsdomNode=function(t){if(S.isLikelyNode){var e=S.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}S.util.request=function(e,i){i||(i={});var n=i.method?i.method.toUpperCase():"GET",r=i.onComplete||function(){},o=new S.window.XMLHttpRequest,a=i.body||i.parameters;return o.onreadystatechange=function(){4===o.readyState&&(r(o),o.onreadystatechange=t)},"GET"===n&&(a=null,"string"==typeof i.parameters&&(e=function(t,e){return t+(/\?/.test(t)?"&":"?")+e}(e,i.parameters))),o.open(n,e,!0),"POST"!==n&&"PUT"!==n||o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(a),o}}(),S.log=console.log,S.warn=console.warn,function(){function t(){return!1}function e(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e}var i=S.window.requestAnimationFrame||S.window.webkitRequestAnimationFrame||S.window.mozRequestAnimationFrame||S.window.oRequestAnimationFrame||S.window.msRequestAnimationFrame||function(t){return S.window.setTimeout(t,1e3/60)},n=S.window.cancelAnimationFrame||S.window.clearTimeout;function r(){return i.apply(S.window,arguments)}S.util.animate=function(i){var n=!1;return r((function(o){i||(i={});var a,s=o||+new Date,l=i.duration||500,c=s+l,u=i.onChange||t,h=i.abort||t,f=i.onComplete||t,g=i.easing||e,d="startValue"in i?i.startValue:0,v="endValue"in i?i.endValue:100,p=i.byValue||v-d;i.onStart&&i.onStart(),function t(e){var i=(a=e||+new Date)>c?l:a-s,o=i/l,m=g(i,d,p,l),y=Math.abs((m-d)/p);if(!n){if(!h(m,y,o))return a>c?(u(v,1,1),void f(v,1,1)):(u(m,y,o),void r(t));f(v,1,1)}}(s)})),function(){n=!0}},S.util.requestAnimFrame=r,S.util.cancelAnimFrame=function(){return n.apply(S.window,arguments)}}(),function(){function t(t,e,i){var n="rgba("+parseInt(t[0]+i*(e[0]-t[0]),10)+","+parseInt(t[1]+i*(e[1]-t[1]),10)+","+parseInt(t[2]+i*(e[2]-t[2]),10);return n+=","+(t&&e?parseFloat(t[3]+i*(e[3]-t[3])):1),n+=")"}S.util.animateColor=function(e,i,n,r){var o=new S.Color(e).getSource(),a=new S.Color(i).getSource(),s=r.onComplete,l=r.onChange;return r=r||{},S.util.animate(S.util.object.extend(r,{duration:n||500,startValue:o,endValue:a,byValue:a,easing:function(e,i,n,o){return t(i,n,r.colorEasing?r.colorEasing(e,o):1-Math.cos(e/o*(Math.PI/2)))},onComplete:function(e,i,n){if(s)return s(t(a,a,0),i,n)},onChange:function(e,i,n){if(l){if(Array.isArray(e))return l(t(e,e,0),i,n);l(e,i,n)}}}))}}(),function(){function t(t,e,i,n){return t<Math.abs(e)?(t=e,n=i/4):n=0===e&&0===t?i/(2*Math.PI)*Math.asin(1):i/(2*Math.PI)*Math.asin(e/t),{a:t,c:e,p:i,s:n}}function e(t,e,i){return t.a*Math.pow(2,10*(e-=1))*Math.sin((e*i-t.s)*(2*Math.PI)/t.p)}function i(t,e,i,r){return i-n(r-t,0,i,r)+e}function n(t,e,i,n){return(t/=n)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e}S.util.ease={easeInQuad:function(t,e,i,n){return i*(t/=n)*t+e},easeOutQuad:function(t,e,i,n){return-i*(t/=n)*(t-2)+e},easeInOutQuad:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,n){return i*(t/=n)*t*t+e},easeOutCubic:function(t,e,i,n){return i*((t=t/n-1)*t*t+1)+e},easeInOutCubic:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,i,n){return i*(t/=n)*t*t*t+e},easeOutQuart:function(t,e,i,n){return-i*((t=t/n-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,i,n){return i*(t/=n)*t*t*t*t+e},easeOutQuint:function(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e},easeOutSine:function(t,e,i,n){return i*Math.sin(t/n*(Math.PI/2))+e},easeInOutSine:function(t,e,i,n){return-i/2*(Math.cos(Math.PI*t/n)-1)+e},easeInExpo:function(t,e,i,n){return 0===t?e:i*Math.pow(2,10*(t/n-1))+e},easeOutExpo:function(t,e,i,n){return t===n?e+i:i*(1-Math.pow(2,-10*t/n))+e},easeInOutExpo:function(t,e,i,n){return 0===t?e:t===n?e+i:(t/=n/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,i,n){return-i*(Math.sqrt(1-(t/=n)*t)-1)+e},easeOutCirc:function(t,e,i,n){return i*Math.sqrt(1-(t=t/n-1)*t)+e},easeInOutCirc:function(t,e,i,n){return(t/=n/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(i,n,r,o){var a=0;return 0===i?n:1===(i/=o)?n+r:(a||(a=.3*o),-e(t(r,r,a,1.70158),i,o)+n)},easeOutElastic:function(e,i,n,r){var o=0;if(0===e)return i;if(1===(e/=r))return i+n;o||(o=.3*r);var a=t(n,n,o,1.70158);return a.a*Math.pow(2,-10*e)*Math.sin((e*r-a.s)*(2*Math.PI)/a.p)+a.c+i},easeInOutElastic:function(i,n,r,o){var a=0;if(0===i)return n;if(2===(i/=o/2))return n+r;a||(a=o*(.3*1.5));var s=t(r,r,a,1.70158);return i<1?-.5*e(s,i,o)+n:s.a*Math.pow(2,-10*(i-=1))*Math.sin((i*o-s.s)*(2*Math.PI)/s.p)*.5+s.c+n},easeInBack:function(t,e,i,n,r){return void 0===r&&(r=1.70158),i*(t/=n)*t*((r+1)*t-r)+e},easeOutBack:function(t,e,i,n,r){return void 0===r&&(r=1.70158),i*((t=t/n-1)*t*((r+1)*t+r)+1)+e},easeInOutBack:function(t,e,i,n,r){return void 0===r&&(r=1.70158),(t/=n/2)<1?i/2*(t*t*((1+(r*=1.525))*t-r))+e:i/2*((t-=2)*t*((1+(r*=1.525))*t+r)+2)+e},easeInBounce:i,easeOutBounce:n,easeInOutBounce:function(t,e,r,o){return t<o/2?.5*i(2*t,0,r,o)+e:.5*n(2*t-o,0,r,o)+.5*r+e}}}(),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.object.clone,r=e.util.toFixed,o=e.util.parseUnit,a=e.util.multiplyTransformMatrices,s={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing"},l={stroke:"strokeOpacity",fill:"fillOpacity"},c="font-size",u="clip-path";function h(t){return t in s?s[t]:t}function f(t,i,n,r){var s,l="[object Array]"===Object.prototype.toString.call(i);if("fill"!==t&&"stroke"!==t||"none"!==i){if("strokeUniform"===t)return"non-scaling-stroke"===i;if("strokeDashArray"===t)i="none"===i?null:i.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===t)i=n&&n.transformMatrix?a(n.transformMatrix,e.parseTransformAttribute(i)):e.parseTransformAttribute(i);else if("visible"===t)i="none"!==i&&"hidden"!==i,n&&!1===n.visible&&(i=!1);else if("opacity"===t)i=parseFloat(i),n&&void 0!==n.opacity&&(i*=n.opacity);else if("textAnchor"===t)i="start"===i?"left":"end"===i?"right":"center";else if("charSpacing"===t)s=o(i,r)/r*1e3;else if("paintFirst"===t){var c=i.indexOf("fill"),u=i.indexOf("stroke");i="fill";(c>-1&&u>-1&&u<c||-1===c&&u>-1)&&(i="stroke")}else{if("href"===t||"xlink:href"===t||"font"===t)return i;if("imageSmoothing"===t)return"optimizeQuality"===i;s=l?i.map(o):o(i,r)}}else i="";return!l&&isNaN(s)?i:s}function g(t){return new RegExp("^("+t.join("|")+")\\b","i")}function d(t,e){var i,n,r,o,a=[];for(r=0,o=e.length;r<o;r++)i=e[r],n=t.getElementsByTagName(i),a=a.concat(Array.prototype.slice.call(n));return a}function v(t,e){var i,n=!0;return(i=p(t,e.pop()))&&e.length&&(n=function(t,e){var i,n=!0;for(;t.parentNode&&1===t.parentNode.nodeType&&e.length;)n&&(i=e.pop()),n=p(t=t.parentNode,i);return 0===e.length}(t,e)),i&&n&&0===e.length}function p(t,e){var i,n,r=t.nodeName,o=t.getAttribute("class"),a=t.getAttribute("id");if(i=new RegExp("^"+r,"i"),e=e.replace(i,""),a&&e.length&&(i=new RegExp("#"+a+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"")),o&&e.length)for(n=(o=o.split(" ")).length;n--;)i=new RegExp("\\."+o[n]+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"");return 0===e.length}function m(t,e){var i;if(t.getElementById&&(i=t.getElementById(e)),i)return i;var n,r,o,a=t.getElementsByTagName("*");for(r=0,o=a.length;r<o;r++)if(e===(n=a[r]).getAttribute("id"))return n}e.svgValidTagNamesRegEx=g(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),e.svgViewBoxElementsRegEx=g(["symbol","image","marker","pattern","view","svg"]),e.svgInvalidAncestorsRegEx=g(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),e.svgValidParentsRegEx=g(["symbol","g","a","svg","clipPath","defs"]),e.cssRules={},e.gradientDefs={},e.clipPaths={},e.parseTransformAttribute=function(){function t(t,i,n){t[n]=Math.tan(e.util.degreesToRadians(i[0]))}var i=e.iMatrix,n=e.reNum,r=e.commaWsp,o="(?:"+("(?:(matrix)\\s*\\(\\s*("+n+")"+r+"("+n+")"+r+"("+n+")"+r+"("+n+")"+r+"("+n+")"+r+"("+n+")\\s*\\))")+"|"+("(?:(translate)\\s*\\(\\s*("+n+")(?:"+r+"("+n+"))?\\s*\\))")+"|"+("(?:(scale)\\s*\\(\\s*("+n+")(?:"+r+"("+n+"))?\\s*\\))")+"|"+("(?:(rotate)\\s*\\(\\s*("+n+")(?:"+r+"("+n+")"+r+"("+n+"))?\\s*\\))")+"|"+("(?:(skewX)\\s*\\(\\s*("+n+")\\s*\\))")+"|"+("(?:(skewY)\\s*\\(\\s*("+n+")\\s*\\))")+")",a=new RegExp("^\\s*(?:"+("(?:"+o+"(?:"+r+"*"+o+")*)")+"?)\\s*$"),s=new RegExp(o,"g");return function(n){var r=i.concat(),l=[];if(!n||n&&!a.test(n))return r;n.replace(s,(function(n){var a=new RegExp(o).exec(n).filter((function(t){return!!t})),s=a[1],c=a.slice(2).map(parseFloat);switch(s){case"translate":!function(t,e){t[4]=e[0],2===e.length&&(t[5]=e[1])}(r,c);break;case"rotate":c[0]=e.util.degreesToRadians(c[0]),function(t,i){var n=e.util.cos(i[0]),r=e.util.sin(i[0]),o=0,a=0;3===i.length&&(o=i[1],a=i[2]),t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=o-(n*o-r*a),t[5]=a-(r*o+n*a)}(r,c);break;case"scale":!function(t,e){var i=e[0],n=2===e.length?e[1]:e[0];t[0]=i,t[3]=n}(r,c);break;case"skewX":t(r,c,2);break;case"skewY":t(r,c,1);break;case"matrix":r=c}l.push(r.concat()),r=i.concat()}));for(var c=l[0];l.length>1;)l.shift(),c=e.util.multiplyTransformMatrices(c,l[0]);return c}}();var y=new RegExp("^\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*$");function b(t){if(!e.svgViewBoxElementsRegEx.test(t.nodeName))return{};var i,n,r,a,s,l,c=t.getAttribute("viewBox"),u=1,h=1,f=t.getAttribute("width"),g=t.getAttribute("height"),d=t.getAttribute("x")||0,v=t.getAttribute("y")||0,p=t.getAttribute("preserveAspectRatio")||"",m=!c||!(c=c.match(y)),b=!f||!g||"100%"===f||"100%"===g,x=m&&b,C={},I="",_=0,M=0;if(C.width=0,C.height=0,C.toBeParsed=x,m&&(d||v)&&t.parentNode&&"#document"!==t.parentNode.nodeName&&(I=" translate("+o(d)+" "+o(v)+") ",s=(t.getAttribute("transform")||"")+I,t.setAttribute("transform",s),t.removeAttribute("x"),t.removeAttribute("y")),x)return C;if(m)return C.width=o(f),C.height=o(g),C;if(i=-parseFloat(c[1]),n=-parseFloat(c[2]),r=parseFloat(c[3]),a=parseFloat(c[4]),C.minX=i,C.minY=n,C.viewBoxWidth=r,C.viewBoxHeight=a,b?(C.width=r,C.height=a):(C.width=o(f),C.height=o(g),u=C.width/r,h=C.height/a),"none"!==(p=e.util.parsePreserveAspectRatioAttribute(p)).alignX&&("meet"===p.meetOrSlice&&(h=u=u>h?h:u),"slice"===p.meetOrSlice&&(h=u=u>h?u:h),_=C.width-r*u,M=C.height-a*u,"Mid"===p.alignX&&(_/=2),"Mid"===p.alignY&&(M/=2),"Min"===p.alignX&&(_=0),"Min"===p.alignY&&(M=0)),1===u&&1===h&&0===i&&0===n&&0===d&&0===v)return C;if((d||v)&&"#document"!==t.parentNode.nodeName&&(I=" translate("+o(d)+" "+o(v)+") "),s=I+" matrix("+u+" 0 0 "+h+" "+(i*u+_)+" "+(n*h+M)+") ","svg"===t.nodeName){for(l=t.ownerDocument.createElementNS(e.svgNS,"g");t.firstChild;)l.appendChild(t.firstChild);t.appendChild(l)}else(l=t).removeAttribute("x"),l.removeAttribute("y"),s=l.getAttribute("transform")+s;return l.setAttribute("transform",s),C}function x(t,e){var i="xlink:href",n=m(t,e.getAttribute(i).substr(1));if(n&&n.getAttribute(i)&&x(t,n),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach((function(t){n&&!e.hasAttribute(t)&&n.hasAttribute(t)&&e.setAttribute(t,n.getAttribute(t))})),!e.children.length)for(var r=n.cloneNode(!0);r.firstChild;)e.appendChild(r.firstChild);e.removeAttribute(i)}e.parseSVGDocument=function(t,i,r,o){if(t){!function(t){for(var i=d(t,["use","svg:use"]),n=0;i.length&&n<i.length;){var r=i[n],o=r.getAttribute("xlink:href")||r.getAttribute("href");if(null===o)return;var a,s,l,c,u=o.substr(1),h=r.getAttribute("x")||0,f=r.getAttribute("y")||0,g=m(t,u).cloneNode(!0),v=(g.getAttribute("transform")||"")+" translate("+h+", "+f+")",p=i.length,y=e.svgNS;if(b(g),/^svg$/i.test(g.nodeName)){var x=g.ownerDocument.createElementNS(y,"g");for(s=0,c=(l=g.attributes).length;s<c;s++)a=l.item(s),x.setAttributeNS(y,a.nodeName,a.nodeValue);for(;g.firstChild;)x.appendChild(g.firstChild);g=x}for(s=0,c=(l=r.attributes).length;s<c;s++)"x"!==(a=l.item(s)).nodeName&&"y"!==a.nodeName&&"xlink:href"!==a.nodeName&&"href"!==a.nodeName&&("transform"===a.nodeName?v=a.nodeValue+" "+v:g.setAttribute(a.nodeName,a.nodeValue));g.setAttribute("transform",v),g.setAttribute("instantiated_by_use","1"),g.removeAttribute("id"),r.parentNode.replaceChild(g,r),i.length===p&&n++}}(t);var a,s,l=e.Object.__uid++,c=b(t),u=e.util.toArray(t.getElementsByTagName("*"));if(c.crossOrigin=o&&o.crossOrigin,c.svgUid=l,0===u.length&&e.isLikelyNode){var h=[];for(a=0,s=(u=t.selectNodes('//*[name(.)!="svg"]')).length;a<s;a++)h[a]=u[a];u=h}var f=u.filter((function(t){return b(t),e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))&&!function(t,e){for(;t&&(t=t.parentNode);)if(t.nodeName&&e.test(t.nodeName.replace("svg:",""))&&!t.getAttribute("instantiated_by_use"))return!0;return!1}(t,e.svgInvalidAncestorsRegEx)}));if(!f||f&&!f.length)i&&i([],{});else{var g={};u.filter((function(t){return"clipPath"===t.nodeName.replace("svg:","")})).forEach((function(t){var i=t.getAttribute("id");g[i]=e.util.toArray(t.getElementsByTagName("*")).filter((function(t){return e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))}))})),e.gradientDefs[l]=e.getGradientDefs(t),e.cssRules[l]=e.getCSSRules(t),e.clipPaths[l]=g,e.parseElements(f,(function(t,n){i&&(i(t,c,n,u),delete e.gradientDefs[l],delete e.cssRules[l],delete e.clipPaths[l])}),n(c),r,o)}}};var C=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+e.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+e.reNum+"))?\\s+(.*)");i(e,{parseFontDeclaration:function(t,e){var i=t.match(C);if(i){var n=i[1],r=i[3],a=i[4],s=i[5],l=i[6];n&&(e.fontStyle=n),r&&(e.fontWeight=isNaN(parseFloat(r))?r:parseFloat(r)),a&&(e.fontSize=o(a)),l&&(e.fontFamily=l),s&&(e.lineHeight="normal"===s?1:s)}},getGradientDefs:function(t){var e,i=d(t,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),n=0,r={};for(n=i.length;n--;)(e=i[n]).getAttribute("xlink:href")&&x(t,e),r[e.getAttribute("id")]=e;return r},parseAttributes:function(t,n,a){if(t){var s,g,d,p={};void 0===a&&(a=t.getAttribute("svgUid")),t.parentNode&&e.svgValidParentsRegEx.test(t.parentNode.nodeName)&&(p=e.parseAttributes(t.parentNode,n,a));var m=n.reduce((function(e,i){return(s=t.getAttribute(i))&&(e[i]=s),e}),{}),y=i(function(t,i){var n={};for(var r in e.cssRules[i])if(v(t,r.split(" ")))for(var o in e.cssRules[i][r])n[o]=e.cssRules[i][r][o];return n}(t,a),e.parseStyleAttribute(t));m=i(m,y),y[u]&&t.setAttribute(u,y[u]),g=d=p.fontSize||e.Text.DEFAULT_SVG_FONT_SIZE,m[c]&&(m[c]=g=o(m[c],d));var b,x,C={};for(var I in m)x=f(b=h(I),m[I],p,g),C[b]=x;C&&C.font&&e.parseFontDeclaration(C.font,C);var _=i(p,C);return e.svgValidParentsRegEx.test(t.nodeName)?_:function(t){for(var i in l)if(void 0!==t[l[i]]&&""!==t[i]){if(void 0===t[i]){if(!e.Object.prototype[i])continue;t[i]=e.Object.prototype[i]}if(0!==t[i].indexOf("url(")){var n=new e.Color(t[i]);t[i]=n.setAlpha(r(n.getAlpha()*t[l[i]],2)).toRgba()}}return t}(_)}},parseElements:function(t,i,n,r,o){new e.ElementsParser(t,i,n,r,o).parse()},parseStyleAttribute:function(t){var e={},i=t.getAttribute("style");return i?("string"==typeof i?function(t,e){var i,n;t.replace(/;\s*$/,"").split(";").forEach((function(t){var r=t.split(":");i=r[0].trim().toLowerCase(),n=r[1].trim(),e[i]=n}))}(i,e):function(t,e){var i,n;for(var r in t)void 0!==t[r]&&(i=r.toLowerCase(),n=t[r],e[i]=n)}(i,e),e):e},parsePointsAttribute:function(t){if(!t)return null;var e,i,n=[];for(e=0,i=(t=(t=t.replace(/,/g," ").trim()).split(/\s+/)).length;e<i;e+=2)n.push({x:parseFloat(t[e]),y:parseFloat(t[e+1])});return n},getCSSRules:function(t){var i,n,r=t.getElementsByTagName("style"),o={};for(i=0,n=r.length;i<n;i++){var a=r[i].textContent;""!==(a=a.replace(/\/\*[\s\S]*?\*\//g,"")).trim()&&a.match(/[^{]*\{[\s\S]*?\}/g).map((function(t){return t.trim()})).forEach((function(t){var r=t.match(/([\s\S]*?)\s*\{([^}]*)\}/),a={},s=r[2].trim().replace(/;$/,"").split(/\s*;\s*/);for(i=0,n=s.length;i<n;i++){var l=s[i].split(/\s*:\s*/),c=l[0],u=l[1];a[c]=u}(t=r[1]).split(",").forEach((function(t){""!==(t=t.replace(/^svg/i,"").trim())&&(o[t]?e.util.object.extend(o[t],a):o[t]=e.util.object.clone(a))}))}))}return o},loadSVGFromURL:function(t,i,n,r){t=t.replace(/^\n\s*/,"").trim(),new e.util.request(t,{method:"get",onComplete:function(t){var o=t.responseXML;if(!o||!o.documentElement)return i&&i(null),!1;e.parseSVGDocument(o.documentElement,(function(t,e,n,r){i&&i(t,e,n,r)}),n,r)}})},loadSVGFromString:function(t,i,n,r){var o=(new e.window.DOMParser).parseFromString(t.trim(),"text/xml");e.parseSVGDocument(o.documentElement,(function(t,e,n,r){i(t,e,n,r)}),n,r)}})}(e),S.ElementsParser=function(t,e,i,n,r,o){this.elements=t,this.callback=e,this.options=i,this.reviver=n,this.svgUid=i&&i.svgUid||0,this.parsingOptions=r,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=o},(p=S.ElementsParser.prototype).parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},p.createObjects=function(){var t=this;this.elements.forEach((function(e,i){e.setAttribute("svgUid",t.svgUid),t.createObject(e,i)}))},p.findTag=function(t){return S[S.util.string.capitalize(t.tagName.replace("svg:",""))]},p.createObject=function(t,e){var i=this.findTag(t);if(i&&i.fromElement)try{i.fromElement(t,this.createCallback(e,t),this.options)}catch(t){S.log(t)}else this.checkIfDone()},p.createCallback=function(t,e){var i=this;return function(n){var r;i.resolveGradient(n,e,"fill"),i.resolveGradient(n,e,"stroke"),n instanceof S.Image&&n._originalElement&&(r=n.parsePreserveAspectRatioAttribute(e)),n._removeTransformMatrix(r),i.resolveClipPath(n,e),i.reviver&&i.reviver(e,n),i.instances[t]=n,i.checkIfDone()}},p.extractPropertyDefinition=function(t,e,i){var n=t[e],r=this.regexUrl;if(r.test(n)){r.lastIndex=0;var o=r.exec(n)[1];return r.lastIndex=0,S[i][this.svgUid][o]}},p.resolveGradient=function(t,e,i){var n=this.extractPropertyDefinition(t,i,"gradientDefs");if(n){var r=e.getAttribute(i+"-opacity"),o=S.Gradient.fromElement(n,t,r,this.options);t.set(i,o)}},p.createClipPathCallback=function(t,e){return function(t){t._removeTransformMatrix(),t.fillRule=t.clipRule,e.push(t)}},p.resolveClipPath=function(t,e){var i,n,r,o,a=this.extractPropertyDefinition(t,"clipPath","clipPaths");if(a){r=[],n=S.util.invertTransform(t.calcTransformMatrix());for(var s=a[0].parentNode,l=e;l.parentNode&&l.getAttribute("clip-path")!==t.clipPath;)l=l.parentNode;l.parentNode.appendChild(s);for(var c=0;c<a.length;c++)i=a[c],this.findTag(i).fromElement(i,this.createClipPathCallback(t,r),this.options);a=1===r.length?r[0]:new S.Group(r),o=S.util.multiplyTransformMatrices(n,a.calcTransformMatrix()),a.clipPath&&this.resolveClipPath(a,l);var u=S.util.qrDecompose(o);a.flipX=!1,a.flipY=!1,a.set("scaleX",u.scaleX),a.set("scaleY",u.scaleY),a.angle=u.angle,a.skewX=u.skewX,a.skewY=0,a.setPositionByOrigin({x:u.translateX,y:u.translateY},"center","center"),t.clipPath=a}else delete t.clipPath},p.checkIfDone=function(){0==--this.numElements&&(this.instances=this.instances.filter((function(t){return null!=t})),this.callback(this.instances,this.elements))},function(t){"use strict";var e=t.fabric||(t.fabric={});function i(t,e){this.x=t,this.y=e}e.Point?e.warn("fabric.Point is already defined"):(e.Point=i,i.prototype={type:"point",constructor:i,add:function(t){return new i(this.x+t.x,this.y+t.y)},addEquals:function(t){return this.x+=t.x,this.y+=t.y,this},scalarAdd:function(t){return new i(this.x+t,this.y+t)},scalarAddEquals:function(t){return this.x+=t,this.y+=t,this},subtract:function(t){return new i(this.x-t.x,this.y-t.y)},subtractEquals:function(t){return this.x-=t.x,this.y-=t.y,this},scalarSubtract:function(t){return new i(this.x-t,this.y-t)},scalarSubtractEquals:function(t){return this.x-=t,this.y-=t,this},multiply:function(t){return new i(this.x*t,this.y*t)},multiplyEquals:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return new i(this.x/t,this.y/t)},divideEquals:function(t){return this.x/=t,this.y/=t,this},eq:function(t){return this.x===t.x&&this.y===t.y},lt:function(t){return this.x<t.x&&this.y<t.y},lte:function(t){return this.x<=t.x&&this.y<=t.y},gt:function(t){return this.x>t.x&&this.y>t.y},gte:function(t){return this.x>=t.x&&this.y>=t.y},lerp:function(t,e){return void 0===e&&(e=.5),e=Math.max(Math.min(1,e),0),new i(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)},distanceFrom:function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},midPointFrom:function(t){return this.lerp(t)},min:function(t){return new i(Math.mi