UNPKG

plot-plan-designer

Version:

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

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