@dsisolutions/react-fabricjs
Version:
fabricjs implemented by react
3 lines • 411 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["react-fabricjs"]=e(require("react")):t["react-fabricjs"]=e(t.React)}(this,function(__WEBPACK_EXTERNAL_MODULE_13__){return function(t){function e(r){if(i[r])return i[r].exports;var n=i[r]={exports:{},id:r,loaded:!1};return t[r].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}(function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))switch(typeof t[e]){case"function":break;case"object":t[e]=function(e){var i=e.slice(1),r=t[e[0]];return function(t,e,n){r.apply(this,[t,e,n].concat(i))}}(t[e]);break;default:t[e]=t[t[e]]}return t}([function(t,e,i){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.color=e.imageFilter=e.Itext=e.Text=e.Image=e.Triangle=e.Rect=e.Polyline=e.Polygon=e.PathGroup=e.Path=e.Line=e.Ellipse=e.Circle=e.Canvas=e.StaticCanvas=void 0;var n=i(15),o=r(n),s=i(26),a=r(s),c=i(32),h=r(c),l=i(33),u=r(l),f=i(34),p=r(f),d=i(18),g=r(d),b=i(35),v=r(b),y=i(36),m=r(y),_=i(37),w=r(_),x=i(38),S=r(x),C=i(39),O=r(C),j=i(29),T=r(j),k=i(16),E=r(k),P=i(28),A=r(P),M=i(30),D=r(M),L=i(27),I=r(L);e["default"]={StaticCanvas:o["default"],Canvas:a["default"],Circle:h["default"],Ellipse:u["default"],Line:p["default"],Path:g["default"],PathGroup:v["default"],Polygon:m["default"],Polyline:w["default"],Rect:S["default"],Triangle:O["default"],Image:T["default"],Text:E["default"],Itext:A["default"],imageFilter:D["default"],color:I["default"]};e.StaticCanvas=o["default"],e.Canvas=a["default"],e.Circle=h["default"],e.Ellipse=u["default"],e.Line=p["default"],e.Path=g["default"],e.PathGroup=v["default"],e.Polygon=m["default"],e.Polyline=w["default"],e.Rect=S["default"],e.Triangle=O["default"],e.Image=T["default"],e.Text=E["default"],e.Itext=A["default"],e.imageFilter=D["default"],e.color=I["default"]},function(module,exports,__webpack_require__){(function(Buffer,process){/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
var fabric=fabric||{version:"1.7.19"};exports.fabric=fabric,"undefined"!=typeof document&&"undefined"!=typeof window?(fabric.document=document,fabric.window=window,window.fabric=fabric):(fabric.document=__webpack_require__(65).jsdom(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E")),fabric.document.createWindow?fabric.window=fabric.document.createWindow():fabric.window=fabric.document.parentWindow),fabric.isTouchSupported="ontouchstart"in fabric.window,fabric.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window,fabric.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id"],fabric.DPI=96,fabric.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:e[-+]?\\d+)?)",fabric.fontPaths={},fabric.iMatrix=[1,0,0,1,0,0],fabric.canvasModule="canvas",fabric.perfLimitSizeTotal=2097152,fabric.maxCacheSideLimit=4096,fabric.minCacheSideLimit=256,fabric.charWidthsCache={},fabric.devicePixelRatio=fabric.window.devicePixelRatio||fabric.window.webkitDevicePixelRatio||fabric.window.mozDevicePixelRatio||1,function(){function t(t,e){if(this.__eventListeners[t]){var i=this.__eventListeners[t];e?i[i.indexOf(e)]=!1:fabric.util.array.fill(i,!1)}}function e(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}function i(e,i){if(this.__eventListeners){if(0===arguments.length)for(e in this.__eventListeners)t.call(this,e);else if(1===arguments.length&&"object"==typeof arguments[0])for(var r in e)t.call(this,r,e[r]);else t.call(this,e,i);return this}}function r(t,e){if(this.__eventListeners){var i=this.__eventListeners[t];if(i){for(var r=0,n=i.length;r<n;r++)i[r]&&i[r].call(this,e||{});return this.__eventListeners[t]=i.filter(function(t){return t!==!1}),this}}}fabric.Observable={observe:e,stopObserving:i,fire:r,on:e,off:i,trigger:r}}(),fabric.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.renderAll(),this},insertAt:function(t,e,i){var r=this.getObjects();return i?r[e]=t:r.splice(e,0,t),this._onObjectAdded&&this._onObjectAdded(t),this.renderOnAddRemove&&this.renderAll(),this},remove:function(){for(var t,e=this.getObjects(),i=!1,r=0,n=arguments.length;r<n;r++)t=e.indexOf(arguments[r]),t!==-1&&(i=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[r]));return this.renderOnAddRemove&&i&&this.renderAll(),this},forEachObject:function(t,e){for(var i=this.getObjects(),r=0,n=i.length;r<n;r++)t.call(e,i[r],r,i);return this},getObjects:function(t){return"undefined"==typeof t?this._objects:this._objects.filter(function(e){return e.type===t})},item:function(t){return this.getObjects()[t]},isEmpty:function(){return 0===this.getObjects().length},size:function(){return this.getObjects().length},contains:function(t){return this.getObjects().indexOf(t)>-1},complexity:function(){return this.getObjects().reduce(function(t,e){return t+=e.complexity?e.complexity():0},0)}},fabric.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof fabric.Gradient||this.set(e,new fabric.Gradient(t))},_initPattern:function(t,e,i){!t||!t.source||t instanceof fabric.Pattern?i&&i():this.set(e,new fabric.Pattern(t,i))},_initClipping:function(t){if(t.clipTo&&"string"==typeof t.clipTo){var e=fabric.util.getFunctionBody(t.clipTo);"undefined"!=typeof e&&(this.clipTo=new Function("ctx",e))}},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):"function"==typeof e&&"clipTo"!==t?this._set(t,e(this.get(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]}},function(t){var e=Math.sqrt,i=Math.atan2,r=Math.pow,n=Math.abs,o=Math.PI/180;fabric.util={removeFromArray:function(t,e){var i=t.indexOf(e);return i!==-1&&t.splice(i,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*o},radiansToDegrees:function(t){return t/o},rotatePoint:function(t,e,i){t.subtractEquals(e);var r=fabric.util.rotateVector(t,i);return new fabric.Point(r.x,r.y).addEquals(e)},rotateVector:function(t,e){var i=Math.sin(e),r=Math.cos(e),n=t.x*r-t.y*i,o=t.x*i+t.y*r;return{x:n,y:o}},transformPoint:function(t,e,i){return i?new fabric.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new fabric.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t){var e=[t[0].x,t[1].x,t[2].x,t[3].x],i=fabric.util.array.min(e),r=fabric.util.array.max(e),n=Math.abs(i-r),o=[t[0].y,t[1].y,t[2].y,t[3].y],s=fabric.util.array.min(o),a=fabric.util.array.max(o),c=Math.abs(s-a);return{left:i,top:s,width:n,height:c}},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]],r=fabric.util.transformPoint({x:t[4],y:t[5]},i,!0);return i[4]=-r.x,i[5]=-r.y,i},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t,e){var i=/\D{0,2}$/.exec(t),r=parseFloat(t);switch(e||(e=fabric.Text.DEFAULT_SVG_FONT_SIZE),i[0]){case"mm":return r*fabric.DPI/25.4;case"cm":return r*fabric.DPI/2.54;case"in":return r*fabric.DPI;case"pt":return r*fabric.DPI/72;case"pc":return r*fabric.DPI/72*12;case"em":return r*e;default:return r}},falseFunction:function(){return!1},getKlass:function(t,e){return t=fabric.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),fabric.util.resolveNamespace(e)[t]},resolveNamespace:function(e){if(!e)return fabric;var i,r=e.split("."),n=r.length,o=t||fabric.window;for(i=0;i<n;++i)o=o[r[i]];return o},loadImage:function(t,e,i,r){if(!t)return void(e&&e.call(i,t));var n=fabric.util.createImage();n.onload=function(){e&&e.call(i,n),n=n.onload=n.onerror=null},n.onerror=function(){fabric.log("Error loading "+n.src),e&&e.call(i,null,!0),n=n.onload=n.onerror=null},0!==t.indexOf("data")&&r&&(n.crossOrigin=r),n.src=t},enlivenObjects:function(t,e,i,r){function n(){++s===a&&e&&e(o)}t=t||[];var o=[],s=0,a=t.length,c=!0;return a?void t.forEach(function(t,e){if(!t||!t.type)return void n();var s=fabric.util.getKlass(t.type,i);s.fromObject(t,function(i,s){s||(o[e]=i),r&&r(t,i,s),n()},c)}):void(e&&e(o))},enlivenPatterns:function(t,e){function i(){++n===o&&e&&e(r)}t=t||[];var r=[],n=0,o=t.length;return o?void t.forEach(function(t,e){t&&t.source?new fabric.Pattern(t,function(t){r[e]=t,i()}):(r[e]=t,i())}):void(e&&e(r))},groupSVGElements:function(t,e,i){var r;return r=new fabric.PathGroup(t,e),"undefined"!=typeof i&&(r.sourcePath=i),r},populateWithProperties:function(t,e,i){if(i&&"[object Array]"===Object.prototype.toString.call(i))for(var r=0,n=i.length;r<n;r++)i[r]in t&&(e[i[r]]=t[i[r]])},drawDashedLine:function(t,r,n,o,s,a){var c=o-r,h=s-n,l=e(c*c+h*h),u=i(h,c),f=a.length,p=0,d=!0;for(t.save(),t.translate(r,n),t.moveTo(0,0),t.rotate(u),r=0;l>r;)r+=a[p++%f],r>l&&(r=l),t[d?"lineTo":"moveTo"](r,0),d=!d;t.restore()},createCanvasElement:function(t){return t||(t=fabric.document.createElement("canvas")),t.getContext||"undefined"==typeof G_vmlCanvasManager||G_vmlCanvasManager.initElement(t),t},createImage:function(){return fabric.isLikelyNode?new(__webpack_require__(14).Image):fabric.document.createElement("img")},createAccessors:function(t){var e,i,r,n,o,s=t.prototype;for(e=s.stateProperties.length;e--;)i=s.stateProperties[e],r=i.charAt(0).toUpperCase()+i.slice(1),n="set"+r,o="get"+r,s[o]||(s[o]=function(t){return new Function('return this.get("'+t+'")')}(i)),s[n]||(s[n]=function(t){return new Function("value",'return this.set("'+t+'", value)')}(i))},clipContext:function(t,e){e.save(),e.beginPath(),t.clipTo(e),e.clip()},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 n=i(t[1],t[0]),s=r(t[0],2)+r(t[1],2),a=e(s),c=(t[0]*t[3]-t[2]*t[1])/a,h=i(t[0]*t[2]+t[1]*t[3],s);return{angle:n/o,scaleX:a,scaleY:c,skewX:h/o,skewY:0,translateX:t[4],translateY:t[5]}},customTransformMatrix:function(t,e,i){var r=[1,0,n(Math.tan(i*o)),1],s=[n(t),0,0,n(e)];return fabric.util.multiplyTransformMatrices(s,r,!0)},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.setAngle(0)},getFunctionBody:function(t){return(String(t).match(/function[^{]*\{([\s\S]*)\}/)||{})[1]},isTransparent:function(t,e,i,r){r>0&&(e>r?e-=r:e=0,i>r?i-=r:i=0);var n,o,s=!0,a=t.getImageData(e,i,2*r||1,2*r||1),c=a.data.length;for(n=3;n<c&&(o=a.data[n],s=o<=0,s!==!1);n+=4);return a=null,s},parsePreserveAspectRatioAttribute:function(t){var e,i="meet",r="Mid",n="Mid",o=t.split(" ");return o&&o.length&&(i=o.pop(),"meet"!==i&&"slice"!==i?(e=i,i="meet"):o.length&&(e=o.pop())),r="none"!==e?e.slice(1,4):"none",n="none"!==e?e.slice(5,8):"none",{meetOrSlice:i,alignX:r,alignY:n}},clearFabricFontCache:function(t){t?fabric.charWidthsCache[t]&&delete fabric.charWidthsCache[t]:fabric.charWidthsCache={}},limitDimsByArea:function(t,e){var i=Math.sqrt(e*t),r=Math.floor(e/i);return{x:Math.floor(i),y:r}},capValue:function(t,e,i){return Math.max(t,Math.min(e,i))}}}(exports),function(){function t(t,r,o,s,c,h,l){var u=a.call(arguments);if(n[u])return n[u];var f=Math.PI,p=l*f/180,d=Math.sin(p),g=Math.cos(p),b=0,v=0;o=Math.abs(o),s=Math.abs(s);var y=-g*t*.5-d*r*.5,m=-g*r*.5+d*t*.5,_=o*o,w=s*s,x=m*m,S=y*y,C=_*w-_*x-w*S,O=0;if(C<0){var j=Math.sqrt(1-C/(_*w));o*=j,s*=j}else O=(c===h?-1:1)*Math.sqrt(C/(_*x+w*S));var T=O*o*m/s,k=-O*s*y/o,E=g*T-d*k+.5*t,P=d*T+g*k+.5*r,A=i(1,0,(y-T)/o,(m-k)/s),M=i((y-T)/o,(m-k)/s,(-y-T)/o,(-m-k)/s);0===h&&M>0?M-=2*f:1===h&&M<0&&(M+=2*f);for(var D=Math.ceil(Math.abs(M/f*2)),L=[],I=M/D,R=8/3*Math.sin(I/4)*Math.sin(I/4)/Math.sin(I/2),B=A+I,F=0;F<D;F++)L[F]=e(A,B,g,d,o,s,E,P,R,b,v),b=L[F][4],v=L[F][5],A=B,B+=I;return n[u]=L,L}function e(t,e,i,r,n,s,c,h,l,u,f){var p=a.call(arguments);if(o[p])return o[p];var d=Math.cos(t),g=Math.sin(t),b=Math.cos(e),v=Math.sin(e),y=i*n*b-r*s*v+c,m=r*n*b+i*s*v+h,_=u+l*(-i*n*g-r*s*d),w=f+l*(-r*n*g+i*s*d),x=y+l*(i*n*v+r*s*b),S=m+l*(r*n*v-i*s*b);return o[p]=[_,w,x,S,y,m],o[p]}function i(t,e,i,r){var n=Math.atan2(e,t),o=Math.atan2(r,i);return o>=n?o-n:2*Math.PI-(n-o)}function r(t,e,i,r,n,o,c,h){var l=a.call(arguments);if(s[l])return s[l];var u,f,p,d,g,b,v,y,m=Math.sqrt,_=Math.min,w=Math.max,x=Math.abs,S=[],C=[[],[]];f=6*t-12*i+6*n,u=-3*t+9*i-9*n+3*c,p=3*i-3*t;for(var O=0;O<2;++O)if(O>0&&(f=6*e-12*r+6*o,u=-3*e+9*r-9*o+3*h,p=3*r-3*e),x(u)<1e-12){if(x(f)<1e-12)continue;d=-p/f,0<d&&d<1&&S.push(d)}else v=f*f-4*p*u,v<0||(y=m(v),g=(-f+y)/(2*u),0<g&&g<1&&S.push(g),b=(-f-y)/(2*u),0<b&&b<1&&S.push(b));for(var j,T,k,E=S.length,P=E;E--;)d=S[E],k=1-d,j=k*k*k*t+3*k*k*d*i+3*k*d*d*n+d*d*d*c,C[0][E]=j,T=k*k*k*e+3*k*k*d*r+3*k*d*d*o+d*d*d*h,C[1][E]=T;C[0][P]=t,C[1][P]=e,C[0][P+1]=c,C[1][P+1]=h;var A=[{x:_.apply(null,C[0]),y:_.apply(null,C[1])},{x:w.apply(null,C[0]),y:w.apply(null,C[1])}];return s[l]=A,A}var n={},o={},s={},a=Array.prototype.join;fabric.util.drawArc=function(e,i,r,n){for(var o=n[0],s=n[1],a=n[2],c=n[3],h=n[4],l=n[5],u=n[6],f=[[],[],[],[]],p=t(l-i,u-r,o,s,c,h,a),d=0,g=p.length;d<g;d++)f[d][0]=p[d][0]+i,f[d][1]=p[d][1]+r,f[d][2]=p[d][2]+i,f[d][3]=p[d][3]+r,f[d][4]=p[d][4]+i,f[d][5]=p[d][5]+r,e.bezierCurveTo.apply(e,f[d])},fabric.util.getBoundsOfArc=function(e,i,n,o,s,a,c,h,l){for(var u,f=0,p=0,d=[],g=t(h-e,l-i,n,o,a,c,s),b=0,v=g.length;b<v;b++)u=r(f,p,g[b][0],g[b][1],g[b][2],g[b][3],g[b][4],g[b][5]),d.push({x:u[0].x+e,y:u[0].y+i}),d.push({x:u[1].x+e,y:u[1].y+i}),f=g[b][4],p=g[b][5];return d},fabric.util.getBoundsOfCurve=r}(),function(){function t(t,e){for(var i=o.call(arguments,2),r=[],n=0,s=t.length;n<s;n++)r[n]=i.length?t[n][e].apply(t[n],i):t[n][e].call(t[n]);return r}function e(t,e){return n(t,e,function(t,e){return t>=e})}function i(t,e){return n(t,e,function(t,e){return t<e})}function r(t,e){for(var i=t.length;i--;)t[i]=e;return t}function n(t,e,i){if(t&&0!==t.length){var r=t.length-1,n=e?t[r][e]:t[r];if(e)for(;r--;)i(t[r][e],n)&&(n=t[r][e]);else for(;r--;)i(t[r],n)&&(n=t[r]);return n}}var o=Array.prototype.slice;Array.prototype.indexOf||(Array.prototype.indexOf=function(t){if(void 0===this||null===this)throw new TypeError;var e=Object(this),i=e.length>>>0;if(0===i)return-1;var r=0;if(arguments.length>0&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&r!==Number.POSITIVE_INFINITY&&r!==Number.NEGATIVE_INFINITY&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=i)return-1;for(var n=r>=0?r:Math.max(i-Math.abs(r),0);n<i;n++)if(n in e&&e[n]===t)return n;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){for(var i=0,r=this.length>>>0;i<r;i++)i in this&&t.call(e,this[i],i,this)}),Array.prototype.map||(Array.prototype.map=function(t,e){for(var i=[],r=0,n=this.length>>>0;r<n;r++)r in this&&(i[r]=t.call(e,this[r],r,this));return i}),Array.prototype.every||(Array.prototype.every=function(t,e){for(var i=0,r=this.length>>>0;i<r;i++)if(i in this&&!t.call(e,this[i],i,this))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(t,e){for(var i=0,r=this.length>>>0;i<r;i++)if(i in this&&t.call(e,this[i],i,this))return!0;return!1}),Array.prototype.filter||(Array.prototype.filter=function(t,e){for(var i,r=[],n=0,o=this.length>>>0;n<o;n++)n in this&&(i=this[n],t.call(e,i,n,this)&&r.push(i));return r}),Array.prototype.reduce||(Array.prototype.reduce=function(t){var e,i=this.length>>>0,r=0;if(arguments.length>1)e=arguments[1];else for(;;){if(r in this){e=this[r++];break}if(++r>=i)throw new TypeError}for(;r<i;r++)r in this&&(e=t.call(null,e,this[r],r,this));return e}),fabric.util.array={fill:r,invoke:t,min:i,max:e}}(),function(){function t(e,i,r){if(r)if(!fabric.isLikelyNode&&i instanceof Element)e=i;else if(i instanceof Array){e=[];for(var n=0,o=i.length;n<o;n++)e[n]=t({},i[n],r)}else if(i&&"object"==typeof i)for(var s in i)i.hasOwnProperty(s)&&(e[s]=t({},i[s],r));else e=i;else for(var s in i)e[s]=i[s];return e}function e(e,i){return t({},e,i)}fabric.util.object={extend:t,clone:e}}(),function(){function t(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})}function e(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())}function i(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,"")}),fabric.util.string={camelize:t,capitalize:e,escapeXml:i}}(),function(){var t=Array.prototype.slice,e=Function.prototype.apply,i=function(){};Function.prototype.bind||(Function.prototype.bind=function(r){var n,o=this,s=t.call(arguments,1);return n=s.length?function(){return e.call(o,this instanceof i?this:r,s.concat(t.call(arguments)))}:function(){return e.call(o,this instanceof i?this:r,arguments)},i.prototype=this.prototype,n.prototype=new i,n})}(),function(){function t(){}function e(t){for(var e=null,i=this;i.constructor.superclass;){var n=i.constructor.superclass.prototype[t];if(i[t]!==n){e=n;break}i=i.constructor.superclass.prototype}return e?arguments.length>1?e.apply(this,r.call(arguments,1)):e.call(this):console.log("tried to callSuper "+t+", method not found in prototype chain",this)}function i(){function i(){this.initialize.apply(this,arguments)}var o=null,a=r.call(arguments,0);"function"==typeof a[0]&&(o=a.shift()),i.superclass=o,i.subclasses=[],o&&(t.prototype=o.prototype,i.prototype=new t,o.subclasses.push(i));for(var c=0,h=a.length;c<h;c++)s(i,a[c],o);return i.prototype.initialize||(i.prototype.initialize=n),i.prototype.constructor=i,i.prototype.callSuper=e,i}var r=Array.prototype.slice,n=function(){},o=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),s=function(t,e,i){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 r=this.constructor.superclass;this.constructor.superclass=i;var n=e[t].apply(this,arguments);if(this.constructor.superclass=r,"initialize"!==t)return n}}(r):t.prototype[r]=e[r],o&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};fabric.util.createClass=i}(),function(){function t(t){var e,i,r=Array.prototype.slice.call(arguments,1),n=r.length;for(i=0;i<n;i++)if(e=typeof t[r[i]],!/^(?:function|object|unknown)$/.test(e))return!1;return!0}function e(t,e){return{handler:e,wrappedHandler:i(t,e)}}function i(t,e){return function(i){e.call(s(t),i||fabric.window.event)}}function r(t,e){return function(i){if(g[t]&&g[t][e])for(var r=g[t][e],n=0,o=r.length;n<o;n++)r[n].call(this,i||fabric.window.event)}}function n(t){t||(t=fabric.window.event);var e=t.target||(typeof t.srcElement!==c?t.srcElement:null),i=fabric.util.getScrollLeftTop(e);return{x:b(t)+i.left,y:v(t)+i.top}}function o(t,e,i){var r="touchend"===t.type?"changedTouches":"touches";return t[r]&&t[r][0]?t[r][0][e]-(t[r][0][e]-t[r][0][i])||t[i]:t[i]}var s,a,c="unknown",h=function(){var t=0;return function(e){return e.__uniqueID||(e.__uniqueID="uniqueID__"+t++)}}();!function(){var t={};s=function(e){return t[e]},a=function(e,i){t[e]=i}}();var l,u,f=t(fabric.document.documentElement,"addEventListener","removeEventListener")&&t(fabric.window,"addEventListener","removeEventListener"),p=t(fabric.document.documentElement,"attachEvent","detachEvent")&&t(fabric.window,"attachEvent","detachEvent"),d={},g={};f?(l=function(t,e,i,r){t&&t.addEventListener(e,i,!p&&r)},u=function(t,e,i,r){t&&t.removeEventListener(e,i,!p&&r)}):p?(l=function(t,i,r){if(t){var n=h(t);a(n,t),d[n]||(d[n]={}),d[n][i]||(d[n][i]=[]);var o=e(n,r);d[n][i].push(o),t.attachEvent("on"+i,o.wrappedHandler)}},u=function(t,e,i){if(t){var r,n=h(t);if(d[n]&&d[n][e])for(var o=0,s=d[n][e].length;o<s;o++)r=d[n][e][o],r&&r.handler===i&&(t.detachEvent("on"+e,r.wrappedHandler),d[n][e][o]=null)}}):(l=function(t,e,i){if(t){var n=h(t);if(g[n]||(g[n]={}),!g[n][e]){g[n][e]=[];var o=t["on"+e];o&&g[n][e].push(o),t["on"+e]=r(n,e)}g[n][e].push(i)}},u=function(t,e,i){if(t){var r=h(t);if(g[r]&&g[r][e])for(var n=g[r][e],o=0,s=n.length;o<s;o++)n[o]===i&&n.splice(o,1)}}),fabric.util.addListener=l,fabric.util.removeListener=u;var b=function(t){return typeof t.clientX!==c?t.clientX:0},v=function(t){return typeof t.clientY!==c?t.clientY:0};fabric.isTouchSupported&&(b=function(t){return o(t,"pageX","clientX")},v=function(t){return o(t,"pageY","clientY")}),fabric.util.getPointer=n,fabric.util.object.extend(fabric.util,fabric.Observable)}(),function(){function t(t,e){var i=t.style;if(!i)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?o(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var r in e)if("opacity"===r)o(t,e[r]);else{var n="float"===r||"cssFloat"===r?"undefined"==typeof i.styleFloat?"cssFloat":"styleFloat":r;i[n]=e[r]}return t}var e=fabric.document.createElement("div"),i="string"==typeof e.style.opacity,r="string"==typeof e.style.filter,n=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,o=function(t){return t};i?o=function(t,e){return t.style.opacity=e,t}:r&&(o=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),n.test(i.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",i.filter=i.filter.replace(n,e)):i.filter+=" alpha(opacity="+100*e+")",t}),fabric.util.setStyle=t}(),function(){function t(t){return"string"==typeof t?fabric.document.getElementById(t):t}function e(t,e){var i=fabric.document.createElement(t);for(var r in e)"class"===r?i.className=e[r]:"for"===r?i.htmlFor=e[r]:i.setAttribute(r,e[r]);return i}function i(t,e){t&&(" "+t.className+" ").indexOf(" "+e+" ")===-1&&(t.className+=(t.className?" ":"")+e)}function r(t,i,r){return"string"==typeof i&&(i=e(i,r)),t.parentNode&&t.parentNode.replaceChild(i,t),i.appendChild(t),i}function n(t){for(var e=0,i=0,r=fabric.document.documentElement,n=fabric.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&(t=t.parentNode||t.host,t===fabric.document?(e=n.scrollLeft||r.scrollLeft||0,i=n.scrollTop||r.scrollTop||0):(e+=t.scrollLeft||0,i+=t.scrollTop||0),1!==t.nodeType||"fixed"!==fabric.util.getElementStyle(t,"position")););return{left:e,top:i}}function o(t){var e,i,r=t&&t.ownerDocument,o={left:0,top:0},s={left:0,top:0},a={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!r)return s;for(var c in a)s[a[c]]+=parseInt(l(t,c),10)||0;return e=r.documentElement,"undefined"!=typeof t.getBoundingClientRect&&(o=t.getBoundingClientRect()),i=n(t),{left:o.left+i.left-(e.clientLeft||0)+s.left,top:o.top+i.top-(e.clientTop||0)+s.top}}var s,a=Array.prototype.slice,c=function(t){return a.call(t,0)};try{s=c(fabric.document.childNodes)instanceof Array}catch(h){}s||(c=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e});var l;l=fabric.document.defaultView&&fabric.document.defaultView.getComputedStyle?function(t,e){var i=fabric.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},function(){function t(t){return"undefined"!=typeof t.onselectstart&&(t.onselectstart=fabric.util.falseFunction),r?t.style[r]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t}function e(t){return"undefined"!=typeof t.onselectstart&&(t.onselectstart=null),r?t.style[r]="":"string"==typeof t.unselectable&&(t.unselectable=""),t}var i=fabric.document.documentElement.style,r="userSelect"in i?"userSelect":"MozUserSelect"in i?"MozUserSelect":"WebkitUserSelect"in i?"WebkitUserSelect":"KhtmlUserSelect"in i?"KhtmlUserSelect":"";fabric.util.makeElementUnselectable=t,fabric.util.makeElementSelectable=e}(),function(){function t(t,e){var i=fabric.document.getElementsByTagName("head")[0],r=fabric.document.createElement("script"),n=!0;r.onload=r.onreadystatechange=function(t){if(n){if("string"==typeof this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)return;n=!1,e(t||fabric.window.event),r=r.onload=r.onreadystatechange=null}},r.src=t,i.appendChild(r)}fabric.util.getScript=t}(),fabric.util.getById=t,fabric.util.toArray=c,fabric.util.makeElement=e,fabric.util.addClass=i,fabric.util.wrapElement=r,fabric.util.getScrollLeftTop=n,fabric.util.getElementOffset=o,fabric.util.getElementStyle=l}(),function(){function t(t,e){return t+(/\?/.test(t)?"&":"?")+e}function e(){}function i(i,n){n||(n={});var o=n.method?n.method.toUpperCase():"GET",s=n.onComplete||function(){},a=r(),c=n.body||n.parameters;return a.onreadystatechange=function(){4===a.readyState&&(s(a),a.onreadystatechange=e)},"GET"===o&&(c=null,"string"==typeof n.parameters&&(i=t(i,n.parameters))),a.open(o,i,!0),"POST"!==o&&"PUT"!==o||a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.send(c),a}var r=function(){for(var t=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0")},function(){return new XMLHttpRequest}],e=t.length;e--;)try{var i=t[e]();if(i)return t[e]}catch(r){}}();fabric.util.request=i}(),fabric.log=function(){},fabric.warn=function(){},"undefined"!=typeof console&&["log","warn"].forEach(function(t){"undefined"!=typeof console[t]&&"function"==typeof console[t].apply&&(fabric[t]=function(){return console[t].apply(console,arguments)})}),function(){function t(){return!1}function e(e){i(function(r){e||(e={});var n,o=r||+new Date,s=e.duration||500,a=o+s,c=e.onChange||t,h=e.abort||t,l=e.onComplete||t,u=e.easing||function(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e},f="startValue"in e?e.startValue:0,p="endValue"in e?e.endValue:100,d=e.byValue||p-f;e.onStart&&e.onStart(),function g(t){if(h())return void l(p,1,1);n=t||+new Date;var r=n>a?s:n-o,b=r/s,v=u(r,f,d,s),y=Math.abs((v-f)/d);return c(v,y,b),n>a?void(e.onComplete&&e.onComplete()):void i(g)}(o)})}function i(){return r.apply(fabric.window,arguments)}var r=fabric.window.requestAnimationFrame||fabric.window.webkitRequestAnimationFrame||fabric.window.mozRequestAnimationFrame||fabric.window.oRequestAnimationFrame||fabric.window.msRequestAnimationFrame||function(t){fabric.window.setTimeout(t,1e3/60)};fabric.util.animate=e,fabric.util.requestAnimFrame=i}(),function(){function t(t,e,i){var r="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 r+=","+(t&&e?parseFloat(t[3]+i*(e[3]-t[3])):1),r+=")"}function e(e,i,r,n){var o=new fabric.Color(e).getSource(),s=new fabric.Color(i).getSource();n=n||{},fabric.util.animate(fabric.util.object.extend(n,{duration:r||500,startValue:o,endValue:s,byValue:s,easing:function(e,i,r,o){var s=n.colorEasing?n.colorEasing(e,o):1-Math.cos(e/o*(Math.PI/2));return t(i,r,s)}}))}fabric.util.animateColor=e}(),function(){function t(t,e,i,r){return t<Math.abs(e)?(t=e,r=i/4):r=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:r}}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*((t=t/r-1)*t*t+1)+e}function r(t,e,i,r){return t/=r/2,t<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e}function n(t,e,i,r){return i*(t/=r)*t*t*t+e}function o(t,e,i,r){return-i*((t=t/r-1)*t*t*t-1)+e}function s(t,e,i,r){return t/=r/2,t<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e}function a(t,e,i,r){return i*(t/=r)*t*t*t*t+e}function c(t,e,i,r){return i*((t=t/r-1)*t*t*t*t+1)+e}function h(t,e,i,r){return t/=r/2,t<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e}function l(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e}function u(t,e,i,r){return i*Math.sin(t/r*(Math.PI/2))+e}function f(t,e,i,r){return-i/2*(Math.cos(Math.PI*t/r)-1)+e}function p(t,e,i,r){return 0===t?e:i*Math.pow(2,10*(t/r-1))+e}function d(t,e,i,r){return t===r?e+i:i*(-Math.pow(2,-10*t/r)+1)+e}function g(t,e,i,r){return 0===t?e:t===r?e+i:(t/=r/2,t<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(-Math.pow(2,-10*--t)+2)+e)}function b(t,e,i,r){return-i*(Math.sqrt(1-(t/=r)*t)-1)+e}function v(t,e,i,r){return i*Math.sqrt(1-(t=t/r-1)*t)+e}function y(t,e,i,r){return t/=r/2,t<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e}function m(i,r,n,o){var s=1.70158,a=0,c=n;if(0===i)return r;if(i/=o,1===i)return r+n;a||(a=.3*o);var h=t(c,n,a,s);return-e(h,i,o)+r}function _(e,i,r,n){var o=1.70158,s=0,a=r;if(0===e)return i;if(e/=n,1===e)return i+r;s||(s=.3*n);var c=t(a,r,s,o);return c.a*Math.pow(2,-10*e)*Math.sin((e*n-c.s)*(2*Math.PI)/c.p)+c.c+i}function w(i,r,n,o){var s=1.70158,a=0,c=n;if(0===i)return r;if(i/=o/2,2===i)return r+n;a||(a=o*(.3*1.5));var h=t(c,n,a,s);return i<1?-.5*e(h,i,o)+r:h.a*Math.pow(2,-10*(i-=1))*Math.sin((i*o-h.s)*(2*Math.PI)/h.p)*.5+h.c+r}function x(t,e,i,r,n){return void 0===n&&(n=1.70158),i*(t/=r)*t*((n+1)*t-n)+e}function S(t,e,i,r,n){return void 0===n&&(n=1.70158),i*((t=t/r-1)*t*((n+1)*t+n)+1)+e}function C(t,e,i,r,n){return void 0===n&&(n=1.70158),t/=r/2,t<1?i/2*(t*t*(((n*=1.525)+1)*t-n))+e:i/2*((t-=2)*t*(((n*=1.525)+1)*t+n)+2)+e}function O(t,e,i,r){return i-j(r-t,0,i,r)+e}function j(t,e,i,r){return(t/=r)<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}function T(t,e,i,r){return t<r/2?.5*O(2*t,0,i,r)+e:.5*j(2*t-r,0,i,r)+.5*i+e}fabric.util.ease={easeInQuad:function(t,e,i,r){return i*(t/=r)*t+e},easeOutQuad:function(t,e,i,r){return-i*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,i,r){return t/=r/2,t<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,r){return i*(t/=r)*t*t+e},easeOutCubic:i,easeInOutCubic:r,easeInQuart:n,easeOutQuart:o,easeInOutQuart:s,easeInQuint:a,easeOutQuint:c,easeInOutQuint:h,easeInSine:l,easeOutSine:u,easeInOutSine:f,easeInExpo:p,easeOutExpo:d,easeInOutExpo:g,easeInCirc:b,easeOutCirc:v,easeInOutCirc:y,easeInElastic:m,easeOutElastic:_,easeInOutElastic:w,easeInBack:x,easeOutBack:S,easeInOutBack:C,easeInBounce:O,easeOutBounce:j,easeInOutBounce:T}}(),function(t){"use strict";function e(t){return t in O?O[t]:t}function i(t,e,i,r){var n,o="[object Array]"===Object.prototype.toString.call(e);return"fill"!==t&&"stroke"!==t||"none"!==e?"strokeDashArray"===t?e="none"===e?null:e.replace(/,/g," ").split(/\s+/).map(function(t){return parseFloat(t)}):"transformMatrix"===t?e=i&&i.transformMatrix?_(i.transformMatrix,g.parseTransformAttribute(e)):g.parseTransformAttribute(e):"visible"===t?(e="none"!==e&&"hidden"!==e,i&&i.visible===!1&&(e=!1)):"opacity"===t?(e=parseFloat(e),i&&"undefined"!=typeof i.opacity&&(e*=i.opacity)):"originX"===t?e="start"===e?"left":"end"===e?"right":"center":n=o?e.map(m):m(e,r):e="",!o&&isNaN(n)?e:n}function r(t){for(var e in j)if("undefined"!=typeof t[j[e]]&&""!==t[e]){if("undefined"==typeof t[e]){if(!g.Object.prototype[e])continue;t[e]=g.Object.prototype[e]}if(0!==t[e].indexOf("url(")){var i=new g.Color(t[e]);t[e]=i.setAlpha(y(i.getAlpha()*t[j[e]],2)).toRgba()}}return t}function n(t,e){for(var i,r,n=[],o=0;o<e.length;o++)i=e[o],r=t.getElementsByTagName(i),n=n.concat(Array.prototype.slice.call(r));return n}function o(t,e){var i,r;t.replace(/;\s*$/,"").split(";").forEach(function(t){var n=t.split(":");i=n[0].trim().toLowerCase(),r=n[1].trim(),e[i]=r})}function s(t,e){var i,r;for(var n in t)"undefined"!=typeof t[n]&&(i=n.toLowerCase(),r=t[n],e[i]=r)}function a(t,e){var i={};for(var r in g.cssRules[e])if(c(t,r.split(" ")))for(var n in g.cssRules[e][r])i[n]=g.cssRules[e][r][n];return i}function c(t,e){var i,r=!0;return i=l(t,e.pop()),i&&e.length&&(r=h(t,e)),i&&r&&0===e.length}function h(t,e){for(var i,r=!0;t.parentNode&&1===t.parentNode.nodeType&&e.length;)r&&(i=e.pop()),t=t.parentNode,r=l(t,i);return 0===e.length}function l(t,e){var i,r=t.nodeName,n=t.getAttribute("class"),o=t.getAttribute("id");if(i=new RegExp("^"+r,"i"),e=e.replace(i,""),o&&e.length&&(i=new RegExp("#"+o+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"")),n&&e.length){n=n.split(" ");for(var s=n.length;s--;)i=new RegExp("\\."+n[s]+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"")}return 0===e.length}function u(t,e){var i;if(t.getElementById&&(i=t.getElementById(e)),i)return i;var r,n,o=t.getElementsByTagName("*");for(n=0;n<o.length;n++)if(r=o[n],e===r.getAttribute("id"))return r}function f(t){for(var e=n(t,["use","svg:use"]),i=0;e.length&&i<e.length;){var r,o,s,a,c,h=e[i],l=h.getAttribute("xlink:href").substr(1),f=h.getAttribute("x")||0,d=h.getAttribute("y")||0,g=u(t,l).cloneNode(!0),b=(g.getAttribute("transform")||"")+" translate("+f+", "+d+")",v=e.length;if(p(g),/^svg$/i.test(g.nodeName)){var y=g.ownerDocument.createElement("g");for(s=0,a=g.attributes,c=a.length;s<c;s++)o=a.item(s),y.setAttribute(o.nodeName,o.nodeValue);for(;g.firstChild;)y.appendChild(g.firstChild);g=y}for(s=0,a=h.attributes,c=a.length;s<c;s++)o=a.item(s),"x"!==o.nodeName&&"y"!==o.nodeName&&"xlink:href"!==o.nodeName&&("transform"===o.nodeName?b=o.nodeValue+" "+b:g.setAttribute(o.nodeName,o.nodeValue));g.setAttribute("transform",b),g.setAttribute("instantiated_by_use","1"),g.removeAttribute("id"),r=h.parentNode,r.replaceChild(g,h),e.length===v&&i++}}function p(t){var e,i,r,n,o=t.getAttribute("viewBox"),s=1,a=1,c=0,h=0,l=t.getAttribute("width"),u=t.getAttribute("height"),f=t.getAttribute("x")||0,p=t.getAttribute("y")||0,d=t.getAttribute("preserveAspectRatio")||"",b=!o||!x.test(t.nodeName)||!(o=o.match(T)),v=!l||!u||"100%"===l||"100%"===u,y=b&&v,_={},w="";if(_.width=0,_.height=0,_.toBeParsed=y,y)return _;if(b)return _.width=m(l),_.height=m(u),_;if(c=-parseFloat(o[1]),h=-parseFloat(o[2]),e=parseFloat(o[3]),i=parseFloat(o[4]),v?(_.width=e,_.height=i):(_.width=m(l),
_.height=m(u),s=_.width/e,a=_.height/i),d=g.util.parsePreserveAspectRatioAttribute(d),"none"!==d.alignX&&(a=s=s>a?a:s),1===s&&1===a&&0===c&&0===h&&0===f&&0===p)return _;if((f||p)&&(w=" translate("+m(f)+" "+m(p)+") "),r=w+" matrix("+s+" 0 0 "+a+" "+c*s+" "+h*a+") ","svg"===t.nodeName){for(n=t.ownerDocument.createElement("g");t.firstChild;)n.appendChild(t.firstChild);t.appendChild(n)}else n=t,r=n.getAttribute("transform")+r;return n.setAttribute("transform",r),_}function d(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}var g=t.fabric||(t.fabric={}),b=g.util.object.extend,v=g.util.object.clone,y=g.util.toFixed,m=g.util.parseUnit,_=g.util.multiplyTransformMatrices,w=/^(path|circle|polygon|polyline|ellipse|rect|line|image|text)$/i,x=/^(symbol|image|marker|pattern|view|svg)$/i,S=/^(?:pattern|defs|symbol|metadata|clipPath|mask)$/i,C=/^(symbol|g|a|svg)$/i,O={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","stroke-dasharray":"strokeDashArray","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"originX",opacity:"opacity"},j={stroke:"strokeOpacity",fill:"fillOpacity"};g.cssRules={},g.gradientDefs={},g.parseTransformAttribute=function(){function t(t,e){var i=Math.cos(e[0]),r=Math.sin(e[0]),n=0,o=0;3===e.length&&(n=e[1],o=e[2]),t[0]=i,t[1]=r,t[2]=-r,t[3]=i,t[4]=n-(i*n-r*o),t[5]=o-(r*n+i*o)}function e(t,e){var i=e[0],r=2===e.length?e[1]:e[0];t[0]=i,t[3]=r}function i(t,e,i){t[i]=Math.tan(g.util.degreesToRadians(e[0]))}function r(t,e){t[4]=e[0],2===e.length&&(t[5]=e[1])}var n=[1,0,0,1,0,0],o=g.reNum,s="(?:\\s+,?\\s*|,\\s*)",a="(?:(skewX)\\s*\\(\\s*("+o+")\\s*\\))",c="(?:(skewY)\\s*\\(\\s*("+o+")\\s*\\))",h="(?:(rotate)\\s*\\(\\s*("+o+")(?:"+s+"("+o+")"+s+"("+o+"))?\\s*\\))",l="(?:(scale)\\s*\\(\\s*("+o+")(?:"+s+"("+o+"))?\\s*\\))",u="(?:(translate)\\s*\\(\\s*("+o+")(?:"+s+"("+o+"))?\\s*\\))",f="(?:(matrix)\\s*\\(\\s*("+o+")"+s+"("+o+")"+s+"("+o+")"+s+"("+o+")"+s+"("+o+")"+s+"("+o+")\\s*\\))",p="(?:"+f+"|"+u+"|"+l+"|"+h+"|"+a+"|"+c+")",d="(?:"+p+"(?:"+s+"*"+p+")*)",b="^\\s*(?:"+d+"?)\\s*$",v=new RegExp(b),y=new RegExp(p,"g");return function(o){var s=n.concat(),a=[];if(!o||o&&!v.test(o))return s;o.replace(y,function(o){var c=new RegExp(p).exec(o).filter(function(t){return!!t}),h=c[1],l=c.slice(2).map(parseFloat);switch(h){case"translate":r(s,l);break;case"rotate":l[0]=g.util.degreesToRadians(l[0]),t(s,l);break;case"scale":e(s,l);break;case"skewX":i(s,l,2);break;case"skewY":i(s,l,1);break;case"matrix":s=l}a.push(s.concat()),s=n.concat()});for(var c=a[0];a.length>1;)a.shift(),c=g.util.multiplyTransformMatrices(c,a[0]);return c}}();var T=new RegExp("^\\s*("+g.reNum+"+)\\s*,?\\s*("+g.reNum+"+)\\s*,?\\s*("+g.reNum+"+)\\s*,?\\s*("+g.reNum+"+)\\s*$");g.parseSVGDocument=function(t,e,i,r){if(t){f(t);var n=g.Object.__uid++,o=p(t),s=g.util.toArray(t.getElementsByTagName("*"));if(o.crossOrigin=r&&r.crossOrigin,o.svgUid=n,0===s.length&&g.isLikelyNode){s=t.selectNodes('//*[name(.)!="svg"]');for(var a=[],c=0,h=s.length;c<h;c++)a[c]=s[c];s=a}var l=s.filter(function(t){return p(t),w.test(t.nodeName.replace("svg:",""))&&!d(t,S)});if(!l||l&&!l.length)return void(e&&e([],{}));g.gradientDefs[n]=g.getGradientDefs(t),g.cssRules[n]=g.getCSSRules(t),g.parseElements(l,function(t){e&&e(t,o)},v(o),i,r)}};var k=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+g.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+g.reNum+"))?\\s+(.*)");b(g,{parseFontDeclaration:function(t,e){var i=t.match(k);if(i){var r=i[1],n=i[3],o=i[4],s=i[5],a=i[6];r&&(e.fontStyle=r),n&&(e.fontWeight=isNaN(parseFloat(n))?n:parseFloat(n)),o&&(e.fontSize=m(o)),a&&(e.fontFamily=a),s&&(e.lineHeight="normal"===s?1:s)}},getGradientDefs:function(t){var e,i,r,o=["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"],s=n(t,o),a=0,c={},h={};for(a=s.length;a--;)e=s[a],r=e.getAttribute("xlink:href"),i=e.getAttribute("id"),r&&(h[i]=r.substr(1)),c[i]=e;for(i in h){var l=c[h[i]].cloneNode(!0);for(e=c[i];l.firstChild;)e.appendChild(l.firstChild)}return c},parseAttributes:function(t,n,o){if(t){var s,c,h={};"undefined"==typeof o&&(o=t.getAttribute("svgUid")),t.parentNode&&C.test(t.parentNode.nodeName)&&(h=g.parseAttributes(t.parentNode,n,o)),c=h&&h.fontSize||t.getAttribute("font-size")||g.Text.DEFAULT_SVG_FONT_SIZE;var l=n.reduce(function(e,i){return s=t.getAttribute(i),s&&(e[i]=s),e},{});l=b(l,b(a(t,o),g.parseStyleAttribute(t)));var u,f,p={};for(var d in l)u=e(d),f=i(u,l[d],h,c),p[u]=f;p&&p.font&&g.parseFontDeclaration(p.font,p);var v=b(h,p);return C.test(t.nodeName)?v:r(v)}},parseElements:function(t,e,i,r,n){new g.ElementsParser(t,e,i,r,n).parse()},parseStyleAttribute:function(t){var e={},i=t.getAttribute("style");return i?("string"==typeof i?o(i,e):s(i,e),e):e},parsePointsAttribute:function(t){if(!t)return null;t=t.replace(/,/g," ").trim(),t=t.split(/\s+/);var e,i,r=[];for(e=0,i=t.length;e<i;e+=2)r.push({x:parseFloat(t[e]),y:parseFloat(t[e+1])});return r},getCSSRules:function(t){for(var e,i=t.getElementsByTagName("style"),r={},n=0,o=i.length;n<o;n++){var s=i[n].textContent||i[n].text;s=s.replace(/\/\*[\s\S]*?\*\//g,""),""!==s.trim()&&(e=s.match(/[^{]*\{[\s\S]*?\}/g),e=e.map(function(t){return t.trim()}),e.forEach(function(t){for(var e=t.match(/([\s\S]*?)\s*\{([^}]*)\}/),i={},n=e[2].trim(),o=n.replace(/;$/,"").split(/\s*;\s*/),s=0,a=o.length;s<a;s++){var c=o[s].split(/\s*:\s*/),h=c[0],l=c[1];i[h]=l}t=e[1],t.split(",").forEach(function(t){t=t.replace(/^svg/i,"").trim(),""!==t&&(r[t]?g.util.object.extend(r[t],i):r[t]=g.util.object.clone(i))})}))}return r},loadSVGFromURL:function(t,e,i,r){function n(t){var n=t.responseXML;n&&!n.documentElement&&g.window.ActiveXObject&&t.responseText&&(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t.responseText.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,""))),n&&n.documentElement||e&&e(null),g.parseSVGDocument(n.documentElement,function(t,i){e&&e(t,i)},i,r)}t=t.replace(/^\n\s*/,"").trim(),new g.util.request(t,{method:"get",onComplete:n})},loadSVGFromString:function(t,e,i,r){t=t.trim();var n;if("undefined"!=typeof DOMParser){var o=new DOMParser;o&&o.parseFromString&&(n=o.parseFromString(t,"text/xml"))}else g.window.ActiveXObject&&(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,"")));g.parseSVGDocument(n.documentElement,function(t,i){e(t,i)},i,r)}})}(exports),fabric.ElementsParser=function(t,e,i,r,n){this.elements=t,this.callback=e,this.options=i,this.reviver=r,this.svgUid=i&&i.svgUid||0,this.parsingOptions=n},fabric.ElementsParser.prototype.parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},fabric.ElementsParser.prototype.createObjects=function(){for(var t=0,e=this.elements.length;t<e;t++)this.elements[t].setAttribute("svgUid",this.svgUid),function(t,e){setTimeout(function(){t.createObject(t.elements[e],e)},0)}(this,t)},fabric.ElementsParser.prototype.createObject=function(t,e){var i=fabric[fabric.util.string.capitalize(t.tagName.replace("svg:",""))];if(i&&i.fromElement)try{this._createObject(i,t,e)}catch(r){fabric.log(r)}else this.checkIfDone()},fabric.ElementsParser.prototype._createObject=function(t,e,i){if(t.async)t.fromElement(e,this.createCallback(i,e),this.options);else{var r=t.fromElement(e,this.options);this.resolveGradient(r,"fill"),this.resolveGradient(r,"stroke"),this.reviver&&this.reviver(e,r),this.instances[i]=r,this.checkIfDone()}},fabric.ElementsParser.prototype.createCallback=function(t,e){var i=this;return function(r){i.resolveGradient(r,"fill"),i.resolveGradient(r,"stroke"),i.reviver&&i.reviver(e,r),i.instances[t]=r,i.checkIfDone()}},fabric.ElementsParser.prototype.resolveGradient=function(t,e){var i=t.get(e);if(/^url\(/.test(i)){var r=i.slice(5,i.length-1);fabric.gradientDefs[this.svgUid][r]&&t.set(e,fabric.Gradient.fromElement(fabric.gradientDefs[this.svgUid][r],t))}},fabric.ElementsParser.prototype.checkIfDone=function(){0===--this.numElements&&(this.instances=this.instances.filter(function(t){return null!=t}),this.callback(this.instances))},function(t){"use strict";function e(t,e){this.x=t,this.y=e}var i=t.fabric||(t.fabric={});return i.Point?void i.warn("fabric.Point is already defined"):(i.Point=e,void(e.prototype={type:"point",constructor:e,add:function(t){return new e(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 e(this.x+t,this.y+t)},scalarAddEquals:function(t){return this.x+=t,this.y+=t,this},subtract:function(t){return new e(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 e(this.x-t,this.y-t)},scalarSubtractEquals:function(t){return this.x-=t,this.y-=t,this},multiply:function(t){return new e(this.x*t,this.y*t)},multiplyEquals:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return new e(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,i){return"undefined"==typeof i&&(i=.5),i=Math.max(Math.min(1,i),0),new e(this.x+(t.x-this.x)*i,this.y+(t.y-this.y)*i)},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 e(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new e(Math.max(this.x,t.x),Math.max(this.y,t.y))},toString:function(){return this.x+","+this.y},setXY:function(t,e){return this.x=t,this.y=e,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setFromPoint:function(t){return this.x=t.x,this.y=t.y,this},swap:function(t){var e=this.x,i=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=i},clone:function(){return new e(this.x,this.y)}}))}(exports),function(t){"use strict";function e(t){this.status=t,this.points=[]}var i=t.fabric||(t.fabric={});return i.Intersection?void i.warn("fabric.Intersection is already defined"):(i.Intersection=e,i.Intersection.prototype={constructor:e,appendPoint:function(t){return this.points.push(t),this},appendPoints:function(t){return this.points=this.points.concat(t),this}},i.Intersection.intersectLineLine=function(t,r,n,o){var s,a=(o.x-n.x)*(t.y-n.y)-(o.y-n.y)*(t.x-n.x),c=(r.x-t.x)*(t.y-n.y)-(r.y-t.y)*(t.x-n.x),h=(o.y-n.y)*(r.x-t.x)-(o.x-n.x)*(r.y-t.y);if(0!==h){var l=a/h,u=c/h;0<=l&&l<=1&&0<=u&&u<=1?(s=new e("Intersection"),s.appendPoint(new i.Point(t.x+l*(r.x-t.x),t.y+l*(r.y-t.y)))):s=new e}else s=new e(0===a||0===c?"Coincident":"Parallel");return s},i.Intersection.intersectLinePolygon=function(t,i,r){for(var n,o,s,a=new e,c=r.length,h=0;h<c;h++)n=r[h],o=r[(h+1)%c],s=e.intersectLineLine(t,i,n,o),a.appendPoints(s.points);return a.points.length>0&&(a.status="Intersection"),a},i.Intersection.intersectPolygonPolygon=function(t,i){for(var r=new e,n=t.length,o=0;o<n;o++){var s=t[o],a=t[(o+1)%n],c=e.intersectLinePolygon(s,a,i);r.appendPoints(c.points)}return r.points.length>0&&(r.status="Intersection"),r},void(i.Intersection.intersectPolygonRectangle=function(t,r,n){var o=r.min(n),s=r.max(n),a=new i.Point(s.x,o.y),c=new i.Point(o.x,s.y),h=e.intersectLinePolygon(o,a,t),l=e.intersectLinePolygon(a,s,t),u=e.intersectLinePolygon(s,c,t),f=e.intersectLinePolygon(c,o,t),p=new e;return p.appendPoints(h.points),p.appendPoints(l.points),p.appendPoints(u.points),p.appendPoints(f.points),p.points.length>0&&(p.status="Intersection"),p}))}(exports),function(t){"use strict";function e(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}function i(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}var r=t.fabric||(t.fabric={});return r.Color?void r.warn("fabric.Color is already defined."):(r.Color=e,r.Color.prototype={_tryParsingColor:function(t){var i;t in e.colorNameMap&&(t=e.colorNameMap[t]),"transparent"===t&&(i=[255,255,255,0]),i||(i=e.sourceFromHex(t)),i||(i=e.sourceFromRgb(t)),i||(i=e.sourceFromHsl(t)),i||(i=[0,0,0,1]),i&&this.setSource(i)},_rgbToHsl:function(t,e,i){t/=255,e/=255,i/=255;var n,o,s,a=r.util.array.max([t,e,i]),c=r.util.array.min([t,e,i]);if(s=(a+c)/2,a===c)n=o=0;else{var h=a-c;switch(o=s>.5?h/(2-a-c):h/(a+c),a){case t:n=(e-i)/h+(e<i?6:0);break;case e:n=(i-t)/h+2;break;case i:n=(t-e)/h+4}n/=6}return[Math.round(360*n),Math.round(100*o),Math.round(100*s)]},getSource:function(){return this._source},setSource:function(t){this._source=t},toRgb:function(){var t=this.getSource();return"rgb("+t[0]+","+t[1]+","+t[2]+")"},toRgba:function(){var t=this.getSource();return"rgba("+t[0]+","+t[1]+","+t[2]+","+t[3]+")"},toHsl:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsl("+e[0]+","+e[1]+"%,"+e[2]+"%)"},toHsla:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsla("+e[0]+","+e[1]+"%,"+e[2]+"%,"+t[3]+")"},toHex:function(){var t,e,i,r=this.getSource();return t=r[0].toString(16),t=1===t.length?"0"+t:t,e=r[1].toString(16),e=1===e.length?"0"+e:e,i=r[2].toString(16),i=1===i.length?"0"+i:i,t.toUpperCase()+e.toUpperCase()+i.toUpperCase()},toHexa:function(){var t,e=this.getSource();return t=255*e[3],t=t.toString(16),t=1===t.length?"0"+t:t,this.toHex()+t.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(t){var e=this.getSource();return e[3]=t,this.setSource(e),this},toGrayscale:function(){var t=this.getSource(),e=parseInt((.3*t[0]+.59*t[1]+.11*t[2]).toFixed(0),10),i=t[3];return this.setSource([e,e,e,i]),this},toBlackWhite:function(t){var e=this.getSource(),i=(.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),r=e[3];return t=t||127,i=Number(i)<Number(t)?0:255,this.setSource([i,i,i,r]),this},overlayWith:function(t){t instanceof e||(t=new e(t));for(var i=[],r=this.getAlpha(),n=.5,o=this.getSource(),s=t.getSource(),a=0;a<3;a++)i.push(Math.round(o[a]*(1-n)+s[a]*n));return i[3]=r,this.setSource(i),this}},r.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/,r.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/,r.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,r.Color.colorNameMap={aqua:"#00FFFF",black:"#000000",blue:"#0000FF",fuchsia:"#FF00FF",gray:"#808080",grey:"#808080",green:"#008000",lime:"#00FF00",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#FFA500",purple:"#800080",red:"#FF0000",silver:"#C0C0C0",teal:"#008080",white:"#FFFFFF",yellow:"#FFFF00"},r.Color.fromRgb=function(t){return e.fromSource(e.sourceFromRgb(t))},r.Color.sourceFromRgb=function(t){var i=t.match(e.reRGBa);if(i){var r=parseInt(i[1],10)/(/%$/.test(i[1])?100:1)*(/%$/.test(i[1])?255:1),n=parseInt(i[2],10)/(/%$/.test(i[2])?100:1)*(/%$/.test(i[2])?255:1),o=parseInt(i[3],10)/(/%$/.test(i[3])?100:1)*(/%$/.test(i[3])?255:1);return[parseInt(r,10),parseInt(n,10),parseInt(o,10),i[4]?parseFloat(i[4]):1]}},r.Color.fromRgba=e.fromRgb,r.Color.fromHsl=function(t){return e.fromSource(e.sourceFromHsl(t))},r.Color.sourceFromHsl=function(t){var r=t.match(e.reHSLa);if(r){var n,o,s,a=(parseFloat(r[1])%