UNPKG

react-design-editor

Version:

Design Editor Tools with React.js + ant.design + fabric.js

2 lines 1.85 MB
/*! For license information please see react-design-editor.min.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define("react-design-editor.js",["react","react-dom"],e):"object"==typeof exports?exports["react-design-editor.js"]=e(require("react"),require("react-dom")):t["react-design-editor.js"]=e(t.react,t["react-dom"])}(window,(function(t,e){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="./",n(n.s=503)}([function(t,e){var n={"[object Function]":1,"[object RegExp]":1,"[object Date]":1,"[object Error]":1,"[object CanvasGradient]":1,"[object CanvasPattern]":1,"[object Image]":1,"[object Canvas]":1},i={"[object Int8Array]":1,"[object Uint8Array]":1,"[object Uint8ClampedArray]":1,"[object Int16Array]":1,"[object Uint16Array]":1,"[object Int32Array]":1,"[object Uint32Array]":1,"[object Float32Array]":1,"[object Float64Array]":1},r=Object.prototype.toString,o=Array.prototype,a=o.forEach,s=o.filter,l=o.slice,c=o.map,u=o.reduce,h={};function d(t){if(null==t||"object"!=typeof t)return t;var e=t,o=r.call(t);if("[object Array]"===o){if(!C(t)){e=[];for(var a=0,s=t.length;a<s;a++)e[a]=d(t[a])}}else if(i[o]){if(!C(t)){var l=t.constructor;if(t.constructor.from)e=l.from(t);else{e=new l(t.length);for(a=0,s=t.length;a<s;a++)e[a]=d(t[a])}}}else if(!n[o]&&!C(t)&&!w(t))for(var c in e={},t)t.hasOwnProperty(c)&&(e[c]=d(t[c]));return e}function f(t,e,n){if(!_(e)||!_(t))return n?d(e):t;for(var i in e)if(e.hasOwnProperty(i)){var r=t[i],o=e[i];!_(o)||!_(r)||x(o)||x(r)||w(o)||w(r)||b(o)||b(r)||C(o)||C(r)?!n&&i in t||(t[i]=d(e[i])):f(r,o,n)}return t}function p(t,e,n){for(var i in e)e.hasOwnProperty(i)&&(n?null!=e[i]:null==t[i])&&(t[i]=e[i]);return t}var g,v=function(){return h.createCanvas()};function m(t,e,n){if(t&&e)if(t.forEach&&t.forEach===a)t.forEach(e,n);else if(t.length===+t.length)for(var i=0,r=t.length;i<r;i++)e.call(n,t[i],i,t);else for(var o in t)t.hasOwnProperty(o)&&e.call(n,t[o],o,t)}function y(t,e){var n=l.call(arguments,2);return function(){return t.apply(e,n.concat(l.call(arguments)))}}function x(t){return"[object Array]"===r.call(t)}function _(t){var e=typeof t;return"function"===e||!!t&&"object"===e}function b(t){return!!n[r.call(t)]}function w(t){return"object"==typeof t&&"number"==typeof t.nodeType&&"object"==typeof t.ownerDocument}h.createCanvas=function(){return document.createElement("canvas")};var S="__ec_primitive__";function C(t){return t[S]}function T(t){var e=x(t);this.data={};var n=this;function i(t,i){e?n.set(t,i):n.set(i,t)}t instanceof T?t.each(i):t&&m(t,i)}T.prototype={constructor:T,get:function(t){return this.data.hasOwnProperty(t)?this.data[t]:null},set:function(t,e){return this.data[t]=e},each:function(t,e){for(var n in void 0!==e&&(t=y(t,e)),this.data)this.data.hasOwnProperty(n)&&t(this.data[n],n)},removeKey:function(t){delete this.data[t]}},e.$override=function(t,e){"createCanvas"===t&&(g=null),h[t]=e},e.clone=d,e.merge=f,e.mergeAll=function(t,e){for(var n=t[0],i=1,r=t.length;i<r;i++)n=f(n,t[i],e);return n},e.extend=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},e.defaults=p,e.createCanvas=v,e.getContext=function(){return g||(g=v().getContext("2d")),g},e.indexOf=function(t,e){if(t){if(t.indexOf)return t.indexOf(e);for(var n=0,i=t.length;n<i;n++)if(t[n]===e)return n}return-1},e.inherits=function(t,e){var n=t.prototype;function i(){}for(var r in i.prototype=e.prototype,t.prototype=new i,n)n.hasOwnProperty(r)&&(t.prototype[r]=n[r]);t.prototype.constructor=t,t.superClass=e},e.mixin=function(t,e,n){p(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,n)},e.isArrayLike=function(t){if(t)return"string"!=typeof t&&"number"==typeof t.length},e.each=m,e.map=function(t,e,n){if(t&&e){if(t.map&&t.map===c)return t.map(e,n);for(var i=[],r=0,o=t.length;r<o;r++)i.push(e.call(n,t[r],r,t));return i}},e.reduce=function(t,e,n,i){if(t&&e){if(t.reduce&&t.reduce===u)return t.reduce(e,n,i);for(var r=0,o=t.length;r<o;r++)n=e.call(i,n,t[r],r,t);return n}},e.filter=function(t,e,n){if(t&&e){if(t.filter&&t.filter===s)return t.filter(e,n);for(var i=[],r=0,o=t.length;r<o;r++)e.call(n,t[r],r,t)&&i.push(t[r]);return i}},e.find=function(t,e,n){if(t&&e)for(var i=0,r=t.length;i<r;i++)if(e.call(n,t[i],i,t))return t[i]},e.bind=y,e.curry=function(t){var e=l.call(arguments,1);return function(){return t.apply(this,e.concat(l.call(arguments)))}},e.isArray=x,e.isFunction=function(t){return"function"==typeof t},e.isString=function(t){return"[object String]"===r.call(t)},e.isObject=_,e.isBuiltInObject=b,e.isTypedArray=function(t){return!!i[r.call(t)]},e.isDom=w,e.eqNaN=function(t){return t!=t},e.retrieve=function(t){for(var e=0,n=arguments.length;e<n;e++)if(null!=arguments[e])return arguments[e]},e.retrieve2=function(t,e){return null!=t?t:e},e.retrieve3=function(t,e,n){return null!=t?t:null!=e?e:n},e.slice=function(){return Function.call.apply(l,arguments)},e.normalizeCssArray=function(t){if("number"==typeof t)return[t,t,t,t];var e=t.length;return 2===e?[t[0],t[1],t[0],t[1]]:3===e?[t[0],t[1],t[2],t[1]]:t},e.assert=function(t,e){if(!t)throw new Error(e)},e.trim=function(t){return null==t?null:"function"==typeof t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},e.setAsPrimitive=function(t){t[S]=!0},e.isPrimitive=C,e.createHashMap=function(t){return new T(t)},e.concatArray=function(t,e){for(var n=new t.constructor(t.length+e.length),i=0;i<t.length;i++)n[i]=t[i];var r=t.length;for(i=0;i<e.length;i++)n[i+r]=e[i];return n},e.noop=function(){}},function(t,e,n){var i=n(7),r=n(49).f,o=n(53),a=n(31),s=n(257),l=n(199),c=n(158);t.exports=function(t,e){var n,u,h,d,f,p=t.target,g=t.global,v=t.stat;if(n=g?i:v?i[p]||s(p,{}):(i[p]||{}).prototype)for(u in e){if(d=e[u],h=t.dontCallGetSet?(f=r(n,u))&&f.value:n[u],!c(g?u:p+(v?".":"#")+u,t.forced)&&void 0!==h){if(typeof d==typeof h)continue;l(d,h)}(t.sham||h&&h.sham)&&o(d,"sham",!0),a(n,u,d,t)}}},function(t,e,n){(function(t){var i,r,o,a,s,l,c,u,h,d,f,p,g,v,m,y,x,_,b,w,S,C,T=T||{version:"4.6.0"};if(e.fabric=T,"undefined"!=typeof document&&"undefined"!=typeof window)document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?T.document=document:T.document=document.implementation.createHTMLDocument(""),T.window=window;else{var M=new(n(762).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;T.document=M.document,T.jsdomImplForWrapper=n(763).implForWrapper,T.nodeCanvas=n(764).Canvas,T.window=M,DOMParser=T.window.DOMParser}function A(t,e){var n=t.canvas,i=e.targetCanvas,r=i.getContext("2d");r.translate(0,i.height),r.scale(1,-1);var o=n.height-i.height;r.drawImage(n,0,o,i.width,i.height,0,0,i.width,i.height)}function I(t,e){var n=e.targetCanvas.getContext("2d"),i=e.destinationWidth,r=e.destinationHeight,o=i*r*4,a=new Uint8Array(this.imageBuffer,0,o),s=new Uint8ClampedArray(this.imageBuffer,0,o);t.readPixels(0,0,i,r,t.RGBA,t.UNSIGNED_BYTE,a);var l=new ImageData(s,i,r);n.putImageData(l,0,0)}T.isTouchSupported="ontouchstart"in T.window||"ontouchstart"in T.document||T.window&&T.window.navigator&&T.window.navigator.maxTouchPoints>0,T.isLikelyNode=void 0!==t&&"undefined"==typeof window,T.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"],T.DPI=96,T.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",T.commaWsp="(?:\\s+,?\\s*|,\\s*)",T.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,T.reNonWord=/[ \n\.,;!\?\-]/,T.fontPaths={},T.iMatrix=[1,0,0,1,0,0],T.svgNS="http://www.w3.org/2000/svg",T.perfLimitSizeTotal=2097152,T.maxCacheSideLimit=4096,T.minCacheSideLimit=256,T.charWidthsCache={},T.textureSize=2048,T.disableStyleCopyPaste=!1,T.enableGLFiltering=!0,T.devicePixelRatio=T.window.devicePixelRatio||T.window.webkitDevicePixelRatio||T.window.mozDevicePixelRatio||1,T.browserShadowBlurConstant=1,T.arcToSegmentsCache={},T.boundsOfCurveCache={},T.cachesBoundsOfCurve=!0,T.forceGLPutImageData=!1,T.initFilterBackend=function(){return T.enableGLFiltering&&T.isWebglSupported&&T.isWebglSupported(T.textureSize)?(console.log("max texture size: "+T.maxTextureSize),new T.WebglFilterBackend({tileSize:T.textureSize})):T.Canvas2dFilterBackend?new T.Canvas2dFilterBackend:void 0},"undefined"!=typeof document&&"undefined"!=typeof window&&(window.fabric=T),function(){function t(t,e){if(this.__eventListeners[t]){var n=this.__eventListeners[t];e?n[n.indexOf(e)]=!1:T.util.array.fill(n,!1)}}function e(t,e){var n=function(){e.apply(this,arguments),this.off(t,n)}.bind(this);this.on(t,n)}T.Observable={fire:function(t,e){if(!this.__eventListeners)return this;var n=this.__eventListeners[t];if(!n)return this;for(var i=0,r=n.length;i<r;i++)n[i]&&n[i].call(this,e||{});return this.__eventListeners[t]=n.filter((function(t){return!1!==t})),this},on:function(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var n in t)this.on(n,t[n]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this},once:function(t,n){if(1===arguments.length)for(var i in t)e.call(this,i,t[i]);else e.call(this,t,n);return this},off:function(e,n){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 i in e)t.call(this,i,e[i]);else t.call(this,e,n);return this}}}(),T.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,n){var i=this._objects;return n?i[e]=t:i.splice(e,0,t),this._onObjectAdded&&this._onObjectAdded(t),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var t,e=this._objects,n=!1,i=0,r=arguments.length;i<r;i++)-1!==(t=e.indexOf(arguments[i]))&&(n=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[i]));return this.renderOnAddRemove&&n&&this.requestRenderAll(),this},forEachObject:function(t,e){for(var n=this.getObjects(),i=0,r=n.length;i<r;i++)t.call(e,n[i],i,n);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)}},T.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof T.Gradient||this.set(e,new T.Gradient(t))},_initPattern:function(t,e,n){!t||!t.source||t instanceof T.Pattern?n&&n():this.set(e,new T.Pattern(t,n))},_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]}},i=e,r=Math.sqrt,o=Math.atan2,a=Math.pow,s=Math.PI/180,l=Math.PI/2,T.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 n=t.indexOf(e);return-1!==n&&t.splice(n,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,n){var i=new T.Point(t.x-e.x,t.y-e.y),r=T.util.rotateVector(i,n);return new T.Point(r.x,r.y).addEquals(e)},rotateVector:function(t,e){var n=T.util.sin(e),i=T.util.cos(e);return{x:t.x*i-t.y*n,y:t.x*n+t.y*i}},transformPoint:function(t,e,n){return n?new T.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new T.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 n=0;n<t.length;n++)t[n]=T.util.transformPoint(t[n],e);var i=[t[0].x,t[1].x,t[2].x,t[3].x],r=T.util.array.min(i),o=T.util.array.max(i)-r,a=[t[0].y,t[1].y,t[2].y,t[3].y],s=T.util.array.min(a);return{left:r,top:s,width:o,height:T.util.array.max(a)-s}},invertTransform:function(t){var e=1/(t[0]*t[3]-t[1]*t[2]),n=[e*t[3],-e*t[1],-e*t[2],e*t[0]],i=T.util.transformPoint({x:t[4],y:t[5]},n,!0);return n[4]=-i.x,n[5]=-i.y,n},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t,e){var n=/\D{0,2}$/.exec(t),i=parseFloat(t);switch(e||(e=T.Text.DEFAULT_SVG_FONT_SIZE),n[0]){case"mm":return i*T.DPI/25.4;case"cm":return i*T.DPI/2.54;case"in":return i*T.DPI;case"pt":return i*T.DPI/72;case"pc":return i*T.DPI/72*12;case"em":return i*e;default:return i}},falseFunction:function(){return!1},getKlass:function(t,e){return t=T.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),T.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 T;var e,n=t.split("."),r=n.length,o=i||T.window;for(e=0;e<r;++e)o=o[n[e]];return o},loadImage:function(t,e,n,i){if(t){var r=T.util.createImage(),o=function(){e&&e.call(n,r,!1),r=r.onload=r.onerror=null};r.onload=o,r.onerror=function(){T.log("Error loading "+r.src),e&&e.call(n,null,!0),r=r.onload=r.onerror=null},0!==t.indexOf("data")&&null!=i&&(r.crossOrigin=i),"data:image/svg"===t.substring(0,14)&&(r.onload=null,T.util.loadImageInDom(r,o)),r.src=t}else e&&e.call(n,t)},loadImageInDom:function(t,e){var n=T.document.createElement("div");n.style.width=n.style.height="1px",n.style.left=n.style.top="-100%",n.style.position="absolute",n.appendChild(t),T.document.querySelector("body").appendChild(n),t.onload=function(){e(),n.parentNode.removeChild(n),n=null}},enlivenObjects:function(t,e,n,i){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?T.util.getKlass(t.type,n).fromObject(t,(function(n,o){o||(r[e]=n),i&&i(t,n,o),s()})):s()})):e&&e(r)},enlivenPatterns:function(t,e){function n(){++r===o&&e&&e(i)}var i=[],r=0,o=(t=t||[]).length;o?t.forEach((function(t,e){t&&t.source?new T.Pattern(t,(function(t){i[e]=t,n()})):(i[e]=t,n())})):e&&e(i)},groupSVGElements:function(t,e,n){var i;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)),i=new T.Group(t,e),void 0!==n&&(i.sourcePath=n),i)},populateWithProperties:function(t,e,n){if(n&&"[object Array]"===Object.prototype.toString.call(n))for(var i=0,r=n.length;i<r;i++)n[i]in t&&(e[n[i]]=t[n[i]])},drawDashedLine:function(t,e,n,i,a,s){var l=i-e,c=a-n,u=r(l*l+c*c),h=o(c,l),d=s.length,f=0,p=!0;for(t.save(),t.translate(e,n),t.moveTo(0,0),t.rotate(h),e=0;u>e;)(e+=s[f++%d])>u&&(e=u),t[p?"lineTo":"moveTo"](e,0),p=!p;t.restore()},createCanvasElement:function(){return T.document.createElement("canvas")},copyCanvasElement:function(t){var e=T.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e},toDataURL:function(t,e,n){return t.toDataURL("image/"+e,n)},createImage:function(){return T.document.createElement("img")},multiplyTransformMatrices:function(t,e,n){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],n?0:t[0]*e[4]+t[2]*e[5]+t[4],n?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var e=o(t[1],t[0]),n=a(t[0],2)+a(t[1],2),i=r(n),l=(t[0]*t[3]-t[2]*t[1])/i,c=o(t[0]*t[2]+t[1]*t[3],n);return{angle:e/s,scaleX:i,scaleY:l,skewX:c/s,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return T.iMatrix.concat();var e=T.util.degreesToRadians(t.angle),n=T.util.cos(e),i=T.util.sin(e);return[n,i,-i,n,0,0]},calcDimensionsMatrix:function(t){var e=void 0===t.scaleX?1:t.scaleX,n=void 0===t.scaleY?1:t.scaleY,i=[t.flipX?-e:e,0,0,t.flipY?-n:n,0,0],r=T.util.multiplyTransformMatrices,o=T.util.degreesToRadians;return t.skewX&&(i=r(i,[1,0,Math.tan(o(t.skewX)),1],!0)),t.skewY&&(i=r(i,[1,Math.tan(o(t.skewY)),0,1],!0)),i},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],n=T.util.multiplyTransformMatrices;return t.angle&&(e=n(e,T.util.calcRotateMatrix(t))),(1!==t.scaleX||1!==t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=n(e,T.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,n,i){i>0&&(e>i?e-=i:e=0,n>i?n-=i:n=0);var r,o=!0,a=t.getImageData(e,n,2*i||1,2*i||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,n="meet",i=t.split(" ");return i&&i.length&&("meet"!==(n=i.pop())&&"slice"!==n?(e=n,n="meet"):i.length&&(e=i.pop())),{meetOrSlice:n,alignX:"none"!==e?e.slice(1,4):"none",alignY:"none"!==e?e.slice(5,8):"none"}},clearFabricFontCache:function(t){(t=(t||"").toLowerCase())?T.charWidthsCache[t]&&delete T.charWidthsCache[t]:T.charWidthsCache={}},limitDimsByArea:function(t,e){var n=Math.sqrt(e*t),i=Math.floor(e/n);return{x:Math.floor(n),y:i}},capValue:function(t,e,n){return Math.max(t,Math.min(e,n))},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 T.util.toFixed(t,T.Object.NUM_FRACTION_DIGITS)})).join(" ")+")"},removeTransformFromObject:function(t,e){var n=T.util.invertTransform(e),i=T.util.multiplyTransformMatrices(n,t.calcOwnMatrix());T.util.applyTransformToObject(t,i)},addTransformToObject:function(t,e){T.util.applyTransformToObject(t,T.util.multiplyTransformMatrices(e,t.calcOwnMatrix()))},applyTransformToObject:function(t,e){var n=T.util.qrDecompose(e),i=new T.Point(n.translateX,n.translateY);t.flipX=!1,t.flipY=!1,t.set("scaleX",n.scaleX),t.set("scaleY",n.scaleY),t.skewX=n.skewX,t.skewY=n.skewY,t.angle=n.angle,t.setPositionByOrigin(i,"center","center")},sizeAfterTransform:function(t,e,n){var i=t/2,r=e/2,o=[{x:-i,y:-r},{x:i,y:-r},{x:-i,y:r},{x:i,y:r}],a=T.util.calcDimensionsMatrix(n),s=T.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},n={m:"l",M:"L"};function i(t,e,n,i,r,o,a,s,l,c,u){var h=T.util.cos(t),d=T.util.sin(t),f=T.util.cos(e),p=T.util.sin(e),g=n*r*f-i*o*p+a,v=i*r*f+n*o*p+s;return["C",c+l*(-n*r*d-i*o*h),u+l*(-i*r*d+n*o*h),g+l*(n*r*p+i*o*f),v+l*(i*r*p-n*o*f),g,v]}function r(t,e,n,r,a,s,l){var c=Math.PI,u=l*c/180,h=T.util.sin(u),d=T.util.cos(u),f=0,p=0,g=-d*t*.5-h*e*.5,v=-d*e*.5+h*t*.5,m=(n=Math.abs(n))*n,y=(r=Math.abs(r))*r,x=v*v,_=g*g,b=m*y-m*x-y*_,w=0;if(b<0){var S=Math.sqrt(1-b/(m*y));n*=S,r*=S}else w=(a===s?-1:1)*Math.sqrt(b/(m*x+y*_));var C=w*n*v/r,M=-w*r*g/n,A=d*C-h*M+.5*t,I=h*C+d*M+.5*e,O=o(1,0,(g-C)/n,(v-M)/r),k=o((g-C)/n,(v-M)/r,(-g-C)/n,(-v-M)/r);0===s&&k>0?k-=2*c:1===s&&k<0&&(k+=2*c);for(var E=Math.ceil(Math.abs(k/c*2)),P=[],L=k/E,D=8/3*Math.sin(L/4)*Math.sin(L/4)/Math.sin(L/2),j=O+L,R=0;R<E;R++)P[R]=i(O,j,d,h,n,r,A,I,D,f,p),f=P[R][5],p=P[R][6],O=j,j+=L;return P}function o(t,e,n,i){var r=Math.atan2(e,t),o=Math.atan2(i,n);return o>=r?o-r:2*Math.PI-(r-o)}function a(e,n,i,r,o,a,s,l){var c;if(T.cachesBoundsOfCurve&&(c=t.call(arguments),T.boundsOfCurveCache[c]))return T.boundsOfCurveCache[c];var u,h,d,f,p,g,v,m,y=Math.sqrt,x=Math.min,_=Math.max,b=Math.abs,w=[],S=[[],[]];h=6*e-12*i+6*o,u=-3*e+9*i-9*o+3*s,d=3*i-3*e;for(var C=0;C<2;++C)if(C>0&&(h=6*n-12*r+6*a,u=-3*n+9*r-9*a+3*l,d=3*r-3*n),b(u)<1e-12){if(b(h)<1e-12)continue;0<(f=-d/h)&&f<1&&w.push(f)}else(v=h*h-4*d*u)<0||(0<(p=(-h+(m=y(v)))/(2*u))&&p<1&&w.push(p),0<(g=(-h-m)/(2*u))&&g<1&&w.push(g));for(var M,A,I,O=w.length,k=O;O--;)M=(I=1-(f=w[O]))*I*I*e+3*I*I*f*i+3*I*f*f*o+f*f*f*s,S[0][O]=M,A=I*I*I*n+3*I*I*f*r+3*I*f*f*a+f*f*f*l,S[1][O]=A;S[0][k]=e,S[1][k]=n,S[0][k+1]=s,S[1][k+1]=l;var E=[{x:x.apply(null,S[0]),y:x.apply(null,S[1])},{x:_.apply(null,S[0]),y:_.apply(null,S[1])}];return T.cachesBoundsOfCurve&&(T.boundsOfCurveCache[c]=E),E}function s(t,e,n){for(var i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],c=r(n[6]-t,n[7]-e,i,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,n,i){return Math.sqrt((n-t)*(n-t)+(i-e)*(i-e))}function c(t,e,n,i,r,o,a,s){return function(l){var c,u=(c=l)*c*c,h=function(t){return 3*t*t*(1-t)}(l),d=function(t){return 3*t*(1-t)*(1-t)}(l),f=function(t){return(1-t)*(1-t)*(1-t)}(l);return{x:a*u+r*h+n*d+t*f,y:s*u+o*h+i*d+e*f}}}function u(t,e,n,i,r,o,a,s){return function(l){var c=1-l,u=3*c*c*(n-t)+6*c*l*(r-n)+3*l*l*(a-r),h=3*c*c*(i-e)+6*c*l*(o-i)+3*l*l*(s-o);return Math.atan2(h,u)}}function h(t,e,n,i,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+n*c+t*u,y:o*l+i*c+e*u}}}function d(t,e,n,i,r,o){return function(a){var s=1-a,l=2*s*(n-t)+2*a*(r-n),c=2*s*(i-e)+2*a*(o-i);return Math.atan2(c,l)}}function f(t,e,n){var i,r,o={x:e,y:n},a=0;for(r=1;r<=100;r+=1)i=t(r/100),a+=l(o.x,o.y,i.x,i.y),o=i;return a}function p(t,e){for(var n,i,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;)n=s(o),r=o,(i=l(c.x,c.y,n.x,n.y))+a>e?o-=u/=2:(c=n,o+=u,a+=i);return n.angle=h(r),n}function g(t){for(var e,n,i,r,o=0,a=t.length,s=0,p=0,g=0,v=0,m=[],y=0;y<a;y++){switch(i={x:s,y:p,command:(e=t[y])[0]},e[0]){case"M":i.length=0,g=s=e[1],v=p=e[2];break;case"L":i.length=l(s,p,e[1],e[2]),s=e[1],p=e[2];break;case"C":n=c(s,p,e[1],e[2],e[3],e[4],e[5],e[6]),r=u(s,p,e[1],e[2],e[3],e[4],e[5],e[6]),i.iterator=n,i.angleFinder=r,i.length=f(n,s,p),s=e[5],p=e[6];break;case"Q":n=h(s,p,e[1],e[2],e[3],e[4]),r=d(s,p,e[1],e[2],e[3],e[4]),i.iterator=n,i.angleFinder=r,i.length=f(n,s,p),s=e[3],p=e[4];break;case"Z":case"z":i.destX=g,i.destY=v,i.length=l(s,p,g,v),s=g,p=v}o+=i.length,m.push(i)}return m.push({length:o,x:s,y:p}),m}T.util.joinPath=function(t){return t.map((function(t){return t.join(" ")})).join(" ")},T.util.parsePath=function(t){var i,r,o,a,s,l=[],c=[],u=T.rePathCommand,h="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",d="("+h+")"+T.commaWsp,f="([01])"+T.commaWsp+"?",p=new RegExp(d+"?"+d+"?"+d+f+f+d+"?("+h+")","g");if(!t||!t.match)return l;for(var g,v=0,m=(s=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;v<m;v++){a=(i=s[v]).slice(1).trim(),c.length=0;var y=i.charAt(0);if(g=[y],"a"===y.toLowerCase())for(var x;x=p.exec(a);)for(var _=1;_<x.length;_++)c.push(x[_]);else for(;o=u.exec(a);)c.push(o[0]);_=0;for(var b=c.length;_<b;_++)r=parseFloat(c[_]),isNaN(r)||g.push(r);var w=e[y.toLowerCase()],S=n[y]||y;if(g.length-1>w)for(var C=1,M=g.length;C<M;C+=w)l.push([y].concat(g.slice(C,C+w))),y=S;else l.push(g)}return l},T.util.makePathSimpler=function(t){var e,n,i,r,o,a,l=0,c=0,u=t.length,h=0,d=0,f=[];for(n=0;n<u;++n){switch(i=!1,(e=t[n].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],d=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":i=!0,f=f.concat(s(l,c,e)),l=e[6],c=e[7];break;case"z":case"Z":l=h,c=d}i||f.push(e),r=e[0]}return f},T.util.getSmoothPathFromPoints=function(t,e){var n,i=[],r=new T.Point(t[0].x,t[0].y),o=new T.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),i.push(["M",r.x-s*e,r.y-l*e]),n=1;n<a;n++){if(!r.eq(o)){var u=r.midPointFrom(o);i.push(["Q",r.x,r.y,u.x,u.y])}r=t[n],n+1<t.length&&(o=t[n+1])}return c&&(s=r.x>t[n-2].x?1:r.x===t[n-2].x?0:-1,l=r.y>t[n-2].y?1:r.y===t[n-2].y?0:-1),i.push(["L",r.x+s*e,r.y+l*e]),i},T.util.getPathSegmentsInfo=g,T.util.getBoundsOfCurve=a,T.util.getPointOnPath=function(t,e,n){n||(n=g(t));for(var i=0;e-n[i].length>0&&i<n.length-2;)e-=n[i].length,i++;var r,o=n[i],a=e/o.length,s=o.command,l=t[i];switch(s){case"M":return{x:o.x,y:o.y,angle:0};case"Z":case"z":return(r=new T.Point(o.x,o.y).lerp(new T.Point(o.destX,o.destY),a)).angle=Math.atan2(o.destY-o.y,o.destX-o.x),r;case"L":return(r=new T.Point(o.x,o.y).lerp(new T.Point(l[1],l[2]),a)).angle=Math.atan2(l[2]-o.y,l[1]-o.x),r;case"C":case"Q":return p(o,e)}},T.util.transformPath=function(t,e,n){return n&&(e=T.util.multiplyTransformMatrices(e,[1,0,0,1,-n.x,-n.y])),t.map((function(t){for(var n=t.slice(0),i={},r=1;r<t.length-1;r+=2)i.x=t[r],i.y=t[r+1],i=T.util.transformPoint(i,e),n[r]=i.x,n[r+1]=i.y;return n}))},T.util.fromArcToBeizers=s,T.util.getBoundsOfArc=function(t,e,n,i,o,s,l,c,u){for(var h,d=0,f=0,p=[],g=r(c-t,u-e,n,i,s,l,o),v=0,m=g.length;v<m;v++)h=a(d,f,g[v][1],g[v][2],g[v][3],g[v][4],g[v][5],g[v][6]),p.push({x:h[0].x+t,y:h[0].y+e}),p.push({x:h[1].x+t,y:h[1].y+e}),d=g[v][5],f=g[v][6];return p},T.util.drawArc=function(t,e,n,i){s(e,n,i=i.slice(0).unshift("X")).forEach((function(e){t.bezierCurveTo.apply(t,e.slice(1))}))}}(),function(){var t=Array.prototype.slice;function e(t,e,n){if(t&&0!==t.length){var i=t.length-1,r=e?t[i][e]:t[i];if(e)for(;i--;)n(t[i][e],r)&&(r=t[i][e]);else for(;i--;)n(t[i],r)&&(r=t[i]);return r}}T.util.array={fill:function(t,e){for(var n=t.length;n--;)t[n]=e;return t},invoke:function(e,n){for(var i=t.call(arguments,2),r=[],o=0,a=e.length;o<a;o++)r[o]=i.length?e[o][n].apply(e[o],i):e[o][n].call(e[o]);return r},min:function(t,n){return e(t,n,(function(t,e){return t<e}))},max:function(t,n){return e(t,n,(function(t,e){return t>=e}))}}}(),function(){function t(e,n,i){if(i)if(!T.isLikelyNode&&n instanceof Element)e=n;else if(n instanceof Array){e=[];for(var r=0,o=n.length;r<o;r++)e[r]=t({},n[r],i)}else if(n&&"object"==typeof n)for(var a in n)"canvas"===a||"group"===a?e[a]=null:n.hasOwnProperty(a)&&(e[a]=t({},n[a],i));else e=n;else for(var a in n)e[a]=n[a];return e}T.util.object={extend:t,clone:function(e,n){return t({},e,n)}},T.util.object.extend(T.util,T.Observable)}(),function(){function t(t,e){var n=t.charCodeAt(e);if(isNaN(n))return"";if(n<55296||n>57343)return t.charAt(e);if(55296<=n&&n<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";var i=t.charCodeAt(e+1);if(56320>i||i>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}T.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,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},graphemeSplit:function(e){var n,i=0,r=[];for(i=0;i<e.length;i++)!1!==(n=t(e,i))&&r.push(n);return r}}}(),function(){var t=Array.prototype.slice,e=function(){},n=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),i=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 n=this.constructor.superclass;this.constructor.superclass=i;var r=e[t].apply(this,arguments);if(this.constructor.superclass=n,"initialize"!==t)return r}}(r):t.prototype[r]=e[r],n&&(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 n=null,i=this;i.constructor.superclass;){var r=i.constructor.superclass.prototype[e];if(i[e]!==r){n=r;break}i=i.constructor.superclass.prototype}return n?arguments.length>1?n.apply(this,t.call(arguments,1)):n.call(this):console.log("tried to callSuper "+e+", method not found in prototype chain",this)}T.util.createClass=function(){var n=null,a=t.call(arguments,0);function s(){this.initialize.apply(this,arguments)}"function"==typeof a[0]&&(n=a.shift()),s.superclass=n,s.subclasses=[],n&&(r.prototype=n.prototype,s.prototype=new r,n.subclasses.push(s));for(var l=0,c=a.length;l<c;l++)i(s,a[l],n);return s.prototype.initialize||(s.prototype.initialize=e),s.prototype.constructor=s,s.prototype.callSuper=o,s}}(),c=!!T.document.createElement("div").attachEvent,u=["touchstart","touchmove","touchend"],T.util.addListener=function(t,e,n,i){t&&t.addEventListener(e,n,!c&&i)},T.util.removeListener=function(t,e,n,i){t&&t.removeEventListener(e,n,!c&&i)},T.util.getPointer=function(t){var e=t.target,n=T.util.getScrollLeftTop(e),i=function(t){var e=t.changedTouches;return e&&e[0]?e[0]:t}(t);return{x:i.clientX+n.left,y:i.clientY+n.top}},T.util.isTouchEvent=function(t){return u.indexOf(t.type)>-1||"touch"===t.pointerType},h=T.document.createElement("div"),d="string"==typeof h.style.opacity,f="string"==typeof h.style.filter,p=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,g=function(t){return t},d?g=function(t,e){return t.style.opacity=e,t}:f&&(g=function(t,e){var n=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(n.zoom=1),p.test(n.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",n.filter=n.filter.replace(p,e)):n.filter+=" alpha(opacity="+100*e+")",t}),T.util.setStyle=function(t,e){var n=t.style;if(!n)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?g(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var i in e)"opacity"===i?g(t,e[i]):n["float"===i||"cssFloat"===i?void 0===n.styleFloat?"cssFloat":"styleFloat":i]=e[i];return t},function(){var t=Array.prototype.slice;var e,n,i,r,o=function(e){return t.call(e,0)};try{e=o(T.document.childNodes)instanceof Array}catch(t){}function a(t,e){var n=T.document.createElement(t);for(var i in e)"class"===i?n.className=e[i]:"for"===i?n.htmlFor=e[i]:n.setAttribute(i,e[i]);return n}function s(t){for(var e=0,n=0,i=T.document.documentElement,r=T.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===T.document?(e=r.scrollLeft||i.scrollLeft||0,n=r.scrollTop||i.scrollTop||0):(e+=t.scrollLeft||0,n+=t.scrollTop||0),1!==t.nodeType||"fixed"!==t.style.position););return{left:e,top:n}}e||(o=function(t){for(var e=new Array(t.length),n=t.length;n--;)e[n]=t[n];return e}),n=T.document.defaultView&&T.document.defaultView.getComputedStyle?function(t,e){var n=T.document.defaultView.getComputedStyle(t,null);return n?n[e]:void 0}:function(t,e){var n=t.style[e];return!n&&t.currentStyle&&(n=t.currentStyle[e]),n},i=T.document.documentElement.style,r="userSelect"in i?"userSelect":"MozUserSelect"in i?"MozUserSelect":"WebkitUserSelect"in i?"WebkitUserSelect":"KhtmlUserSelect"in i?"KhtmlUserSelect":"",T.util.makeElementUnselectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=T.util.falseFunction),r?t.style[r]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},T.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),r?t.style[r]="":"string"==typeof t.unselectable&&(t.unselectable=""),t},T.util.setImageSmoothing=function(t,e){t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=e},T.util.getById=function(t){return"string"==typeof t?T.document.getElementById(t):t},T.util.toArray=o,T.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},T.util.makeElement=a,T.util.wrapElement=function(t,e,n){return"string"==typeof e&&(e=a(e,n)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},T.util.getScrollLeftTop=s,T.util.getElementOffset=function(t){var e,i,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(n(t,c),10)||0;return e=r.documentElement,void 0!==t.getBoundingClientRect&&(o=t.getBoundingClientRect()),i=s(t),{left:o.left+i.left-(e.clientLeft||0)+a.left,top:o.top+i.top-(e.clientTop||0)+a.top}},T.util.getNodeCanvas=function(t){var e=T.jsdomImplForWrapper(t);return e._canvas||e._image},T.util.cleanUpJsdomNode=function(t){if(T.isLikelyNode){var e=T.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}T.util.request=function(e,n){n||(n={});var i=n.method?n.method.toUpperCase():"GET",r=n.onComplete||function(){},o=new T.window.XMLHttpRequest,a=n.body||n.parameters;return o.onreadystatechange=function(){4===o.readyState&&(r(o),o.onreadystatechange=t)},"GET"===i&&(a=null,"string"==typeof n.parameters&&(e=function(t,e){return t+(/\?/.test(t)?"&":"?")+e}(e,n.parameters))),o.open(i,e,!0),"POST"!==i&&"PUT"!==i||o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(a),o}}(),T.log=console.log,T.warn=console.warn,function(){function t(){return!1}function e(t,e,n,i){return-n*Math.cos(t/i*(Math.PI/2))+n+e}var n=T.window.requestAnimationFrame||T.window.webkitRequestAnimationFrame||T.window.mozRequestAnimationFrame||T.window.oRequestAnimationFrame||T.window.msRequestAnimationFrame||function(t){return T.window.setTimeout(t,1e3/60)},i=T.window.cancelAnimationFrame||T.window.clearTimeout;function r(){return n.apply(T.window,arguments)}T.util.animate=function(n){var i=!1;return r((function(o){n||(n={});var a,s=o||+new Date,l=n.duration||500,c=s+l,u=n.onChange||t,h=n.abort||t,d=n.onComplete||t,f=n.easing||e,p="startValue"in n?n.startValue:0,g="endValue"in n?n.endValue:100,v=n.byValue||g-p;n.onStart&&n.onStart(),function t(e){var n=(a=e||+new Date)>c?l:a-s,o=n/l,m=f(n,p,v,l),y=Math.abs((m-p)/v);if(!i){if(!h(m,y,o))return a>c?(u(g,1,1),void d(g,1,1)):(u(m,y,o),void r(t));d(g,1,1)}}(s)})),function(){i=!0}},T.util.requestAnimFrame=r,T.util.cancelAnimFrame=function(){return i.apply(T.window,arguments)}}(),function(){function t(t,e,n){var i="rgba("+parseInt(t[0]+n*(e[0]-t[0]),10)+","+parseInt(t[1]+n*(e[1]-t[1]),10)+","+parseInt(t[2]+n*(e[2]-t[2]),10);return i+=","+(t&&e?parseFloat(t[3]+n*(e[3]-t[3])):1),i+=")"}T.util.animateColor=function(e,n,i,r){var o=new T.Color(e).getSource(),a=new T.Color(n).getSource(),s=r.onComplete,l=r.onChange;return r=r||{},T.util.animate(T.util.object.extend(r,{duration:i||500,startValue:o,endValue:a,byValue:a,easing:function(e,n,i,o){return t(n,i,r.colorEasing?r.colorEasing(e,o):1-Math.cos(e/o*(Math.PI/2)))},onComplete:function(e,n,i){if(s)return s(t(a,a,0),n,i)},onChange:function(e,n,i){if(l){if(Array.isArray(e))return l(t(e,e,0),n,i);l(e,n,i)}}}))}}(),function(){function t(t,e,n,i){return t<Math.abs(e)?(t=e,i=n/4):i=0===e&&0===t?n/(2*Math.PI)*Math.asin(1):n/(2*Math.PI)*Math.asin(e/t),{a:t,c:e,p:n,s:i}}function e(t,e,n){return t.a*Math.pow(2,10*(e-=1))*Math.sin((e*n-t.s)*(2*Math.PI)/t.p)}function n(t,e,n,r){return n-i(r-t,0,n,r)+e}function i(t,e,n,i){return(t/=i)<1/2.75?n*(7.5625*t*t)+e:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e}T.util.ease={easeInQuad:function(t,e,n,i){return n*(t/=i)*t+e},easeOutQuad:function(t,e,n,i){return-n*(t/=i)*(t-2)+e},easeInOutQuad:function(t,e,n,i){return(t/=i/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,n,i){return n*(t/=i)*t*t+e},easeOutCubic:function(t,e,n,i){return n*((t=t/i-1)*t*t+1)+e},easeInOutCubic:function(t,e,n,i){return(t/=i/2)<1?n/2*t*t*t+e:n/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,n,i){return n*(t/=i)*t*t*t+e},easeOutQuart:function(t,e,n,i){return-n*((t=t/i-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,n,i){return(t/=i/2)<1?n/2*t*t*t*t+e:-n/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,n,i){return n*(t/=i)*t*t*t*t+e},easeOutQuint:function(t,e,n,i){return n*((t=t/i-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,n,i){return(t/=i/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,n,i){return-n*Math.cos(t/i*(Math.PI/2))+n+e},easeOutSine:function(t,e,n,i){return n*Math.sin(t/i*(Math.PI/2))+e},easeInOutSine:function(t,e,n,i){return-n/2*(Math.cos(Math.PI*t/i)-1)+e},easeInExpo:function(t,e,n,i){return 0===t?e:n*Math.pow(2,10*(t/i-1))+e},easeOutExpo:function(t,e,n,i){return t===i?e+n:n*(1-Math.pow(2,-10*t/i))+e},easeInOutExpo:function(t,e,n,i){return 0===t?e:t===i?e+n:(t/=i/2)<1?n/2*Math.pow(2,10*(t-1))+e:n/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,n,i){return-n*(Math.sqrt(1-(t/=i)*t)-1)+e},easeOutCirc:function(t,e,n,i){return n*Math.sqrt(1-(t=t/i-1)*t)+e},easeInOutCirc:function(t,e,n,i){return(t/=i/2)<1?-n/2*(Math.sqrt(1-t*t)-1)+e:n/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(n,i,r,o){var a=0;return 0===n?i:1===(n/=o)?i+r:(a||(a=.3*o),-e(t(r,r,a,1.70158),n,o)+i)},easeOutElastic:function(e,n,i,r){var o=0;if(0===e)return n;if(1===(e/=r))return n+i;o||(o=.3*r);var a=t(i,i,o,1.70158);return a.a*Math.pow(2,-10*e)*Math.sin((e*r-a.s)*(2*Math.PI)/a.p)+a.c+n},easeInOutElastic:function(n,i,r,o){var a=0;if(0===n)return i;if(2===(n/=o/2))return i+r;a||(a=o*(.3*1.5));var s=t(r,r,a,1.70158);return n<1?-.5*e(s,n,o)+i:s.a*Math.pow(2,-10*(n-=1))*Math.sin((n*o-s.s)*(2*Math.PI)/s.p)*.5+s.c+i},easeInBack:function(t,e,n,i,r){return void 0===r&&(r=1.70158),n*(t/=i)*t*((r+1)*t-r)+e},easeOutBack:function(t,e,n,i,r){return void 0===r&&(r=1.70158),n*((t=t/i-1)*t*((r+1)*t+r)+1)+e},easeInOutBack:function(t,e,n,i,r){return void 0===r&&(r=1.70158),(t/=i/2)<1?n/2*(t*t*((1+(r*=1.525))*t-r))+e:n/2*((t-=2)*t*((1+(r*=1.525))*t+r)+2)+e},easeInBounce:n,easeOutBounce:i,easeInOutBounce:function(t,e,r,o){return t<o/2?.5*n(2*t,0,r,o)+e:.5*i(2*t-o,0,r,o)+.5*r+e}}}(),function(t){"use strict";var e=t.fabric||(t.fabric={}),n=e.util.object.extend,i=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 d(t,n,i,r){var s,l="[object Array]"===Object.prototype.toString.call(n);if("fill"!==t&&"stroke"!==t||"none"!==n){if("strokeUniform"===t)return"non-scaling-stroke"===n;if("strokeDashArray"===t)n="none"===n?null:n.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===t)n=i&&i.transformMatrix?a(i.transformMatrix,e.parseTransformAttribute(n)):e.parseTransformAttribute(n);else if("visible"===t)n="none"!==n&&"hidden"!==n,i&&!1===i.visible&&(n=!1);else if("opacity"===t)n=parseFloat(n),i&&void 0!==i.opacity&&(n*=i.opacity);else if("textAnchor"===t)n="start"===n?"left":"end"===n?"right":"center";else if("charSpacing"===t)s=o(n,r)/r*1e3;else if("paintFirst"===t){var c=n.indexOf("fill"),u=n.indexOf("stroke");n="fill";(c>-1&&u>-1&&u<c||-1===c&&u>-1)&&(n="stroke")}else{if("href"===t||"xlink:href"===t||"font"===t)return n;if("imageSmoothing"===t)return"optimizeQuality"===n;s=l?n.map(o):o(n,r)}}else n="";return!l&&isNaN(s)?n:s}function f(t){return new RegExp("^("+t.join("|")+")\\b","i")}function p(t,e){var n,i,r,o,a=[];for(r=0,o=e.length;r<o;r++)n=e[r],i=t.getElementsByTagName(n),a=a.concat(Array.prototype.slice.call(i));return a}function g(t,e){var n,i=!0;return(n=v(t,e.pop()))&&e.length&&(i=function(t,e){var n,i=!0;for(;t.parentNode&&1===t.parentNode.nodeType&&e.length;)i&&(n=e.pop()),i=v(t=t.parentNode,n);return 0===e.length}(t,e)),n&&i&&0===e.length}function v(t,e){var n,i,r=t.nodeName,o=t.getAttribute("class"),a=t.getAttribute("id");if(n=new RegExp("^"+r,"i"),e=e.replace(n,""),a&&e.length&&(n=new RegExp("#"+a+"(?![a-zA-Z\\-]+)","i"),e=e.replace(n,"")),o&&e.length)for(i=(o=o.split(" ")).length;i--;)n=new RegExp("\\."+o[i]+"(?![a-zA-Z\\-]+)","i"),e=e.replace(n,"");return 0===e.length}function m(t,e){var n;if(t.getElementById&&(n=t.getElementById(e)),n)return n;var i,r,o,a=t.getElementsByTagName("*");for(r=0,o=a.length;r<o;r++)if(e===(i=a[r]).getAttribute("id"))return i}e.svgValidTagNamesRegEx=f(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),e.svgViewBoxElementsRegEx=f(["symbol","image","marker","pattern","view","svg"]),e.svgInvalidAncestorsRegEx=f(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),e.svgValidParentsRegEx=f(["symbol","g","a","svg","clipPath","defs"]),e.cssRules={},e.gradientDefs={},e.clipPaths={},e.parseTransformAttribute=function(){function t(t,n,i){t[i]=Math.tan(e.util.degreesToRadians(n[0]))}var n=e.iMatrix,i=e.reNum,r=e.commaWsp,o="(?:"+("(?:(matrix)\\s*\\(\\s*("+i+")"+r+"("+i+")"+r+"("+i+")"+r+"("+i+")"+r+"("+i+")"+r+"("+i+")\\s*\\))")+"|"+("(?:(translate)\\s*\\(\\s*("+i+")(?:"+r+"("+i+"))?\\s*\\))")+"|"+("(?:(scale)\\s*\\(\\s*("+i+")(?:"+r+"("+i+"))?\\s*\\))")+"|"+("(?:(rotate)\\s*\\(\\s*("+i+")(?:"+r+"("+i+")"+r+"("+i+"))?\\s*\\))")+"|"+("(?:(skewX)\\s*\\(\\s*("+i+")\\s*\\))")+"|"+("(?:(skewY)\\s*\\(\\s*("+i+")\\s*\\))")+")",a=new RegExp("^\\s*(?:"+("(?:"+o+"(?:"+r+"*"+o+")*)")+"?)\\s*$"),s=new RegExp(o,"g");return function(i){var r=n.concat(),l=[];if(!i||i&&!a.test(i))return r;i.replace(s,(function(i){var a=new RegExp(o).exec(i).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,n){var i=e.util.cos(n[0]),r=e.util.sin(n[0]),o=0,a=0;3===n.length&&(o=n[1],a=n[2]),t[0]=i,t[1]=r,t[2]=-r,t[3]=i,t[4]=o-(i*o-r*a),t[5]=a-(r*o+i*a)}(r,c);break;case"scale":!function(t,e){var n=e[0],i=2===e.length?e[1]:e[0];t[0]=n,t[3]=i}(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=n.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 x(t){if(!e.svgViewBoxElementsRegEx.test(t.nodeName))return{};var n,i,r,a,s,l,c=t.getAttribute("viewBox"),u=1,h=1,d=t.getAttribute("width"),f=t.getAttribute("height"),p=t.getAttribute("x")||0,g=t.getAttribute("y")||0,v=t.getAttribute("preserveAspectRatio")||"",m=!c||!(c=c.match(y)),x=!d||!f||"100%"===d||"100%"===f,_=m&&x,b={},w="",S=0,C=0;if(b.width=0,b.height=0,b.toBeParsed=_,m&&(p||g)&&t.parentNode&&"#document"!==t.parentNode.nodeName&&(w=" translate("+o(p)+" "+o(g)+") ",s=(t.getAttribute("transform")||"")+w,t.setAttribute("transform",s),t.removeAttribute("x"),t.removeAttribute("y")),_)return b;if(m)return b.width=o(d),b.height=o(f),b;if(n=-parseFloat(c[1]),i=-parseFloat(c[2]),r=parseFloat(c[3]),a=parseFloat(c[4]),b.minX=n,b.minY=i,b.viewBoxWidth=r,b.viewBoxHeight=a,x?(b.width=r,b.height=a):(b.width=o(d),b.height=o(f),u=b.width/r,h=b.height/a),"none"!==(v=e.util.parsePreserveAspectRatioAttribute(v)).alignX&&("meet"===v.meetOrSlice&&(h=u=u>h?h:u),"slice"===v.meetOrSlice&&(h=u=u>h?u:h),S=b.width-r*u,C=b.height-a*u,"Mid"===v.alignX&&(S/=2),"Mid"===v.alignY&&(C/=2),"Min"===v.alignX&&(S=0),"Min"===v.alignY&&(C=0)),1===u&&1===h&&0===n&&0===i&&0===p&&0===g)return b;if((p||g)&&"#document"!==t.parentNode.nodeName&&(w=" translate("+o(p)+" "+o(g)+") "),s=w+" matrix("+u+" 0 0 "+h+" "+(n*u+S)+" "+(i*h+C)+") ","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),b}function _(t,e){var n="xlink:href",i=m(t,e.getAttribute(n).substr(1));if(i&&i.getAttribute(n)&&_(t,i),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach((function(t){i&&!e.hasAttribute(t)&&i.hasAttribute(t)&&e.setAttribute(t,i.getAttribute(t))})),!e.children.length)for(var r=i.cloneNode(!0);r.firstChild;)e.appendChild(r.firstChild);e.removeAttribute(n)}e.parseSVGDocument=function(t,n,r,o){if(t){!function(t){for(var n=p(t,["use","svg:use"]),i=0;n.length&&i<n.length;){var r=n[i],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,d=r.getAttribute("y")||0,f=m(t,u).cloneNode(!0),g=(f.getAttribute("transform")||"")+" translate("+h+", "+d+")",v=n.length,y=e.svgNS;if(x(f),/^svg$/i.test(f.nodeName)){var _=f.ownerDocument.createElementNS(y,"g");for(s=0,c=(l=f.attributes).length;s<c;s++)a=l.item(s),_.setAttributeNS(y,a.nodeName,a.nodeValue);for(;f.firstChild;)_.appendChild(f.firstChild);f=_}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?g=a.nodeValue+" "+g:f.setAttribute(a.nodeName,a.nodeValue));f.setAttribute("transform",g),f.setAttribute("instantiated_by_use","1"),f.removeAttribute("id"),r.parentNode.replaceChild(f,r),n.length===v&&i++}}(t);var a,s,l=e.Object.__uid++,c=x(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 d=u.filter((function(t){return x(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(!d||d&&!d.length)n&&n([],{});else{var f={};u.filter((function(t){return"clipPath"===t.nodeName.replace("svg:","")})).forEach((function(t){var n=t.getAttribute("id");f[n]=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]=f,e.parseElements(d,(function(t,i){n&&(n(t,c,i,u),delete e.gradientDefs[l],delete e.cssRules[l],delete e.clipPaths[l])}),i(c),r,o)}}};var b=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+(.*)");n(e,{parseFontDeclaration:function(t,e){var n=t.match(b);if(n){var i=n[1],r=n[3],a=n[4],s=n[5],l=n[6];i&&(e.fontStyle=i),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,n=p(t,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),i=0,r={};for(i=n.length;i--;)(e=n[i]).getAttribute("xlink:href")&&_(t,e),r[e.getAttribute("id")]=e;return r},parseAttributes:function(t,i,a){if(t){var s,f,p,v={};void 0===a&&(a=t.getAttribute("svgUid")),t.parentNode&&e.svgValidParentsRegEx.test(t.parentNode.nodeName)&&(v=e.parseAttributes(t.parentNode,i,a));var m=i.reduce((function(e,n){re