From 9fd3d729186f9467d0d6de96d3c87a0667a3a483 Mon Sep 17 00:00:00 2001
From: X1627315083 <1627315083@qq.com>
Date: Wed, 21 Feb 2024 09:42:43 +0800
Subject: [PATCH] fix
---
.env.dev | 4 ++--
public/index.html | 1 +
public/js/fabric.min.js | 1 +
src/tool/https.js | 2 +-
4 files changed, 5 insertions(+), 3 deletions(-)
create mode 100644 public/js/fabric.min.js
diff --git a/.env.dev b/.env.dev
index 4b93508e..38b3deea 100644
--- a/.env.dev
+++ b/.env.dev
@@ -3,6 +3,6 @@ NODE_ENV = 'development'
# VUE_APP_BASE_URL = 'https://api.aida.com.hk'
# VUE_APP_BASE_URL = 'http://18.167.251.121:10086'
-# VUE_APP_BASE_URL = 'https://develop.api.aida.com.hk'
-VUE_APP_BASE_URL = 'http://192.168.1.9:17088'
+VUE_APP_BASE_URL = 'https://develop.api.aida.com.hk'
+# VUE_APP_BASE_URL = 'http://192.168.1.9:17088'
# VUE_APP_BASE_URL = '18.167.251.121:17088'
diff --git a/public/index.html b/public/index.html
index ebb75311..6206b504 100644
--- a/public/index.html
+++ b/public/index.html
@@ -14,6 +14,7 @@
+
diff --git a/public/js/fabric.min.js b/public/js/fabric.min.js
new file mode 100644
index 00000000..416d1172
--- /dev/null
+++ b/public/js/fabric.min.js
@@ -0,0 +1 @@
+var fabric=fabric||{version:"5.2.1"};if("undefined"!=typeof exports?exports.fabric=fabric:"function"==typeof define&&define.amd&&define([],function(){return fabric}),"undefined"!=typeof document&&"undefined"!=typeof window)fabric.document=document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?document:document.implementation.createHTMLDocument(""),fabric.window=window;else{var jsdom=require("jsdom"),virtualWindow=new jsdom.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;fabric.document=virtualWindow.document,fabric.jsdomImplForWrapper=require("jsdom/lib/jsdom/living/generated/utils").implForWrapper,fabric.nodeCanvas=require("jsdom/lib/jsdom/utils").Canvas,fabric.window=virtualWindow,DOMParser=fabric.window.DOMParser}fabric.isTouchSupported="ontouchstart"in fabric.window||"ontouchstart"in fabric.document||fabric.window&&fabric.window.navigator&&fabric.window.navigator.maxTouchPoints>0,fabric.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window,fabric.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],fabric.DPI=96,fabric.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",fabric.commaWsp="(?:\\s+,?\\s*|,\\s*)",fabric.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,fabric.reNonWord=/[ \n\.,;!\?\-]/,fabric.fontPaths={},fabric.iMatrix=[1,0,0,1,0,0],fabric.svgNS="http://www.w3.org/2000/svg",fabric.perfLimitSizeTotal=2097152,fabric.maxCacheSideLimit=4096,fabric.minCacheSideLimit=256,fabric.charWidthsCache={},fabric.textureSize=2048,fabric.disableStyleCopyPaste=!1,fabric.enableGLFiltering=!0,fabric.devicePixelRatio=fabric.window.devicePixelRatio||fabric.window.webkitDevicePixelRatio||fabric.window.mozDevicePixelRatio||1,fabric.browserShadowBlurConstant=1,fabric.arcToSegmentsCache={},fabric.boundsOfCurveCache={},fabric.cachesBoundsOfCurve=!0,fabric.forceGLPutImageData=!1,fabric.initFilterBackend=function(){return fabric.enableGLFiltering&&fabric.isWebglSupported&&fabric.isWebglSupported(fabric.textureSize)?(console.log("max texture size: "+fabric.maxTextureSize),new fabric.WebglFilterBackend({tileSize:fabric.textureSize})):fabric.Canvas2dFilterBackend?new fabric.Canvas2dFilterBackend:void 0};"undefined"!=typeof document&&"undefined"!=typeof window&&(window.fabric=fabric);if("undefined"==typeof eventjs)var eventjs={};if(function(e){"use strict";e.modifyEventListener=!1,e.modifySelectors=!1,e.configure=function(t){isFinite(t.modifyEventListener)&&(e.modifyEventListener=t.modifyEventListener),isFinite(t.modifySelectors)&&(e.modifySelectors=t.modifySelectors),l===!1&&e.modifyEventListener&&p(),g===!1&&e.modifySelectors&&m()},e.add=function(e,t,r,o){return n(e,t,r,o,"add")},e.remove=function(e,t,r,o){return n(e,t,r,o,"remove")},e.returnFalse=function(){return!1},e.stop=function(e){e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,e.cancelBubbleCount=0)},e.prevent=function(e){e&&(e.preventDefault?e.preventDefault():e.preventManipulation?e.preventManipulation():e.returnValue=!1)},e.cancel=function(t){e.stop(t),e.prevent(t)},e.blur=function(){var e=document.activeElement;if(e){var t=document.activeElement.nodeName;("INPUT"===t||"TEXTAREA"===t||"true"===e.contentEditable)&&e.blur&&e.blur()}},e.getEventSupport=function(e,t){if("string"==typeof e&&(t=e,e=window),t="on"+t,t in e)return!0;if(e.setAttribute||(e=document.createElement("div")),e.setAttribute&&e.removeAttribute){e.setAttribute(t,"");var n="function"==typeof e[t];return"undefined"!=typeof e[t]&&(e[t]=null),e.removeAttribute(t),n}};var t=function(e){if(!e||"object"!=typeof e)return e;var n=new e.constructor;for(var r in e)n[r]=e[r]&&"object"==typeof e[r]?t(e[r]):e[r];return n},n=function(i,s,d,l,p,g){if(l=l||{},"[object Object]"===String(i)){var m=i;if(i=m.target,delete m.target,!m.type||!m.listener){for(var y in m){var j=m[y];"function"!=typeof j&&(l[y]=j)}var w={};for(var h in m){var y=h.split(","),b=m[h],x={};for(var P in l)x[P]=l[P];if("function"==typeof b)var d=b;else{if("function"!=typeof b.listener)continue;var d=b.listener;for(var P in b)"function"!=typeof b[P]&&(x[P]=b[P])}for(var E=0;ET&&window.clearInterval(G),document.querySelector(i)&&(window.clearInterval(G),setTimeout(d,1))},D);return}s="load",i=window}if("string"==typeof i){if(i=document.querySelectorAll(i),0===i.length)return o("Missing target on listener!",arguments);1===i.length&&(i=i[0])}var L,k={};if(i.length>0&&i!==window){for(var S=0,C=i.length;C>S;S++)L=n(i[S],s,d,t(l),p),L&&(k[S]=L);return r(k)}if("string"==typeof s&&(s=s.toLowerCase(),-1!==s.indexOf(" ")?s=s.split(" "):-1!==s.indexOf(",")&&(s=s.split(","))),"string"!=typeof s){if("number"==typeof s.length)for(var H=0,F=s.length;F>H;H++)L=n(i,s[H],d,t(l),p),L&&(k[s[H]]=L);else for(var h in s)L="function"==typeof s[h]?n(i,h,s[h],t(l),p):n(i,h,s[h].listener,t(s[h]),p),L&&(k[h]=L);return r(k)}if(0===s.indexOf("on")&&(s=s.slice(2)),"object"!=typeof i)return o("Target is not defined!",arguments);if("function"!=typeof d)return o("Listener is not a function!",arguments);var X=l.useCapture||!1,Y=v(i)+"."+v(d)+"."+(X?1:0);if(e.Gesture&&e.Gesture._gestureHandlers[s]){if(Y=s+Y,"remove"===p){if(!u[Y])return;u[Y].remove(),delete u[Y]}else if("add"===p){if(u[Y])return u[Y].add(),u[Y];if(l.useCall&&!e.modifyEventListener){var _=d;d=function(e,t){for(var n in t)e[n]=t[n];return _.call(i,e)}}l.gesture=s,l.target=i,l.listener=d,l.fromOverwrite=g,u[Y]=e.proxy[s](l)}return u[Y]}for(var U,O=a(s),E=0;Er;r++)this[r].removeEventListener(e,t,n)},e.addEventListener=function(e,t,n){for(var r=0,o=this.length;o>r;r++)this[r].addEventListener(e,t,n)}};return e}(eventjs),"undefined"==typeof eventjs)var eventjs={};if("undefined"==typeof eventjs.proxy&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";e.pointerSetup=function(e,t){e.target=e.target||window,e.doc=e.target.ownerDocument||e.target,e.minFingers=e.minFingers||e.fingers||1,e.maxFingers=e.maxFingers||e.fingers||1/0,e.position=e.position||"relative",delete e.fingers,t=t||{},t.enabled=!0,t.gesture=e.gesture,t.target=e.target,t.env=e.env,eventjs.modifyEventListener&&e.fromOverwrite&&(e.oldListener=e.listener,e.listener=eventjs.createPointerEvent);var n=0,r=0===t.gesture.indexOf("pointer")&&eventjs.modifyEventListener?"pointer":"mouse";return e.oldListener&&(t.oldListener=e.oldListener),t.listener=e.listener,t.proxy=function(n){t.defaultListener=e.listener,e.listener=n,n(e.event,t)},t.add=function(){t.enabled!==!0&&(e.onPointerDown&&eventjs.add(e.target,r+"down",e.onPointerDown),e.onPointerMove&&eventjs.add(e.doc,r+"move",e.onPointerMove),e.onPointerUp&&eventjs.add(e.doc,r+"up",e.onPointerUp),t.enabled=!0)},t.remove=function(){t.enabled!==!1&&(e.onPointerDown&&eventjs.remove(e.target,r+"down",e.onPointerDown),e.onPointerMove&&eventjs.remove(e.doc,r+"move",e.onPointerMove),e.onPointerUp&&eventjs.remove(e.doc,r+"up",e.onPointerUp),t.reset(),t.enabled=!1)},t.pause=function(t){!e.onPointerMove||t&&!t.move||eventjs.remove(e.doc,r+"move",e.onPointerMove),!e.onPointerUp||t&&!t.up||eventjs.remove(e.doc,r+"up",e.onPointerUp),n=e.fingers,e.fingers=0},t.resume=function(t){!e.onPointerMove||t&&!t.move||eventjs.add(e.doc,r+"move",e.onPointerMove),!e.onPointerUp||t&&!t.up||eventjs.add(e.doc,r+"up",e.onPointerUp),e.fingers=n},t.reset=function(){e.tracker={},e.fingers=0},t};var t=eventjs.supports;eventjs.isMouse=!!t.mouse,eventjs.isMSPointer=!!t.touch,eventjs.isTouch=!!t.msPointer,e.pointerStart=function(t,n,r){var o=(t.type||"mousedown").toUpperCase();0===o.indexOf("MOUSE")?(eventjs.isMouse=!0,eventjs.isTouch=!1,eventjs.isMSPointer=!1):0===o.indexOf("TOUCH")?(eventjs.isMouse=!1,eventjs.isTouch=!0,eventjs.isMSPointer=!1):0===o.indexOf("MSPOINTER")&&(eventjs.isMouse=!1,eventjs.isTouch=!1,eventjs.isMSPointer=!0);var i=function(e,t){var n=r.bbox,o=a[t]={};switch(r.position){case"absolute":o.offsetX=0,o.offsetY=0;break;case"differenceFromLast":o.offsetX=e.pageX,o.offsetY=e.pageY;break;case"difference":o.offsetX=e.pageX,o.offsetY=e.pageY;break;case"move":o.offsetX=e.pageX-n.x1,o.offsetY=e.pageY-n.y1;break;default:o.offsetX=n.x1-n.scrollLeft,o.offsetY=n.y1-n.scrollTop}var i=e.pageX-o.offsetX,s=e.pageY-o.offsetY;o.rotation=0,o.scale=1,o.startTime=o.moveTime=(new Date).getTime(),o.move={x:i,y:s},o.start={x:i,y:s},r.fingers++};r.event=t,n.defaultListener&&(r.listener=n.defaultListener,delete n.defaultListener);for(var s=!r.fingers,a=r.tracker,u=t.changedTouches||e.getCoords(t),d=u.length,v=0;d>v;v++){var f=u[v],c=f.identifier||1/0;if(r.fingers){if(r.fingers>=r.maxFingers){var l=[];for(var c in r.tracker)l.push(c);return n.identifier=l.join(","),s}var p=0;for(var g in a){if(a[g].up){delete a[g],i(f,c),r.cancel=!0;break}p++}if(a[c])continue;i(f,c)}else a=r.tracker={},n.bbox=r.bbox=e.getBoundingBox(r.target),r.fingers=0,r.cancel=!1,i(f,c)}var l=[];for(var c in r.tracker)l.push(c);return n.identifier=l.join(","),s},e.pointerEnd=function(e,t,n,r){for(var o=e.touches||[],i=o.length,s={},a=0;i>a;a++){var u=o[a],d=u.identifier;s[d||1/0]=!0}for(var d in n.tracker){var v=n.tracker[d];s[d]||v.up||(r&&r({pageX:v.pageX,pageY:v.pageY,changedTouches:[{pageX:v.pageX,pageY:v.pageY,identifier:"Infinity"===d?1/0:d}]},"up"),v.up=!0,n.fingers--)}if(0!==n.fingers)return!1;var f=[];n.gestureFingers=0;for(var d in n.tracker)n.gestureFingers++,f.push(d);return t.identifier=f.join(","),!0},e.getCoords=function(t){return e.getCoords="undefined"!=typeof t.pageX?function(e){return Array({type:"mouse",x:e.pageX,y:e.pageY,pageX:e.pageX,pageY:e.pageY,identifier:e.pointerId||1/0})}:function(e){var t=document.documentElement;return e=e||window.event,Array({type:"mouse",x:e.clientX+t.scrollLeft,y:e.clientY+t.scrollTop,pageX:e.clientX+t.scrollLeft,pageY:e.clientY+t.scrollTop,identifier:1/0})},e.getCoords(t)},e.getCoord=function(t){if("ontouchstart"in window){var n=0,r=0;e.getCoord=function(e){var t=e.changedTouches;return t&&t.length?{x:n=t[0].pageX,y:r=t[0].pageY}:{x:n,y:r}}}else e.getCoord="undefined"!=typeof t.pageX&&"undefined"!=typeof t.pageY?function(e){return{x:e.pageX,y:e.pageY}}:function(e){var t=document.documentElement;return e=e||window.event,{x:e.clientX+t.scrollLeft,y:e.clientY+t.scrollTop}};return e.getCoord(t)};var n=function(e,t){var n=parseFloat(e.getPropertyValue(t),10);return isFinite(n)?n:0};return e.getBoundingBox=function(e){(e===window||e===document)&&(e=document.body);var t={},r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.x1=r.left,t.y1=r.top,t.scaleX=r.width/e.offsetWidth||1,t.scaleY=r.height/e.offsetHeight||1,t.scrollLeft=0,t.scrollTop=0;var o=window.getComputedStyle(e),i="border-box"===o.getPropertyValue("box-sizing");if(i===!1){var s=n(o,"border-left-width"),a=n(o,"border-right-width"),u=n(o,"border-bottom-width"),d=n(o,"border-top-width");t.border=[s,a,d,u],t.x1+=s,t.y1+=d,t.width-=a+s,t.height-=u+d}t.x2=t.x1+t.width,t.y2=t.y1+t.height;for(var v=o.getPropertyValue("position"),f="fixed"===v?e:e.parentNode;null!==f&&f!==document.body&&void 0!==f.scrollTop;){var o=window.getComputedStyle(f),v=o.getPropertyValue("position");if("absolute"===v);else{if("fixed"===v){t.scrollTop-=f.parentNode.scrollTop,t.scrollLeft-=f.parentNode.scrollLeft;break}t.scrollLeft+=f.scrollLeft,t.scrollTop+=f.scrollTop}f=f.parentNode}return t.scrollBodyLeft=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,t.scrollBodyTop=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,t.scrollLeft-=t.scrollBodyLeft,t.scrollTop-=t.scrollBodyTop,t},function(){var t,n=navigator.userAgent.toLowerCase(),r=-1!==n.indexOf("macintosh");t=r&&-1!==n.indexOf("khtml")?{91:!0,93:!0}:r&&-1!==n.indexOf("firefox")?{224:!0}:{17:!0},(e.metaTrackerReset=function(){eventjs.fnKey=e.fnKey=!1,eventjs.metaKey=e.metaKey=!1,eventjs.escKey=e.escKey=!1,eventjs.ctrlKey=e.ctrlKey=!1,eventjs.shiftKey=e.shiftKey=!1,eventjs.altKey=e.altKey=!1})(),e.metaTracker=function(n){var r="keydown"===n.type;27===n.keyCode&&(eventjs.escKey=e.escKey=r),t[n.keyCode]&&(eventjs.metaKey=e.metaKey=r),eventjs.ctrlKey=e.ctrlKey=n.ctrlKey,eventjs.shiftKey=e.shiftKey=n.shiftKey,eventjs.altKey=e.altKey=n.altKey}}(),e}(eventjs.proxy),"undefined"==typeof eventjs)var eventjs={};if(eventjs.MutationObserver=function(){var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,t=!e&&function(){var e=document.createElement("p"),t=!1,n=function(){t=!0};if(e.addEventListener)e.addEventListener("DOMAttrModified",n,!1);else{if(!e.attachEvent)return!1;e.attachEvent("onDOMAttrModified",n)}return e.setAttribute("id","target"),t}();return function(n,r){if(e){var o={subtree:!1,attributes:!0},i=new e(function(e){e.forEach(function(e){r.call(e.target,e.attributeName)})});i.observe(n,o)}else t?eventjs.add(n,"DOMAttrModified",function(e){r.call(n,e.attrName)}):"onpropertychange"in document.body&&eventjs.add(n,"propertychange",function(){r.call(n,window.event.propertyName)})}}(),"undefined"==typeof eventjs)var eventjs={};if("undefined"==typeof eventjs.proxy&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";return e.click=function(t){t.gesture=t.gesture||"click",t.maxFingers=t.maxFingers||t.fingers||1,t.onPointerDown=function(r){e.pointerStart(r,n,t)&&eventjs.add(t.target,"mouseup",t.onPointerUp)},t.onPointerUp=function(r){if(e.pointerEnd(r,n,t)){eventjs.remove(t.target,"mouseup",t.onPointerUp);var o=r.changedTouches||e.getCoords(r),i=o[0],s=t.bbox,a=e.getBoundingBox(t.target),u=i.pageY-a.scrollBodyTop,d=i.pageX-a.scrollBodyLeft;if(d>s.x1&&u>s.y1&&d0&&v0&&f=r){u.state=t.gesture;for(var s in t.tracker)break;var d=t.tracker[s];u.x=d.start.x,u.y=d.start.y,t.listener(i,u)}clearTimeout(o),n=r=0}};var u=e.pointerSetup(t);return u.state="dblclick",eventjs.add(t.target,"mousedown",t.onPointerDown),u},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.dbltap=e.dbltap,eventjs.Gesture._gestureHandlers.dblclick=e.dblclick,e}(eventjs.proxy),"undefined"==typeof eventjs)var eventjs={};if("undefined"==typeof eventjs.proxy&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";return e.dragElement=function(t,n){e.drag({event:n,target:t,position:"move",listener:function(e,n){t.style.left=n.x+"px",t.style.top=n.y+"px",eventjs.prevent(e)}})},e.drag=function(t){t.gesture="drag",t.onPointerDown=function(r){e.pointerStart(r,n,t)&&(t.monitor||(eventjs.add(t.doc,"mousemove",t.onPointerMove),eventjs.add(t.doc,"mouseup",t.onPointerUp))),t.onPointerMove(r,"down")},t.onPointerMove=function(r,o){if(!t.tracker)return t.onPointerDown(r);for(var i=(t.bbox,r.changedTouches||e.getCoords(r)),s=i.length,a=0;s>a;a++){var u=i[a],d=u.identifier||1/0,v=t.tracker[d];v&&(v.pageX=u.pageX,v.pageY=u.pageY,n.state=o||"move",n.identifier=d,n.start=v.start,n.fingers=t.fingers,"differenceFromLast"===t.position?(n.x=v.pageX-v.offsetX,n.y=v.pageY-v.offsetY,v.offsetX=v.pageX,v.offsetY=v.pageY):(n.x=v.pageX-v.offsetX,n.y=v.pageY-v.offsetY),t.listener(r,n))}},t.onPointerUp=function(r){e.pointerEnd(r,n,t,t.onPointerMove)&&(t.monitor||(eventjs.remove(t.doc,"mousemove",t.onPointerMove),eventjs.remove(t.doc,"mouseup",t.onPointerUp)))};var n=e.pointerSetup(t);return t.event?t.onPointerDown(t.event):(eventjs.add(t.target,"mousedown",t.onPointerDown),t.monitor&&(eventjs.add(t.doc,"mousemove",t.onPointerMove),eventjs.add(t.doc,"mouseup",t.onPointerUp))),n},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.drag=e.drag,e}(eventjs.proxy),"undefined"==typeof eventjs)var eventjs={};if("undefined"==typeof eventjs.proxy&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";var t=Math.PI/180,n=function(e,t){var n=0,r=0,o=0;for(var i in t){var s=t[i];s.up||(n+=s.move.x,r+=s.move.y,o++)}return e.x=n/=o,e.y=r/=o,e};return e.gesture=function(r){r.gesture=r.gesture||"gesture",r.minFingers=r.minFingers||r.fingers||2,r.onPointerDown=function(t){var i=r.fingers;if(e.pointerStart(t,o,r)&&(eventjs.add(r.doc,"mousemove",r.onPointerMove),eventjs.add(r.doc,"mouseup",r.onPointerUp)),r.fingers===r.minFingers&&i!==r.fingers){o.fingers=r.minFingers,o.scale=1,o.rotation=0,o.state="start";var s="";for(var a in r.tracker)s+=a;o.identifier=parseInt(s),n(o,r.tracker),r.listener(t,o)}},r.onPointerMove=function(i){for(var s=r.bbox,a=r.tracker,u=i.changedTouches||e.getCoords(i),d=u.length,v=0;d>v;v++){var f=u[v],c=f.identifier||1/0,l=a[c];l&&(l.move.x=f.pageX-s.x1,l.move.y=f.pageY-s.y1)}if(!(r.fingers0?b:-b,"undefined"!=typeof f.DEG2&&(b>0?f.rotation+=f.DEG1-f.DEG2:f.rotation-=f.DEG1-f.DEG2,g+=f.rotation),u.push(f.move)}}o.touches=u,o.fingers=r.fingers,o.scale=p/r.fingers,o.rotation=g/r.fingers,o.state="change",r.listener(i,o)}},r.onPointerUp=function(t){var n=r.fingers;e.pointerEnd(t,o,r)&&(eventjs.remove(r.doc,"mousemove",r.onPointerMove),eventjs.remove(r.doc,"mouseup",r.onPointerUp)),n===r.minFingers&&r.fingersp;p++){var m=c[p],y=t.acceleration[m],j=u[m],w=Math.abs(y);if(!(r>l-s)&&w>n){var h=l*y/w,b=Math.abs(h+j.value);j.value&&o>b?(j.value=h,j.count++,j.count===i&&(e.listener(d,t),s=l,j.value=0,j.count=0)):(j.value=h,j.count=1)}}};return window.addEventListener?(window.addEventListener("devicemotion",d,!1),t):void 0},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.shake=e.shake,e}(eventjs.proxy),"undefined"==typeof eventjs)var eventjs={};if("undefined"==typeof eventjs.proxy&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";var t=Math.PI/180;return e.swipe=function(n){n.snap=n.snap||90,n.threshold=n.threshold||1,n.gesture=n.gesture||"swipe",n.onPointerDown=function(t){e.pointerStart(t,r,n)&&(eventjs.add(n.doc,"mousemove",n.onPointerMove).listener(t),eventjs.add(n.doc,"mouseup",n.onPointerUp))},n.onPointerMove=function(t){for(var r=t.changedTouches||e.getCoords(t),o=r.length,i=0;o>i;i++){var s=r[i],a=s.identifier||1/0,u=n.tracker[a];u&&(u.move.x=s.pageX,u.move.y=s.pageY,u.moveTime=(new Date).getTime())}},n.onPointerUp=function(o){if(e.pointerEnd(o,r,n)){eventjs.remove(n.doc,"mousemove",n.onPointerMove),eventjs.remove(n.doc,"mouseup",n.onPointerUp);var i,s,a,u,d={x:0,y:0},v=0,f=0,c=0;for(var l in n.tracker){var p=n.tracker[l],g=p.move.x-p.start.x,m=p.move.y-p.start.y;v+=p.move.x,f+=p.move.y,d.x+=p.start.x,d.y+=p.start.y,c++;var y=Math.sqrt(g*g+m*m),j=p.moveTime-p.startTime,u=Math.atan2(g,m)/t+180,s=j?y/j:0;if("undefined"==typeof a)a=u,i=s;else{if(!(Math.abs(u-a)<=20))return;a=(a+u)/2,i=(i+s)/2}}var w=n.gestureFingers;n.minFingers<=w&&n.maxFingers>=w&&i>n.threshold&&(d.x/=c,d.y/=c,r.start=d,r.x=v/c,r.y=f/c,r.angle=-(((a/n.snap+.5>>0)*n.snap||360)-360),r.velocity=i,r.fingers=w,r.state="swipe",n.listener(o,r))}};var r=e.pointerSetup(n);return eventjs.add(n.target,"mousedown",n.onPointerDown),r},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.swipe=e.swipe,e}(eventjs.proxy),"undefined"==typeof eventjs)var eventjs={};if("undefined"==typeof eventjs.proxy&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";return e.longpress=function(t){return t.gesture="longpress",e.tap(t)},e.tap=function(t){t.delay=t.delay||500,t.timeout=t.timeout||250,t.driftDeviance=t.driftDeviance||10,t.gesture=t.gesture||"tap";var n,r;t.onPointerDown=function(i){if(e.pointerStart(i,o,t)){if(n=(new Date).getTime(),eventjs.add(t.doc,"mousemove",t.onPointerMove).listener(i),eventjs.add(t.doc,"mouseup",t.onPointerUp),"longpress"!==t.gesture)return;r=setTimeout(function(){if(!(i.cancelBubble&&++i.cancelBubbleCount>1)){var e=0;for(var n in t.tracker){var r=t.tracker[n];if(r.end===!0)return;if(t.cancel)return;e++}t.minFingers<=e&&t.maxFingers>=e&&(o.state="start",o.fingers=e,o.x=r.start.x,o.y=r.start.y,t.listener(i,o))}},t.delay)}},t.onPointerMove=function(n){for(var r=t.bbox,o=n.changedTouches||e.getCoords(n),i=o.length,s=0;i>s;s++){var a=o[s],u=a.identifier||1/0,d=t.tracker[u];if(d){var v=a.pageX-r.x1-parseInt(window.scrollX),f=a.pageY-r.y1-parseInt(window.scrollY),c=v-d.start.x,l=f-d.start.y,p=Math.sqrt(c*c+l*l);if(!(v>0&&v0&&f1)return;if("longpress"===t.gesture)return void("start"===o.state&&(o.state="end",t.listener(i,o)));if(t.cancel)return;if((new Date).getTime()-n>t.timeout)return;var s=t.gestureFingers;t.minFingers<=s&&t.maxFingers>=s&&(o.state="tap",o.fingers=t.gestureFingers,t.listener(i,o))}};var o=e.pointerSetup(t);return eventjs.add(t.target,"mousedown",t.onPointerDown),o},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.tap=e.tap,eventjs.Gesture._gestureHandlers.longpress=e.longpress,e}(eventjs.proxy),"undefined"==typeof eventjs)var eventjs={};if("undefined"==typeof eventjs.proxy&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";return e.wheelPreventElasticBounce=function(e){e&&("string"==typeof e&&(e=document.querySelector(e)),eventjs.add(e,"wheel",function(e,t){t.preventElasticBounce(),eventjs.stop(e)}))},e.wheel=function(e){var t,n=e.timeout||150,r=0,o={gesture:"wheel",state:"start",wheelDelta:0,target:e.target,listener:e.listener,preventElasticBounce:function(e){var t=this.target,n=t.scrollTop,r=n+t.offsetHeight,o=t.scrollHeight;r===o&&this.wheelDelta<=0?eventjs.cancel(e):0===n&&this.wheelDelta>=0&&eventjs.cancel(e),eventjs.stop(e)},add:function(){e.target[s](u,i,!1)},remove:function(){e.target[a](u,i,!1)}},i=function(i){i=i||window.event,o.state=r++?"change":"start",o.wheelDelta=i.detail?-20*i.detail:i.wheelDelta,e.listener(i,o),clearTimeout(t),t=setTimeout(function(){r=0,o.state="end",o.wheelDelta=0,e.listener(i,o)},n)},s=document.addEventListener?"addEventListener":"attachEvent",a=document.removeEventListener?"removeEventListener":"detachEvent",u=eventjs.getEventSupport("mousewheel")?"mousewheel":"DOMMouseScroll";return e.target[s](u,i,!1),o},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.wheel=e.wheel,e}(eventjs.proxy),"undefined"==typeof Event)var Event={};"undefined"==typeof Event.proxy&&(Event.proxy={}),Event.proxy=function(e){"use strict";return e.orientation=function(e){var t={gesture:"orientationchange",previous:null,current:window.orientation,target:e.target,listener:e.listener,remove:function(){window.removeEventListener("orientationchange",n,!1)}},n=function(n){return t.previous=t.current,t.current=window.orientation,null!==t.previous&&t.previous!=t.current?void e.listener(n,t):void 0};return window.DeviceOrientationEvent&&window.addEventListener("orientationchange",n,!1),t},Event.Gesture=Event.Gesture||{},Event.Gesture._gestureHandlers=Event.Gesture._gestureHandlers||{},Event.Gesture._gestureHandlers.orientation=e.orientation,e}(Event.proxy);!function(){function e(e,t){if(this.__eventListeners[e]){var n=this.__eventListeners[e];t?n[n.indexOf(t)]=!1:fabric.util.array.fill(n,!1)}}function t(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}function n(e,t){var n=function(){t.apply(this,arguments),this.off(e,n)}.bind(this);this.on(e,n)}function r(e,t){if(1===arguments.length)for(var r in e)n.call(this,r,e[r]);else n.call(this,e,t);return this}function o(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}function i(e,t){if(!this.__eventListeners)return this;var n=this.__eventListeners[e];if(!n)return this;for(var r=0,o=n.length;o>r;r++)n[r]&&n[r].call(this,t||{});return this.__eventListeners[e]=n.filter(function(e){return e!==!1}),this}fabric.Observable={fire:i,on:t,once:r,off:o}}();fabric.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var e=0,t=arguments.length;t>e;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,o=arguments.length;o>r;r++)e=t.indexOf(arguments[r]),-1!==e&&(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,o=n.length;o>r;r++)e.call(t,n[r],r,n);return this},getObjects:function(e){return"undefined"==typeof 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?!0:t?this._objects.some(function(t){return"function"==typeof t.contains&&t.contains(e,!0)}):!1},complexity:function(){return this._objects.reduce(function(e,t){return e+=t.complexity?t.complexity():0},0)}};fabric.CommonMethods={_setOptions:function(e){for(var t in e)this.set(t,e[t])},_initGradient:function(e,t){!e||!e.colorStops||e instanceof fabric.Gradient||this.set(t,new fabric.Gradient(e))},_initPattern:function(e,t,n){!e||!e.source||e instanceof fabric.Pattern?n&&n():this.set(t,new fabric.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]}};!function(e){var t=Math.sqrt,n=Math.atan2,r=Math.pow,i=Math.PI/180,o=Math.PI/2;fabric.util={cos:function(e){if(0===e)return 1;0>e&&(e=-e);var t=e/o;switch(t){case 1:case 3:return 0;case 2:return-1}return Math.cos(e)},sin:function(e){if(0===e)return 0;var t=e/o,n=1;switch(0>e&&(n=-1),t){case 1:return n;case 2:return 0;case 3:return-n}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*i},radiansToDegrees:function(e){return e/i},rotatePoint:function(e,t,n){var r=new fabric.Point(e.x-t.x,e.y-t.y),i=fabric.util.rotateVector(r,n);return new fabric.Point(i.x,i.y).addEquals(t)},rotateVector:function(e,t){var n=fabric.util.sin(t),r=fabric.util.cos(t),i=e.x*r-e.y*n,o=e.x*n+e.y*r;return{x:i,y:o}},createVector:function(e,t){return new fabric.Point(t.x-e.x,t.y-e.y)},calcAngleBetweenVectors:function(e,t){return Math.acos((e.x*t.x+e.y*t.y)/(Math.hypot(e.x,e.y)*Math.hypot(t.x,t.y)))},getHatVector:function(e){return new fabric.Point(e.x,e.y).multiply(1/Math.hypot(e.x,e.y))},getBisector:function(e,t,n){var r=fabric.util.createVector(e,t),i=fabric.util.createVector(e,n),o=fabric.util.calcAngleBetweenVectors(r,i),a=fabric.util.calcAngleBetweenVectors(fabric.util.rotateVector(r,o),i),s=o*(0===a?1:-1)/2;return{vector:fabric.util.getHatVector(fabric.util.rotateVector(r,s)),angle:o}},projectStrokeOnPoints:function(e,t,n){var r=[],i=t.strokeWidth/2,o=t.strokeUniform?new fabric.Point(1/t.scaleX,1/t.scaleY):new fabric.Point(1,1),a=function(e){var t=i/Math.hypot(e.x,e.y);return new fabric.Point(e.x*t*o.x,e.y*t*o.y)};return e.length<=1?r:(e.forEach(function(s,u){var c,f,d=new fabric.Point(s.x,s.y);0===u?(f=e[u+1],c=n?a(fabric.util.createVector(f,d)).addEquals(d):e[e.length-1]):u===e.length-1?(c=e[u-1],f=n?a(fabric.util.createVector(c,d)).addEquals(d):e[0]):(c=e[u-1],f=e[u+1]);var l,v,p=fabric.util.getBisector(d,c,f),g=p.vector,m=p.angle;return"miter"===t.strokeLineJoin&&(l=-i/Math.sin(m/2),v=new fabric.Point(g.x*l*o.x,g.y*l*o.y),Math.hypot(v.x,v.y)/i<=t.strokeMiterLimit)?(r.push(d.add(v)),void r.push(d.subtract(v))):(l=-i*Math.SQRT2,v=new fabric.Point(g.x*l*o.x,g.y*l*o.y),r.push(d.add(v)),void r.push(d.subtract(v)))}),r)},transformPoint:function(e,t,n){return n?new fabric.Point(t[0]*e.x+t[2]*e.y,t[1]*e.x+t[3]*e.y):new fabric.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;nn;++n)o=o[r[n]];return o},loadImage:function(e,t,n,r){if(!e)return void(t&&t.call(n,e));var i=fabric.util.createImage(),o=function(){t&&t.call(n,i,!1),i=i.onload=i.onerror=null};i.onload=o,i.onerror=function(){fabric.log("Error loading "+i.src),t&&t.call(n,null,!0),i=i.onload=i.onerror=null},0!==e.indexOf("data")&&void 0!==r&&null!==r&&(i.crossOrigin=r),"data:image/svg"===e.substring(0,14)&&(i.onload=null,fabric.util.loadImageInDom(i,o)),i.src=e},loadImageInDom:function(e,t){var n=fabric.document.createElement("div");n.style.width=n.style.height="1px",n.style.left=n.style.top="-100%",n.style.position="absolute",n.appendChild(e),fabric.document.querySelector("body").appendChild(n),e.onload=function(){t(),n.parentNode.removeChild(n),n=null}},enlivenObjects:function(e,t,n,r){function i(){++a===s&&t&&t(o.filter(function(e){return e}))}e=e||[];var o=[],a=0,s=e.length;return s?void e.forEach(function(e,t){if(!e||!e.type)return void i();var a=fabric.util.getKlass(e.type,n);a.fromObject(e,function(n,a){a||(o[t]=n),r&&r(e,n,a),i()})}):void(t&&t(o))},enlivenObjectEnlivables:function(e,t,n){var r=fabric.Object.ENLIVEN_PROPS.filter(function(t){return!!e[t]});fabric.util.enlivenObjects(r.map(function(t){return e[t]}),function(e){var i={};r.forEach(function(n,r){i[n]=e[r],t&&(t[n]=e[r])}),n&&n(i)})},enlivenPatterns:function(e,t){function n(){++i===o&&t&&t(r)}e=e||[];var r=[],i=0,o=e.length;return o?void e.forEach(function(e,t){e&&e.source?new fabric.Pattern(e,function(e){r[t]=e,n()}):(r[t]=e,n())}):void(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 fabric.Group(e,t),"undefined"!=typeof n&&(r.sourcePath=n),r)},populateWithProperties:function(e,t,n){if(n&&Array.isArray(n))for(var r=0,i=n.length;i>r;r++)n[r]in e&&(t[n[r]]=e[n[r]])},createCanvasElement:function(){return fabric.document.createElement("canvas")},copyCanvasElement:function(e){var t=fabric.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 fabric.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 o=n(e[1],e[0]),a=r(e[0],2)+r(e[1],2),s=t(a),u=(e[0]*e[3]-e[2]*e[1])/s,c=n(e[0]*e[2]+e[1]*e[3],a);return{angle:o/i,scaleX:s,scaleY:u,skewX:c/i,skewY:0,translateX:e[4],translateY:e[5]}},calcRotateMatrix:function(e){if(!e.angle)return fabric.iMatrix.concat();var t=fabric.util.degreesToRadians(e.angle),n=fabric.util.cos(t),r=fabric.util.sin(t);return[n,r,-r,n,0,0]},calcDimensionsMatrix:function(e){var t="undefined"==typeof e.scaleX?1:e.scaleX,n="undefined"==typeof e.scaleY?1:e.scaleY,r=[e.flipX?-t:t,0,0,e.flipY?-n:n,0,0],i=fabric.util.multiplyTransformMatrices,o=fabric.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=fabric.util.multiplyTransformMatrices;return e.angle&&(t=n(t,fabric.util.calcRotateMatrix(e))),(1!==e.scaleX||1!==e.scaleY||e.skewX||e.skewY||e.flipX||e.flipY)&&(t=n(t,fabric.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,a=!0,s=e.getImageData(t,n,2*r||1,2*r||1),u=s.data.length;for(i=3;u>i&&(o=s.data[i],a=0>=o,a!==!1);i+=4);return s=null,a},parsePreserveAspectRatioAttribute:function(e){var t,n="meet",r="Mid",i="Mid",o=e.split(" ");return o&&o.length&&(n=o.pop(),"meet"!==n&&"slice"!==n?(t=n,n="meet"):o.length&&(t=o.pop())),r="none"!==t?t.slice(1,4):"none",i="none"!==t?t.slice(5,8):"none",{meetOrSlice:n,alignX:r,alignY:i}},clearFabricFontCache:function(e){e=(e||"").toLowerCase(),e?fabric.charWidthsCache[e]&&delete fabric.charWidthsCache[e]:fabric.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 fabric.util.toFixed(e,fabric.Object.NUM_FRACTION_DIGITS)}).join(" ")+")"},removeTransformFromObject:function(e,t){var n=fabric.util.invertTransform(t),r=fabric.util.multiplyTransformMatrices(n,e.calcOwnMatrix());fabric.util.applyTransformToObject(e,r)},addTransformToObject:function(e,t){fabric.util.applyTransformToObject(e,fabric.util.multiplyTransformMatrices(t,e.calcOwnMatrix()))},applyTransformToObject:function(e,t){var n=fabric.util.qrDecompose(t),r=new fabric.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=fabric.util.calcDimensionsMatrix(n),s=fabric.util.makeBoundingBoxFromPoints(o,a);return{x:s.width,y:s.height}},mergeClipPaths:function(e,t){var n=e,r=t;n.inverted&&!r.inverted&&(n=t,r=e),fabric.util.applyTransformToObject(r,fabric.util.multiplyTransformMatrices(fabric.util.invertTransform(n.calcTransformMatrix()),r.calcTransformMatrix()));var i=n.inverted&&r.inverted;return i&&(n.inverted=r.inverted=!1),new fabric.Group([n],{clipPath:r,inverted:i})},hasStyleChanged:function(e,t,n){return n=n||!1,e.fill!==t.fill||e.stroke!==t.stroke||e.strokeWidth!==t.strokeWidth||e.fontSize!==t.fontSize||e.fontFamily!==t.fontFamily||e.fontWeight!==t.fontWeight||e.fontStyle!==t.fontStyle||e.deltaY!==t.deltaY||n&&(e.overline!==t.overline||e.underline!==t.underline||e.linethrough!==t.linethrough)},stylesToArray:function(e,t){for(var e=fabric.util.object.clone(e,!0),n=t.split("\n"),r=-1,i={},o=[],a=0;ax){var P=Math.sqrt(1-x/(h*y));i*=P,o*=P}else j=(a===s?-1:1)*Math.sqrt(x/(h*b+y*w));var M=j*i*m/o,E=-j*o*g/i,T=d*M-l*E+.5*t,k=l*M+d*E+.5*r,L=n(1,0,(g-M)/i,(m-E)/o),_=n((g-M)/i,(m-E)/o,(-g-M)/i,(-m-E)/o);0===s&&_>0?_-=2*c:1===s&&0>_&&(_+=2*c);for(var C=Math.ceil(Math.abs(_/c*2)),D=[],O=_/C,S=8/3*Math.sin(O/4)*Math.sin(O/4)/Math.sin(O/2),G=L+O,Y=0;C>Y;Y++)D[Y]=e(L,G,d,l,i,o,T,k,S,v,p),v=D[Y][5],p=D[Y][6],L=G,G+=O;return D}function n(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 r(e,t,n,r,i,o,a,s){var u;if(fabric.cachesBoundsOfCurve&&(u=E.call(arguments),fabric.boundsOfCurveCache[u]))return fabric.boundsOfCurveCache[u];var c,f,l,d,v,p,g,m,h=Math.sqrt,y=Math.min,b=Math.max,w=Math.abs,x=[],j=[[],[]];f=6*e-12*n+6*i,c=-3*e+9*n-9*i+3*a,l=3*n-3*e;for(var P=0;2>P;++P)if(P>0&&(f=6*t-12*r+6*o,c=-3*t+9*r-9*o+3*s,l=3*r-3*t),w(c)<1e-12){if(w(f)<1e-12)continue;d=-l/f,d>0&&1>d&&x.push(d)}else g=f*f-4*l*c,0>g||(m=h(g),v=(-f+m)/(2*c),v>0&&1>v&&x.push(v),p=(-f-m)/(2*c),p>0&&1>p&&x.push(p));for(var M,T,k,L=x.length,_=L;L--;)d=x[L],k=1-d,M=k*k*k*e+3*k*k*d*n+3*k*d*d*i+d*d*d*a,j[0][L]=M,T=k*k*k*t+3*k*k*d*r+3*k*d*d*o+d*d*d*s,j[1][L]=T;j[0][_]=e,j[1][_]=t,j[0][_+1]=a,j[1][_+1]=s;var C=[{x:y.apply(null,j[0]),y:y.apply(null,j[1])},{x:b.apply(null,j[0]),y:b.apply(null,j[1])}];return fabric.cachesBoundsOfCurve&&(fabric.boundsOfCurveCache[u]=C),C}function i(e,n,r){for(var i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],f=r[7],l=t(c-e,f-n,i,o,s,u,a),d=0,v=l.length;v>d;d++)l[d][1]+=e,l[d][2]+=n,l[d][3]+=e,l[d][4]+=n,l[d][5]+=e,l[d][6]+=n;return l}function o(e){var t,n,r,o,a,s,u=0,c=0,f=e.length,l=0,d=0,v=[];for(n=0;f>n;++n){switch(r=!1,t=e[n].slice(0),t[0]){case"l":t[0]="L",t[1]+=u,t[2]+=c;case"L":u=t[1],c=t[2];break;case"h":t[1]+=u;case"H":t[0]="L",t[2]=c,u=t[1];break;case"v":t[1]+=c;case"V":t[0]="L",c=t[1],t[1]=u,t[2]=c;break;case"m":t[0]="M",t[1]+=u,t[2]+=c;case"M":u=t[1],c=t[2],l=t[1],d=t[2];break;case"c":t[0]="C",t[1]+=u,t[2]+=c,t[3]+=u,t[4]+=c,t[5]+=u,t[6]+=c;case"C":a=t[3],s=t[4],u=t[5],c=t[6];break;case"s":t[0]="S",t[1]+=u,t[2]+=c,t[3]+=u,t[4]+=c;case"S":"C"===o?(a=2*u-a,s=2*c-s):(a=u,s=c),u=t[3],c=t[4],t[0]="C",t[5]=t[3],t[6]=t[4],t[3]=t[1],t[4]=t[2],t[1]=a,t[2]=s,a=t[3],s=t[4];break;case"q":t[0]="Q",t[1]+=u,t[2]+=c,t[3]+=u,t[4]+=c;case"Q":a=t[1],s=t[2],u=t[3],c=t[4];break;case"t":t[0]="T",t[1]+=u,t[2]+=c;case"T":"Q"===o?(a=2*u-a,s=2*c-s):(a=u,s=c),t[0]="Q",u=t[1],c=t[2],t[1]=a,t[2]=s,t[3]=u,t[4]=c;break;case"a":t[0]="A",t[6]+=u,t[7]+=c;case"A":r=!0,v=v.concat(i(u,c,t)),u=t[6],c=t[7];break;case"z":case"Z":u=l,c=d}r||v.push(t),o=t[0]}return v}function a(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}function s(e){return e*e*e}function u(e){return 3*e*e*(1-e)}function c(e){return 3*e*(1-e)*(1-e)}function f(e){return(1-e)*(1-e)*(1-e)}function l(e,t,n,r,i,o,a,l){return function(d){var v=s(d),p=u(d),g=c(d),m=f(d);return{x:a*v+i*p+n*g+e*m,y:l*v+o*p+r*g+t*m}}}function d(e,t,n,r,i,o,a,s){return function(u){var c=1-u,f=3*c*c*(n-e)+6*c*u*(i-n)+3*u*u*(a-i),l=3*c*c*(r-t)+6*c*u*(o-r)+3*u*u*(s-o);return Math.atan2(l,f)}}function v(e){return e*e}function p(e){return 2*e*(1-e)}function g(e){return(1-e)*(1-e)}function m(e,t,n,r,i,o){return function(a){var s=v(a),u=p(a),c=g(a);return{x:i*s+n*u+e*c,y:o*s+r*u+t*c}}}function h(e,t,n,r,i,o){return function(a){var s=1-a,u=2*s*(n-e)+2*a*(i-n),c=2*s*(r-t)+2*a*(o-r);return Math.atan2(c,u)}}function y(e,t,n){var r,i,o={x:t,y:n},s=0;for(i=1;100>=i;i+=1)r=e(i/100),s+=a(o.x,o.y,r.x,r.y),o=r;return s}function b(e,t){for(var n,r,i,o=0,s=0,u=e.iterator,c={x:e.x,y:e.y},f=.01,l=e.angleFinder;t>s&&f>1e-4;)n=u(o),i=o,r=a(c.x,c.y,n.x,n.y),r+s>t?(o-=f,f/=2):(c=n,o+=f,s+=r);return n.angle=l(i),n}function w(e){for(var t,n,r,i,o=0,s=e.length,u=0,c=0,f=0,v=0,p=[],g=0;s>g;g++){switch(t=e[g],r={x:u,y:c,command:t[0]},t[0]){case"M":r.length=0,f=u=t[1],v=c=t[2];break;case"L":r.length=a(u,c,t[1],t[2]),u=t[1],c=t[2];break;case"C":n=l(u,c,t[1],t[2],t[3],t[4],t[5],t[6]),i=d(u,c,t[1],t[2],t[3],t[4],t[5],t[6]),r.iterator=n,r.angleFinder=i,r.length=y(n,u,c),u=t[5],c=t[6];break;case"Q":n=m(u,c,t[1],t[2],t[3],t[4]),i=h(u,c,t[1],t[2],t[3],t[4]),r.iterator=n,r.angleFinder=i,r.length=y(n,u,c),u=t[3],c=t[4];break;case"Z":case"z":r.destX=f,r.destY=v,r.length=a(u,c,f,v),u=f,c=v}o+=r.length,p.push(r)}return p.push({length:o,x:u,y:c}),p}function x(e,t,n){n||(n=w(e));for(var r=0;t-n[r].length>0&&rg;g++){t=o[g],i=t.slice(1).trim(),s.length=0;var h=t.charAt(0);if(p=[h],"a"===h.toLowerCase())for(var y;y=v.exec(i);)for(var b=1;bb;b++)n=parseFloat(s[b]),isNaN(n)||p.push(n);var x=T[h.toLowerCase()],j=k[h]||h;if(p.length-1>x)for(var P=1,M=p.length;M>P;P+=x)a.push([h].concat(p.slice(P,P+x))),h=j;else a.push(p)}return a}function P(e,t){var n,r=[],i=new fabric.Point(e[0].x,e[0].y),o=new fabric.Point(e[1].x,e[1].y),a=e.length,s=1,u=0,c=a>2;for(t=t||0,c&&(s=e[2].xn;n++){if(!i.eq(o)){var f=i.midPointFrom(o);r.push(["Q",i.x,i.y,f.x,f.y])}i=e[n],n+1e[n-2].x?1:i.x===e[n-2].x?0:-1,u=i.y>e[n-2].y?1:i.y===e[n-2].y?0:-1),r.push(["L",i.x+s*t,i.y+u*t]),r}function M(e,t,n){return n&&(t=fabric.util.multiplyTransformMatrices(t,[1,0,0,1,-n.x,-n.y])),e.map(function(e){for(var n=e.slice(0),r={},i=1;ii;i++)r[i]=n.length?e[i][t].apply(e[i],n):e[i][t].call(e[i]);return r}function t(e,t){return i(e,t,function(e,t){return e>=t})}function n(e,t){return i(e,t,function(e,t){return t>e})}function r(e,t){for(var n=e.length;n--;)e[n]=t;return e}function i(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}}var o=Array.prototype.slice;fabric.util.array={fill:r,invoke:e,min:n,max:t}}();!function(){function e(t,n,r){if(r)if(!fabric.isLikelyNode&&n instanceof Element)t=n;else if(n instanceof Array){t=[];for(var i=0,o=n.length;o>i;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}function t(t,n){return e({},t,n)}fabric.util.object={extend:e,clone:t},fabric.util.object.extend(fabric.util,fabric.Observable)}();!function(){function e(e){return e.replace(/-+(.)?/g,function(e,t){return t?t.toUpperCase():""})}function t(e,t){return e.charAt(0).toUpperCase()+(t?e.slice(1):e.slice(1).toLowerCase())}function r(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function n(e){var t,r=0,n=[];for(r=0,t;rr||r>57343)return e.charAt(t);if(r>=55296&&56319>=r){if(e.length<=t+1)throw"High surrogate without following low surrogate";var n=e.charCodeAt(t+1);if(56320>n||n>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}fabric.util.string={camelize:e,capitalize:t,escapeXml:r,graphemeSplit:n}}();!function(){function e(){}function t(e){for(var t=null,n=this;n.constructor.superclass;){var i=n.constructor.superclass.prototype[e];if(n[e]!==i){t=i;break}n=n.constructor.superclass.prototype}return t?arguments.length>1?t.apply(this,r.call(arguments,1)):t.call(this):console.log("tried to callSuper "+e+", method not found in prototype chain",this)}function n(){function n(){this.initialize.apply(this,arguments)}var o=null,s=r.call(arguments,0);"function"==typeof s[0]&&(o=s.shift()),n.superclass=o,n.subclasses=[],o&&(e.prototype=o.prototype,n.prototype=new e,o.subclasses.push(n));for(var u=0,c=s.length;c>u;u++)a(n,s[u],o);return n.prototype.initialize||(n.prototype.initialize=i),n.prototype.constructor=n,n.prototype.callSuper=t,n}var r=Array.prototype.slice,i=function(){},o=function(){for(var e in{toString:1})if("toString"===e)return!1;return!0}(),a=function(e,t,n){for(var r in t)e.prototype[r]=r in e.prototype&&"function"==typeof e.prototype[r]&&(t[r]+"").indexOf("callSuper")>-1?function(e){return function(){var r=this.constructor.superclass;this.constructor.superclass=n;var i=t[e].apply(this,arguments);return this.constructor.superclass=r,"initialize"!==e?i:void 0}}(r):t[r],o&&(t.toString!==Object.prototype.toString&&(e.prototype.toString=t.toString),t.valueOf!==Object.prototype.valueOf&&(e.prototype.valueOf=t.valueOf))};fabric.util.createClass=n}();!function(){function e(e){var t=e.changedTouches;return t&&t[0]?t[0]:e}var t=!!fabric.document.createElement("div").attachEvent,n=["touchstart","touchmove","touchend"];fabric.util.addListener=function(e,n,r,i){e&&e.addEventListener(n,r,t?!1:i)},fabric.util.removeListener=function(e,n,r,i){e&&e.removeEventListener(n,r,t?!1:i)},fabric.util.getPointer=function(t){var n=t.target,r=fabric.util.getScrollLeftTop(n),i=e(t);return{x:i.clientX+r.left,y:i.clientY+r.top}},fabric.util.isTouchEvent=function(e){return n.indexOf(e.type)>-1||"touch"===e.pointerType}}();!function(){function e(e,t){var n=e.style;if(!n)return e;if("string"==typeof t)return e.style.cssText+=";"+t,t.indexOf("opacity")>-1?o(e,t.match(/opacity:\s*(\d?\.?\d*)/)[1]):e;for(var r in t)if("opacity"===r)o(e,t[r]);else{var i="float"===r||"cssFloat"===r?"undefined"==typeof n.styleFloat?"cssFloat":"styleFloat":r;n.setProperty(i,t[r])}return e}var t=fabric.document.createElement("div"),n="string"==typeof t.style.opacity,r="string"==typeof t.style.filter,i=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,o=function(e){return e};n?o=function(e,t){return e.style.opacity=t,e}:r&&(o=function(e,t){var n=e.style;return e.currentStyle&&!e.currentStyle.hasLayout&&(n.zoom=1),i.test(n.filter)?(t=t>=.9999?"":"alpha(opacity="+100*t+")",n.filter=n.filter.replace(i,t)):n.filter+=" alpha(opacity="+100*t+")",e}),fabric.util.setStyle=e}();!function(){function e(e){return"string"==typeof e?fabric.document.getElementById(e):e}function t(e,t){var n=fabric.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 n(e,t){e&&-1===(" "+e.className+" ").indexOf(" "+t+" ")&&(e.className+=(e.className?" ":"")+t)}function r(e,n,r){return"string"==typeof n&&(n=t(n,r)),e.parentNode&&e.parentNode.replaceChild(n,e),n.appendChild(e),n}function i(e){for(var t=0,n=0,r=fabric.document.documentElement,i=fabric.document.body||{scrollLeft:0,scrollTop:0};e&&(e.parentNode||e.host)&&(e=e.parentNode||e.host,e===fabric.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}}function o(e){var t,n,r=e&&e.ownerDocument,o={left:0,top:0},a={left:0,top:0},s={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!r)return a;for(var c in s)a[s[c]]+=parseInt(v(e,c),10)||0;return t=r.documentElement,"undefined"!=typeof e.getBoundingClientRect&&(o=e.getBoundingClientRect()),n=i(e),{left:o.left+n.left-(t.clientLeft||0)+a.left,top:o.top+n.top-(t.clientTop||0)+a.top}}function a(e){var t=fabric.jsdomImplForWrapper(e);return t._canvas||t._image}function s(e){if(fabric.isLikelyNode){var t=fabric.jsdomImplForWrapper(e);t&&(t._image=null,t._canvas=null,t._currentSrc=null,t._attributes=null,t._classList=null)}}function c(e,t){e.imageSmoothingEnabled=e.imageSmoothingEnabled||e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled||e.oImageSmoothingEnabled,e.imageSmoothingEnabled=t}var u,f=Array.prototype.slice,l=function(e){return f.call(e,0)};try{u=l(fabric.document.childNodes)instanceof Array}catch(d){}u||(l=function(e){for(var t=new Array(e.length),n=e.length;n--;)t[n]=e[n];return t});var v;v=fabric.document.defaultView&&fabric.document.defaultView.getComputedStyle?function(e,t){var n=fabric.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},function(){function e(e){return"undefined"!=typeof e.onselectstart&&(e.onselectstart=fabric.util.falseFunction),r?e.style[r]="none":"string"==typeof e.unselectable&&(e.unselectable="on"),e}function t(e){return"undefined"!=typeof e.onselectstart&&(e.onselectstart=null),r?e.style[r]="":"string"==typeof e.unselectable&&(e.unselectable=""),e}var n=fabric.document.documentElement.style,r="userSelect"in n?"userSelect":"MozUserSelect"in n?"MozUserSelect":"WebkitUserSelect"in n?"WebkitUserSelect":"KhtmlUserSelect"in n?"KhtmlUserSelect":"";fabric.util.makeElementUnselectable=e,fabric.util.makeElementSelectable=t}(),fabric.util.setImageSmoothing=c,fabric.util.getById=e,fabric.util.toArray=l,fabric.util.addClass=n,fabric.util.makeElement=t,fabric.util.wrapElement=r,fabric.util.getScrollLeftTop=i,fabric.util.getElementOffset=o,fabric.util.getNodeCanvas=a,fabric.util.cleanUpJsdomNode=s}();!function(){function e(e,t){return e+(/\?/.test(e)?"&":"?")+t}function t(){}function n(n,r){r||(r={});var i=r.method?r.method.toUpperCase():"GET",o=r.onComplete||function(){},a=new fabric.window.XMLHttpRequest,s=r.body||r.parameters;return a.onreadystatechange=function(){4===a.readyState&&(o(a),a.onreadystatechange=t)},"GET"===i&&(s=null,"string"==typeof r.parameters&&(n=e(n,r.parameters))),a.open(i,n,!0),("POST"===i||"PUT"===i)&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.send(s),a}fabric.util.request=n}();fabric.log=console.log,fabric.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}function n(n){n||(n={});var i,s=!1,c=function(){var e=fabric.runningAnimations.indexOf(i);return e>-1&&fabric.runningAnimations.splice(e,1)[0]};return i=o(a(n),{cancel:function(){return s=!0,c()},currentValue:"startValue"in n?n.startValue:0,completionRate:0,durationRate:0}),fabric.runningAnimations.push(i),r(function(o){var a,u=o||+new Date,f=n.duration||500,l=u+f,d=n.onChange||e,v=n.abort||e,p=n.onComplete||e,g=n.easing||t,m="startValue"in n?n.startValue.length>0:!1,h="startValue"in n?n.startValue:0,y="endValue"in n?n.endValue:100,b=n.byValue||(m?h.map(function(e,t){return y[t]-h[t]}):y-h);n.onStart&&n.onStart(),function w(e){a=e||+new Date;var t=a>l?f:a-u,n=t/f,o=m?h.map(function(e,n){return g(t,h[n],b[n],f)}):g(t,h,b,f),x=Math.abs(m?(o[0]-h[0])/b[0]:(o-h)/b);return i.currentValue=m?o.slice():o,i.completionRate=x,i.durationRate=n,s?void 0:v(o,x,n)?void c():a>l?(i.currentValue=m?y.slice():y,i.completionRate=1,i.durationRate=1,d(m?y.slice():y,1,1),p(y,1,1),void c()):(d(o,x,n),void r(w))}(u)}),i.cancel}function r(){return c.apply(fabric.window,arguments)}function i(){return u.apply(fabric.window,arguments)}var o=fabric.util.object.extend,a=fabric.util.object.clone,s=[];fabric.util.object.extend(s,{cancelAll:function(){var e=this.splice(0);return e.forEach(function(e){e.cancel()}),e},cancelByCanvas:function(e){if(!e)return[];var t=this.filter(function(t){return"object"==typeof t.target&&t.target.canvas===e});return t.forEach(function(e){e.cancel()}),t},cancelByTarget:function(e){var t=this.findAnimationsByTarget(e);return t.forEach(function(e){e.cancel()}),t},findAnimationIndex:function(e){return this.indexOf(this.findAnimation(e))},findAnimation:function(e){return this.find(function(t){return t.cancel===e})},findAnimationsByTarget:function(e){return e?this.filter(function(t){return t.target===e}):[]}});var c=fabric.window.requestAnimationFrame||fabric.window.webkitRequestAnimationFrame||fabric.window.mozRequestAnimationFrame||fabric.window.oRequestAnimationFrame||fabric.window.msRequestAnimationFrame||function(e){return fabric.window.setTimeout(e,1e3/60)},u=fabric.window.cancelAnimationFrame||fabric.window.clearTimeout;fabric.util.animate=n,fabric.util.requestAnimFrame=r,fabric.util.cancelAnimFrame=i,fabric.runningAnimations=s}();!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+=")"}function t(t,n,r,o){var i=new fabric.Color(t).getSource(),a=new fabric.Color(n).getSource(),s=o.onComplete,c=o.onChange;return o=o||{},fabric.util.animate(fabric.util.object.extend(o,{duration:r||500,startValue:i,endValue:a,byValue:a,easing:function(t,n,r,i){var a=o.colorEasing?o.colorEasing(t,i):1-Math.cos(t/i*(Math.PI/2));return e(n,r,a)},onComplete:function(t,n,r){return s?s(e(a,a,0),n,r):void 0},onChange:function(t,n,r){if(c){if(Array.isArray(t))return c(e(t,t,0),n,r);c(t,n,r)}}}))}fabric.util.animateColor=t}();!function(){function e(e,t,n,r){return ee?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t}function i(e,t,n,r){return n*(e/=r)*e*e*e+t}function o(e,t,n,r){return-n*((e=e/r-1)*e*e*e-1)+t}function a(e,t,n,r){return e/=r/2,1>e?n/2*e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t}function s(e,t,n,r){return n*(e/=r)*e*e*e*e+t}function u(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t}function c(e,t,n,r){return e/=r/2,1>e?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t}function f(e,t,n,r){return-n*Math.cos(e/r*(Math.PI/2))+n+t}function l(e,t,n,r){return n*Math.sin(e/r*(Math.PI/2))+t}function d(e,t,n,r){return-n/2*(Math.cos(Math.PI*e/r)-1)+t}function v(e,t,n,r){return 0===e?t:n*Math.pow(2,10*(e/r-1))+t}function p(e,t,n,r){return e===r?t+n:n*(-Math.pow(2,-10*e/r)+1)+t}function g(e,t,n,r){return 0===e?t:e===r?t+n:(e/=r/2,1>e?n/2*Math.pow(2,10*(e-1))+t:n/2*(-Math.pow(2,-10*--e)+2)+t)}function m(e,t,n,r){return-n*(Math.sqrt(1-(e/=r)*e)-1)+t}function h(e,t,n,r){return n*Math.sqrt(1-(e=e/r-1)*e)+t}function y(e,t,n,r){return e/=r/2,1>e?-n/2*(Math.sqrt(1-e*e)-1)+t:n/2*(Math.sqrt(1-(e-=2)*e)+1)+t}function b(n,r,i,o){var a=1.70158,s=0,u=i;if(0===n)return r;if(n/=o,1===n)return r+i;s||(s=.3*o);var c=e(u,i,s,a);return-t(c,n,o)+r}function w(t,n,r,i){var o=1.70158,a=0,s=r;if(0===t)return n;if(t/=i,1===t)return n+r;a||(a=.3*i);var u=e(s,r,a,o);return u.a*Math.pow(2,-10*t)*Math.sin(2*(t*i-u.s)*Math.PI/u.p)+u.c+n}function x(n,r,i,o){var a=1.70158,s=0,u=i;if(0===n)return r;if(n/=o/2,2===n)return r+i;s||(s=.3*o*1.5);var c=e(u,i,s,a);return 1>n?-.5*t(c,n,o)+r:c.a*Math.pow(2,-10*(n-=1))*Math.sin(2*(n*o-c.s)*Math.PI/c.p)*.5+c.c+r}function j(e,t,n,r,i){return void 0===i&&(i=1.70158),n*(e/=r)*e*((i+1)*e-i)+t}function M(e,t,n,r,i){return void 0===i&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t}function P(e,t,n,r,i){return void 0===i&&(i=1.70158),e/=r/2,1>e?n/2*e*e*(((i*=1.525)+1)*e-i)+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t}function E(e,t,n,r){return n-T(r-e,0,n,r)+t}function T(e,t,n,r){return(e/=r)<1/2.75?7.5625*n*e*e+t:2/2.75>e?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:2.5/2.75>e?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t}function S(e,t,n,r){return r/2>e?.5*E(2*e,0,n,r)+t:.5*T(2*e-r,0,n,r)+.5*n+t}fabric.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>e?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:n,easeInOutCubic:r,easeInQuart:i,easeOutQuart:o,easeInOutQuart:a,easeInQuint:s,easeOutQuint:u,easeInOutQuint:c,easeInSine:f,easeOutSine:l,easeInOutSine:d,easeInExpo:v,easeOutExpo:p,easeInOutExpo:g,easeInCirc:m,easeOutCirc:h,easeInOutCirc:y,easeInElastic:b,easeOutElastic:w,easeInOutElastic:x,easeInBack:j,easeOutBack:M,easeInOutBack:P,easeInBounce:E,easeOutBounce:T,easeInOutBounce:S}}();!function(e){"use strict";function t(e){return e in S?S[e]:e}function n(e,t,n,r){var i,o=Array.isArray(t);if("fill"!==e&&"stroke"!==e||"none"!==t){if("strokeUniform"===e)return"non-scaling-stroke"===t;if("strokeDashArray"===e)t="none"===t?null:t.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===e)t=n&&n.transformMatrix?j(n.transformMatrix,h.parseTransformAttribute(t)):h.parseTransformAttribute(t);else if("visible"===e)t="none"!==t&&"hidden"!==t,n&&n.visible===!1&&(t=!1);else if("opacity"===e)t=parseFloat(t),n&&"undefined"!=typeof n.opacity&&(t*=n.opacity);else if("textAnchor"===e)t="start"===t?"left":"end"===t?"right":"center";else if("charSpacing"===e)i=x(t,r)/r*1e3;else if("paintFirst"===e){var a=t.indexOf("fill"),s=t.indexOf("stroke"),t="fill";a>-1&&s>-1&&a>s?t="stroke":-1===a&&s>-1&&(t="stroke")}else{if("href"===e||"xlink:href"===e||"font"===e)return t;if("imageSmoothing"===e)return"optimizeQuality"===t;i=o?t.map(x):x(t,r)}}else t="";return!o&&isNaN(i)?t:i}function r(e){return new RegExp("^("+e.join("|")+")\\b","i")}function i(e){for(var t in k)if("undefined"!=typeof e[k[t]]&&""!==e[t]){if("undefined"==typeof e[t]){if(!h.Object.prototype[t])continue;e[t]=h.Object.prototype[t]}if(0!==e[t].indexOf("url(")){var n=new h.Color(e[t]);e[t]=n.setAlpha(w(n.getAlpha()*e[k[t]],2)).toRgba()}}return e}function o(e,t){var n,r,i,o,a=[];for(i=0,o=t.length;o>i;i++)n=t[i],r=e.getElementsByTagName(n),a=a.concat(Array.prototype.slice.call(r));return a}function a(e,t){var n,r;e.replace(/;\s*$/,"").split(";").forEach(function(e){var i=e.split(":");n=i[0].trim().toLowerCase(),r=i[1].trim(),t[n]=r})}function s(e,t){var n,r;for(var i in e)"undefined"!=typeof e[i]&&(n=i.toLowerCase(),r=e[i],t[n]=r)}function u(e,t){var n={};for(var r in h.cssRules[t])if(c(e,r.split(" ")))for(var i in h.cssRules[t][r])n[i]=h.cssRules[t][r][i];return n}function c(e,t){var n,r=!0;return n=l(e,t.pop()),n&&t.length&&(r=f(e,t)),n&&r&&0===t.length}function f(e,t){for(var n,r=!0;e.parentNode&&1===e.parentNode.nodeType&&t.length;)r&&(n=t.pop()),e=e.parentNode,r=l(e,n);return 0===t.length}function l(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(o=o.split(" "),r=o.length;r--;)n=new RegExp("\\."+o[r]+"(?![a-zA-Z\\-]+)","i"),t=t.replace(n,"");return 0===t.length}function d(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;o>i;i++)if(r=a[i],t===r.getAttribute("id"))return r}function v(e){for(var t=o(e,["use","svg:use"]),n=0;t.length&νu++)s=c.item(u),x.setAttributeNS(w,s.nodeName,s.nodeValue);for(;m.firstChild;)x.appendChild(m.firstChild);m=x}for(u=0,c=r.attributes,f=c.length;f>u;u++)s=c.item(u),"x"!==s.nodeName&&"y"!==s.nodeName&&"xlink:href"!==s.nodeName&&"href"!==s.nodeName&&("transform"===s.nodeName?y=s.nodeValue+" "+y:m.setAttribute(s.nodeName,s.nodeValue));m.setAttribute("transform",y),m.setAttribute("instantiated_by_use","1"),m.removeAttribute("id"),a=r.parentNode,a.replaceChild(m,r),t.length===b&&n++}}function p(e){if(!h.svgViewBoxElementsRegEx.test(e.nodeName))return{};var t,n,r,i,o=e.getAttribute("viewBox"),a=1,s=1,u=0,c=0,f=e.getAttribute("width"),l=e.getAttribute("height"),d=e.getAttribute("x")||0,v=e.getAttribute("y")||0,p=e.getAttribute("preserveAspectRatio")||"",g=!o||!(o=o.match(O)),m=!f||!l||"100%"===f||"100%"===l,y=g&&m,b={},w="",j=0,M=0;if(b.width=0,b.height=0,b.toBeParsed=y,g&&(d||v)&&e.parentNode&&"#document"!==e.parentNode.nodeName&&(w=" translate("+x(d)+" "+x(v)+") ",r=(e.getAttribute("transform")||"")+w,e.setAttribute("transform",r),e.removeAttribute("x"),e.removeAttribute("y")),y)return b;if(g)return b.width=x(f),b.height=x(l),b;if(u=-parseFloat(o[1]),c=-parseFloat(o[2]),t=parseFloat(o[3]),n=parseFloat(o[4]),b.minX=u,b.minY=c,b.viewBoxWidth=t,b.viewBoxHeight=n,m?(b.width=t,b.height=n):(b.width=x(f),b.height=x(l),a=b.width/t,s=b.height/n),p=h.util.parsePreserveAspectRatioAttribute(p),"none"!==p.alignX&&("meet"===p.meetOrSlice&&(s=a=a>s?s:a),"slice"===p.meetOrSlice&&(s=a=a>s?a:s),j=b.width-t*a,M=b.height-n*a,"Mid"===p.alignX&&(j/=2),"Mid"===p.alignY&&(M/=2),"Min"===p.alignX&&(j=0),"Min"===p.alignY&&(M=0)),1===a&&1===s&&0===u&&0===c&&0===d&&0===v)return b;if((d||v)&&"#document"!==e.parentNode.nodeName&&(w=" translate("+x(d)+" "+x(v)+") "),r=w+" matrix("+a+" 0 0 "+s+" "+(u*a+j)+" "+(c*s+M)+") ","svg"===e.nodeName){for(i=e.ownerDocument.createElementNS(h.svgNS,"g");e.firstChild;)i.appendChild(e.firstChild);e.appendChild(i)}else i=e,i.removeAttribute("x"),i.removeAttribute("y"),r=i.getAttribute("transform")+r;return i.setAttribute("transform",r),b}function g(e,t){for(;e&&(e=e.parentNode);)if(e.nodeName&&t.test(e.nodeName.replace("svg:",""))&&!e.getAttribute("instantiated_by_use"))return!0;return!1}function m(e,t){var n=["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"],r="xlink:href",i=t.getAttribute(r).slice(1),o=d(e,i);if(o&&o.getAttribute(r)&&m(e,o),n.forEach(function(e){o&&!t.hasAttribute(e)&&o.hasAttribute(e)&&t.setAttribute(e,o.getAttribute(e))}),!t.children.length)for(var a=o.cloneNode(!0);a.firstChild;)t.appendChild(a.firstChild);t.removeAttribute(r)}var h=e.fabric||(e.fabric={}),y=h.util.object.extend,b=h.util.object.clone,w=h.util.toFixed,x=h.util.parseUnit,j=h.util.multiplyTransformMatrices,M=["path","circle","polygon","polyline","ellipse","rect","line","image","text"],P=["symbol","image","marker","pattern","view","svg"],E=["pattern","defs","symbol","metadata","clipPath","mask","desc"],T=["symbol","g","a","svg","clipPath","defs"],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"},k={stroke:"strokeOpacity",fill:"fillOpacity"},A="font-size",C="clip-path";h.svgValidTagNamesRegEx=r(M),h.svgViewBoxElementsRegEx=r(P),h.svgInvalidAncestorsRegEx=r(E),h.svgValidParentsRegEx=r(T),h.cssRules={},h.gradientDefs={},h.clipPaths={},h.parseTransformAttribute=function(){function e(e,t){var n=h.util.cos(t[0]),r=h.util.sin(t[0]),i=0,o=0;3===t.length&&(i=t[1],o=t[2]),e[0]=n,e[1]=r,e[2]=-r,e[3]=n,e[4]=i-(n*i-r*o),e[5]=o-(r*i+n*o)}function t(e,t){var n=t[0],r=2===t.length?t[1]:t[0];e[0]=n,e[3]=r}function n(e,t,n){e[n]=Math.tan(h.util.degreesToRadians(t[0]))}function r(e,t){e[4]=t[0],2===t.length&&(e[5]=t[1])}var i=h.iMatrix,o=h.reNum,a=h.commaWsp,s="(?:(skewX)\\s*\\(\\s*("+o+")\\s*\\))",u="(?:(skewY)\\s*\\(\\s*("+o+")\\s*\\))",c="(?:(rotate)\\s*\\(\\s*("+o+")(?:"+a+"("+o+")"+a+"("+o+"))?\\s*\\))",f="(?:(scale)\\s*\\(\\s*("+o+")(?:"+a+"("+o+"))?\\s*\\))",l="(?:(translate)\\s*\\(\\s*("+o+")(?:"+a+"("+o+"))?\\s*\\))",d="(?:(matrix)\\s*\\(\\s*("+o+")"+a+"("+o+")"+a+"("+o+")"+a+"("+o+")"+a+"("+o+")"+a+"("+o+")\\s*\\))",v="(?:"+d+"|"+l+"|"+f+"|"+c+"|"+s+"|"+u+")",p="(?:"+v+"(?:"+a+"*"+v+")*)",g="^\\s*(?:"+p+"?)\\s*$",m=new RegExp(g),y=new RegExp(v,"g");return function(o){var a=i.concat(),s=[];if(!o||o&&!m.test(o))return a;o.replace(y,function(o){var u=new RegExp(v).exec(o).filter(function(e){return!!e}),c=u[1],f=u.slice(2).map(parseFloat);switch(c){case"translate":r(a,f);break;case"rotate":f[0]=h.util.degreesToRadians(f[0]),e(a,f);break;case"scale":t(a,f);break;case"skewX":n(a,f,2);break;case"skewY":n(a,f,1);break;case"matrix":a=f}s.push(a.concat()),a=i.concat()});for(var u=s[0];s.length>1;)s.shift(),u=h.util.multiplyTransformMatrices(u,s[0]);return u}}();var O=new RegExp("^\\s*("+h.reNum+"+)\\s*,?\\s*("+h.reNum+"+)\\s*,?\\s*("+h.reNum+"+)\\s*,?\\s*("+h.reNum+"+)\\s*$");h.parseSVGDocument=function(e,t,n,r){if(e){v(e);var i,o,a=h.Object.__uid++,s=p(e),u=h.util.toArray(e.getElementsByTagName("*"));if(s.crossOrigin=r&&r.crossOrigin,s.svgUid=a,0===u.length&&h.isLikelyNode){u=e.selectNodes('//*[name(.)!="svg"]');var c=[];for(i=0,o=u.length;o>i;i++)c[i]=u[i];u=c}var f=u.filter(function(e){return p(e),h.svgValidTagNamesRegEx.test(e.nodeName.replace("svg:",""))&&!g(e,h.svgInvalidAncestorsRegEx)});if(!f||f&&!f.length)return void(t&&t([],{}));var l={};u.filter(function(e){return"clipPath"===e.nodeName.replace("svg:","")}).forEach(function(e){var t=e.getAttribute("id");l[t]=h.util.toArray(e.getElementsByTagName("*")).filter(function(e){return h.svgValidTagNamesRegEx.test(e.nodeName.replace("svg:",""))})}),h.gradientDefs[a]=h.getGradientDefs(e),h.cssRules[a]=h.getCSSRules(e),h.clipPaths[a]=l,h.parseElements(f,function(e,n){t&&(t(e,s,n,u),delete h.gradientDefs[a],delete h.cssRules[a],delete h.clipPaths[a])},b(s),n,r)}};var L=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+h.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+h.reNum+"))?\\s+(.*)");y(h,{parseFontDeclaration:function(e,t){var n=e.match(L);if(n){var r=n[1],i=n[3],o=n[4],a=n[5],s=n[6];r&&(t.fontStyle=r),i&&(t.fontWeight=isNaN(parseFloat(i))?i:parseFloat(i)),o&&(t.fontSize=x(o)),s&&(t.fontFamily=s),a&&(t.lineHeight="normal"===a?1:a)}},getGradientDefs:function(e){var t,n=["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"],r=o(e,n),i=0,a={};for(i=r.length;i--;)t=r[i],t.getAttribute("xlink:href")&&m(e,t),a[t.getAttribute("id")]=t;return a},parseAttributes:function(e,r,o){if(e){var a,s,c,f={};"undefined"==typeof o&&(o=e.getAttribute("svgUid")),e.parentNode&&h.svgValidParentsRegEx.test(e.parentNode.nodeName)&&(f=h.parseAttributes(e.parentNode,r,o));var l=r.reduce(function(t,n){return a=e.getAttribute(n),a&&(t[n]=a),t},{}),d=y(u(e,o),h.parseStyleAttribute(e));l=y(l,d),d[C]&&e.setAttribute(C,d[C]),s=c=f.fontSize||h.Text.DEFAULT_SVG_FONT_SIZE,l[A]&&(l[A]=s=x(l[A],c));var v,p,g={};for(var m in l)v=t(m),p=n(v,l[m],f,s),g[v]=p;g&&g.font&&h.parseFontDeclaration(g.font,g);var b=y(f,g);return h.svgValidParentsRegEx.test(e.nodeName)?b:i(b)}},parseElements:function(e,t,n,r,i){new h.ElementsParser(e,t,n,r,i).parse()},parseStyleAttribute:function(e){var t={},n=e.getAttribute("style");return n?("string"==typeof n?a(n,t):s(n,t),t):t},parsePointsAttribute:function(e){if(!e)return null;e=e.replace(/,/g," ").trim(),e=e.split(/\s+/);var t,n,r=[];for(t=0,n=e.length;n>t;t+=2)r.push({x:parseFloat(e[t]),y:parseFloat(e[t+1])});return r},getCSSRules:function(e){var t,n,r,i=e.getElementsByTagName("style"),o={};for(t=0,n=i.length;n>t;t++){var a=i[t].textContent;a=a.replace(/\/\*[\s\S]*?\*\//g,""),""!==a.trim()&&(r=a.split("}"),r=r.filter(function(e){return e.trim()}),r.forEach(function(e){var r=e.split("{"),i={},a=r[1].trim(),s=a.split(";").filter(function(e){return e.trim()});for(t=0,n=s.length;n>t;t++){var u=s[t].split(":"),c=u[0].trim(),f=u[1].trim();i[c]=f}e=r[0].trim(),e.split(",").forEach(function(e){e=e.replace(/^svg/i,"").trim(),""!==e&&(o[e]?h.util.object.extend(o[e],i):o[e]=h.util.object.clone(i))})}))}return o},loadSVGFromURL:function(e,t,n,r){function i(e){var i=e.responseXML;return i&&i.documentElement?void h.parseSVGDocument(i.documentElement,function(e,n,r,i){t&&t(e,n,r,i)},n,r):(t&&t(null),!1)}e=e.replace(/^\n\s*/,"").trim(),new h.util.request(e,{method:"get",onComplete:i})},loadSVGFromString:function(e,t,n,r){var i=new h.window.DOMParser,o=i.parseFromString(e.trim(),"text/xml");h.parseSVGDocument(o.documentElement,function(e,n,r,i){t(e,n,r,i)},n,r)}})}("undefined"!=typeof exports?exports:this);fabric.ElementsParser=function(e,t,n,r,i,o){this.elements=e,this.callback=t,this.options=n,this.reviver=r,this.svgUid=n&&n.svgUid||0,this.parsingOptions=i,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=o},function(e){e.parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},e.createObjects=function(){var e=this;this.elements.forEach(function(t,n){t.setAttribute("svgUid",e.svgUid),e.createObject(t,n)})},e.findTag=function(e){return fabric[fabric.util.string.capitalize(e.tagName.replace("svg:",""))]},e.createObject=function(e,t){var n=this.findTag(e);if(n&&n.fromElement)try{n.fromElement(e,this.createCallback(t,e),this.options)}catch(r){fabric.log(r)}else this.checkIfDone()},e.createCallback=function(e,t){var n=this;return function(r){var i;n.resolveGradient(r,t,"fill"),n.resolveGradient(r,t,"stroke"),r instanceof fabric.Image&&r._originalElement&&(i=r.parsePreserveAspectRatioAttribute(t)),r._removeTransformMatrix(i),n.resolveClipPath(r,t),n.reviver&&n.reviver(t,r),n.instances[e]=r,n.checkIfDone()}},e.extractPropertyDefinition=function(e,t,n){var r=e[t],i=this.regexUrl;if(i.test(r)){i.lastIndex=0;var o=i.exec(r)[1];return i.lastIndex=0,fabric[n][this.svgUid][o]}},e.resolveGradient=function(e,t,n){var r=this.extractPropertyDefinition(e,n,"gradientDefs");if(r){var i=t.getAttribute(n+"-opacity"),o=fabric.Gradient.fromElement(r,e,i,this.options);e.set(n,o)}},e.createClipPathCallback=function(e,t){return function(e){e._removeTransformMatrix(),e.fillRule=e.clipRule,t.push(e)}},e.resolveClipPath=function(e,t){var n,r,i,o,a,s,u=this.extractPropertyDefinition(e,"clipPath","clipPaths");if(u){o=[],i=fabric.util.invertTransform(e.calcTransformMatrix());for(var c=u[0].parentNode,f=t;f.parentNode&&f.getAttribute("clip-path")!==e.clipPath;)f=f.parentNode;f.parentNode.appendChild(c);for(var l=0;le.x&&this.y>e.y},gte:function(e){return this.x>=e.x&&this.y>=e.y},lerp:function(e,n){return"undefined"==typeof n&&(n=.5),n=Math.max(Math.min(1,n),0),new t(this.x+(e.x-this.x)*n,this.y+(e.y-this.y)*n)},distanceFrom:function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)},midPointFrom:function(e){return this.lerp(e)},min:function(e){return new t(Math.min(this.x,e.x),Math.min(this.y,e.y))},max:function(e){return new t(Math.max(this.x,e.x),Math.max(this.y,e.y))},toString:function(){return this.x+","+this.y},setXY:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setFromPoint:function(e){return this.x=e.x,this.y=e.y,this},swap:function(e){var t=this.x,n=this.y;this.x=e.x,this.y=e.y,e.x=t,e.y=n},clone:function(){return new t(this.x,this.y)}}))}("undefined"!=typeof exports?exports:this);!function(e){"use strict";function t(e){this.status=e,this.points=[]}var n=e.fabric||(e.fabric={});return n.Intersection?void n.warn("fabric.Intersection is already defined"):(n.Intersection=t,n.Intersection.prototype={constructor:t,appendPoint:function(e){return this.points.push(e),this},appendPoints:function(e){return this.points=this.points.concat(e),this}},n.Intersection.intersectLineLine=function(e,r,i,o){var a,s=(o.x-i.x)*(e.y-i.y)-(o.y-i.y)*(e.x-i.x),c=(r.x-e.x)*(e.y-i.y)-(r.y-e.y)*(e.x-i.x),u=(o.y-i.y)*(r.x-e.x)-(o.x-i.x)*(r.y-e.y);if(0!==u){var f=s/u,l=c/u;f>=0&&1>=f&&l>=0&&1>=l?(a=new t("Intersection"),a.appendPoint(new n.Point(e.x+f*(r.x-e.x),e.y+f*(r.y-e.y)))):a=new t}else a=new t(0===s||0===c?"Coincident":"Parallel");return a},n.Intersection.intersectLinePolygon=function(e,n,r){var i,o,a,s,c=new t,u=r.length;for(s=0;u>s;s++)i=r[s],o=r[(s+1)%u],a=t.intersectLineLine(e,n,i,o),c.appendPoints(a.points);return c.points.length>0&&(c.status="Intersection"),c},n.Intersection.intersectPolygonPolygon=function(e,n){var r,i=new t,o=e.length;for(r=0;o>r;r++){var a=e[r],s=e[(r+1)%o],c=t.intersectLinePolygon(a,s,n);i.appendPoints(c.points)}return i.points.length>0&&(i.status="Intersection"),i},void(n.Intersection.intersectPolygonRectangle=function(e,r,i){var o=r.min(i),a=r.max(i),s=new n.Point(a.x,o.y),c=new n.Point(o.x,a.y),u=t.intersectLinePolygon(o,s,e),f=t.intersectLinePolygon(s,a,e),l=t.intersectLinePolygon(a,c,e),d=t.intersectLinePolygon(c,o,e),p=new t;return p.appendPoints(u.points),p.appendPoints(f.points),p.appendPoints(l.points),p.appendPoints(d.points),p.points.length>0&&(p.status="Intersection"),p}))}("undefined"!=typeof exports?exports:this);!function(e){"use strict";function t(e){e?this._tryParsingColor(e):this.setSource([0,0,0,1])}function n(e,t,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?e+6*(t-e)*n:.5>n?t:2/3>n?e+(t-e)*(2/3-n)*6:e}var r=e.fabric||(e.fabric={});return r.Color?void r.warn("fabric.Color is already defined."):(r.Color=t,r.Color.prototype={_tryParsingColor:function(e){var n;e in t.colorNameMap&&(e=t.colorNameMap[e]),"transparent"===e&&(n=[255,255,255,0]),n||(n=t.sourceFromHex(e)),n||(n=t.sourceFromRgb(e)),n||(n=t.sourceFromHsl(e)),n||(n=[0,0,0,1]),n&&this.setSource(n)},_rgbToHsl:function(e,t,n){e/=255,t/=255,n/=255;var i,o,a,s=r.util.array.max([e,t,n]),u=r.util.array.min([e,t,n]);if(a=(s+u)/2,s===u)i=o=0;else{var c=s-u;switch(o=a>.5?c/(2-s-u):c/(s+u),s){case e:i=(t-n)/c+(n>t?6:0);break;case t:i=(n-e)/c+2;break;case n:i=(e-t)/c+4}i/=6}return[Math.round(360*i),Math.round(100*o),Math.round(100*a)]},getSource:function(){return this._source},setSource:function(e){this._source=e},toRgb:function(){var e=this.getSource();return"rgb("+e[0]+","+e[1]+","+e[2]+")"},toRgba:function(){var e=this.getSource();return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},toHsl:function(){var e=this.getSource(),t=this._rgbToHsl(e[0],e[1],e[2]);return"hsl("+t[0]+","+t[1]+"%,"+t[2]+"%)"},toHsla:function(){var e=this.getSource(),t=this._rgbToHsl(e[0],e[1],e[2]);return"hsla("+t[0]+","+t[1]+"%,"+t[2]+"%,"+e[3]+")"},toHex:function(){var e,t,n,r=this.getSource();return e=r[0].toString(16),e=1===e.length?"0"+e:e,t=r[1].toString(16),t=1===t.length?"0"+t:t,n=r[2].toString(16),n=1===n.length?"0"+n:n,e.toUpperCase()+t.toUpperCase()+n.toUpperCase()},toHexa:function(){var e,t=this.getSource();return e=Math.round(255*t[3]),e=e.toString(16),e=1===e.length?"0"+e:e,this.toHex()+e.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(e){var t=this.getSource();return t[3]=e,this.setSource(t),this},toGrayscale:function(){var e=this.getSource(),t=parseInt((.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),10),n=e[3];return this.setSource([t,t,t,n]),this},toBlackWhite:function(e){var t=this.getSource(),n=(.3*t[0]+.59*t[1]+.11*t[2]).toFixed(0),r=t[3];return e=e||127,n=Number(n)n;n++)r.push(Math.round(a[n]*(1-o)+s[n]*o));return r[3]=i,this.setSource(r),this}},r.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i,r.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i,r.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,r.Color.colorNameMap={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"},r.Color.fromRgb=function(e){return t.fromSource(t.sourceFromRgb(e))},r.Color.sourceFromRgb=function(e){var n=e.match(t.reRGBa);if(n){var r=parseInt(n[1],10)/(/%$/.test(n[1])?100:1)*(/%$/.test(n[1])?255:1),i=parseInt(n[2],10)/(/%$/.test(n[2])?100:1)*(/%$/.test(n[2])?255:1),o=parseInt(n[3],10)/(/%$/.test(n[3])?100:1)*(/%$/.test(n[3])?255:1);return[parseInt(r,10),parseInt(i,10),parseInt(o,10),n[4]?parseFloat(n[4]):1]}},r.Color.fromRgba=t.fromRgb,r.Color.fromHsl=function(e){return t.fromSource(t.sourceFromHsl(e))},r.Color.sourceFromHsl=function(e){var r=e.match(t.reHSLa);if(r){var i,o,a,s=(parseFloat(r[1])%360+360)%360/360,u=parseFloat(r[2])/(/%$/.test(r[2])?100:1),c=parseFloat(r[3])/(/%$/.test(r[3])?100:1);if(0===u)i=o=a=c;else{var l=.5>=c?c*(u+1):c+u-c*u,f=2*c-l;i=n(f,l,s+1/3),o=n(f,l,s),a=n(f,l,s-1/3)}return[Math.round(255*i),Math.round(255*o),Math.round(255*a),r[4]?parseFloat(r[4]):1]}},r.Color.fromHsla=t.fromHsl,r.Color.fromHex=function(e){return t.fromSource(t.sourceFromHex(e))},r.Color.sourceFromHex=function(e){if(e.match(t.reHex)){var n=e.slice(e.indexOf("#")+1),r=3===n.length||4===n.length,i=8===n.length||4===n.length,o=r?n.charAt(0)+n.charAt(0):n.substring(0,2),a=r?n.charAt(1)+n.charAt(1):n.substring(2,4),s=r?n.charAt(2)+n.charAt(2):n.substring(4,6),u=i?r?n.charAt(3)+n.charAt(3):n.substring(6,8):"FF";return[parseInt(o,16),parseInt(a,16),parseInt(s,16),parseFloat((parseInt(u,16)/255).toFixed(2))]}},void(r.Color.fromSource=function(e){var n=new t;return n.setSource(e),n}))}("undefined"!=typeof exports?exports:this);!function(e){"use strict";function t(e,t){var n=e.angle+G(Math.atan2(t.y,t.x))+360;return Math.round(n%360/45)}function n(e,t){var n=t.transform.target,r=n.canvas,i=C.util.object.clone(t);i.target=n,r&&r.fire("object:"+e,i),n.fire(e,t)}function r(e,t){var n=t.canvas,r=n.uniScaleKey,i=e[r];return n.uniformScaling&&!i||!n.uniformScaling&&i}function i(e){return e.originX===I&&e.originY===I}function o(e,t,n){var r=e.lockScalingX,i=e.lockScalingY;return r&&i?!0:!t&&(r||i)&&n?!0:r&&"x"===t?!0:i&&"y"===t?!0:!1}function a(e,n,i){var a="not-allowed",s=r(e,i),c="";if(0!==n.x&&0===n.y?c="x":0===n.x&&0!==n.y&&(c="y"),o(i,c,s))return a;var u=t(i,n);return O[u]+"-resize"}function s(e,n,r){var i="not-allowed";if(0!==n.x&&r.lockSkewingY)return i;if(0!==n.y&&r.lockSkewingX)return i;var o=t(r,n)%4;return X[o]+"-resize"}function c(e,t,n){return e[n.canvas.altActionKey]?Y.skewCursorStyleHandler(e,t,n):Y.scaleCursorStyleHandler(e,t,n)}function u(e,t,n){var r=e[n.canvas.altActionKey];return 0===t.x?r?"skewX":"scaleY":0===t.y?r?"skewY":"scaleX":void 0}function f(e,t,n){return n.lockRotation?"not-allowed":t.cursorStyle}function l(e,t,n,r){return{e:e,transform:t,pointer:{x:n,y:r}}}function d(e){return function(t,n,r,i){var o=n.target,a=o.getCenterPoint(),s=o.translateToOriginPoint(a,n.originX,n.originY),c=e(t,n,r,i);return o.setPositionByOrigin(s,n.originX,n.originY),c}}function v(e,t){return function(r,i,o,a){var s=t(r,i,o,a);return s&&n(e,l(r,i,o,a)),s}}function p(e,t,n,r,i){var o=e.target,a=o.controls[e.corner],s=o.canvas.getZoom(),c=o.padding/s,u=o.toLocalPoint(new C.Point(r,i),t,n);return u.x>=c&&(u.x-=c),u.x<=-c&&(u.x+=c),u.y>=c&&(u.y-=c),u.y<=c&&(u.y+=c),u.x-=a.offsetX,u.y-=a.offsetY,u}function g(e){return e.flipX!==e.flipY}function h(e,t,n,r,i){if(0!==e[t]){var o=e._getTransformedDimensions()[r],a=i/o*e[n];e.set(n,a)}}function m(e,t,n,r){var i,o=t.target,a=o._getTransformedDimensions(0,o.skewY),s=p(t,t.originX,t.originY,n,r),c=Math.abs(2*s.x)-a.x,u=o.skewX;2>c?i=0:(i=G(Math.atan2(c/o.scaleX,a.y/o.scaleY)),t.originX===L&&t.originY===F&&(i=-i),t.originX===_&&t.originY===D&&(i=-i),g(o)&&(i=-i));var f=u!==i;if(f){var l=o._getTransformedDimensions().y;o.set("skewX",i),h(o,"skewY","scaleY","y",l)}return f}function y(e,t,n,r){var i,o=t.target,a=o._getTransformedDimensions(o.skewX,0),s=p(t,t.originX,t.originY,n,r),c=Math.abs(2*s.y)-a.y,u=o.skewY;2>c?i=0:(i=G(Math.atan2(c/o.scaleY,a.x/o.scaleX)),t.originX===L&&t.originY===F&&(i=-i),t.originX===_&&t.originY===D&&(i=-i),g(o)&&(i=-i));var f=u!==i;if(f){var l=o._getTransformedDimensions().x;o.set("skewY",i),h(o,"skewX","scaleX","x",l)}return f}function b(e,t,n,r){var i,o=t.target,a=o.skewX,s=t.originY;if(o.lockSkewingX)return!1;if(0===a){var c=p(t,I,I,n,r);i=c.x>0?L:_}else a>0&&(i=s===D?L:_),0>a&&(i=s===D?_:L),g(o)&&(i=i===L?_:L);t.originX=i;var u=v("skewing",d(m));return u(e,t,n,r)}function x(e,t,n,r){var i,o=t.target,a=o.skewY,s=t.originX;if(o.lockSkewingY)return!1;if(0===a){var c=p(t,I,I,n,r);i=c.y>0?D:F}else a>0&&(i=s===L?D:F),0>a&&(i=s===L?F:D),g(o)&&(i=i===D?F:D);t.originY=i;var u=v("skewing",d(y));return u(e,t,n,r)}function w(e,t,n,r){var i=t,o=i.target,a=o.translateToOriginPoint(o.getCenterPoint(),i.originX,i.originY);if(o.lockRotation)return!1;var s=Math.atan2(i.ey-a.y,i.ex-a.x),c=Math.atan2(r-a.y,n-a.x),u=G(c-s+i.theta),f=!0;if(o.snapAngle>0){var l=o.snapAngle,d=o.snapThreshold||l,v=Math.ceil(u/l)*l,p=Math.floor(u/l)*l;Math.abs(u-p)u&&(u=360+u),u%=360,f=o.angle!==u,o.angle=u,f}function j(e,t,n,a,s){s=s||{};var c,u,f,l,d,v,g=t.target,h=g.lockScalingX,m=g.lockScalingY,y=s.by,b=r(e,g),x=o(g,y,b),w=t.gestureScale;if(x)return!1;if(w)u=t.scaleX*w,f=t.scaleY*w;else{if(c=p(t,t.originX,t.originY,n,a),d="y"!==y?R(c.x):1,v="x"!==y?R(c.y):1,t.signX||(t.signX=d),t.signY||(t.signY=v),g.lockScalingFlip&&(t.signX!==d||t.signY!==v))return!1;if(l=g._getTransformedDimensions(),b&&!y){var j=Math.abs(c.x)+Math.abs(c.y),P=t.original,M=Math.abs(l.x*P.scaleX/g.scaleX)+Math.abs(l.y*P.scaleY/g.scaleY),E=j/M;u=P.scaleX*E,f=P.scaleY*E}else u=Math.abs(c.x*g.scaleX/l.x),f=Math.abs(c.y*g.scaleY/l.y);i(t)&&(u*=2,f*=2),t.signX!==d&&"y"!==y&&(t.originX=N[t.originX],u*=-1,t.signX=d),t.signY!==v&&"x"!==y&&(t.originY=N[t.originY],f*=-1,t.signY=v)}var k=g.scaleX,S=g.scaleY;return y?("x"===y&&g.set("scaleX",u),"y"===y&&g.set("scaleY",f)):(!h&&g.set("scaleX",u),!m&&g.set("scaleY",f)),k!==g.scaleX||S!==g.scaleY}function P(e,t,n,r){return j(e,t,n,r)}function M(e,t,n,r){return j(e,t,n,r,{by:"x"})}function E(e,t,n,r){return j(e,t,n,r,{by:"y"})}function k(e,t,n,r){return e[t.target.canvas.altActionKey]?Y.skewHandlerX(e,t,n,r):Y.scalingY(e,t,n,r)}function S(e,t,n,r){return e[t.target.canvas.altActionKey]?Y.skewHandlerY(e,t,n,r):Y.scalingX(e,t,n,r)}function T(e,t,n,r){var o=t.target,a=p(t,t.originX,t.originY,n,r),s=o.strokeWidth/(o.strokeUniform?o.scaleX:1),c=i(t)?2:1,u=o.width,f=Math.abs(a.x*c/o.scaleX)-s;return o.set("width",Math.max(f,0)),u!==f}function A(e,t,r,i){var o=t.target,a=r-t.offsetX,s=i-t.offsetY,c=!o.get("lockMovementX")&&o.left!==a,u=!o.get("lockMovementY")&&o.top!==s;return c&&o.set("left",a),u&&o.set("top",s),(c||u)&&n("moving",l(e,t,r,i)),c||u}var C=e.fabric||(e.fabric={}),O=["e","se","s","sw","w","nw","n","ne","e"],X=["ns","nesw","ew","nwse"],Y={},L="left",D="top",_="right",F="bottom",I="center",N={top:F,bottom:D,left:_,right:L,center:I},G=C.util.radiansToDegrees,R=Math.sign||function(e){return(e>0)-(0>e)||+e};Y.scaleCursorStyleHandler=a,Y.skewCursorStyleHandler=s,Y.scaleSkewCursorStyleHandler=c,Y.rotationWithSnapping=v("rotating",d(w)),Y.scalingEqually=v("scaling",d(P)),Y.scalingX=v("scaling",d(M)),Y.scalingY=v("scaling",d(E)),Y.scalingYOrSkewingX=k,Y.scalingXOrSkewingY=S,Y.changeWidth=v("resizing",d(T)),Y.skewHandlerX=b,Y.skewHandlerY=x,Y.dragHandler=A,Y.scaleOrSkewActionName=u,Y.rotationStyleHandler=f,Y.fireEvent=n,Y.wrapWithFixedAnchor=d,Y.wrapWithFireEvent=v,Y.getLocalPoint=p,C.controlsUtils=Y}("undefined"!=typeof exports?exports:this);!function(e){"use strict";function t(e,t,n,r,i){r=r||{};var o,a=this.sizeX||r.cornerSize||i.cornerSize,s=this.sizeY||r.cornerSize||i.cornerSize,c="undefined"!=typeof r.transparentCorners?r.transparentCorners:i.transparentCorners,u=c?"stroke":"fill",l=!c&&(r.cornerStrokeColor||i.cornerStrokeColor),f=t,d=n;e.save(),e.fillStyle=r.cornerColor||i.cornerColor,e.strokeStyle=r.cornerStrokeColor||i.cornerStrokeColor,a>s?(o=a,e.scale(1,s/a),d=n*a/s):s>a?(o=s,e.scale(a/s,1),f=t*s/a):o=a,e.lineWidth=1,e.beginPath(),e.arc(f,d,o/2,0,2*Math.PI,!1),e[u](),l&&e.stroke(),e.restore()}function n(e,t,n,r,o){r=r||{};var a=this.sizeX||r.cornerSize||o.cornerSize,s=this.sizeY||r.cornerSize||o.cornerSize,c="undefined"!=typeof r.transparentCorners?r.transparentCorners:o.transparentCorners,u=c?"stroke":"fill",l=!c&&(r.cornerStrokeColor||o.cornerStrokeColor),f=a/2,d=s/2;e.save(),e.fillStyle=r.cornerColor||o.cornerColor,e.strokeStyle=r.cornerStrokeColor||o.cornerStrokeColor,e.lineWidth=1,e.translate(t,n),e.rotate(i(o.angle)),e[u+"Rect"](-f,-d,a,s),l&&e.strokeRect(-f,-d,a,s),e.restore()}var r=e.fabric||(e.fabric={}),i=r.util.degreesToRadians,o=r.controlsUtils;o.renderCircleControl=t,o.renderSquareControl=n}("undefined"!=typeof exports?exports:this);!function(e){"use strict";function t(e){for(var t in e)this[t]=e[t]}var n=e.fabric||(e.fabric={});n.Control=t,n.Control.prototype={visible:!0,actionName:"scale",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:"crosshair",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(e,t){return t.cursorStyle},getActionName:function(e,t){return t.actionName},getVisibility:function(e,t){var n=e._controlsVisibility;return n&&"undefined"!=typeof n[t]?n[t]:this.visible},setVisibility:function(e){this.visible=e},positionHandler:function(e,t){var r=n.util.transformPoint({x:this.x*e.x+this.offsetX,y:this.y*e.y+this.offsetY},t);return r},calcCornerCoords:function(e,t,r,i,o){var a,s,u,c,l=o?this.touchSizeX:this.sizeX,f=o?this.touchSizeY:this.sizeY;if(l&&f&&l!==f){var d=Math.atan2(f,l),p=Math.sqrt(l*l+f*f)/2,v=d-n.util.degreesToRadians(e),g=Math.PI/2-d-n.util.degreesToRadians(e);a=p*n.util.cos(v),s=p*n.util.sin(v),u=p*n.util.cos(g),c=p*n.util.sin(g)}else{var h=l&&f?l:t;p=.7071067812*h;var v=n.util.degreesToRadians(45-e);a=u=p*n.util.cos(v),s=c=p*n.util.sin(v)}return{tl:{x:r-c,y:i-u},tr:{x:r+a,y:i-s},bl:{x:r-a,y:i+s},br:{x:r+c,y:i+u}}},render:function(e,t,r,i,o){switch(i=i||{},i.cornerStyle||o.cornerStyle){case"circle":n.controlsUtils.renderCircleControl.call(this,e,t,r,i,o);break;default:n.controlsUtils.renderSquareControl.call(this,e,t,r,i,o)}}}}("undefined"!=typeof exports?exports:this);!function(){function e(e,t){var n,r,i,o,a=e.getAttribute("style"),s=e.getAttribute("offset")||0;if(s=parseFloat(s)/(/%$/.test(s)?100:1),s=0>s?0:s>1?1:s,a){var c=a.split(/\s*;\s*/);for(""===c[c.length-1]&&c.pop(),o=c.length;o--;){var u=c[o].split(/\s*:\s*/),l=u[0].trim(),f=u[1].trim();"stop-color"===l?n=f:"stop-opacity"===l&&(i=f)}}return n||(n=e.getAttribute("stop-color")||"rgb(0,0,0)"),i||(i=e.getAttribute("stop-opacity")),n=new fabric.Color(n),r=n.getAlpha(),i=isNaN(parseFloat(i))?1:parseFloat(i),i*=r*t,{offset:s,color:n.toRgb(),opacity:i}}function t(e){return{x1:e.getAttribute("x1")||0,y1:e.getAttribute("y1")||0,x2:e.getAttribute("x2")||"100%",y2:e.getAttribute("y2")||0}}function n(e){return{x1:e.getAttribute("fx")||e.getAttribute("cx")||"50%",y1:e.getAttribute("fy")||e.getAttribute("cy")||"50%",r1:0,x2:e.getAttribute("cx")||"50%",y2:e.getAttribute("cy")||"50%",r2:e.getAttribute("r")||"50%"}}function r(e,t,n,r){var i,o;Object.keys(t).forEach(function(e){i=t[e],"Infinity"===i?o=1:"-Infinity"===i?o=0:(o=parseFloat(t[e],10),"string"==typeof i&&/^(\d+\.\d+)%|(\d+)%$/.test(i)&&(o*=.01,"pixels"===r&&(("x1"===e||"x2"===e||"r2"===e)&&(o*=n.viewBoxWidth||n.width),("y1"===e||"y2"===e)&&(o*=n.viewBoxHeight||n.height)))),t[e]=o})}var i=fabric.util.object.clone;fabric.Gradient=fabric.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(e){e||(e={}),e.coords||(e.coords={});var t,n=this;Object.keys(e).forEach(function(t){n[t]=e[t]}),this.id?this.id+="_"+fabric.Object.__uid++:this.id=fabric.Object.__uid++,t={x1:e.coords.x1||0,y1:e.coords.y1||0,x2:e.coords.x2||0,y2:e.coords.y2||0},"radial"===this.type&&(t.r1=e.coords.r1||0,t.r2=e.coords.r2||0),this.coords=t,this.colorStops=e.colorStops.slice()},addColorStop:function(e){for(var t in e){var n=new fabric.Color(e[t]);this.colorStops.push({offset:parseFloat(t),color:n.toRgb(),opacity:n.getAlpha()})}return this},toObject:function(e){var t={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return fabric.util.populateWithProperties(this,t,e),t},toSVG:function(e,t){var n,r,o,a,s=i(this.coords,!0),t=t||{},c=i(this.colorStops,!0),u=s.r1>s.r2,l=this.gradientTransform?this.gradientTransform.concat():fabric.iMatrix.concat(),f=-this.offsetX,d=-this.offsetY,p=!!t.additionalTransform,g="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox";if(c.sort(function(e,t){return e.offset-t.offset}),"objectBoundingBox"===g?(f/=e.width,d/=e.height):(f+=e.width/2,d+=e.height/2),"path"===e.type&&"percentage"!==this.gradientUnits&&(f-=e.pathOffset.x,d-=e.pathOffset.y),l[4]-=f,l[5]-=d,a='id="SVGID_'+this.id+'" gradientUnits="'+g+'"',a+=' gradientTransform="'+(p?t.additionalTransform+" ":"")+fabric.util.matrixToSVG(l)+'" ',"linear"===this.type?o=["\n']:"radial"===this.type&&(o=["\n']),"radial"===this.type){if(u)for(c=c.concat(),c.reverse(),n=0,r=c.length;r>n;n++)c[n].offset=1-c[n].offset;var v=Math.min(s.r1,s.r2);if(v>0){var h=Math.max(s.r1,s.r2),m=v/h;for(n=0,r=c.length;r>n;n++)c[n].offset+=m*(1-c[n].offset)}}for(n=0,r=c.length;r>n;n++){var y=c[n];o.push("\n')}return o.push("linear"===this.type?"\n":"\n"),o.join("")},toLive:function(e){var t,n,r,i=fabric.util.object.clone(this.coords);if(this.type){for("linear"===this.type?t=e.createLinearGradient(i.x1,i.y1,i.x2,i.y2):"radial"===this.type&&(t=e.createRadialGradient(i.x1,i.y1,i.r1,i.x2,i.y2,i.r2)),n=0,r=this.colorStops.length;r>n;n++){var o=this.colorStops[n].color,a=this.colorStops[n].opacity,s=this.colorStops[n].offset;"undefined"!=typeof a&&(o=new fabric.Color(o).setAlpha(a).toRgba()),t.addColorStop(s,o)}return t}}}),fabric.util.object.extend(fabric.Gradient,{fromElement:function(i,o,a,s){var c=parseFloat(a)/(/%$/.test(a)?100:1);c=0>c?0:c>1?1:c,isNaN(c)&&(c=1);var u,l,f,d,p=i.getElementsByTagName("stop"),g="userSpaceOnUse"===i.getAttribute("gradientUnits")?"pixels":"percentage",v=i.getAttribute("gradientTransform")||"",h=[],m=0,y=0;for("linearGradient"===i.nodeName||"LINEARGRADIENT"===i.nodeName?(u="linear",l=t(i)):(u="radial",l=n(i)),f=p.length;f--;)h.push(e(p[f],c));d=fabric.parseTransformAttribute(v),r(o,l,s,g),"pixels"===g&&(m=-o.left,y=-o.top);var b=new fabric.Gradient({id:i.getAttribute("id"),type:u,coords:l,colorStops:h,gradientUnits:g,gradientTransform:d,offsetX:m,offsetY:y});return b}})}();!function(){"use strict";var e=fabric.util.toFixed;fabric.Pattern=fabric.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(e,t){if(e||(e={}),this.id=fabric.Object.__uid++,this.setOptions(e),!e.source||e.source&&"string"!=typeof e.source)return void(t&&t(this));var r=this;this.source=fabric.util.createImage(),fabric.util.loadImage(e.source,function(e,n){r.source=e,t&&t(r,n)},null,this.crossOrigin)},toObject:function(t){var r,n,i=fabric.Object.NUM_FRACTION_DIGITS;return"string"==typeof this.source.src?r=this.source.src:"object"==typeof this.source&&this.source.toDataURL&&(r=this.source.toDataURL()),n={type:"pattern",source:r,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:e(this.offsetX,i),offsetY:e(this.offsetY,i),patternTransform:this.patternTransform?this.patternTransform.concat():null},fabric.util.populateWithProperties(this,n,t),n},toSVG:function(e){var t="function"==typeof this.source?this.source():this.source,r=t.width/e.width,n=t.height/e.height,i=this.offsetX/e.width,o=this.offsetY/e.height,a="";return("repeat-x"===this.repeat||"no-repeat"===this.repeat)&&(n=1,o&&(n+=Math.abs(o))),("repeat-y"===this.repeat||"no-repeat"===this.repeat)&&(r=1,i&&(r+=Math.abs(i))),t.src?a=t.src:t.toDataURL&&(a=t.toDataURL()),'\n\n\n'},setOptions:function(e){for(var t in e)this[t]=e[t]},toLive:function(e){var t=this.source;if(!t)return"";if("undefined"!=typeof t.src){if(!t.complete)return"";if(0===t.naturalWidth||0===t.naturalHeight)return""}return e.createPattern(t,this.repeat)}})}();!function(e){"use strict";var t=e.fabric||(e.fabric={}),r=t.util.toFixed;return t.Shadow?void t.warn("fabric.Shadow is already defined."):(t.Shadow=t.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(e){"string"==typeof e&&(e=this._parseShadow(e));for(var r in e)this[r]=e[r];this.id=t.Object.__uid++},_parseShadow:function(e){var r=e.trim(),n=t.Shadow.reOffsetsAndBlur.exec(r)||[],i=r.replace(t.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)";return{color:i.trim(),offsetX:parseFloat(n[1],10)||0,offsetY:parseFloat(n[2],10)||0,blur:parseFloat(n[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(e){var n=40,i=40,o=t.Object.NUM_FRACTION_DIGITS,a=t.util.rotateVector({x:this.offsetX,y:this.offsetY},t.util.degreesToRadians(-e.angle)),s=20,c=new t.Color(this.color);return e.width&&e.height&&(n=100*r((Math.abs(a.x)+this.blur)/e.width,o)+s,i=100*r((Math.abs(a.y)+this.blur)/e.height,o)+s),e.flipX&&(a.x*=-1),e.flipY&&(a.y*=-1),'\n \n \n \n \n \n \n \n \n\n'},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling};var e={},r=t.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke","nonScaling"].forEach(function(t){this[t]!==r[t]&&(e[t]=this[t])},this),e}}),void(t.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/))}("undefined"!=typeof exports?exports:this);!function(){"use strict";if(fabric.StaticCanvas)return void fabric.warn("fabric.StaticCanvas is already defined.");var e=fabric.util.object.extend,t=fabric.util.getElementOffset,r=fabric.util.removeFromArray,n=fabric.util.toFixed,i=fabric.util.transformPoint,o=fabric.util.invertTransform,a=fabric.util.getNodeCanvas,s=fabric.util.createCanvasElement,c=new Error("Could not initialize `canvas` element");fabric.StaticCanvas=fabric.util.createClass(fabric.CommonMethods,{initialize:function(e,t){t||(t={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(e,t)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:fabric.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(e,t){var r=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(e),this._initOptions(t),this.interactive||this._initRetinaScaling(),t.overlayImage&&this.setOverlayImage(t.overlayImage,r),t.backgroundImage&&this.setBackgroundImage(t.backgroundImage,r),t.backgroundColor&&this.setBackgroundColor(t.backgroundColor,r),t.overlayColor&&this.setOverlayColor(t.overlayColor,r),this.calcOffset()},_isRetinaScaling:function(){return fabric.devicePixelRatio>1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?Math.max(1,fabric.devicePixelRatio):1},_initRetinaScaling:function(){if(this._isRetinaScaling()){var e=fabric.devicePixelRatio;this.__initRetinaScaling(e,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(e,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(e,t,r){t.setAttribute("width",this.width*e),t.setAttribute("height",this.height*e),r.scale(e,e)},calcOffset:function(){return this._offset=t(this.lowerCanvasEl),this},setOverlayImage:function(e,t,r){return this.__setBgOverlayImage("overlayImage",e,t,r)},setBackgroundImage:function(e,t,r){return this.__setBgOverlayImage("backgroundImage",e,t,r)},setOverlayColor:function(e,t){return this.__setBgOverlayColor("overlayColor",e,t)},setBackgroundColor:function(e,t){return this.__setBgOverlayColor("backgroundColor",e,t)},__setBgOverlayImage:function(e,t,r,n){return"string"==typeof t?fabric.util.loadImage(t,function(t,i){if(t){var o=new fabric.Image(t,n);this[e]=o,o.canvas=this}r&&r(t,i)},this,n&&n.crossOrigin):(n&&t.setOptions(n),this[e]=t,t&&(t.canvas=this),r&&r(t,!1)),this},__setBgOverlayColor:function(e,t,r){return this[e]=t,this._initGradient(t,e),this._initPattern(t,e,r),this},_createCanvasElement:function(){var e=s();if(!e)throw c;if(e.style||(e.style={}),"undefined"==typeof e.getContext)throw c;return e},_initOptions:function(e){var t=this.lowerCanvasEl;this._setOptions(e),this.width=this.width||parseInt(t.width,10)||0,this.height=this.height||parseInt(t.height,10)||0,this.lowerCanvasEl.style&&(t.width=this.width,t.height=this.height,t.style.width=this.width+"px",t.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(e){this.lowerCanvasEl=e&&e.getContext?e:fabric.util.getById(e)||this._createCanvasElement(),fabric.util.addClass(this.lowerCanvasEl,"lower-canvas"),this._originalCanvasStyle=this.lowerCanvasEl.style,this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(e,t){return this.setDimensions({width:e},t)},setHeight:function(e,t){return this.setDimensions({height:e},t)},setDimensions:function(e,t){var r;t=t||{};for(var n in e)r=e[n],t.cssOnly||(this._setBackstoreDimension(n,e[n]),r+="px",this.hasLostContext=!0),t.backstoreOnly||this._setCssDimension(n,r);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop),this._initRetinaScaling(),this.calcOffset(),t.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(e,t){return this.lowerCanvasEl[e]=t,this.upperCanvasEl&&(this.upperCanvasEl[e]=t),this.cacheCanvasEl&&(this.cacheCanvasEl[e]=t),this[e]=t,this},_setCssDimension:function(e,t){return this.lowerCanvasEl.style[e]=t,this.upperCanvasEl&&(this.upperCanvasEl.style[e]=t),this.wrapperEl&&(this.wrapperEl.style[e]=t),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(e){var t,r,n,i=this._activeObject,o=this.backgroundImage,a=this.overlayImage;for(this.viewportTransform=e,r=0,n=this._objects.length;n>r;r++)t=this._objects[r],t.group||t.setCoords(!0);return i&&i.setCoords(),o&&o.setCoords(!0),a&&a.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(e,t){var r=e,n=this.viewportTransform.slice(0);e=i(e,o(this.viewportTransform)),n[0]=t,n[3]=t;var a=i(e,n);return n[4]+=r.x-a.x,n[5]+=r.y-a.y,this.setViewportTransform(n)},setZoom:function(e){return this.zoomToPoint(new fabric.Point(0,0),e),this},absolutePan:function(e){var t=this.viewportTransform.slice(0);return t[4]=-e.x,t[5]=-e.y,this.setViewportTransform(t)},relativePan:function(e){return this.absolutePan(new fabric.Point(-e.x-this.viewportTransform[4],-e.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(e){this.stateful&&e.setupState(),e._set("canvas",this),e.setCoords(),this.fire("object:added",{target:e}),e.fire("added")},_onObjectRemoved:function(e){this.fire("object:removed",{target:e}),e.fire("removed"),delete e.canvas},clearContext:function(e){return e.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this.remove.apply(this,this.getObjects()),this.backgroundImage=null,this.overlayImage=null,this.backgroundColor="",this.overlayColor="",this._hasITextHandlers&&(this.off("mouse:up",this._mouseUpITextHandler),this._iTextInstances=null,this._hasITextHandlers=!1),this.clearContext(this.contextContainer),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll(),this},renderAll:function(){var e=this.contextContainer;return this.renderCanvas(e,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=fabric.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var e={},t=this.width,r=this.height,n=o(this.viewportTransform);return e.tl=i({x:0,y:0},n),e.br=i({x:t,y:r},n),e.tr=new fabric.Point(e.br.x,e.tl.y),e.bl=new fabric.Point(e.tl.x,e.br.y),this.vptCoords=e,e},cancelRequestedRender:function(){this.isRendering&&(fabric.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(e,t){var r=this.viewportTransform,n=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(e),fabric.util.setImageSmoothing(e,this.imageSmoothingEnabled),this.fire("before:render",{ctx:e}),this._renderBackground(e),e.save(),e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this._renderObjects(e,t),e.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(e),n&&(n.canvas=this,n.shouldCache(),n._transformDone=!0,n.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(e)),this._renderOverlay(e),this.controlsAboveOverlay&&this.interactive&&this.drawControls(e),this.fire("after:render",{ctx:e})},drawClipPathOnCanvas:function(e){var t=this.viewportTransform,r=this.clipPath;e.save(),e.transform(t[0],t[1],t[2],t[3],t[4],t[5]),e.globalCompositeOperation="destination-in",r.transform(e),e.scale(1/r.zoomX,1/r.zoomY),e.drawImage(r._cacheCanvas,-r.cacheTranslationX,-r.cacheTranslationY),e.restore()},_renderObjects:function(e,t){var r,n;for(r=0,n=t.length;n>r;++r)t[r]&&t[r].render(e)},_renderBackgroundOrOverlay:function(e,t){var r=this[t+"Color"],n=this[t+"Image"],i=this.viewportTransform,o=this[t+"Vpt"];if(r||n){if(r){e.save(),e.beginPath(),e.moveTo(0,0),e.lineTo(this.width,0),e.lineTo(this.width,this.height),e.lineTo(0,this.height),e.closePath(),e.fillStyle=r.toLive?r.toLive(e,this):r,o&&e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),e.transform(1,0,0,1,r.offsetX||0,r.offsetY||0);var a=r.gradientTransform||r.patternTransform;a&&e.transform(a[0],a[1],a[2],a[3],a[4],a[5]),e.fill(),e.restore()}n&&(e.save(),o&&e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),n.render(e),e.restore())}},_renderBackground:function(e){this._renderBackgroundOrOverlay(e,"background")},_renderOverlay:function(e){this._renderBackgroundOrOverlay(e,"overlay")},getCenter:function(){return{top:this.height/2,left:this.width/2}},getCenterPoint:function(){return new fabric.Point(this.width/2,this.height/2)},centerObjectH:function(e){return this._centerObject(e,new fabric.Point(this.getCenterPoint().x,e.getCenterPoint().y))},centerObjectV:function(e){return this._centerObject(e,new fabric.Point(e.getCenterPoint().x,this.getCenterPoint().y))},centerObject:function(e){var t=this.getCenterPoint();return this._centerObject(e,t)},viewportCenterObject:function(e){var t=this.getVpCenter();return this._centerObject(e,t)},viewportCenterObjectH:function(e){var t=this.getVpCenter();return this._centerObject(e,new fabric.Point(t.x,e.getCenterPoint().y)),this},viewportCenterObjectV:function(e){var t=this.getVpCenter();return this._centerObject(e,new fabric.Point(e.getCenterPoint().x,t.y))},getVpCenter:function(){var e=this.getCenterPoint(),t=o(this.viewportTransform);return i(e,t)},_centerObject:function(e,t){return e.setPositionByOrigin(t,"center","center"),e.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(e){return this.toDatalessObject(e)},toObject:function(e){return this._toObjectMethod("toObject",e)},toDatalessObject:function(e){return this._toObjectMethod("toDatalessObject",e)},_toObjectMethod:function(t,r){var n=this.clipPath,i={version:fabric.version,objects:this._toObjects(t,r)};return n&&!n.excludeFromExport&&(i.clipPath=this._toObject(this.clipPath,t,r)),e(i,this.__serializeBgOverlay(t,r)),fabric.util.populateWithProperties(this,i,r),i},_toObjects:function(e,t){return this._objects.filter(function(e){return!e.excludeFromExport}).map(function(r){return this._toObject(r,e,t)},this)},_toObject:function(e,t,r){var n;this.includeDefaultValues||(n=e.includeDefaultValues,e.includeDefaultValues=!1);var i=e[t](r);return this.includeDefaultValues||(e.includeDefaultValues=n),i},__serializeBgOverlay:function(e,t){var r={},n=this.backgroundImage,i=this.overlayImage,o=this.backgroundColor,a=this.overlayColor;return o&&o.toObject?o.excludeFromExport||(r.background=o.toObject(t)):o&&(r.background=o),a&&a.toObject?a.excludeFromExport||(r.overlay=a.toObject(t)):a&&(r.overlay=a),n&&!n.excludeFromExport&&(r.backgroundImage=this._toObject(n,e,t)),i&&!i.excludeFromExport&&(r.overlayImage=this._toObject(i,e,t)),r},svgViewportTransformation:!0,toSVG:function(e,t){e||(e={}),e.reviver=t;var r=[];return this._setSVGPreamble(r,e),this._setSVGHeader(r,e),this.clipPath&&r.push('\n'),this._setSVGBgOverlayColor(r,"background"),this._setSVGBgOverlayImage(r,"backgroundImage",t),this._setSVGObjects(r,t),this.clipPath&&r.push("\n"),this._setSVGBgOverlayColor(r,"overlay"),this._setSVGBgOverlayImage(r,"overlayImage",t),r.push(""),r.join("")},_setSVGPreamble:function(e,t){t.suppressPreamble||e.push('\n','\n')},_setSVGHeader:function(e,t){var r,i=t.width||this.width,o=t.height||this.height,a='viewBox="0 0 '+this.width+" "+this.height+'" ',s=fabric.Object.NUM_FRACTION_DIGITS;t.viewBox?a='viewBox="'+t.viewBox.x+" "+t.viewBox.y+" "+t.viewBox.width+" "+t.viewBox.height+'" ':this.svgViewportTransformation&&(r=this.viewportTransform,a='viewBox="'+n(-r[4]/r[0],s)+" "+n(-r[5]/r[3],s)+" "+n(this.width/r[0],s)+" "+n(this.height/r[3],s)+'" '),e.push("