PageSourceSearch

https://rasch.de/theme/e2a39899ea91df829d56423b5775db01/js/hb-h-ma…hb-h-magic-walls-configurator.js?1790241503

js rasch.de collected 2026-09-25 07:14:50 UTC 356,674 bytes, 1 lines download raw bytes

1(()=>{"use strict";var t={};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}();class e{_isEditMode(){let t=document.querySelector("#configurator");return!!t&&""!==(t.dataset.configuratorid||"")}_resolveStepTransition(t,e){let i=t+e;return(""!==document.querySelector("#configurator").dataset.templateproductimage&&1===t&&2===i&&(i=3),this._isEditMode()&&(e>0&&1===t&&2===i&&(i=3),e<0&&3===t&&2===i&&(i=1)),i<1)?1:i>4?4:i}_handleResponse(t){!0===t.success?this._updateLocalStorage(t.configuratorData):alert(t.message)}_updateLocalStorage(t){var[e]=Object.keys(t),i=JSON.parse(localStorage.getItem("configurator_"+e));null===i&&((i={}).crdate=Date.now()/1e3,i.configuratorId=e),i=Object.assign(i,t[e]),localStorage.setItem("configurator_"+e,JSON.stringify(i)),document.querySelector("#configurator").dataset.configuratorid=e}_removeOldConfigurations(){for(var t=[],e=0;e<localStorage.length;e++)localStorage.key(e).indexOf("configurator_")>=0&&t.push(JSON.parse(localStorage.getItem(localStorage.key(e))));for(var e=0;e<t.length;e++)t[e].crdate<Date.now()/1e3-2592e3&&localStorage.removeItem("configurator_"+t[e].configuratorId)}_getConfiguratorConfigFromLocalStorage(t){var e=JSON.parse(localStorage.getItem("configurator_"+t));return null===e?[]:e}_collectFormData(t){let e=new FormData;return e.append("configuratorId",t.configuratorId),e.append("templateproductnumber",t.templateproductnumber),e.append("crdate",Date.now()/1e3),e.append("originalFileName",t.configuratorConfig.originalFileName),e.append("editedFileName",t.configuratorConfig.editedFileName),e.append("croppedEditedFileName",t.configuratorConfig.croppedEditedFileName),e.append("canvasScreenshotFileName",t.configuratorConfig.canvasScreenshotFileName),e.append("canvasScreenshotBase64",t._createCanvasScreenshot()),e.append("wallWidth",document.querySelector("#wallWidth").value),e.append("wallHeight",document.querySelector("#wallHeight").value),e.append("imageWidth",t.configuratorConfig.imageWidth),e.append("imageHeight",t.configuratorConfig.imageHeight),e.append("roomWidth",t._canvas.roomWidth),e.append("roomHeight",t._canvas.roomHeight),e.append("mirrorImage",document.querySelector("#mirrorImage").checked),e.append("qualityProductId",document.querySelector("input[name='qualityProductId']:checked").value),e.append("qualityProductNumber",document.querySelector("input[name='qualityProductId']:checked").dataset.qualityproductnumber),e.append("cropX",t._canvas.cropX),e.append("cropY",t._canvas.cropY),e.append("bottomX",t._canvas.bottomX),e.append("bottomY",t._canvas.bottomY),e.append("scaleX",t._canvas.scaleX),e.append("initScaleX",t._canvas.initScaleX),e.append("stripWidth",t._canvas.stripWidth),e.append("stripAmount",t._canvas.stripCount),e}_presetInputs(t){document.querySelector("#wallWidth").value=t.wallWidth,document.querySelector("#wallHeight").value=t.wallHeight,"true"===t.mirrorImage||!0===t.mirrorImage?document.querySelector("#mirrorImage").checked=!0:document.querySelector("#mirrorImage").checked=!1,document.querySelector("input[value='"+t.qualityProductId+"']").checked=!0}_validateWallSettings(t){var e=t.target;e.value>=8e3?e.classList.contains("errorInput")||e.classList.add("errorInput"):e.classList.remove("errorInput")}_printWallMeasures(t,e){let i=document.querySelector("#wallMeasuresWidth"),r=document.querySelector("#wallMeasuresHeight");i.innerHTML=t+" cm",r.innerHTML=e+" cm"}_syncSaveButtonState(t){let e=document.getElementById("saveButton");if(!e)return;if(1!==t){e.disabled=!1;return}let i=document.getElementById("wallWidth"),r=document.getElementById("wallHeight"),n=i?parseInt(i.value,10):NaN,s=r?parseInt(r.value,10):NaN,o=Number.isInteger(n)&&Number.isInteger(s)&&n>=75&&n<=2e3&&s>=100&&s<=600;e.disabled=!o}_handleStep(t,e){let i="hbh_magicwall_step_";document.querySelector("#"+i+e).classList.remove("d-block"),document.querySelector("#"+i+e).classList.add("d-none"),document.querySelector("#"+i+t).classList.remove("d-none"),document.querySelector("#"+i+t).classList.add("d-block"),4
1===t&&3===e&&(document.getElementById("lastStepActions").classList.remove("d-none"),document.getElementById("lastStepActions").classList.add("d-block"),document.getElementById("saveButton").classList.remove("d-block"),document.getElementById("saveButton").classList.add("d-none")),4===e&&3===t&&(document.getElementById("lastStepActions").classList.add("d-none"),document.getElementById("lastStepActions").classList.remove("d-block"),document.getElementById("saveButton").classList.add("d-block"),document.getElementById("saveButton").classList.remove("d-none")),this._syncSaveButtonState(t),this._handleProgressSteps(t)}_handleProgressSteps(t){let e="modal-step__";for(let i=1;i<t;i++)document.querySelector("."+e+i).classList.remove("active"),document.querySelector("."+e+i).classList.add("was__active");for(let i=4;i>t;i--)document.querySelector("."+e+i).classList.remove("active"),document.querySelector("."+e+i).classList.remove("was__active");document.querySelector("."+e+t).classList.remove("was__active"),document.querySelector("."+e+t).classList.add("active")}}var i=void 0!==t.g?t.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o=!1;function a(){o=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)r[e]=t[e],n[t.charCodeAt(e)]=e;n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}function h(t){var e;o||a();for(var i=t.length,n=i%3,s="",h=[],l=0,c=i-n;l<c;l+=16383)h.push(function(t,e,i){for(var n,s=[],o=e;o<i;o+=3)s.push(r[(n=(t[o]<<16)+(t[o+1]<<8)+t[o+2])>>18&63]+r[n>>12&63]+r[n>>6&63]+r[63&n]);return s.join("")}(t,l,l+16383>c?c:l+16383));return 1===n?(s+=r[(e=t[i-1])>>2],s+=r[e<<4&63],s+="=="):2===n&&(s+=r[(e=(t[i-2]<<8)+t[i-1])>>10],s+=r[e>>4&63],s+=r[e<<2&63],s+="="),h.push(s),h.join("")}function l(t,e,i,r,n){var s,o,a=8*n-r-1,h=(1<<a)-1,l=h>>1,c=-7,u=i?n-1:0,f=i?-1:1,d=t[e+u];for(u+=f,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=256*s+t[e+u],u+=f,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=r;c>0;o=256*o+t[e+u],u+=f,c-=8);if(0===s)s=1-l;else{if(s===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=l}return(d?-1:1)*o*Math.pow(2,s-r)}function c(t,e,i,r,n,s){var o,a,h,l=8*s-n-1,c=(1<<l)-1,u=c>>1,f=5960464477539062e-23*(23===n),d=r?0:s-1,g=r?1:-1,p=+(e<0||0===e&&1/e<0);for(isNaN(e=Math.abs(e))||e===1/0?(a=+!!isNaN(e),o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+u>=1?f/h:f*Math.pow(2,1-u))*h>=2&&(o++,h/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(e*h-1)*Math.pow(2,n),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;t[i+d]=255&a,d+=g,a/=256,n-=8);for(o=o<<n|a,l+=n;l>0;t[i+d]=255&o,d+=g,o/=256,l-=8);t[i+d-g]|=128*p}var u={}.toString,f=Array.isArray||function(t){return"[object Array]"==u.call(t)};function d(){return p.TYPED_ARRAY_SUPPORT?0x7fffffff:0x3fffffff}function g(t,e){if(d()<e)throw RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=p.prototype:(null===t&&(t=new p(e)),t.length=e),t}function p(t,e,i){if(!(p.TYPED_ARRAY_SUPPORT||this instanceof p))return new p(t,e,i);if("number"==typeof t){if("string"==typeof e)throw Error("If encoding is specified then the first argument must be a string");return y(this,t)}return m(this,t,e,i)}function m(t,e,i,r){if("number"==typeof e)throw TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,i,r){if(e.byteLength,i<0||e.byteLength<i)throw RangeError("'offset' is out of bounds");if(e.byteLength<i+(r||0))throw RangeError("'length' is out of bounds");return e=void 0===i&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,i):new Uint8Array(e,i,r),p.TYPED_ARRAY_SUPPORT?(t=e).__proto__=p.prototype:t=_(t,e),t}(t,e,i,r):"string"==typeof e?function(t,e,i){if("string"==typeof i&&""!==i||(i="utf8"),!p.isEncoding(i))throw TypeError('"encoding" must be a valid string encoding');var r=0|C(e,i),n=(t=g(t,r)).write(e,i);return n!==r&&(t=t.slice(0,n)),t}(t,e,i):function(t,e){if(x(e)){var i,r=0|b(e.length);return 0===(t=g(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?g(t,0):_(t,e);if("Buffer"===e.type&&f(e.data))return _(t,e.data)}throw TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function v(t){if("number"!=typeof t)throw TypeError('"size" argument must be a number');if(t<0)throw RangeError('"size" argument must not be negative')}function y(t,e){if(v(e),t=g(t,e<0?0:0|b(e)),!p.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)t[i]=0;return t}function _(t,e){var i=e.length<0?0:0|b(e.length);t=g(t,i);for(var r=0;r<i;r+=1)t[r]=255&e[r];return t}function b(t){if(t>=d())throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d().toString(16)+" bytes");return 0|t}function x(t){return!(null==t||!t._isBuffer)}function C(t,e){if(x(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&
1(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return R(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return B(t).length;default:if(r)return R(t).length;e=(""+e).toLowerCase(),r=!0}}function S(t,e,i){var r,n,s=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===i||i>this.length)&&(i=this.length),i<=0)||(i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,i){var r,n=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>n)&&(i=n);for(var s="",o=e;o<i;++o)s+=(r=t[o])<16?"0"+r.toString(16):r.toString(16);return s}(this,e,i);case"utf8":case"utf-8":return k(this,e,i);case"ascii":return function(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;n<i;++n)r+=String.fromCharCode(127&t[n]);return r}(this,e,i);case"latin1":case"binary":return function(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;n<i;++n)r+=String.fromCharCode(t[n]);return r}(this,e,i);case"base64":return r=e,n=i,0===r&&n===this.length?h(this):h(this.slice(r,n));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,i){for(var r=t.slice(e,i),n="",s=0;s<r.length;s+=2)n+=String.fromCharCode(r[s]+256*r[s+1]);return n}(this,e,i);default:if(s)throw TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),s=!0}}function w(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function T(t,e,i,r,n){if(0===t.length)return -1;if("string"==typeof i?(r=i,i=0):i>0x7fffffff?i=0x7fffffff:i<-0x80000000&&(i=-0x80000000),isNaN(i*=1)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return -1;i=t.length-1}else if(i<0){if(!n)return -1;i=0}if("string"==typeof e&&(e=p.from(e,r)),x(e))return 0===e.length?-1:O(t,e,i,r,n);if("number"==typeof e)return e&=255,p.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):O(t,[e],i,r,n);throw TypeError("val must be string, number or Buffer")}function O(t,e,i,r,n){var s,o=1,a=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return -1;o=2,a/=2,h/=2,i/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var c=-1;for(s=i;s<a;s++)if(l(t,s)===l(e,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===h)return c*o}else -1!==c&&(s-=s-c),c=-1}else for(i+h>a&&(i=a-h),s=i;s>=0;s--){for(var u=!0,f=0;f<h;f++)if(l(t,s+f)!==l(e,f)){u=!1;break}if(u)return s}return -1}function k(t,e,i){i=Math.min(t.length,i);for(var r=[],n=e;n<i;){var s,o,a,h,l=t[n],c=null,u=l>239?4:l>223?3:l>191?2:1;if(n+u<=i)switch(u){case 1:l<128&&(c=l);break;case 2:128==(192&(s=t[n+1]))&&(h=(31&l)<<6|63&s)>127&&(c=h);break;case 3:s=t[n+1],o=t[n+2],128==(192&s)&&128==(192&o)&&(h=(15&l)<<12|(63&s)<<6|63&o)>2047&&(h<55296||h>57343)&&(c=h);break;case 4:s=t[n+1],o=t[n+2],a=t[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(h=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&h<1114112&&(c=h)}null===c?(c=65533,u=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),n+=u}return function(t){var e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);for(var i="",r=0;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=E));return i}(r)}p.TYPED_ARRAY_SUPPORT=void 0===i.TYPED_ARRAY_SUPPORT||i.TYPED_ARRAY_SUPPORT,d(),p.poolSize=8192,p._augment=function(t){return t.__proto__=p.prototype,t},p.from=function(t,e,i){return m(null,t,e,i)},p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&p[Symbol.species]),p.alloc=function(t,e,i){return v(t),t<=0?g(null,t):void 0!==e?"string"==typeof i?g(null,t).fill(e,i):g(null,t).fill(e):g(null,t)},p.allocUnsafe=function(t){return y(null,t)},p.allocUnsafeSlow=function(t){return y(null,t)},p.isBuffer=function(t){return null!=t&&(!!t._isBuffer||z(t)||"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&z(t.slice(0,0)))},p.compare=function(t,e){if(!x(t)||!x(e))throw TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,n=0,s=Math.min(i,r);n<s;++n)if(t[n]!==e[n]){i=t[n],r=e[n];break}return i<r?-1:+(r<i)},p.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.concat=function(t,e){if(!f(t))throw TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return p.alloc(0);if(void 0===e)for(e=0,i=0;i<t.length;++i)e+=t[i].length;var i,r=p.allocUnsafe(e),n=0;for(i=0;i<t.length;++i){var s=t[i];if(!x(s))throw TypeError('"list" argument must be an Array of Buffers');s.copy(r,n),n+=s.length}return r},p.byteLength=C,p.prototype._isBuffer=!0,p.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)w(this,e,e+1);return this},p.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},p.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},p.prototype.toString=function(){var t=0|this.length;return 0===t?"":0==arguments.length?k(this,0,t):S.apply(this,arguments)},p.prototype.equals=function(t){if(!x(t))throw TypeError("Argument must be a Buffer");return this===t||0===p.compare(this,t)},p.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"}
1,p.prototype.compare=function(t,e,i,r,n){if(!x(t))throw TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||i>t.length||r<0||n>this.length)throw RangeError("out of range index");if(r>=n&&e>=i)return 0;if(r>=n)return -1;if(e>=i)return 1;if(this===t)return 0;for(var s=(n>>>=0)-(r>>>=0),o=(i>>>=0)-(e>>>=0),a=Math.min(s,o),h=this.slice(r,n),l=t.slice(e,i),c=0;c<a;++c)if(h[c]!==l[c]){s=h[c],o=l[c];break}return s<o?-1:+(o<s)},p.prototype.includes=function(t,e,i){return -1!==this.indexOf(t,e,i)},p.prototype.indexOf=function(t,e,i){return T(this,t,e,i,!0)},p.prototype.lastIndexOf=function(t,e,i){return T(this,t,e,i,!1)},p.prototype.write=function(t,e,i,r){if(void 0===e)r="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)r=e,i=this.length,e=0;else{if(!isFinite(e))throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var n,s,o,a,h,l,c,u,f,d,g=this.length-e;if((void 0===i||i>g)&&(i=g),t.length>0&&(i<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var p=!1;;)switch(r){case"hex":return function(t,e,i,r){i=Number(i)||0;var n=t.length-i;r?(r=Number(r))>n&&(r=n):r=n;var s=e.length;if(s%2!=0)throw TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var a=parseInt(e.substr(2*o,2),16);if(isNaN(a))break;t[i+o]=a}return o}(this,t,e,i);case"utf8":case"utf-8":return h=e,l=i,W(R(t,this.length-h),this,h,l);case"ascii":case"latin1":case"binary":return n=this,s=t,o=e,a=i,W(function(t){for(var e=[],i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}(s),n,o,a);case"base64":return c=e,u=i,W(B(t),this,c,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f=e,d=i,W(function(t,e){for(var i,r,n=[],s=0;s<t.length&&!((e-=2)<0);++s)r=(i=t.charCodeAt(s))>>8,n.push(i%256),n.push(r);return n}(t,this.length-f),this,f,d);default:if(p)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),p=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function P(t,e,i){if(t%1!=0||t<0)throw RangeError("offset is not uint");if(t+e>i)throw RangeError("Trying to access beyond buffer length")}function A(t,e,i,r,n,s){if(!x(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw RangeError('"value" argument is out of bounds');if(i+r>t.length)throw RangeError("Index out of range")}function j(t,e,i,r){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-i,2);n<s;++n)t[i+n]=(e&255<<8*(r?n:1-n))>>>8*(r?n:1-n)}function D(t,e,i,r){e<0&&(e=0xffffffff+e+1);for(var n=0,s=Math.min(t.length-i,4);n<s;++n)t[i+n]=e>>>8*(r?n:3-n)&255}function M(t,e,i,r,n,s){if(i+r>t.length||i<0)throw RangeError("Index out of range")}function I(t,e,i,r,n){return n||M(t,0,i,4),c(t,e,i,r,23,4),i+4}function F(t,e,i,r,n){return n||M(t,0,i,8),c(t,e,i,r,52,8),i+8}p.prototype.slice=function(t,e){var i,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),p.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,e)).__proto__=p.prototype;else{var n=e-t;i=new p(n,void 0);for(var s=0;s<n;++s)i[s]=this[s+t]}return i},p.prototype.readUIntLE=function(t,e,i){t|=0,e|=0,i||P(t,e,this.length);for(var r=this[t],n=1,s=0;++s<e&&(n*=256);)r+=this[t+s]*n;return r},p.prototype.readUIntBE=function(t,e,i){t|=0,e|=0,i||P(t,e,this.length);for(var r=this[t+--e],n=1;e>0&&(n*=256);)r+=this[t+--e]*n;return r},p.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},p.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},p.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},p.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+0x1000000*this[t+3]},p.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),0x1000000*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])}
vendor: 4,105 bytes, line 1
1,p.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||P(t,e,this.length);for(var r=this[t],n=1,s=0;++s<e&&(n*=256);)r+=this[t+s]*n;return r>=(n*=128)&&(r-=Math.pow(2,8*e)),r},p.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||P(t,e,this.length);for(var r=e,n=1,s=this[t+--r];r>0&&(n*=256);)s+=this[t+--r]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},p.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},p.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?0xffff0000|i:i},p.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?0xffff0000|i:i},p.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},p.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},p.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),l(this,t,!0,23,4)},p.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),l(this,t,!1,23,4)},p.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),l(this,t,!0,52,8)},p.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),l(this,t,!1,52,8)},p.prototype.writeUIntLE=function(t,e,i,r){t*=1,e|=0,i|=0,r||A(this,t,e,i,Math.pow(2,8*i)-1,0);var n=1,s=0;for(this[e]=255&t;++s<i&&(n*=256);)this[e+s]=t/n&255;return e+i},p.prototype.writeUIntBE=function(t,e,i,r){t*=1,e|=0,i|=0,r||A(this,t,e,i,Math.pow(2,8*i)-1,0);var n=i-1,s=1;for(this[e+n]=255&t;--n>=0&&(s*=256);)this[e+n]=t/s&255;return e+i},p.prototype.writeUInt8=function(t,e,i){return t*=1,e|=0,i||A(this,t,e,1,255,0),p.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},p.prototype.writeUInt16LE=function(t,e,i){return t*=1,e|=0,i||A(this,t,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},p.prototype.writeUInt16BE=function(t,e,i){return t*=1,e|=0,i||A(this,t,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},p.prototype.writeUInt32LE=function(t,e,i){return t*=1,e|=0,i||A(this,t,e,4,0xffffffff,0),p.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},p.prototype.writeUInt32BE=function(t,e,i){return t*=1,e|=0,i||A(this,t,e,4,0xffffffff,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},p.prototype.writeIntLE=function(t,e,i,r){if(t*=1,e|=0,!r){var n=Math.pow(2,8*i-1);A(this,t,e,i,n-1,-n)}var s=0,o=1,a=0;for(this[e]=255&t;++s<i&&(o*=256);)t<0&&0===a&&0!==this[e+s-1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+i},p.prototype.writeIntBE=function(t,e,i,r){if(t*=1,e|=0,!r){var n=Math.pow(2,8*i-1);A(this,t,e,i,n-1,-n)}var s=i-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+i},p.prototype.writeInt8=function(t,e,i){return t*=1,e|=0,i||A(this,t,e,1,127,-128),p.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},p.prototype.writeInt16LE=function(t,e,i){return t*=1,e|=0,i||A(this,t,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},p.prototype.writeInt16BE=function(t,e,i){return t*=1,e|=0,i||A(this,t,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},p.prototype.writeInt32LE=function(t,e,i){return t*=1,e|=0,i||A(this,t,e,4,0x7fffffff,-0x80000000),p.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},p.prototype.writeInt32BE=function(t,e,i){return t*=1,e|=0,i||A(this,t,e,4,0x7fffffff,-0x80000000),t<0&&(t=0xffffffff+t+1),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},p.prototype.writeFloatLE=function(t,e,i){return I(this,t,e,!0,i)},p.prototype.writeFloatBE=function(t,e,i){return I(this,t,e,!1,i)},p.prototype.writeDoubleLE=function(t,e,i){return F(this,t,e,!0,i)},p.prototype.writeDoubleBE=function(t,e,i){return F(this,t,e,!1,i)}
1,p.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<i&&(r=i),r===i||0===t.length||0===this.length)return 0;if(e<0)throw RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw RangeError("sourceStart out of bounds");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-i&&(r=t.length-e+i);var n,s=r-i;if(this===t&&i<e&&e<r)for(n=s-1;n>=0;--n)t[n+e]=this[n+i];else if(s<1e3||!p.TYPED_ARRAY_SUPPORT)for(n=0;n<s;++n)t[n+e]=this[n+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+s),e);return s},p.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===t.length){var n,s=t.charCodeAt(0);s<256&&(t=s)}if(void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!p.isEncoding(r))throw TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<i)throw RangeError("Out of range index");if(i<=e)return this;if(e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(n=e;n<i;++n)this[n]=t;else{var o=x(t)?t:R(new p(t,r).toString()),a=o.length;for(n=0;n<i-e;++n)this[n+e]=o[n%a]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function R(t,e){var i;e=e||1/0;for(var r=t.length,n=null,s=[],o=0;o<r;++o){if((i=t.charCodeAt(o))>
155295&&i<57344){if(!n){if(i>56319||o+1===r){(e-=3)>-1&&s.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&s.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;s.push(i)}else if(i<2048){if((e-=2)<0)break;s.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;s.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw Error("Invalid code point");if((e-=4)<0)break;s.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return s}function B(t){return function(t){o||a();var e,i,r,h,l,c,u=t.length;if(u%4>0)throw Error("Invalid string. Length must be a multiple of 4");l="="===t[u-2]?2:+("="===t[u-1]),c=new s(3*u/4-l),r=l>0?u-4:u;var f=0;for(e=0,i=0;e<r;e+=4,i+=3)h=n[t.charCodeAt(e)]<<18|n[t.charCodeAt(e+1)]<<12|n[t.charCodeAt(e+2)]<<6|n[t.charCodeAt(e+3)],c[f++]=h>>16&255,c[f++]=h>>8&255,c[f++]=255&h;return 2===l?(h=n[t.charCodeAt(e)]<<2|n[t.charCodeAt(e+1)]>>4,c[f++]=255&h):1===l&&(h=n[t.charCodeAt(e)]<<10|n[t.charCodeAt(e+1)]<<4|n[t.charCodeAt(e+2)]>>2,c[f++]=h>>8&255,c[f++]=255&h),c}(function(t){var e;if((t=((e=t).trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function W(t,e,i,r){for(var n=0;n<r&&!(n+i>=e.length||n>=t.length);++n)e[n+i]=t[n];return n}function z(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var H={},Y={},X=function(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach(function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}),e}(function(t,e){return e.forEach(function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach(function(i){if("default"!==i&&!(i in t)){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}})}),Object.freeze(t)}({__proto__:null,default:Y},[Y]));!function(t){/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */var e,i,r,n,s,o,a,h,l,c,u,f,d,g,m,v,y,_,b,x,C,S,w,T,O,k,E,P,A,j,D,M,I,F,L,R,B,W,z,H,Y,U,N,V,G,q,K,J,Z,$,Q,tt,te,ti,tr,tn,ts,to,ta,th,tl,tc,tu,tf,td,tg,tp,tm,tv,ty,t_,tb,tx,tC,tS,tw,tT,tO,tk,tE,tP,tA,tj,tD,tM,tI,tF,tL,tR,tB,tW,tz,tH,tY,tX,tU,tN,tV,tG,tq,tK,tJ,tZ,t$,tQ,t0,t1,t2,t5,t3,t4,t6,t8,t9,t7,et,ee,ei,er,en,es,eo,ea,eh,el,ec,eu,ef,ed,eg,ep,em,ev=ev||{version:"5.3.0"};if(t.fabric=ev,"undefined"!=typeof document&&"undefined"!=typeof window)document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?ev.document=document:ev.document=document.implementation.createHTMLDocument(""),ev.window=window;else{var ey=new X.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;ev.document=ey.document,ev.jsdomImplForWrapper=X.implForWrapper,ev.nodeCanvas=X.Canvas,ev.window=ey,DOMParser=ev.window.DOMParser}function e_(t,e){var i=t.canvas,r=e.targetCanvas,n=r.getContext("2d");n.translate(0,r.height),n.scale(1,-1);var s=i.height-r.height;n.drawImage(i,0,s,r.width,r.height,0,0,r.width,r.height)}function eb(t,e){var i=e.targetCanvas.getContext("2d"),r=e.destinationWidth,n=e.destinationHeight,s=r*n*4,o=new Uint8Array(this.imageBuffer,0,s),a=new Uint8ClampedArray(this.imageBuffer,0,s);t.readPixels(0,0,r,n,t.RGBA,t.UNSIGNED_BYTE,o);var h=new ImageData(a,r,n);i.putImageData(h,0,0)}ev.isTouchSupported="ontouchstart"in ev.window||"ontouchstart"in ev.document||ev.window&&ev.window.navigator&&ev.window.navigator.maxTouchPoints>0,ev.isLikelyNode=void 0!==p&&"undefined"==typeof window,ev.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"],ev.DPI=96,ev.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",ev.commaWsp="(?:\\s+,?\\s*|,\\s*)",ev.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ev.reNonWord=/[ \n\.,;!\?\-]/,ev.fontPaths={},ev.iMatrix=[1,0,0,1,0,0],ev.svgNS="http://www.w3.org/2000/svg",ev.perfLimitSizeTotal=2097152,ev.maxCacheSideLimit=4096,ev.minCacheSideLimit=256,ev.charWidthsCache={},ev.textureSize=2048,ev.disableStyleCopyPaste=!1,ev.enableGLFiltering=!0,ev.devicePixelRatio=ev.window.devicePixelRatio||ev.window.webkitDevicePixelRatio||ev.window.mozDevicePixelRatio||1,ev.browserShadowBlurConstant=1,ev.arcToSegmentsCache={},ev.boundsOfCurveCache={}
vendor: 12,309 bytes, line 1
1,ev.cachesBoundsOfCurve=!0,ev.forceGLPutImageData=!1,ev.initFilterBackend=function(){return ev.enableGLFiltering&&ev.isWebglSupported&&ev.isWebglSupported(ev.textureSize)?(console.log("max texture size: "+ev.maxTextureSize),new ev.WebglFilterBackend({tileSize:ev.textureSize})):ev.Canvas2dFilterBackend?new ev.Canvas2dFilterBackend:void 0},"undefined"!=typeof document&&"undefined"!=typeof window&&(window.fabric=ev),function(){function t(t,e){if(this.__eventListeners[t]){var i=this.__eventListeners[t];e?i[i.indexOf(e)]=!1:ev.util.array.fill(i,!1)}}function e(t,e){var i=(function(){e.apply(this,arguments),this.off(t,i)}).bind(this);this.on(t,i)}ev.Observable={fire:function(t,e){if(!this.__eventListeners)return this;var i=this.__eventListeners[t];if(!i)return this;for(var r=0,n=i.length;r<n;r++)i[r]&&i[r].call(this,e||{});return this.__eventListeners[t]=i.filter(function(t){return!1!==t}),this},on:function(t,e){if(this.__eventListeners||(this.__eventListeners={}),1==arguments.length)for(var i in t)this.on(i,t[i]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this},once:function(t,i){if(1==arguments.length)for(var r in t)e.call(this,r,t[r]);else e.call(this,t,i);return this},off:function(e,i){if(!this.__eventListeners)return this;if(0==arguments.length)for(e in this.__eventListeners)t.call(this,e);else if(1==arguments.length&&"object"==typeof arguments[0])for(var r in e)t.call(this,r,e[r]);else t.call(this,e,i);return this}}}(),ev.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var t=0,e=arguments.length;t<e;t++)this._onObjectAdded(arguments[t]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(t,e,i){var r=this._objects;return i?r[e]=t:r.splice(e,0,t),this._onObjectAdded&&this._onObjectAdded(t),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var t,e=this._objects,i=!1,r=0,n=arguments.length;r<n;r++)-1!==(t=e.indexOf(arguments[r]))&&(i=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[r]));return this.renderOnAddRemove&&i&&this.requestRenderAll(),this},forEachObject:function(t,e){for(var i=this.getObjects(),r=0,n=i.length;r<n;r++)t.call(e,i[r],r,i);return this},getObjects:function(t){return void 0===t?this._objects.concat():this._objects.filter(function(e){return e.type===t})},item:function(t){return this._objects[t]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(t,e){return this._objects.indexOf(t)>-1||!!e&&this._objects.some(function(e){return"function"==typeof e.contains&&e.contains(t,!0)})},complexity:function(){return this._objects.reduce(function(t,e){return t+(e.complexity?e.complexity():0)},0)}},ev.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof ev.Gradient||this.set(e,new ev.Gradient(t))},_initPattern:function(t,e,i){!t||!t.source||t instanceof ev.Pattern?i&&i():this.set(e,new ev.Pattern(t,i))},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):this._set(t,e),this},_set:function(t,e){this[t]=e},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},get:function(t){return this[t]}},t8=Math.sqrt,t9=Math.atan2,t7=Math.pow,et=Math.PI/180,ee=Math.PI/2,ev.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/ee){case 1:case 3:return 0;case 2:return -1}return Math.cos(t)},sin:function(t){if(0===t)return 0;var e=1;switch(t<0&&(e=-1),t/ee){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)},removeFromArray:function(t,e){var i=t.indexOf(e);return -1!==i&&t.splice(i,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*et},radiansToDegrees:function(t){return t/et},rotatePoint:function(t,e,i){var r=new ev.Point(t.x-e.x,t.y-e.y),n=ev.util.rotateVector(r,i);return new ev.Point(n.x,n.y).addEquals(e)},rotateVector:function(t,e){var i=ev.util.sin(e),r=ev.util.cos(e);return{x:t.x*r-t.y*i,y:t.x*i+t.y*r}},createVector:function(t,e){return new ev.Point(e.x-t.x,e.y-t.y)},calcAngleBetweenVectors:function(t,e){return Math.acos((t.x*e.x+t.y*e.y)/(Math.hypot(t.x,t.y)*Math.hypot(e.x,e.y)))},getHatVector:function(t){return new ev.Point(t.x,t.y).multiply(1/Math.hypot(t.x,t.y))},getBisector:function(t,e,i){var r=ev.util.createVector(t,e),n=ev.util.createVector(t,i),s=ev.util.calcAngleBetweenVectors(r,n),o=s*(0===ev.util.calcAngleBetweenVectors(ev.util.rotateVector(r,s),n)?1:-1)/2;return{vector:ev.util.getHatVector(ev.util.rotateVector(r,o)),angle:s}},projectStrokeOnPoints:function(t,e,i){var r=[],n=e.strokeWidth/2,s=e.strokeUniform?new ev.Point(1/e.scaleX,1/e.scaleY):new ev.Point(1,1),o=function(t){var e=n/Math.hypot(t.x,t.y);return new ev.Point(t.x*e*s.x,t.y*e*s.y)};return t.length<=1||t.forEach(function(a,h){var l,c,u=new ev.Point(a.x,a.y);0===h?(c=t[h+1],l=i?o(ev.util.createVector(c,u)).addEquals(u):t[t.length-1]):h===t.length-1?(l=t[h-1],c=i?o(ev.util.createVector(l,u)).addEquals(u):t[0]):(l=t[h-1],c=t[h+1]);var f,d,g=ev.util.getBisector(u,l,c),p=g.vector,m=g.angle;if("miter"===e.strokeLineJoin&&(f=-n/Math.sin(m/2),Math.hypot((d=new ev.Point(p.x*f*s.x,p.y*f*s.y)).x,d.y)/n<=e.strokeMiterLimit))return r.push(u.add(d)),void r.push(u.subtract(d));f=-n*Math.SQRT2,d=new ev.Point(p.x*f*s.x,p.y*f*s.y),r.push(u.add(d)),r.push(u.subtract(d))}),r},transformPoint:function(t,e,i){return i?new ev.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new ev.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t,e){if(e)for(var i=0;i<t.length;i++)t[i]=ev.util.transformPoint(t[i],e);var r=[t[0].x,t[1].x,t[2].x,t[3].x],n=ev.util.array.min(r),s=ev.util.array.max(r)-n,o=[t[0].y,t[1].y,t[2].y,t[3].y],a=ev.util.array.min(o);return{left:n,top:a,width:s,height:ev.util.array.max(o)-a}},invertTransform:function(t){var e=1/(t[0]*t[3]-t[1]*t[2]),i=[e*t[3],-e*t[1],-e*t[2],e*t[0]],r=ev.util.transformPoint({x:t[4],y:t[5]},i,!0);return i[4]=-r.x,i[5]=-r.y,i},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t,e){var i=/\D{0,2}$/.exec(t),r=parseFloat(t);switch(e||(e=ev.Text.DEFAULT_SVG_FONT_SIZE),i[0]){case"mm":return r*ev.DPI/25.4;case"cm":return r*ev.DPI/2.54;case"in":return r*ev.DPI;case"pt":return r*ev.DPI/72;case"pc":return r*ev.DPI/72*12;case"em":return r*e;default:return r}},falseFunction:function(){return!1},getKlass:function(t,e){return t=ev.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),ev.util.resolveNamespace(e)[t]},getSvgAttributes:function(t){var e=["instantiated_by_use","style","id","class"];switch(t){case"linearGradient":e=e.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":e=e.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":e=e.concat(["offset","stop-color","stop-opacity"])}return e},resolveNamespace:function(e){if(!e)return ev;var i,r=e.split("."),n=r.length,s=t||ev.window;for(i=0;i<n;++i)s=s[r[i]];return s},loadImage:function(t,e,i,r){if(t){var n=ev.util.createImage(),s=function(){e&&e.call(i,n,!1),n=n.onload=n.onerror=null};n.onload=s,n.onerror=function(){ev.log("Error loading "+n.src),e&&e.call(i,null,!0),n=n.onload=n.onerror=null},0!==t.indexOf("data")&&null!=r&&(n.crossOrigin=r),"data:image/svg"===t.substring(0,14)&&(n.onload=null,ev.util.loadImageInDom(n,s)),n.src=t}else e&&e.call(i,t)},loadImageInDom:function(t,e){var i=ev.document.createElement("div");i.style.width=i.style.height="1px",i.style.left=i.style.top="-100%",i.style.position="absolute",i.appendChild(t),ev.document.querySelector("body").appendChild(i),t.onload=function(){e(),i.parentNode.removeChild(i),i=null}},enlivenObjects:function(t,e,i,r){var n=[],s=0,o=(t=t||[]).length;function a(){++s===o&&e&&e(n.filter(function(t){return t}))}o?t.forEach(function(t,e){t&&t.type?ev.util.getKlass(t.type,i).fromObject(t,function(i,s){s||(n[e]=i),r&&r(t,i,s),a()}):a()}):e&&e(n)},enlivenObjectEnlivables:function(t,e,i){var r=ev.Object.ENLIVEN_PROPS.filter(function(e){return!!t[e]});ev.util.enlivenObjects(r.map(function(e){return t[e]}),function(t){var n={};r.forEach(function(i,r){n[i]=t[r],e&&(e[i]=t[r])}),i&&i(n)})},enlivenPatterns:function(t,e){function i(){++n===s&&e&&e(r)}var r=[],n=0,s=(t=t||[]).length;s?t.forEach(function(t,e){t&&t.source?new ev.Pattern(t,function(t){r[e]=t,i()}):(r[e]=t,i())}):e&&e(r)},groupSVGElements:function(t,e,i){var r;return t&&1===t.length?(void 0!==i&&(t[0].sourcePath=i),t[0]):(e&&(e.width&&e.height?e.centerPoint={x:e.width/2,y:e.height/2}:(delete e.width,delete e.height)),r=new ev.Group(t,e),void 0!==i&&(r.sourcePath=i),r)},populateWithProperties:function(t,e,i){if(i&&Array.isArray(i))for(var r=0,n=i.length;r<n;r++)i[r]in t&&(e[i[r]]=t[i[r]])},createCanvasElement:function(){return ev.document.createElement("canvas")},copyCanvasElement:function(t){var e=ev.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e},toDataURL:function(t,e,i){return t.toDataURL("image/"+e,i)},createImage:function(){return ev.document.createElement("img")},multiplyTransformMatrices:function(t,e,i){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],i?0:t[0]*e[4]+t[2]*e[5]+t[4],i?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var e=t9(t[1],t[0]),i=t7(t[0],2)+t7(t[1],2),r=t8(i),n=(t[0]*t[3]-t[2]*t[1])/r;return{angle:e/et,scaleX:r,scaleY:n,skewX:t9(t[0]*t[2]+t[1]*t[3],i)/et,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return ev.iMatrix.concat();var e=ev.util.degreesToRadians(t.angle),i=ev.util.cos(e),r=ev.util.sin(e);return[i,r,-r,i,0,0]},calcDimensionsMatrix:function(t){var e=void 0===t.scaleX?1:t.scaleX,i=void 0===t.scaleY?1:t.scaleY,r=[t.flipX?-e:e,0,0,t.flipY?-i:i,0,0],n=ev.util.multiplyTransformMatrices,s=ev.util.degreesToRadians;return t.skewX&&(r=n(r,[1,0,Math.tan(s(t.skewX)),1],!0)),t.skewY&&(r=n(r,[1,Math.tan(s(t.skewY)),0,1],!0)),r},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],i=ev.util.multiplyTransformMatrices;return t.angle&&(e=i(e,ev.util.calcRotateMatrix(t))),(1!==t.scaleX||1!==t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=i(e,ev.util.calcDimensionsMatrix(t))),e},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},saveObjectTransform:function(t){return{scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}},isTransparent:function(t,e,i,r){r>0&&(e>r?e-=r:e=0,i>r?i-=r:i=0);var n,s=!0,o=t.getImageData(e,i,2*r||1,2*r||1),a=o.data.length;for(n=3;n<a&&!1!=(s=o.data[n]<=0);n+=4);return o=null,s},parsePreserveAspectRatioAttribute:function(t){var e,i="meet",r=t.split(" ");return r&&r.length&&("meet"!==(i=r.pop())&&"slice"!==i?(e=i,i="meet"):r.length&&(e=r.pop())),{meetOrSlice:i,alignX:"none"!==e?e.slice(1,4):"none",alignY:"none"!==e?e.slice(5,8):"none"}},clearFabricFontCache:function(t){(t=(t||"").toLowerCase())?ev.charWidthsCache[t]&&delete ev.charWidthsCache[t]:ev.charWidthsCache={}},limitDimsByArea:function(t,e){var i=Math.sqrt(e*t),r=Math.floor(e/i);return{x:Math.floor(i),y:r}},capValue:function(t,e,i){return Math.max(t,Math.min(e,i))},findScaleToFit:function(t,e){return Math.min(e.width/t.width,e.height/t.height)},findScaleToCover:function(t,e){return Math.max(e.width/t.width,e.height/t.height)},matrixToSVG:function(t){return"matrix("+t.map(function(t){return ev.util.toFixed(t,ev.Object.NUM_FRACTION_DIGITS)}).join(" ")+")"},removeTransformFromObject:function(t,e){var i=ev.util.invertTransform(e),r=ev.util.multiplyTransformMatrices(i,t.calcOwnMatrix());ev.util.applyTransformToObject(t,r)},addTransformToObject:function(t,e){ev.util.applyTransformToObject(t,ev.util.multiplyTransformMatrices(e,t.calcOwnMatrix()))},applyTransformToObject:function(t,e){var i=ev.util.qrDecompose(e),r=new ev.Point(i.translateX,i.translateY);t.flipX=!1,t.flipY=!1,t.set("scaleX",i.scaleX),t.set("scaleY",i.scaleY),t.skewX=i.skewX,t.skewY=i.skewY,t.angle=i.angle,t.setPositionByOrigin(r,"center","center")}
1,sizeAfterTransform:function(t,e,i){var r=t/2,n=e/2,s=ev.util.calcDimensionsMatrix(i),o=ev.util.makeBoundingBoxFromPoints([{x:-r,y:-n},{x:r,y:-n},{x:-r,y:n},{x:r,y:n}],s);return{x:o.width,y:o.height}},mergeClipPaths:function(t,e){var i=t,r=e;i.inverted&&!r.inverted&&(i=e,r=t),ev.util.applyTransformToObject(r,ev.util.multiplyTransformMatrices(ev.util.invertTransform(i.calcTransformMatrix()),r.calcTransformMatrix()));var n=i.inverted&&r.inverted;return n&&(i.inverted=r.inverted=!1),new ev.Group([i],{clipPath:r,inverted:n})},hasStyleChanged:function(t,e,i){return i=i||!1,t.fill!==e.fill||t.stroke!==e.stroke||t.strokeWidth!==e.strokeWidth||t.fontSize!==e.fontSize||t.fontFamily!==e.fontFamily||t.fontWeight!==e.fontWeight||t.fontStyle!==e.fontStyle||t.textBackgroundColor!==e.textBackgroundColor||t.deltaY!==e.deltaY||i&&(t.overline!==e.overline||t.underline!==e.underline||t.linethrough!==e.linethrough)},stylesToArray:function(t,e){t=ev.util.object.clone(t,!0);for(var i=e.split("\n"),r=-1,n={},s=[],o=0;o<i.length;o++)if(t[o])for(var a=0;a<i[o].length;a++){r++;var h=t[o][a];h&&Object.keys(h).length>0&&(ev.util.hasStyleChanged(n,h,!0)?s.push({start:r,end:r+1,style:h}):s[s.length-1].end++),n=h||{}}else r+=i[o].length;return s},stylesFromArray:function(t,e){if(!Array.isArray(t))return t;for(var i=e.split("\n"),r=-1,n=0,s={},o=0;o<i.length;o++)for(var a=0;a<i[o].length;a++)r++,t[n]&&t[n].start<=r&&r<t[n].end&&(s[o]=s[o]||{},s[o][a]=Object.assign({},t[n].style),r===t[n].end-1&&n++);return s}},function(){var t=Array.prototype.join,e={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},i={m:"l",M:"L"};function r(t,e,i,r){var n=Math.atan2(e,t),s=Math.atan2(r,i);return s>=n?s-n:2*Math.PI-(n-s)}function n(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}function s(t,e,i){var r,s,o={x:e,y:i},a=0;for(s=1;s<=100;s+=1)r=t(s/100),a+=n(o.x,o.y,r.x,r.y),o=r;return a}function o(t){for(var e,i,r,o,a=0,h=t.length,l=0,c=0,u=0,f=0,d=[],g=0;g<h;g++){switch(r={x:l,y:c,command:(e=t[g])[0]},e[0]){case"M":r.length=0,u=l=e[1],f=c=e[2];break;case"L":r.length=n(l,c,e[1],e[2]),l=e[1],c=e[2];break;case"C":i=function(t,e,i,r,n,s,o,a){return function(h){var l=h*h*h,c=3*h*h*(1-h),u=3*h*(1-h)*(1-h),f=(1-h)*(1-h)*(1-h);return{x:o*l+n*c+i*u+t*f,y:a*l+s*c+r*u+e*f}}}(l,c,e[1],e[2],e[3],e[4],e[5],e[6]),o=function(t,e,i,r,n,s,o,a){return function(h){var l=1-h;return Math.atan2(3*l*l*(r-e)+6*l*h*(s-r)+3*h*h*(a-s),3*l*l*(i-t)+6*l*h*(n-i)+3*h*h*(o-n))}}(l,c,e[1],e[2],e[3],e[4],e[5],e[6]),r.iterator=i,r.angleFinder=o,r.length=s(i,l,c),l=e[5],c=e[6];break;case"Q":i=function(t,e,i,r,n,s){return function(o){var a=o*o,h=2*o*(1-o),l=(1-o)*(1-o);return{x:n*a+i*h+t*l,y:s*a+r*h+e*l}}}(l,c,e[1],e[2],e[3],e[4]),o=function(t,e,i,r,n,s){return function(o){var a=1-o;return Math.atan2(2*a*(r-e)+2*o*(s-r),2*a*(i-t)+2*o*(n-i))}}(l,c,e[1],e[2],e[3],e[4]),r.iterator=i,r.angleFinder=o,r.length=s(i,l,c),l=e[3],c=e[4];break;case"Z":case"z":r.destX=u,r.destY=f,r.length=n(l,c,u,f),l=u,c=f}a+=r.length,d.push(r)}return d.push({length:a,x:l,y:c}),d}ev.util.joinPath=function(t){return t.map(function(t){return t.join(" ")}).join(" ")},ev.util.parsePath=function(t){var r,n,s,o,a,h=[],l=[],c=ev.rePathCommand,u="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",f="("+u+")"+ev.commaWsp,d="([01])"+ev.commaWsp+"?",g=RegExp(f+"?"+f+"?"+f+d+d+f+"?("+u+")","g");if(!t||!t.match)return h;for(var p,m=0,v=(a=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;m<v;m++){o=(r=a[m]).slice(1).trim(),l.length=0;var y,_=r.charAt(0);if(p=[_],"a"===_.toLowerCase())for(;y=g.exec(o);)for(var b=1;b<y.length;b++)l.push(y[b]);else for(;s=c.exec(o);)l.push(s[0]);b=0;for(var x=l.length;b<x;b++)isNaN(n=parseFloat(l[b]))||p.push(n);var C=e[_.toLowerCase()],S=i[_]||_;if(p.length-1>C)for(var w=1,T=p.length;w<T;w+=C)h.push([_].concat(p.slice(w,w+C))),_=S;else h.push(p)}return h},ev.util.makePathSimpler=function(t){var e,i,n,s,o,a,h=0,l=0,c=t.length,u=0,f=0,d=[];for(i=0;i<c;++i){switch(n=!1,(e=t[i].slice(0))[0]){case"l":e[0]="L",e[1]+=h,e[2]+=l;case"L":h=e[1],l=e[2];break;case"h":e[1]+=h;case"H":e[0]="L",e[2]=l,h=e[1];break;case"v":e[1]+=l;case"V":e[0]="L",l=e[1],e[1]=h,e[2]=l;break;case"m":e[0]="M",e[1]+=h,e[2]+=l;case"M":h=e[1],l=e[2],u=e[1],f=e[2];break;case"c":e[0]="C",e[1]+=h,e[2]+=l,e[3]+=h,e[4]+=l,e[5]+=h,e[6]+=l;case"C":o=e[3],a=e[4],h=e[5],l=e[6];break;case"s":e[0]="S",e[1]+=h,e[2]+=l,e[3]+=h,e[4]+=l;case"S":"C"===s?(o=2*h-o,a=2*l-a):(o=h,a=l),h=e[3],l=e[4],e[0]="C",e[5]=e[3],e[6]=e[4],e[3]=e[1],e[4]=e[2],e[1]=o,e[2]=a,o=e[3],a=e[4];break;case"q":e[0]="Q",e[1]+=h,e[2]+=l,e[3]+=h,e[4]+=l;case"Q":o=e[1],a=e[2],h=e[3],l=e[4];break;case"t":e[0]="T",e[1]+=h,e[2]+=l;case"T":"Q"===s?(o=2*h-o,a=2*l-a):(o=h,a=l),e[0]="Q",h=e[1],l=e[2],e[1]=o,e[2]=a,e[3]=h,e[4]=l;break;case"a":e[0]="A",e[6]+=h,e[7]+=l;
vendor: 15,262 bytes, line 1
1case"A":n=!0,d=d.concat(function(t,e,i){for(var n=i[1],s=i[2],o=i[3],a=i[4],h=i[5],l=function(t,e,i,n,s,o,a){var h=Math.PI,l=a*h/180,c=ev.util.sin(l),u=ev.util.cos(l),f=0,d=0,g=-u*t*.5-c*e*.5,p=-u*e*.5+c*t*.5,m=(i=Math.abs(i))*i,v=(n=Math.abs(n))*n,y=p*p,_=g*g,b=m*v-m*y-v*_,x=0;if(b<0){var C=Math.sqrt(1-b/(m*v));i*=C,n*=C}else x=(s===o?-1:1)*Math.sqrt(b/(m*y+v*_));var S=x*i*p/n,w=-x*n*g/i,T=u*S-c*w+.5*t,O=c*S+u*w+.5*e,k=r(1,0,(g-S)/i,(p-w)/n),E=r((g-S)/i,(p-w)/n,(-g-S)/i,(-p-w)/n);0===o&&E>0?E-=2*h:1===o&&E<0&&(E+=2*h);for(var P=Math.ceil(Math.abs(E/h*2)),A=[],j=E/P,D=8/3*Math.sin(j/4)*Math.sin(j/4)/Math.sin(j/2),M=k+j,I=0;I<P;I++)A[I]=function(t,e,i,r,n,s,o,a,h,l,c){var u=ev.util.cos(t),f=ev.util.sin(t),d=ev.util.cos(e),g=ev.util.sin(e),p=i*n*d-r*s*g+o,m=r*n*d+i*s*g+a;return["C",l+h*(-i*n*f-r*s*u),c+h*(-r*n*f+i*s*u),p+h*(i*n*g+r*s*d),m+h*(r*n*g-i*s*d),p,m]}(k,M,u,c,i,n,T,O,D,f,d),f=A[I][5],d=A[I][6],k=M,M+=j;return A}(i[6]-t,i[7]-e,n,s,a,h,o),c=0,u=l.length;c<u;c++)l[c][1]+=t,l[c][2]+=e,l[c][3]+=t,l[c][4]+=e,l[c][5]+=t,l[c][6]+=e;return l}(h,l,e)),h=e[6],l=e[7];break;case"z":case"Z":h=u,l=f}n||d.push(e),s=e[0]}return d},ev.util.getSmoothPathFromPoints=function(t,e){var i,r=[],n=new ev.Point(t[0].x,t[0].y),s=new ev.Point(t[1].x,t[1].y),o=t.length,a=1,h=0,l=o>2;for(e=e||0,l&&(a=t[2].x<s.x?-1:+(t[2].x!==s.x),h=t[2].y<s.y?-1:+(t[2].y!==s.y)),r.push(["M",n.x-a*e,n.y-h*e]),i=1;i<o;i++){if(!n.eq(s)){var c=n.midPointFrom(s);r.push(["Q",n.x,n.y,c.x,c.y])}n=t[i],i+1<t.length&&(s=t[i+1])}return l&&(a=n.x>t[i-2].x?1:n.x===t[i-2].x?0:-1,h=n.y>t[i-2].y?1:n.y===t[i-2].y?0:-1),r.push(["L",n.x+a*e,n.y+h*e]),r},ev.util.getPathSegmentsInfo=o,ev.util.getBoundsOfCurve=function(e,i,r,n,s,o,a,h){if(ev.cachesBoundsOfCurve&&(l=t.call(arguments),ev.boundsOfCurveCache[l]))return ev.boundsOfCurveCache[l];var l,c,u,f,d,g,p,m,v,y=Math.sqrt,_=Math.min,b=Math.max,x=Math.abs,C=[],S=[[],[]];u=6*e-12*r+6*s,c=-3*e+9*r-9*s+3*a,f=3*r-3*e;for(var w=0;w<2;++w)if(w>0&&(u=6*i-12*n+6*o,c=-3*i+9*n-9*o+3*h,f=3*n-3*i),1e-12>x(c)){if(1e-12>x(u))continue;0<(d=-f/u)&&d<1&&C.push(d)}else(m=u*u-4*f*c)<0||(0<(g=(-u+(v=y(m)))/(2*c))&&g<1&&C.push(g),0<(p=(-u-v)/(2*c))&&p<1&&C.push(p));for(var T,O,k,E=C.length,P=E;E--;)T=(k=1-(d=C[E]))*k*k*e+3*k*k*d*r+3*k*d*d*s+d*d*d*a,S[0][E]=T,O=k*k*k*i+3*k*k*d*n+3*k*d*d*o+d*d*d*h,S[1][E]=O;S[0][P]=e,S[1][P]=i,S[0][P+1]=a,S[1][P+1]=h;var A=[{x:_.apply(null,S[0]),y:_.apply(null,S[1])},{x:b.apply(null,S[0]),y:b.apply(null,S[1])}];return ev.cachesBoundsOfCurve&&(ev.boundsOfCurveCache[l]=A),A},ev.util.getPointOnPath=function(t,e,i){i||(i=o(t));for(var r=0;e-i[r].length>0&&r<i.length-2;)e-=i[r].length,r++;var s,a=i[r],h=e/a.length,l=a.command,c=t[r];switch(l){case"M":return{x:a.x,y:a.y,angle:0};case"Z":case"z":return(s=new ev.Point(a.x,a.y).lerp(new ev.Point(a.destX,a.destY),h)).angle=Math.atan2(a.destY-a.y,a.destX-a.x),s;case"L":return(s=new ev.Point(a.x,a.y).lerp(new ev.Point(c[1],c[2]),h)).angle=Math.atan2(c[2]-a.y,c[1]-a.x),s;case"C":case"Q":return function(t,e){for(var i,r,s,o=0,a=0,h=t.iterator,l={x:t.x,y:t.y},c=.01,u=t.angleFinder;a<e&&c>1e-4;)i=h(o),s=o,(r=n(l.x,l.y,i.x,i.y))+a>e?(o-=c,c/=2):(l=i,o+=c,a+=r);return i.angle=u(s),i}(a,e)}},ev.util.transformPath=function(t,e,i){return i&&(e=ev.util.multiplyTransformMatrices(e,[1,0,0,1,-i.x,-i.y])),t.map(function(t){for(var i=t.slice(0),r={},n=1;n<t.length-1;n+=2)r.x=t[n],r.y=t[n+1],r=ev.util.transformPoint(r,e),i[n]=r.x,i[n+1]=r.y;return i})}}(),function(){var t=Array.prototype.slice;function e(t,e,i){if(t&&0!==t.length){var r=t.length-1,n=e?t[r][e]:t[r];if(e)for(;r--;)i(t[r][e],n)&&(n=t[r][e]);else for(;r--;)i(t[r],n)&&(n=t[r]);return n}}ev.util.array={fill:function(t,e){for(var i=t.length;i--;)t[i]=e;return t},invoke:function(e,i){for(var r=t.call(arguments,2),n=[],s=0,o=e.length;s<o;s++)n[s]=r.length?e[s][i].apply(e[s],r):e[s][i].call(e[s]);return n},min:function(t,i){return e(t,i,function(t,e){return t<e})},max:function(t,i){return e(t,i,function(t,e){return t>=e})}}}(),function(){function t(e,i,r){if(r){if(!ev.isLikelyNode&&i instanceof Element)e=i;else if(i instanceof Array){e=[];for(var n=0,s=i.length;n<s;n++)e[n]=t({},i[n],r)}else if(i&&"object"==typeof i)for(var o in i)"canvas"===o||"group"===o?e[o]=null:i.hasOwnProperty(o)&&(e[o]=t({},i[o],r));else e=i}else for(var o in i)e[o]=i[o];return e}ev.util.object={extend:t,clone:function(e,i){return t({},e,i)}},ev.util.object.extend(ev.util,ev.Observable)}(),ev.util.string={camelize:function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},capitalize:function(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:function(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},graphemeSplit:function(t){var e,i=0,r=[];for(i=0;i<t.length;i++)!1!==(e=function(t,e){var i=t.charCodeAt(e);if(isNaN(i))return"";if(i<55296||i>57343)return t.charAt(e);if(55296<=i&&i<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";var r=t.charCodeAt(e+1);if(56320>r||r>57343)throw"High surrogate without following low surrogate";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw"Low surrogate without preceding high surrogate";var n=t.charCodeAt(e-1);if(55296>n||n>56319)throw"Low surrogate without preceding high surrogate";return!1}(t,i))&&r.push(e);return r}},function(){var t=Array.prototype.slice,e=function(){},i=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),r=function(t,e,r){for(var n in e)n in t.prototype&&"function"==typeof t.prototype[n]&&(e[n]+"").indexOf("callSuper")>-1?t.prototype[n]=function(t){return function(){var i=this.constructor.superclass;this.constructor.superclass=r;var n=e[t].apply(this,arguments);if(this.constructor.superclass=i,"initialize"!==t)return n}}(n):t.prototype[n]=e[n],i&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};function n(){}function s(e){for(var i=null,r=this;r.constructor.superclass;){var n=r.constructor.superclass.prototype[e];if(r[e]!==n){i=n;break}r=r.constructor.superclass.prototype}return i?arguments.length>1?i.apply(this,t.call(arguments,1)):i.call(this):console.log("tried to callSuper "+e+", method not found in prototype chain",this)}ev.util.createClass=function(){var i=null,o=t.call(arguments,0);function a(){this.initialize.apply(this,arguments)}"function"==typeof o[0]&&(i=o.shift()),a.superclass=i,a.subclasses=[],i&&(n.prototype=i.prototype,a.prototype=new n,i.subclasses.push(a));for(var h=0,l=o.length;h<l;h++)r(a,o[h],i);return a.prototype.initialize||(a.prototype.initialize=e),a.prototype.constructor=a,a.prototype.callSuper=s,a}}(),ei=!!ev.document.createElement("div").attachEvent,er=["touchstart","touchmove","touchend"],ev.util.addListener=function(t,e,i,r){t&&t.addEventListener(e,i,!ei&&r)},ev.util.removeListener=function(t,e,i,r){t&&t.removeEventListener(e,i,!ei&&r)},ev.util.getPointer=function(t){var e,i=t.target,r=ev.util.getScrollLeftTop(i),n=(e=t.changedTouches)&&e[0]?e[0]:t;return{x:n.clientX+r.left,y:n.clientY+r.top}},ev.util.isTouchEvent=function(t){return er.indexOf(t.type)>-1||"touch"===t.pointerType},es="string"==typeof(en=ev.document.createElement("div")).style.opacity,eo="string"==typeof en.style.filter,ea=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,eh=function(t){return t},es?eh=function(t,e){return t.style.opacity=e,t}:eo&&(eh=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),ea.test(i.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",i.filter=i.filter.replace(ea,e)):i.filter+=" alpha(opacity="+100*e+")",t}),ev.util.setStyle=function(t,e){var i=t.style;if(!i)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?eh(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var r in e)if("opacity"===r)eh(t,e[r]);else{var n="float"===r||"cssFloat"===r?void 0===i.styleFloat?"cssFloat":"styleFloat":r;i.setProperty(n,e[r])}return t},function(){var t,e,i,r,n=Array.prototype.slice,s=function(t){return n.call(t,0)};try{t=s(ev.document.childNodes)instanceof Array}catch(t){}function o(t,e){var i=ev.document.createElement(t);for(var r in e)"class"===r?i.className=e[r]:"for"===r?i.htmlFor=e[r]:i.setAttribute(r,e[r]);return i}function a(t){for(var e=0,i=0,r=ev.document.documentElement,n=ev.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===ev.document?(e=n.scrollLeft||r.scrollLeft||0,i=n.scrollTop||r.scrollTop||0):(e+=t.scrollLeft||0,i+=t.scrollTop||0),1!==t.nodeType||"fixed"!==t.style.position););return{left:e,top:i}}t||(s=function(t){for(var e=Array(t.length),i=t.length;i--;)e[i]=t[i];return e}),e=ev.document.defaultView&&ev.document.defaultView.getComputedStyle?function(t,e){var i=ev.document.defaultView.getComputedStyle(t,null);return i?i[e]:void 0}:function(t,e){var i=t.style[e];return!i&&t.currentStyle&&(i=t.currentStyle[e]),i},r="userSelect"in(i=ev.document.documentElement.style)?"userSelect":"MozUserSelect"in i?"MozUserSelect":"WebkitUserSelect"in i?"WebkitUserSelect":"KhtmlUserSelect"in i?"KhtmlUserSelect":"",ev.util.makeElementUnselectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=ev.util.falseFunction),r?t.style[r]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},ev.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),r?t.style[r]="":"string"==typeof t.unselectable&&(t.unselectable=""),t},ev.util.setImageSmoothing=function(t,e){t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=e},ev.util.getById=function(t){return"string"==typeof t?ev.document.getElementById(t):t},ev.util.toArray=s,ev.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},ev.util.makeElement=o,ev.util.wrapElement=function(t,e,i){return"string"==typeof e&&(e=o(e,i)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},ev.util.getScrollLeftTop=a,ev.util.getElementOffset=function(t){var i,r,n=t&&t.ownerDocument,s={left:0,top:0},o={left:0,top:0},h={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!n)return o;for(var l in h)o[h[l]]+=parseInt(e(t,l),10)||0;return i=n.documentElement,void 0!==t.getBoundingClientRect&&(s=t.getBoundingClientRect()),r=a(t),{left:s.left+r.left-(i.clientLeft||0)+o.left,top:s.top+r.top-(i.clientTop||0)+o.top}},ev.util.getNodeCanvas=function(t){var e=ev.jsdomImplForWrapper(t);return e._canvas||e._image},ev.util.cleanUpJsdomNode=function(t){if(ev.isLikelyNode){var e=ev.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}ev.util.request=function(e,i){i||(i={});var r,n,s=i.method?i.method.toUpperCase():"GET",o=i.onComplete||function(){},a=new ev.window.XMLHttpRequest,h=i.body||i.parameters;return a.onreadystatechange=function(){4===a.readyState&&(o(a),a.onreadystatechange=t)},"GET"===s&&(h=null,"string"==typeof i.parameters&&(r=e,n=i.parameters,e=r+(/\?/.test(r)?"&":"?")+n)),a.open(s,e,!0),"POST"!==s&&"PUT"!==s||a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.send(h),a}}(),ev.log=console.log,ev.warn=console.warn,function(){var t=ev.util.object.extend,e=ev.util.object.clone,i=[];function r(){return!1}function n(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e}ev.util.object.extend(i,{cancelAll:function(){var t=this.splice(0);return t.forEach(function(t){t.cancel()}),t},cancelByCanvas:function(t){if(!t)return[];var e=this.filter(function(e){return"object"==typeof e.target&&e.target.canvas===t});return e.forEach(function(t){t.cancel()}),e},cancelByTarget:function(t){var e=this.findAnimationsByTarget(t);return e.forEach(function(t){t.cancel()}),e},findAnimationIndex:function(t){return this.indexOf(this.findAnimation(t))},findAnimation:function(t){return this.find(function(e){return e.cancel===t})},findAnimationsByTarget:function(t){return t?this.filter(function(e){return e.target===t}):[]}});var s=ev.window.requestAnimationFrame||ev.window.webkitRequestAnimationFrame||ev.window.mozRequestAnimationFrame||ev.window.oRequestAnimationFrame||ev.window.msRequestAnimationFrame||function(t){return ev.window.setTimeout(t,1e3/60)},o=ev.window.cancelAnimationFrame||ev.window.clearTimeout;function a(){return s.apply(ev.window,arguments)}ev.util.animate=function(i){i||(i={});var s,o=!1,h=function(){var t=ev.runningAnimations.indexOf(s);return t>-1&&ev.runningAnimations.splice(t,1)[0]};return s=t(e(i),{cancel:function(){return o=!0,h()},currentValue:"startValue"in i?i.startValue:0,completionRate:0,durationRate:0}),ev.runningAnimations.push(s),a(function(t){var e,l=t||+new Date,c=i.duration||500,u=l+c,f=i.onChange||r,d=i.abort||r,g=i.onComplete||r,p=i.easing||n,m="startValue"in i&&i.startValue.length>0,v="startValue"in i?i.startValue:0,y="endValue"in i?i.endValue:100,_=i.byValue||(m?v.map(function(t,e){return y[e]-v[e]}):y-v);i.onStart&&i.onStart(),function t(i){var r=(e=i||+new Date)>u?c:e-l,n=r/c,b=m?v.map(function(t,e){return p(r,v[e],_[e],c)}):p(r,v,_,c),x=m?Math.abs((b[0]-v[0])/_[0]):Math.abs((b-v)/_);if(s.currentValue=m?b.slice():b,s.completionRate=x,s.durationRate=n,!o){if(!d(b,x,n))return e>u?(s.currentValue=m?y.slice():y,s.completionRate=1,s.durationRate=1,f(m?y.slice():y,1,1),g(y,1,1),void h()):(f(b,x,n),void a(t));h()}}(l)}),s.cancel},ev.util.requestAnimFrame=a,ev.util.cancelAnimFrame=function(){return o.apply(ev.window,arguments)},ev.runningAnimations=i}(),function(){function t(t,e,i){return"rgba("+parseInt(t[0]+i*(e[0]-t[0]),10)+","+parseInt(t[1]+i*(e[1]-t[1]),10)+","+parseInt(t[2]+i*(e[2]-t[2]),10)+","+(t&&e?parseFloat(t[3]+i*(e[3]-t[3])):1)+")"}ev.util.animateColor=function(e,i,r,n){var s=new ev.Color(e).getSource(),o=new ev.Color(i).getSource(),a=n.onComplete,h=n.onChange;return n=n||{},ev.util.animate(ev.util.object.extend(n,{duration:r||500,startValue:s,endValue:o,byValue:o,easing:function(e,i,r,s){return t(i,r,n.colorEasing?n.colorEasing(e,s):1-Math.cos(e/s*(Math.PI/2)))},onComplete:function(e,i,r){if(a)return a(t(o,o,0),i,r)},onChange:function(e,i,r){if(h){if(Array.isArray(e))return h(t(e,e,0),i,r);h(e,i,r)}}}))}}(),function(){function t(t,e,i,r){return t<Math.abs(e)?(t=e,r=i/4):r=0===e&&0===t?i/(2*Math.PI)*Math.asin(1):i/(2*Math.PI)*Math.asin(e/t),{a:t,c:e,p:i,s:r}}function e(t,e,i){return t.a*Math.pow(2,10*(e-=1))*Math.sin((e*i-t.s)*(2*Math.PI)/t.p)}function i(t,e,i,n){return i-r(n-t,0,i,n)+e}function r(t,e,i,r){return(t/=r)<1/2.75?7.5625*t*t*i+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e}ev.util.ease={easeInQuad:function(t,e,i,r){return i*(t/=r)*t+e},easeOutQuad:function(t,e,i,r){return-i*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,r){return i*(t/=r)*t*t+e},easeOutCubic:function(t,e,i,r){return i*((t=t/r-1)*t*t+1)+e},easeInOutCubic:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e}
1,easeInQuart:function(t,e,i,r){return i*(t/=r)*t*t*t+e},easeOutQuart:function(t,e,i,r){return-i*((t=t/r-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,i,r){return i*(t/=r)*t*t*t*t+e},easeOutQuint:function(t,e,i,r){return i*((t=t/r-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e},easeOutSine:function(t,e,i,r){return i*Math.sin(t/r*(Math.PI/2))+e},easeInOutSine:function(t,e,i,r){return-i/2*(Math.cos(Math.PI*t/r)-1)+e},easeInExpo:function(t,e,i,r){return 0===t?e:i*Math.pow(2,10*(t/r-1))+e},easeOutExpo:function(t,e,i,r){return t===r?e+i:i*(1-Math.pow(2,-10*t/r))+e},easeInOutExpo:function(t,e,i,r){return 0===t?e:t===r?e+i:(t/=r/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,i,r){return-i*(Math.sqrt(1-(t/=r)*t)-1)+e},easeOutCirc:function(t,e,i,r){return i*Math.sqrt(1-(t=t/r-1)*t)+e},easeInOutCirc:function(t,e,i,r){return(t/=r/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(i,r,n,s){var o=0;return 0===i?r:1==(i/=s)?r+n:(o||(o=.3*s),-e(t(n,n,o,1.70158),i,s)+r)},easeOutElastic:function(e,i,r,n){var s=0;if(0===e)return i;if(1==(e/=n))return i+r;s||(s=.3*n);var o=t(r,r,s,1.70158);return o.a*Math.pow(2,-10*e)*Math.sin((e*n-o.s)*(2*Math.PI)/o.p)+o.c+i},easeInOutElastic:function(i,r,n,s){var o=0;if(0===i)return r;if(2==(i/=s/2))return r+n;o||(o=.3*1.5*s);var a=t(n,n,o,1.70158);return i<1?-.5*e(a,i,s)+r:a.a*Math.pow(2,-10*(i-=1))*Math.sin((i*s-a.s)*(2*Math.PI)/a.p)*.5+a.c+r},easeInBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),i*(t/=r)*t*((n+1)*t-n)+e},easeOutBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),i*((t=t/r-1)*t*((n+1)*t+n)+1)+e},easeInOutBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),(t/=r/2)<1?i/2*(t*t*((1+(n*=1.525))*t-n))+e:i/2*((t-=2)*t*((1+(n*=1.525))*t+n)+2)+e},easeInBounce:i,easeOutBounce:r,easeInOutBounce:function(t,e,n,s){return t<s/2?.5*i(2*t,0,n,s)+e:.5*r(2*t-s,0,n,s)+.5*n+e}}}(),function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.extend,r=e.util.object.clone,n=e.util.toFixed,s=e.util.parseUnit,o=e.util.multiplyTransformMatrices,a={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"},h={stroke:"strokeOpacity",fill:"fillOpacity"},l="font-size",c="clip-path";function u(t){return RegExp("^("+t.join("|")+")\\b","i")}function f(t,e){var i,r,n,s,o=[];for(n=0,s=e.length;n<s;n++)i=e[n],r=t.getElementsByTagName(i),o=o.concat(Array.prototype.slice.call(r));return o}function d(t,e){var i,r,n=t.nodeName,s=t.getAttribute("class"),o=t.getAttribute("id");if(i=RegExp("^"+n,"i"),e=e.replace(i,""),o&&e.length&&(i=RegExp("#"+o+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"")),s&&e.length)for(r=(s=s.split(" ")).length;r--;)i=RegExp("\\."+s[r]+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"");return 0===e.length}function g(t,e){if(t.getElementById&&(i=t.getElementById(e)),i)return i;var i,r,n,s,o=t.getElementsByTagName("*");for(n=0,s=o.length;n<s;n++)if(e===(r=o[n]).getAttribute("id"))return r}e.svgValidTagNamesRegEx=u(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),e.svgViewBoxElementsRegEx=u(["symbol","image","marker","pattern","view","svg"]),e.svgInvalidAncestorsRegEx=u(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),e.svgValidParentsRegEx=u(["symbol","g","a","svg","clipPath","defs"]),e.cssRules={},e.gradientDefs={},e.clipPaths={},e.parseTransformAttribute=function(){function t(t,i,r){t[r]=Math.tan(e.util.degreesToRadians(i[0]))}var i=e.iMatrix,r=e.reNum,n=e.commaWsp,s="(?:"+("(?:(matrix)\\s*\\(\\s*("+r+")"+n+"("+r+")"+n+"("+r+")"+n+"("+r+")"+n+"("+r+")"+n)+"("+r+")\\s*\\))|"+("(?:(translate)\\s*\\(\\s*("+r+")(?:"+n)+"("+r+"))?\\s*\\))|"+("(?:(scale)\\s*\\(\\s*("+r+")(?:"+n)+"("+r+"))?\\s*\\))|"+("(?:(rotate)\\s*\\(\\s*("+r+")(?:"+n+"("+r+")"+n)+"("+r+"))?\\s*\\))|(?:(skewX)\\s*\\(\\s*("+r+")\\s*\\))|(?:(skewY)\\s*\\(\\s*("+r+")\\s*\\)))",o=RegExp("^\\s*(?:"+("(?:"+s+"(?:"+n)+"*"+s+")*)?)\\s*$"),a=RegExp(s,"g");return function(r){var n=i.concat(),h=[];if(!r||r&&!o.test(r))return n;r.replace(a,function(r){var o,a,l,c,u,f,d,g,p,m=new RegExp(s).exec(r).filter(function(t){return!!t}),v=m[1],y=m.slice(2).map(parseFloat);switch(v){case"translate":(o=n)[4]=y[0],2===y.length&&(o[5]=y[1]);break;case"rotate":y[0]=e.util.degreesToRadians(y[0]),a=n,l=e.util.cos(y[0]),c=e.util.sin(y[0]),u=0,f=0,3===y.length&&(u=y[1],f=y[2]),a[0]=l,a[1]=c,a[2]=-c,a[3]=l,a[4]=u-(l*u-c*f),a[5]=f-(c*u+l*f);break;case"scale":d=n,g=y[0],p=2===y.length?y[1]:y[0],d[0]=g,d[3]=p;break;case"skewX":t(n,y,2);break;case"skewY":t(n,y,1);break;case"matrix":n=y}h.push(n.concat()),n=i.concat()});for(var l=h[0];h.length>1;)h.shift(),l=e.util.multiplyTransformMatrices(l,h[0]);return l}}();var p=RegExp("^\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*$");
vendor: 9,545 bytes, line 1
1function m(t){if(!e.svgViewBoxElementsRegEx.test(t.nodeName))return{};var i,r,n,o,a,h,l=t.getAttribute("viewBox"),c=1,u=1,f=t.getAttribute("width"),d=t.getAttribute("height"),g=t.getAttribute("x")||0,m=t.getAttribute("y")||0,v=t.getAttribute("preserveAspectRatio")||"",y=!l||!(l=l.match(p)),_=!f||!d||"100%"===f||"100%"===d,b=y&&_,x={},C="",S=0,w=0;if(x.width=0,x.height=0,x.toBeParsed=b,y&&(g||m)&&t.parentNode&&"#document"!==t.parentNode.nodeName&&(C=" translate("+s(g)+" "+s(m)+") ",a=(t.getAttribute("transform")||"")+C,t.setAttribute("transform",a),t.removeAttribute("x"),t.removeAttribute("y")),b)return x;if(y)return x.width=s(f),x.height=s(d),x;if(i=-parseFloat(l[1]),r=-parseFloat(l[2]),n=parseFloat(l[3]),o=parseFloat(l[4]),x.minX=i,x.minY=r,x.viewBoxWidth=n,x.viewBoxHeight=o,_?(x.width=n,x.height=o):(x.width=s(f),x.height=s(d),c=x.width/n,u=x.height/o),"none"!==(v=e.util.parsePreserveAspectRatioAttribute(v)).alignX&&("meet"===v.meetOrSlice&&(u=c=c>u?u:c),"slice"===v.meetOrSlice&&(u=c=c>u?c:u),S=x.width-n*c,w=x.height-o*c,"Mid"===v.alignX&&(S/=2),"Mid"===v.alignY&&(w/=2),"Min"===v.alignX&&(S=0),"Min"===v.alignY&&(w=0)),1===c&&1===u&&0===i&&0===r&&0===g&&0===m)return x;if((g||m)&&"#document"!==t.parentNode.nodeName&&(C=" translate("+s(g)+" "+s(m)+") "),a=C+" matrix("+c+" 0 0 "+u+" "+(i*c+S)+" "+(r*u+w)+") ","svg"===t.nodeName){for(h=t.ownerDocument.createElementNS(e.svgNS,"g");t.firstChild;)h.appendChild(t.firstChild);t.appendChild(h)}else(h=t).removeAttribute("x"),h.removeAttribute("y"),a=h.getAttribute("transform")+a;return h.setAttribute("transform",a),x}e.parseSVGDocument=function(t,i,n,s){if(t){!function(t){for(var i=f(t,["use","svg:use"]),r=0;i.length&&r<i.length;){var n=i[r],s=n.getAttribute("xlink:href")||n.getAttribute("href");if(null===s)return;var o,a,h,l,c=s.slice(1),u=n.getAttribute("x")||0,d=n.getAttribute("y")||0,p=g(t,c).cloneNode(!0),v=(p.getAttribute("transform")||"")+" translate("+u+", "+d+")",y=i.length,_=e.svgNS;if(m(p),/^svg$/i.test(p.nodeName)){var b=p.ownerDocument.createElementNS(_,"g");for(a=0,l=(h=p.attributes).length;a<l;a++)o=h.item(a),b.setAttributeNS(_,o.nodeName,o.nodeValue);for(;p.firstChild;)b.appendChild(p.firstChild);p=b}for(a=0,l=(h=n.attributes).length;a<l;a++)"x"!==(o=h.item(a)).nodeName&&"y"!==o.nodeName&&"xlink:href"!==o.nodeName&&"href"!==o.nodeName&&("transform"===o.nodeName?v=o.nodeValue+" "+v:p.setAttribute(o.nodeName,o.nodeValue));p.setAttribute("transform",v),p.setAttribute("instantiated_by_use","1"),p.removeAttribute("id"),n.parentNode.replaceChild(p,n),i.length===y&&r++}}(t);var o,a,h=e.Object.__uid++,l=m(t),c=e.util.toArray(t.getElementsByTagName("*"));if(l.crossOrigin=s&&s.crossOrigin,l.svgUid=h,0===c.length&&e.isLikelyNode){var u=[];for(o=0,a=(c=t.selectNodes('//*[name(.)!="svg"]')).length;o<a;o++)u[o]=c[o];c=u}var d=c.filter(function(t){return m(t),e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))&&!function(t,e){for(;t&&(t=t.parentNode);)if(t.nodeName&&e.test(t.nodeName.replace("svg:",""))&&!t.getAttribute("instantiated_by_use"))return!0;return!1}(t,e.svgInvalidAncestorsRegEx)});if(d&&(!d||d.length)){var p={};c.filter(function(t){return"clipPath"===t.nodeName.replace("svg:","")}).forEach(function(t){p[t.getAttribute("id")]=e.util.toArray(t.getElementsByTagName("*")).filter(function(t){return e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))})}),e.gradientDefs[h]=e.getGradientDefs(t),e.cssRules[h]=e.getCSSRules(t),e.clipPaths[h]=p,e.parseElements(d,function(t,r){i&&(i(t,l,r,c),delete e.gradientDefs[h],delete e.cssRules[h],delete e.clipPaths[h])},r(l),n,s)}else i&&i([],{})}};var v=RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+e.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+e.reNum+"))?\\s+(.*)");i(e,{parseFontDeclaration:function(t,e){var i=t.match(v);if(i){var r=i[1],n=i[3],o=i[4],a=i[5],h=i[6];r&&(e.fontStyle=r),n&&(e.fontWeight=isNaN(parseFloat(n))?n:parseFloat(n)),o&&(e.fontSize=s(o)),h&&(e.fontFamily=h),a&&(e.lineHeight="normal"===a?1:a)}},getGradientDefs:function(t){var e,i=f(t,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),r=0,n={};for(r=i.length;r--;)(e=i[r]).getAttribute("xlink:href")&&function t(e,i){var r="xlink:href",n=g(e,i.getAttribute(r).slice(1));if(n&&n.getAttribute(r)&&t(e,n),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach(function(t){n&&!i.hasAttribute(t)&&n.hasAttribute(t)&&i.setAttribute(t,n.getAttribute(t))}),!i.children.length)for(var s=n.cloneNode(!0);s.firstChild;)i.appendChild(s.firstChild);i.removeAttribute(r)}(t,e),n[e.getAttribute("id")]=e;return n},parseAttributes:function(t,r,u){if(t){var f,g,p,m={};void 0===u&&(u=t.getAttribute("svgUid")),t.parentNode&&e.svgValidParentsRegEx.test(t.parentNode.nodeName)&&(m=e.parseAttributes(t.parentNode,r,u));var v=r.reduce(function(e,i){return(f=t.getAttribute(i))&&(e[i]=f),e},{}),y=i(function(t,i){var r={};for(var n in e.cssRules[i])if(function(t,e){var i,r=!0;return(i=d(t,e.pop()))&&e.length&&(r=function(t,e){for(var i,r=!0;t.parentNode&&1===t.parentNode.nodeType&&e.length;)r&&(i=e.pop()),r=d(t=t.parentNode,i);return 0===e.length}(t,e)),i&&r&&0===e.length}(t,n.split(" ")))for(var s in e.cssRules[i][n])r[s]=e.cssRules[i][n][s];return r}(t,u),e.parseStyleAttribute(t));v=i(v,y),y[c]&&t.setAttribute(c,y[c]),g=p=m.fontSize||e.Text.DEFAULT_SVG_FONT_SIZE,v[l]&&(v[l]=g=s(v[l],p));var _,b,x={};for(var C in v)b=function(t,i,r,n){var a,h=Array.isArray(i);if("fill"!==t&&"stroke"!==t||"none"!==i){if("strokeUniform"===t)return"non-scaling-stroke"===i;if("strokeDashArray"===t)i="none"===i?null:i.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===t)i=r&&r.transformMatrix?o(r.transformMatrix,e.parseTransformAttribute(i)):e.parseTransformAttribute(i);else if("visible"===t)i="none"!==i&&"hidden"!==i,r&&!1===r.visible&&(i=!1);else if("opacity"===t)i=parseFloat(i),r&&void 0!==r.opacity&&(i*=r.opacity);else if("textAnchor"===t)i="start"===i?"left":"end"===i?"right":"center";else if("charSpacing"===t)a=s(i,n)/n*1e3;else if("paintFirst"===t){var l=i.indexOf("fill"),c=i.indexOf("stroke");i="fill",(l>-1&&c>-1&&c<l||-1===l&&c>-1)&&(i="stroke")}else{if("href"===t||"xlink:href"===t||"font"===t)return i;if("imageSmoothing"===t)return"optimizeQuality"===i;a=h?i.map(s):s(i,n)}}else i="";return!h&&isNaN(a)?i:a}(_=C in a?a[C]:C,v[C],m,g),x[_]=b;x&&x.font&&e.parseFontDeclaration(x.font,x);var S=i(m,x);return e.svgValidParentsRegEx.test(t.nodeName)?S:function(t){for(var i in h)if(void 0!==t[h[i]]&&""!==t[i]){if(void 0===t[i]){if(!e.Object.prototype[i])continue;t[i]=e.Object.prototype[i]}if(0!==t[i].indexOf("url(")){var r=new e.Color(t[i]);t[i]=r.setAlpha(n(r.getAlpha()*t[h[i]],2)).toRgba()}}return t}(S)}},parseElements:function(t,i,r,n,s){new e.ElementsParser(t,i,r,n,s).parse()},parseStyleAttribute:function(t){var e={},i=t.getAttribute("style");return i&&("string"==typeof i?function(t,e){var i,r;t.replace(/;\s*$/,"").split(";").forEach(function(t){var n=t.split(":");i=n[0].trim().toLowerCase(),r=n[1].trim(),e[i]=r})}(i,e):function(t,e){var i,r;for(var n in t)void 0!==t[n]&&(i=n.toLowerCase(),r=t[n],e[i]=r)}(i,e)),e},parsePointsAttribute:function(t){if(!t)return null;var e,i,r=[];for(e=0,i=(t=(t=t.replace(/,/g," ").trim()).split(/\s+/)).length;e<i;e+=2)r.push({x:parseFloat(t[e]),y:parseFloat(t[e+1])});return r},getCSSRules:function(t){var i,r,n=t.getElementsByTagName("style"),s={};for(i=0,r=n.length;i<r;i++){var o=n[i].textContent;""!==(o=o.replace(/\/\*[\s\S]*?\*\//g,"")).trim()&&o.split("}").filter(function(t){return t.trim()}).forEach(function(t){var n=t.split("{"),o={},a=n[1].trim().split(";").filter(function(t){return t.trim()});for(i=0,r=a.length;i<r;i++){var h=a[i].split(":"),l=h[0].trim(),c=h[1].trim();o[l]=c}(t=n[0].trim()).split(",").forEach(function(t){""!==(t=t.replace(/^svg/i,"").trim())&&(s[t]?e.util.object.extend(s[t],o):s[t]=e.util.object.clone(o))})})}return s},loadSVGFromURL:function(t,i,r,n){t=t.replace(/^\n\s*/,"").trim(),new e.util.request(t,{method:"get",onComplete:function(t){var s=t.responseXML;if(!s||!s.documentElement)return i&&i(null),!1;e.parseSVGDocument(s.documentElement,function(t,e,r,n){i&&i(t,e,r,n)},r,n)}})},loadSVGFromString:function(t,i,r,n){var s=(new e.window.DOMParser).parseFromString(t.trim(),"text/xml");e.parseSVGDocument(s.documentElement,function(t,e,r,n){i(t,e,r,n)},r,n)}})}(t),ev.ElementsParser=function(t,e,i,r,n,s){this.elements=t,this.callback=e,this.options=i,this.reviver=r,this.svgUid=i&&i.svgUid||0,this.parsingOptions=n,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=s},(el=ev.ElementsParser.prototype).parse=function(){this.instances=Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},el.createObjects=function(){var t=this;this.elements.forEach(function(e,i){e.setAttribute("svgUid",t.svgUid),t.createObject(e,i)})},el.findTag=function(t){return ev[ev.util.string.capitalize(t.tagName.replace("svg:",""))]},el.createObject=function(t,e){var i=this.findTag(t);if(i&&i.fromElement)try{i.fromElement(t,this.createCallback(e,t),this.options)}catch(t){ev.log(t)}else this.checkIfDone()},el.createCallback=function(t,e){var i=this;return function(r){var n;i.resolveGradient(r,e,"fill"),i.resolveGradient(r,e,"stroke"),r instanceof ev.Image&&r._originalElement&&(n=r.parsePreserveAspectRatioAttribute(e)),r._removeTransformMatrix(n),i.resolveClipPath(r,e),i.reviver&&i.reviver(e,r),i.instances[t]=r,i.checkIfDone()}}
vendor: 6,143 bytes, line 1
1,el.extractPropertyDefinition=function(t,e,i){var r=t[e],n=this.regexUrl;if(n.test(r)){n.lastIndex=0;var s=n.exec(r)[1];return n.lastIndex=0,ev[i][this.svgUid][s]}},el.resolveGradient=function(t,e,i){var r=this.extractPropertyDefinition(t,i,"gradientDefs");if(r){var n=e.getAttribute(i+"-opacity"),s=ev.Gradient.fromElement(r,t,n,this.options);t.set(i,s)}},el.createClipPathCallback=function(t,e){return function(t){t._removeTransformMatrix(),t.fillRule=t.clipRule,e.push(t)}},el.resolveClipPath=function(t,e){var i,r,n,s,o=this.extractPropertyDefinition(t,"clipPath","clipPaths");if(o){n=[],r=ev.util.invertTransform(t.calcTransformMatrix());for(var a=o[0].parentNode,h=e;h.parentNode&&h.getAttribute("clip-path")!==t.clipPath;)h=h.parentNode;h.parentNode.appendChild(a);for(var l=0;l<o.length;l++)i=o[l],this.findTag(i).fromElement(i,this.createClipPathCallback(t,n),this.options);o=1===n.length?n[0]:new ev.Group(n),s=ev.util.multiplyTransformMatrices(r,o.calcTransformMatrix()),o.clipPath&&this.resolveClipPath(o,h);var c=ev.util.qrDecompose(s);o.flipX=!1,o.flipY=!1,o.set("scaleX",c.scaleX),o.set("scaleY",c.scaleY),o.angle=c.angle,o.skewX=c.skewX,o.skewY=0,o.setPositionByOrigin({x:c.translateX,y:c.translateY},"center","center"),t.clipPath=o}else delete t.clipPath},el.checkIfDone=function(){0==--this.numElements&&(this.instances=this.instances.filter(function(t){return null!=t}),this.callback(this.instances,this.elements))},function(t){var e=t.fabric||(t.fabric={});function i(t,e){this.x=t,this.y=e}e.Point?e.warn("fabric.Point is already defined"):(e.Point=i,i.prototype={type:"point",constructor:i,add:function(t){return new i(this.x+t.x,this.y+t.y)},addEquals:function(t){return this.x+=t.x,this.y+=t.y,this},scalarAdd:function(t){return new i(this.x+t,this.y+t)},scalarAddEquals:function(t){return this.x+=t,this.y+=t,this},subtract:function(t){return new i(this.x-t.x,this.y-t.y)},subtractEquals:function(t){return this.x-=t.x,this.y-=t.y,this},scalarSubtract:function(t){return new i(this.x-t,this.y-t)},scalarSubtractEquals:function(t){return this.x-=t,this.y-=t,this},multiply:function(t){return new i(this.x*t,this.y*t)},multiplyEquals:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return new i(this.x/t,this.y/t)},divideEquals:function(t){return this.x/=t,this.y/=t,this},eq:function(t){return this.x===t.x&&this.y===t.y},lt:function(t){return this.x<t.x&&this.y<t.y},lte:function(t){return this.x<=t.x&&this.y<=t.y},gt:function(t){return this.x>t.x&&this.y>t.y},gte:function(t){return this.x>=t.x&&this.y>=t.y},lerp:function(t,e){return void 0===e&&(e=.5),e=Math.max(Math.min(1,e),0),new i(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)},distanceFrom:function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},midPointFrom:function(t){return this.lerp(t)},min:function(t){return new i(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new i(Math.max(this.x,t.x),Math.max(this.y,t.y))},toString:function(){return this.x+","+this.y},setXY:function(t,e){return this.x=t,this.y=e,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setFromPoint:function(t){return this.x=t.x,this.y=t.y,this},swap:function(t){var e=this.x,i=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=i},clone:function(){return new i(this.x,this.y)}})}(t),function(t){var e=t.fabric||(t.fabric={});function i(t){this.status=t,this.points=[]}e.Intersection?e.warn("fabric.Intersection is already defined"):(e.Intersection=i,e.Intersection.prototype={constructor:i,appendPoint:function(t){return this.points.push(t),this},appendPoints:function(t){return this.points=this.points.concat(t),this}},e.Intersection.intersectLineLine=function(t,r,n,s){var o,a=(s.x-n.x)*(t.y-n.y)-(s.y-n.y)*(t.x-n.x),h=(r.x-t.x)*(t.y-n.y)-(r.y-t.y)*(t.x-n.x),l=(s.y-n.y)*(r.x-t.x)-(s.x-n.x)*(r.y-t.y);if(0!==l){var c=a/l,u=h/l;0<=c&&c<=1&&0<=u&&u<=1?(o=new i("Intersection")).appendPoint(new e.Point(t.x+c*(r.x-t.x),t.y+c*(r.y-t.y))):o=new i}else o=new i(0===a||0===h?"Coincident":"Parallel");return o},e.Intersection.intersectLinePolygon=function(t,e,r){var n,s,o,a,h=new i,l=r.length;for(a=0;a<l;a++)n=r[a],s=r[(a+1)%l],o=i.intersectLineLine(t,e,n,s),h.appendPoints(o.points);return h.points.length>0&&(h.status="Intersection"),h},e.Intersection.intersectPolygonPolygon=function(t,e){var r,n=new i,s=t.length;for(r=0;r<s;r++){var o=t[r],a=t[(r+1)%s],h=i.intersectLinePolygon(o,a,e);n.appendPoints(h.points)}return n.points.length>0&&(n.status="Intersection"),n},e.Intersection.intersectPolygonRectangle=function(t,r,n){var s=r.min(n),o=r.max(n),a=new e.Point(o.x,s.y),h=new e.Point(s.x,o.y),l=i.intersectLinePolygon(s,a,t),c=i.intersectLinePolygon(a,o,t),u=i.intersectLinePolygon(o,h,t),f=i.intersectLinePolygon(h,s,t),d=new i;return d.appendPoints(l.points),d.appendPoints(c.points),d.appendPoints(u.points),d.appendPoints(f.points),d.points.length>0&&(d.status="Intersection"),d})}(t),function(t){var e=t.fabric||(t.fabric={});function i(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}function r(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}e.Color?e.warn("fabric.Color is already defined."):(e.Color=i,e.Color.prototype={_tryParsingColor:function(t){var e;t in i.colorNameMap&&(t=i.colorNameMap[t]),"transparent"===t&&(e=[255,255,255,0]),e||(e=i.sourceFromHex(t)),e||(e=i.sourceFromRgb(t)),e||(e=i.sourceFromHsl(t)),e||(e=[0,0,0,1]),e&&this.setSource(e)},_rgbToHsl:function(t,i,r){t/=255,i/=255,r/=255;var n,s,o,a=e.util.array.max([t,i,r]),h=e.util.array.min([t,i,r]);if(o=(a+h)/2,a===h)n=s=0;else{var l=a-h;switch(s=o>.5?l/(2-a-h):l/(a+h),a){case t:n=(i-r)/l+6*(i<r);break;case i:n=(r-t)/l+2;break;case r:n=(t-i)/l+4}n/=6}return[Math.round(360*n),Math.round(100*s),Math.round(100*o)]},getSource:function(){return this._source},setSource:function(t){this._source=t},toRgb:function(){var t=this.getSource();return"rgb("+t[0]+","+t[1]+","+t[2]+")"},toRgba:function(){var t=this.getSource();return"rgba("+t[0]+","+t[1]+","+t[2]+","+t[3]+")"},toHsl:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsl("+e[0]+","+e[1]+"%,"+e[2]+"%)"}
vendor: 8,153 bytes, line 1
1,toHsla:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsla("+e[0]+","+e[1]+"%,"+e[2]+"%,"+t[3]+")"},toHex:function(){var t,e,i,r=this.getSource();return t=1===(t=r[0].toString(16)).length?"0"+t:t,e=1===(e=r[1].toString(16)).length?"0"+e:e,i=1===(i=r[2].toString(16)).length?"0"+i:i,t.toUpperCase()+e.toUpperCase()+i.toUpperCase()},toHexa:function(){var t;return t=1===(t=(t=Math.round(255*this.getSource()[3])).toString(16)).length?"0"+t:t,this.toHex()+t.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(t){var e=this.getSource();return e[3]=t,this.setSource(e),this},toGrayscale:function(){var t=this.getSource(),e=parseInt((.3*t[0]+.59*t[1]+.11*t[2]).toFixed(0),10),i=t[3];return this.setSource([e,e,e,i]),this},toBlackWhite:function(t){var e=this.getSource(),i=(.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),r=e[3];return t=t||127,i=Number(i)<Number(t)?0:255,this.setSource([i,i,i,r]),this},overlayWith:function(t){t instanceof i||(t=new i(t));var e,r=[],n=this.getAlpha(),s=this.getSource(),o=t.getSource();for(e=0;e<3;e++)r.push(Math.round(.5*s[e]+.5*o[e]));return r[3]=n,this.setSource(r),this}},e.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,e.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i,e.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,e.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"},e.Color.fromRgb=function(t){return i.fromSource(i.sourceFromRgb(t))},e.Color.sourceFromRgb=function(t){var e=t.match(i.reRGBa);if(e){var r=parseInt(e[1],10)/(/%$/.test(e[1])?100:1)*(/%$/.test(e[1])?255:1),n=parseInt(e[2],10)/(/%$/.test(e[2])?100:1)*(/%$/.test(e[2])?255:1),s=parseInt(e[3],10)/(/%$/.test(e[3])?100:1)*(/%$/.test(e[3])?255:1);return[parseInt(r,10),parseInt(n,10),parseInt(s,10),e[4]?parseFloat(e[4]):1]}},e.Color.fromRgba=i.fromRgb,e.Color.fromHsl=function(t){return i.fromSource(i.sourceFromHsl(t))},e.Color.sourceFromHsl=function(t){var e=t.match(i.reHSLa);if(e){var n,s,o,a=(parseFloat(e[1])%360+360)%360/360,h=parseFloat(e[2])/(/%$/.test(e[2])?100:1),l=parseFloat(e[3])/(/%$/.test(e[3])?100:1);if(0===h)n=s=o=l;else{var c=l<=.5?l*(h+1):l+h-l*h,u=2*l-c;n=r(u,c,a+1/3),s=r(u,c,a),o=r(u,c,a-1/3)}return[Math.round(255*n),Math.round(255*s),Math.round(255*o),e[4]?parseFloat(e[4]):1]}},e.Color.fromHsla=i.fromHsl,e.Color.fromHex=function(t){return i.fromSource(i.sourceFromHex(t))},e.Color.sourceFromHex=function(t){if(t.match(i.reHex)){var e=t.slice(t.indexOf("#")+1),r=3===e.length||4===e.length,n=8===e.length||4===e.length,s=r?e.charAt(0)+e.charAt(0):e.substring(0,2),o=r?e.charAt(1)+e.charAt(1):e.substring(2,4),a=r?e.charAt(2)+e.charAt(2):e.substring(4,6),h=n?r?e.charAt(3)+e.charAt(3):e.substring(6,8):"FF";return[parseInt(s,16),parseInt(o,16),parseInt(a,16),parseFloat((parseInt(h,16)/255).toFixed(2))]}},e.Color.fromSource=function(t){var e=new i;return e.setSource(t),e})}(t),function(t){var e=t.fabric||(t.fabric={}),i=["e","se","s","sw","w","nw","n","ne","e"],r=["ns","nesw","ew","nwse"],n={},s="left",o="right",a="bottom",h="center",l={top:a,bottom:"top",left:o,right:s,center:h},c=e.util.radiansToDegrees,u=Math.sign||function(t){return(t>0)-(t<0)||+t};function f(t,e){return Math.round((t.angle+c(Math.atan2(e.y,e.x))+360)%360/45)}function d(t,i){var r=i.transform.target,n=r.canvas,s=e.util.object.clone(i);s.target=r,n&&n.fire("object:"+t,s),r.fire(t,i)}function g(t,e){var i=e.canvas,r=t[i.uniScaleKey];return i.uniformScaling&&!r||!i.uniformScaling&&r}function p(t){return t.originX===h&&t.originY===h}function m(t,e,i){var r=t.lockScalingX,n=t.lockScalingY;return!(!r||!n)||!(e||!r&&!n||!i)||!(!r||"x"!==e)||!(!n||"y"!==e)}function v(t,e,i,r){return{e:t,transform:e,pointer:{x:i,y:r}}}function y(t){return function(e,i,r,n){var s=i.target,o=s.getCenterPoint(),a=s.translateToOriginPoint(o,i.originX,i.originY),h=t(e,i,r,n);return s.setPositionByOrigin(a,i.originX,i.originY),h}}function _(t,e){return function(i,r,n,s){var o=e(i,r,n,s);return o&&d(t,v(i,r,n,s)),o}}function b(t,i,r,n,s){var o=t.target,a=o.controls[t.corner],h=o.canvas.getZoom(),l=o.padding/h,c=o.toLocalPoint(new e.Point(n,s),i,r);return c.x>=l&&(c.x-=l),c.x<=-l&&(c.x+=l),c.y>=l&&(c.y-=l),c.y<=l&&(c.y+=l),c.x-=a.offsetX,c.y-=a.offsetY,c}function x(t){return t.flipX!==t.flipY}function C(t,e,i,r,n){if(0!==t[e]){var s=n/t._getTransformedDimensions()[r]*t[i];t.set(i,s)}}function S(t,e,i,r){var n,h=e.target,l=h._getTransformedDimensions(0,h.skewY),u=Math.abs(2*b(e,e.originX,e.originY,i,r).x)-l.x,f=h.skewX;u<2?n=0:(n=c(Math.atan2(u/h.scaleX,l.y/h.scaleY)),e.originX===s&&e.originY===a&&(n=-n),e.originX===o&&"top"===e.originY&&(n=-n),x(h)&&(n=-n));var d=f!==n;if(d){var g=h._getTransformedDimensions().y;h.set("skewX",n),C(h,"skewY","scaleY","y",g)}return d}function w(t,e,i,r){var n,h=e.target,l=h._getTransformedDimensions(h.skewX,0),u=Math.abs(2*b(e,e.originX,e.originY,i,r).y)-l.y,f=h.skewY;u<2?n=0:(n=c(Math.atan2(u/h.scaleY,l.x/h.scaleX)),e.originX===s&&e.originY===a&&(n=-n),e.originX===o&&"top"===e.originY&&(n=-n),x(h)&&(n=-n));var d=f!==n;if(d){var g=h._getTransformedDimensions().x;
1h.set("skewY",n),C(h,"skewX","scaleX","x",g)}return d}function T(t,e,i,r,n){n=n||{};var s,o,a,h,c,f,d=e.target,v=d.lockScalingX,y=d.lockScalingY,_=n.by,x=g(t,d),C=m(d,_,x),S=e.gestureScale;if(C)return!1;if(S)o=e.scaleX*S,a=e.scaleY*S;else{if(s=b(e,e.originX,e.originY,i,r),c="y"!==_?u(s.x):1,f="x"!==_?u(s.y):1,e.signX||(e.signX=c),e.signY||(e.signY=f),d.lockScalingFlip&&(e.signX!==c||e.signY!==f))return!1;if(h=d._getTransformedDimensions(),x&&!_){var w=Math.abs(s.x)+Math.abs(s.y),T=e.original,O=w/(Math.abs(h.x*T.scaleX/d.scaleX)+Math.abs(h.y*T.scaleY/d.scaleY));o=T.scaleX*O,a=T.scaleY*O}else o=Math.abs(s.x*d.scaleX/h.x),a=Math.abs(s.y*d.scaleY/h.y);p(e)&&(o*=2,a*=2),e.signX!==c&&"y"!==_&&(e.originX=l[e.originX],o*=-1,e.signX=c),e.signY!==f&&"x"!==_&&(e.originY=l[e.originY],a*=-1,e.signY=f)}var k=d.scaleX,E=d.scaleY;return _?("x"===_&&d.set("scaleX",o),"y"===_&&d.set("scaleY",a)):(v||d.set("scaleX",o),y||d.set("scaleY",a)),k!==d.scaleX||E!==d.scaleY}n.scaleCursorStyleHandler=function(t,e,r){var n=g(t,r),s="";return(0!==e.x&&0===e.y?s="x":0===e.x&&0!==e.y&&(s="y"),m(r,s,n))?"not-allowed":i[f(r,e)]+"-resize"},n.skewCursorStyleHandler=function(t,e,i){return 0!==e.x&&i.lockSkewingY||0!==e.y&&i.lockSkewingX?"not-allowed":r[f(i,e)%4]+"-resize"},n.scaleSkewCursorStyleHandler=function(t,e,i){return t[i.canvas.altActionKey]?n.skewCursorStyleHandler(t,e,i):n.scaleCursorStyleHandler(t,e,i)},n.rotationWithSnapping=_("rotating",y(function(t,e,i,r){var n=e.target,s=n.translateToOriginPoint(n.getCenterPoint(),e.originX,e.originY);if(n.lockRotation)return!1;var o,a=Math.atan2(e.ey-s.y,e.ex-s.x),h=c(Math.atan2(r-s.y,i-s.x)-a+e.theta);if(n.snapAngle>0){var l=n.snapAngle,u=n.snapThreshold||l,f=Math.ceil(h/l)*l,d=Math.floor(h/l)*l;Math.abs(h-d)<u?h=d:Math.abs(h-f)<u&&(h=f)}return h<0&&(h=360+h),h%=360,o=n.angle!==h,n.angle=h,o})),n.scalingEqually=_("scaling",y(function(t,e,i,r){return T(t,e,i,r)})),n.scalingX=_("scaling",y(function(t,e,i,r){return T(t,e,i,r,{by:"x"})})),n.scalingY=_("scaling",y(function(t,e,i,r){return T(t,e,i,r,{by:"y"})})),n.scalingYOrSkewingX=function(t,e,i,r){return t[e.target.canvas.altActionKey]?n.skewHandlerX(t,e,i,r):n.scalingY(t,e,i,r)},n.scalingXOrSkewingY=function(t,e,i,r){return t[e.target.canvas.altActionKey]?n.skewHandlerY(t,e,i,r):n.scalingX(t,e,i,r)},n.changeWidth=_("resizing",y(function(t,e,i,r){var n=e.target,s=b(e,e.originX,e.originY,i,r),o=n.strokeWidth/(n.strokeUniform?n.scaleX:1),a=p(e)?2:1,h=n.width,l=Math.abs(s.x*a/n.scaleX)-o;return n.set("width",Math.max(l,0)),h!==l})),n.skewHandlerX=function(t,e,i,r){var n,a=e.target,l=a.skewX,c=e.originY;return!a.lockSkewingX&&(0===l?n=b(e,h,h,i,r).x>0?s:o:(l>0&&(n="top"===c?s:o),l<0&&(n="top"===c?o:s),x(a)&&(n=n===s?o:s)),e.originX=n,_("skewing",y(S))(t,e,i,r))},n.skewHandlerY=function(t,e,i,r){var n,o=e.target,l=o.skewY,c=e.originX;return!o.lockSkewingY&&(0===l?n=b(e,h,h,i,r).y>0?"top":a:(l>0&&(n=c===s?"top":a),l<0&&(n=c===s?a:"top"),x(o)&&(n="top"===n?a:"top")),e.originY=n,_("skewing",y(w))(t,e,i,r))},n.dragHandler=function(t,e,i,r){var n=e.target,s=i-e.offsetX,o=r-e.offsetY,a=!n.get("lockMovementX")&&n.left!==s,h=!n.get("lockMovementY")&&n.top!==o;return a&&n.set("left",s),h&&n.set("top",o),(a||h)&&d("moving",v(t,e,i,r)),a||h},n.scaleOrSkewActionName=function(t,e,i){var r=t[i.canvas.altActionKey];return 0===e.x?r?"skewX":"scaleY":0===e.y?r?"skewY":"scaleX":void 0},n.rotationStyleHandler=function(t,e,i){return i.lockRotation?"not-allowed":e.cursorStyle},n.fireEvent=d,n.wrapWithFixedAnchor=y,n.wrapWithFireEvent=_,n.getLocalPoint=b,e.controlsUtils=n}(t),i=(e=t.fabric||(t.fabric={})).util.degreesToRadians,(r=e.controlsUtils).renderCircleControl=function(t,e,i,r,n){r=r||{};var s,o=this.sizeX||r.cornerSize||n.cornerSize,a=this.sizeY||r.cornerSize||n.cornerSize,h=void 0!==r.transparentCorners?r.transparentCorners:n.transparentCorners,l=!h&&(r.cornerStrokeColor||n.cornerStrokeColor),c=e,u=i;t.save(),t.fillStyle=r.cornerColor||n.cornerColor,t.strokeStyle=r.cornerStrokeColor||n.cornerStrokeColor,o>a?(s=o,t.scale(1,a/o),u=i*o/a):a>o?(s=a,t.scale(o/a,1),c=e*a/o):s=o,t.lineWidth=1,t.beginPath(),t.arc(c,u,s/2,0,2*Math.PI,!1),t[h?"stroke":"fill"](),l&&t.stroke(),t.restore(
vendor: 4,559 bytes, line 1
1)},r.renderSquareControl=function(t,e,r,n,s){n=n||{};var o=this.sizeX||n.cornerSize||s.cornerSize,a=this.sizeY||n.cornerSize||s.cornerSize,h=void 0!==n.transparentCorners?n.transparentCorners:s.transparentCorners,l=!h&&(n.cornerStrokeColor||s.cornerStrokeColor),c=o/2,u=a/2;t.save(),t.fillStyle=n.cornerColor||s.cornerColor,t.strokeStyle=n.cornerStrokeColor||s.cornerStrokeColor,t.lineWidth=1,t.translate(e,r),t.rotate(i(s.angle)),t[(h?"stroke":"fill")+"Rect"](-c,-u,o,a),l&&t.strokeRect(-c,-u,o,a),t.restore()},(n=t.fabric||(t.fabric={})).Control=function(t){for(var e in t)this[e]=t[e]},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(t,e){return e.cursorStyle},getActionName:function(t,e){return e.actionName},getVisibility:function(t,e){var i=t._controlsVisibility;return i&&void 0!==i[e]?i[e]:this.visible},setVisibility:function(t){this.visible=t},positionHandler:function(t,e){return n.util.transformPoint({x:this.x*t.x+this.offsetX,y:this.y*t.y+this.offsetY},e)},calcCornerCoords:function(t,e,i,r,s){var o,a,h,l,c=s?this.touchSizeX:this.sizeX,u=s?this.touchSizeY:this.sizeY;if(c&&u&&c!==u){var f=Math.atan2(u,c),d=Math.sqrt(c*c+u*u)/2,g=f-n.util.degreesToRadians(t),p=Math.PI/2-f-n.util.degreesToRadians(t);o=d*n.util.cos(g),a=d*n.util.sin(g),h=d*n.util.cos(p),l=d*n.util.sin(p)}else d=.7071067812*(c&&u?c:e),g=n.util.degreesToRadians(45-t),o=h=d*n.util.cos(g),a=l=d*n.util.sin(g);return{tl:{x:i-l,y:r-h},tr:{x:i+o,y:r-a},bl:{x:i-o,y:r+a},br:{x:i+l,y:r+h}}},render:function(t,e,i,r,s){"circle"===((r=r||{}).cornerStyle||s.cornerStyle)?n.controlsUtils.renderCircleControl.call(this,t,e,i,r,s):n.controlsUtils.renderSquareControl.call(this,t,e,i,r,s)}},s=ev.util.object.clone,ev.Gradient=ev.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(t){t||(t={}),t.coords||(t.coords={});var e,i=this;Object.keys(t).forEach(function(e){i[e]=t[e]}),this.id?this.id+="_"+ev.Object.__uid++:this.id=ev.Object.__uid++,e={x1:t.coords.x1||0,y1:t.coords.y1||0,x2:t.coords.x2||0,y2:t.coords.y2||0},"radial"===this.type&&(e.r1=t.coords.r1||0,e.r2=t.coords.r2||0),this.coords=e,this.colorStops=t.colorStops.slice()},addColorStop:function(t){for(var e in t){var i=new ev.Color(t[e]);this.colorStops.push({offset:parseFloat(e),color:i.toRgb(),opacity:i.getAlpha()})}return this},toObject:function(t){var e={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 ev.util.populateWithProperties(this,e,t),e},toSVG:function(t,e){var i,r,n,o,a=s(this.coords,!0),h=(e=e||{},s(this.colorStops,!0)),l=a.r1>a.r2,c=this.gradientTransform?this.gradientTransform.concat():ev.iMatrix.concat(),u=-this.offsetX,f=-this.offsetY,d=!!e.additionalTransform,g="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox";if(h.sort(function(t,e){return t.offset-e.offset}),"objectBoundingBox"===g?(u/=t.width,f/=t.height):(u+=t.width/2,f+=t.height/2),"path"===t.type&&"percentage"!==this.gradientUnits&&(u-=t.pathOffset.x,f-=t.pathOffset.y),c[4]-=u,c[5]-=f,o='id="SVGID_'+this.id+'" gradientUnits="'+g+'"'+(' gradientTransform="'+(d?e.additionalTransform+" ":""))+ev.util.matrixToSVG(c)+'" ',"linear"===this.type?n=["<linearGradient ",o,' x1="',a.x1,'" y1="',a.y1,'" x2="',a.x2,'" y2="',a.y2,'">\n']:"radial"===this.type&&(n=["<radialGradient ",o,' cx="',l?a.x1:a.x2,'" cy="',l?a.y1:a.y2,'" r="',l?a.r1:a.r2,'" fx="',l?a.x2:a.x1,'" fy="',l?a.y2:a.y1,'">\n']),"radial"===this.type){if(l)for((h=h.concat()).reverse(),i=0,r=h.length;i<r;i++)h[i].offset=1-h[i].offset;var p=Math.min(a.r1,a.r2);if(p>0){var m=p/Math.max(a.r1,a.r2);for(i=0,r=h.length;i<r;i++)h[i].offset+=m*(1-h[i].offset)}}for(i=0,r=h.length;i<r;i++){var v=h[i];n.push("<stop ",'offset="',100*v.offset+"%",'" style="stop-color:',v.color,void 0!==v.opacity?";stop-opacity: "+v.opacity:";",'"/>\n')}return n.push("linear"===this.type?"</linearGradient>\n":"</radialGradient>\n"),n.join("")},toLive:function(t){var e,i,r,n=ev.util.object.clone(this.coords);
vendor: 21,988 bytes, line 1
1if(this.type){for("linear"===this.type?e=t.createLinearGradient(n.x1,n.y1,n.x2,n.y2):"radial"===this.type&&(e=t.createRadialGradient(n.x1,n.y1,n.r1,n.x2,n.y2,n.r2)),i=0,r=this.colorStops.length;i<r;i++){var s=this.colorStops[i].color,o=this.colorStops[i].opacity,a=this.colorStops[i].offset;void 0!==o&&(s=new ev.Color(s).setAlpha(o).toRgba()),e.addColorStop(a,s)}return e}}}),ev.util.object.extend(ev.Gradient,{fromElement:function(t,e,i,r){var n=parseFloat(i)/(/%$/.test(i)?100:1);isNaN(n=n<0?0:n>1?1:n)&&(n=1);var s,o,a,h,l=t.getElementsByTagName("stop"),c="userSpaceOnUse"===t.getAttribute("gradientUnits")?"pixels":"percentage",u=t.getAttribute("gradientTransform")||"",f=[],d=0,g=0;for("linearGradient"===t.nodeName||"LINEARGRADIENT"===t.nodeName?(s="linear",o={x1:t.getAttribute("x1")||0,y1:t.getAttribute("y1")||0,x2:t.getAttribute("x2")||"100%",y2:t.getAttribute("y2")||0}):(s="radial",o={x1:t.getAttribute("fx")||t.getAttribute("cx")||"50%",y1:t.getAttribute("fy")||t.getAttribute("cy")||"50%",r1:0,x2:t.getAttribute("cx")||"50%",y2:t.getAttribute("cy")||"50%",r2:t.getAttribute("r")||"50%"}),a=l.length;a--;)f.push(function(t,e){var i,r,n,s,o=t.getAttribute("style"),a=t.getAttribute("offset")||0;if(a=(a=parseFloat(a)/(/%$/.test(a)?100:1))<0?0:a>1?1:a,o){var h=o.split(/\s*;\s*/);for(""===h[h.length-1]&&h.pop(),s=h.length;s--;){var l=h[s].split(/\s*:\s*/),c=l[0].trim(),u=l[1].trim();"stop-color"===c?i=u:"stop-opacity"===c&&(n=u)}}return i||(i=t.getAttribute("stop-color")||"rgb(0,0,0)"),n||(n=t.getAttribute("stop-opacity")),r=(i=new ev.Color(i)).getAlpha(),n=(isNaN(parseFloat(n))?1:parseFloat(n))*(r*e),{offset:a,color:i.toRgb(),opacity:n}}(l[a],n));return h=ev.parseTransformAttribute(u),function(t,e,i,r){var n,s;Object.keys(e).forEach(function(t){"Infinity"===(n=e[t])?s=1:"-Infinity"===n?s=0:(s=parseFloat(e[t],10),"string"==typeof n&&/^(\d+\.\d+)%|(\d+)%$/.test(n)&&(s*=.01,"pixels"===r&&("x1"!==t&&"x2"!==t&&"r2"!==t||(s*=i.viewBoxWidth||i.width),"y1"!==t&&"y2"!==t||(s*=i.viewBoxHeight||i.height)))),e[t]=s})}(0,o,r,c),"pixels"===c&&(d=-e.left,g=-e.top),new ev.Gradient({id:t.getAttribute("id"),type:s,coords:o,colorStops:f,gradientUnits:c,gradientTransform:h,offsetX:d,offsetY:g})}}),ec=ev.util.toFixed,ev.Pattern=ev.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(t,e){if(t||(t={}),this.id=ev.Object.__uid++,this.setOptions(t),!t.source||t.source&&"string"!=typeof t.source)e&&e(this);else{var i=this;this.source=ev.util.createImage(),ev.util.loadImage(t.source,function(t,r){i.source=t,e&&e(i,r)},null,this.crossOrigin)}},toObject:function(t){var e,i,r=ev.Object.NUM_FRACTION_DIGITS;return"string"==typeof this.source.src?e=this.source.src:"object"==typeof this.source&&this.source.toDataURL&&(e=this.source.toDataURL()),i={type:"pattern",source:e,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:ec(this.offsetX,r),offsetY:ec(this.offsetY,r),patternTransform:this.patternTransform?this.patternTransform.concat():null},ev.util.populateWithProperties(this,i,t),i},toSVG:function(t){var e="function"==typeof this.source?this.source():this.source,i=e.width/t.width,r=e.height/t.height,n=this.offsetX/t.width,s=this.offsetY/t.height,o="";return"repeat-x"!==this.repeat&&"no-repeat"!==this.repeat||(r=1,s&&(r+=Math.abs(s))),"repeat-y"!==this.repeat&&"no-repeat"!==this.repeat||(i=1,n&&(i+=Math.abs(n))),e.src?o=e.src:e.toDataURL&&(o=e.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+n+'" y="'+s+'" width="'+i+'" height="'+r+'">\n<image x="0" y="0" width="'+e.width+'" height="'+e.height+'" xlink:href="'+o+'"></image>\n</pattern>\n'},setOptions:function(t){for(var e in t)this[e]=t[e]},toLive:function(t){var e=this.source;return e&&(void 0===e.src||e.complete&&0!==e.naturalWidth&&0!==e.naturalHeight)?t.createPattern(e,this.repeat):""}}),a=(o=t.fabric||(t.fabric={})).util.toFixed,o.Shadow?o.warn("fabric.Shadow is already defined."):(o.Shadow=o.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(t){for(var e in"string"==typeof t&&(t=this._parseShadow(t)),t)this[e]=t[e];this.id=o.Object.__uid++},_parseShadow:function(t){var e=t.trim(),i=o.Shadow.reOffsetsAndBlur.exec(e)||[];return{color:(e.replace(o.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)").trim(),offsetX:parseFloat(i[1],10)||0,offsetY:parseFloat(i[2],10)||0,blur:parseFloat(i[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(t){var e=40,i=40,r=o.Object.NUM_FRACTION_DIGITS,n=o.util.rotateVector({x:this.offsetX,y:this.offsetY},o.util.degreesToRadians(-t.angle)),s=new o.Color(this.color);return t.width&&t.height&&(e=100*a((Math.abs(n.x)+this.blur)/t.width,r)+20,i=100*a((Math.abs(n.y)+this.blur)/t.height,r)+20),t.flipX&&(n.x*=-1),t.flipY&&(n.y*=-1),'<filter id="SVGID_'+this.id+'" y="-'+i+'%" height="'+(100+2*i)+'%" x="-'+e+'%" width="'+(100+2*e)+'%" >\n	<feGaussianBlur in="SourceAlpha" stdDeviation="'+a(this.blur?this.blur/2:0,r)+'"></feGaussianBlur>\n	<feOffset dx="'+a(n.x,r)+'" dy="'+a(n.y,r)+'" result="oBlur" ></feOffset>\n	<feFlood flood-color="'+s.toRgb()+'" flood-opacity="'+s.getAlpha()+'"/>\n	<feComposite in2="oBlur" operator="in" />\n	<feMerge>\n		<feMergeNode></feMergeNode>\n		<feMergeNode in="SourceGraphic"></feMergeNode>\n	</feMerge>\n</filter>\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 t={},e=o.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke","nonScaling"].forEach(function(i){this[i]!==e[i]&&(t[i]=this[i])},this),t}}),o.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/),function(){if(ev.StaticCanvas)ev.warn("fabric.StaticCanvas is already defined.");else{var t=ev.util.object.extend,e=ev.util.getElementOffset,i=ev.util.removeFromArray,r=ev.util.toFixed,n=ev.util.transformPoint,s=ev.util.invertTransform,o=ev.util.getNodeCanvas,a=ev.util.createCanvasElement,h=Error("Could not initialize `canvas` element");ev.StaticCanvas=ev.util.createClass(ev.CommonMethods,{initialize:function(t,e){e||(e={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:ev.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(t,e){var i=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(t),this._initOptions(e),this.interactive||this._initRetinaScaling(),e.overlayImage&&this.setOverlayImage(e.overlayImage,i),e.backgroundImage&&this.setBackgroundImage(e.backgroundImage,i),e.backgroundColor&&this.setBackgroundColor(e.backgroundColor,i),e.overlayColor&&this.setOverlayColor(e.overlayColor,i),this.calcOffset()},_isRetinaScaling:function(){return ev.devicePixelRatio>1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?Math.max(1,ev.devicePixelRatio):1},_initRetinaScaling:function(){if(this._isRetinaScaling()){var t=ev.devicePixelRatio;this.__initRetinaScaling(t,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(t,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(t,e,i){e.setAttribute("width",this.width*t),e.setAttribute("height",this.height*t),i.scale(t,t)},calcOffset:function(){return this._offset=e(this.lowerCanvasEl),this},setOverlayImage:function(t,e,i){return this.__setBgOverlayImage("overlayImage",t,e,i)},setBackgroundImage:function(t,e,i){return this.__setBgOverlayImage("backgroundImage",t,e,i)},setOverlayColor:function(t,e){return this.__setBgOverlayColor("overlayColor",t,e)},setBackgroundColor:function(t,e){return this.__setBgOverlayColor("backgroundColor",t,e)},__setBgOverlayImage:function(t,e,i,r){return"string"==typeof e?ev.util.loadImage(e,function(e,n){if(e){var s=new ev.Image(e,r);this[t]=s,s.canvas=this}i&&i(e,n)},this,r&&r.crossOrigin):(r&&e.setOptions(r),this[t]=e,e&&(e.canvas=this),i&&i(e,!1)),this},__setBgOverlayColor:function(t,e,i){return this[t]=e,this._initGradient(e,t),this._initPattern(e,t,i),this},_createCanvasElement:function(){var t=a();if(!t||(t.style||(t.style={}),void 0===t.getContext))throw h;return t},_initOptions:function(t){var e=this.lowerCanvasEl;this._setOptions(t),this.width=this.width||parseInt(e.width,10)||0,this.height=this.height||parseInt(e.height,10)||0,this.lowerCanvasEl.style&&(e.width=this.width,e.height=this.height,e.style.width=this.width+"px",e.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(t){t&&t.getContext?this.lowerCanvasEl=t:this.lowerCanvasEl=ev.util.getById(t)||this._createCanvasElement(),ev.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(t,e){return this.setDimensions({width:t},e)},setHeight:function(t,e){return this.setDimensions({height:t},e)},setDimensions:function(t,e){var i;for(var r in e=e||{},t)i=t[r],e.cssOnly||(this._setBackstoreDimension(r,t[r]),i+="px",this.hasLostContext=!0),e.backstoreOnly||this._setCssDimension(r,i);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop),this._initRetinaScaling(),this.calcOffset(),e.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(t,e){return this.lowerCanvasEl[t]=e,this.upperCanvasEl&&(this.upperCanvasEl[t]=e),this.cacheCanvasEl&&(this.cacheCanvasEl[t]=e),this[t]=e,this},_setCssDimension:function(t,e){return this.lowerCanvasEl.style[t]=e,this.upperCanvasEl&&(this.upperCanvasEl.style[t]=e),this.wrapperEl&&(this.wrapperEl.style[t]=e),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(t){var e,i,r,n=this._activeObject,s=this.backgroundImage,o=this.overlayImage;for(this.viewportTransform=t,i=0,r=this._objects.length;i<r;i++)(e=this._objects[i]).group||e.setCoords(!0);return n&&n.setCoords(),s&&s.setCoords(!0),o&&o.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(t,e){var i=t,r=this.viewportTransform.slice(0);t=n(t,s(this.viewportTransform)),r[0]=e,r[3]=e;var o=n(t,r);return r[4]+=i.x-o.x,r[5]+=i.y-o.y,this.setViewportTransform(r)},setZoom:function(t){return this.zoomToPoint(new ev.Point(0,0),t),this},absolutePan:function(t){var e=this.viewportTransform.slice(0);return e[4]=-t.x,e[5]=-t.y,this.setViewportTransform(e)},relativePan:function(t){return this.absolutePan(new ev.Point(-t.x-this.viewportTransform[4],-t.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(t){this.stateful&&t.setupState(),t._set("canvas",this),t.setCoords(),this.fire("object:added",{target:t}),t.fire("added")},_onObjectRemoved:function(t){this.fire("object:removed",{target:t}),t.fire("removed"),delete t.canvas},clearContext:function(t){return t.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 t=this.contextContainer;return this.renderCanvas(t,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=ev.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var t={},e=this.width,i=this.height,r=s(this.viewportTransform);return t.tl=n({x:0,y:0},r),t.br=n({x:e,y:i},r),t.tr=new ev.Point(t.br.x,t.tl.y),t.bl=new ev.Point(t.tl.x,t.br.y),this.vptCoords=t,t},cancelRequestedRender:function(){this.isRendering&&(ev.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(t,e){var i=this.viewportTransform,r=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(t),ev.util.setImageSmoothing(t,this.imageSmoothingEnabled),this.fire("before:render",{ctx:t}),this._renderBackground(t),t.save(),t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this._renderObjects(t,e),t.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),r&&(r.canvas=this,r.shouldCache(),r._transformDone=!0,r.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(t)),this._renderOverlay(t),this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),this.fire("after:render",{ctx:t})},drawClipPathOnCanvas:function(t){var e=this.viewportTransform,i=this.clipPath;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t.globalCompositeOperation="destination-in",i.transform(t),t.scale(1/i.zoomX,1/i.zoomY),t.drawImage(i._cacheCanvas,-i.cacheTranslationX,-i.cacheTranslationY),t.restore()},_renderObjects:function(t,e){var i,r;for(i=0,r=e.length;i<r;++i)e[i]&&e[i].render(t)},_renderBackgroundOrOverlay:function(t,e){var i=this[e+"Color"],r=this[e+"Image"],n=this.viewportTransform,s=this[e+"Vpt"];if(i||r){if(i){t.save(),t.beginPath(),t.moveTo(0,0),t.lineTo(this.width,0),t.lineTo(this.width,this.height),t.lineTo(0,this.height),t.closePath(),t.fillStyle=i.toLive?i.toLive(t,this):i,s&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),t.transform(1,0,0,1,i.offsetX||0,i.offsetY||0);var o=i.gradientTransform||i.patternTransform;o&&t.transform(o[0],o[1],o[2],o[3],o[4],o[5]),t.fill(),t.restore()}r&&(t.save(),s&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),r.render(t),t.restore())}},_renderBackground:function(t){this._renderBackgroundOrOverlay(t,"background")},_renderOverlay:function(t){this._renderBackgroundOrOverlay(t,"overlay")},getCenter:function(){return{top:this.height/2,left:this.width/2}},getCenterPoint:function(){return new ev.Point(this.width/2,this.height/2)},centerObjectH:function(t){return this._centerObject(t,new ev.Point(this.getCenterPoint().x,t.getCenterPoint().y))},centerObjectV:function(t){return this._centerObject(t,new ev.Point(t.getCenterPoint().x,this.getCenterPoint().y))},centerObject:function(t){var e=this.getCenterPoint();return this._centerObject(t,e)},viewportCenterObject:function(t){var e=this.getVpCenter();return this._centerObject(t,e)},viewportCenterObjectH:function(t){var e=this.getVpCenter();return this._centerObject(t,new ev.Point(e.x,t.getCenterPoint().y)),this},viewportCenterObjectV:function(t){var e=this.getVpCenter();return this._centerObject(t,new ev.Point(t.getCenterPoint().x,e.y))},getVpCenter:function(){return n(this.getCenterPoint(),s(this.viewportTransform))},_centerObject:function(t,e){return t.setPositionByOrigin(e,"center","center"),t.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(t){return this.toDatalessObject(t)},toObject:function(t){return this._toObjectMethod("toObject",t)},toDatalessObject:function(t){return this._toObjectMethod("toDatalessObject",t)},_toObjectMethod:function(e,i){var r=this.clipPath,n={version:ev.version,objects:this._toObjects(e,i)};return r&&!r.excludeFromExport&&(n.clipPath=this._toObject(this.clipPath,e,i)),t(n,this.__serializeBgOverlay(e,i)),ev.util.populateWithProperties(this,n,i),n},_toObjects:function(t,e){return this._objects.filter(function(t){return!t.excludeFromExport}).map(function(i){return this._toObject(i,t,e)},this)},_toObject:function(t,e,i){this.includeDefaultValues||(r=t.includeDefaultValues,t.includeDefaultValues=!1);var r,n=t[e](i);return this.includeDefaultValues||(t.includeDefaultValues=r),n},__serializeBgOverlay:function(t,e){var i={},r=this.backgroundImage,n=this.overlayImage,s=this.backgroundColor,o=this.overlayColor;return s&&s.toObject?s.excludeFromExport||(i.background=s.toObject(e)):s&&(i.background=s),o&&o.toObject?o.excludeFromExport||(i.overlay=o.toObject(e)):o&&(i.overlay=o),r&&!r.excludeFromExport&&(i.backgroundImage=this._toObject(r,t,e)),n&&!n.excludeFromExport&&(i.overlayImage=this._toObject(n,t,e)),i},svgViewportTransformation:!0,toSVG:function(t,e){t||(t={}),t.reviver=e;var i=[];return this._setSVGPreamble(i,t),this._setSVGHeader(i,t),this.clipPath&&i.push('<g clip-path="url(#'+this.clipPath.clipPathId+')" >\n'),this._setSVGBgOverlayColor(i,"background"),this._setSVGBgOverlayImage(i,"backgroundImage",e),this._setSVGObjects(i,e),this.clipPath&&i.push("</g>\n"),this._setSVGBgOverlayColor(i,"overlay"),this._setSVGBgOverlayImage(i,"overlayImage",e),i.push("</svg>"),i.join("")},_setSVGPreamble:function(t,e){e.suppressPreamble||t.push('<?xml version="1.0" encoding="',e.encoding||"UTF-8",'" standalone="no" ?>\n','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ','"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')},_setSVGHeader:function(t,e){var i,n=e.width||this.width,s=e.height||this.height,o='viewBox="0 0 '+this.width+" "+this.height+'" ',a=ev.Object.NUM_FRACTION_DIGITS;e.viewBox?o='viewBox="'+e.viewBox.x+" "+e.viewBox.y+" "+e.viewBox.width+" "+e.viewBox.height+'" ':this.svgViewportTransformation&&(o='viewBox="'+r(-(i=this.viewportTransform)[4]/i[0],a)+" "+r(-i[5]/i[3],a)+" "+r(this.width/i[0],a)+" "+r(this.height/i[3],a)+'" '),t.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',n,'" ','height="',s,'" ',o,'xml:space="preserve">\n',"<desc>Created with Fabric.js ",ev.version,"</desc>\n","<defs>\n",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(e),"</defs>\n")},createSVGClipPathMarkup:function(t){var e=this.clipPath;return e?(e.clipPathId="CLIPPATH_"+ev.Object.__uid++,'<clipPath id="'+e.clipPathId+'" >\n'+this.clipPath.toClipPathSVG(t.reviver)+"</clipPath>\n"):""},createSVGRefElementsMarkup:function(){var t=this;return["background","overlay"].map(function(e){var i=t[e+"Color"];if(i&&i.toLive){var r=t[e+"Vpt"],n=t.viewportTransform,s={width:t.width/(r?n[0]:1),height:t.height/(r?n[3]:1)};return i.toSVG(s,{additionalTransform:r?ev.util.matrixToSVG(n):""})}}).join("")},createSVGFontFacesMarkup:function(){var t,e,i,r,n,s,o,a,h="",l={},c=ev.fontPaths,u=[];for(this._objects.forEach(function t(e){u.push(e),e._objects&&e._objects.forEach(t)}),o=0,a=u.length;o<a;o++)if(e=(t=u[o]).fontFamily,-1!==t.type.indexOf("text")&&!l[e]&&c[e]&&(l[e]=!0,t.styles))for(n in i=t.styles)for(s in r=i[n])!l[e=r[s].fontFamily]&&c[e]&&(l[e]=!0);for(var f in l)h+=["		@font-face {\n","			font-family: '",f,"';\n","			src: url('",c[f],"');\n","		}\n"].join("");return h&&(h=['	<style type="text/css">',"<![CDATA[\n",h,"]]>","</style>\n"].join("")),h},_setSVGObjects:function(t,e){var i,r,n,s=this._objects;for(r=0,n=s.length;r<n;r++)(i=s[r]).excludeFromExport||this._setSVGObject(t,i,e)},_setSVGObject:function(t,e,i){t.push(e.toSVG(i))},_setSVGBgOverlayImage:function(t,e,i){this[e]&&!this[e].excludeFromExport&&this[e].toSVG&&t.push(this[e].toSVG(i))},_setSVGBgOverlayColor:function(t,e){var i=this[e+"Color"],r=this.viewportTransform,n=this.width,s=this.height;if(i){if(i.toLive){var o=i.repeat,a=ev.util.invertTransform(r),h=this[e+"Vpt"]?ev.util.matrixToSVG(a):"";t.push('<rect transform="'+h+" translate(",n/2,",",s/2,')"',' x="',i.offsetX-n/2,'" y="',i.offsetY-s/2,'" ','width="',"repeat-y"===o||"no-repeat"===o?i.source.width:n,'" height="',"repeat-x"===o||"no-repeat"===o?i.source.height:s,'" fill="url(#SVGID_'+i.id+')"',"></rect>\n")}else t.push('<rect x="0" y="0" width="100%" height="100%" ','fill="',i,'"',"></rect>\n")}},sendToBack:function(t){if(!t)return this;var e,r,n,s=this._activeObject;if(t===s&&"activeSelection"===t.type)for(e=(n=s._objects).length;e--;)r=n[e],i(this._objects,r),this._objects.unshift(r);else i(this._objects,t),this._objects.unshift(t);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(t){if(!t)return this;var e,r,n,s=this._activeObject;if(t===s&&"activeSelection"===t.type)for(n=s._objects,e=0;e<n.length;e++)r=n[e],i(this._objects,r),this._objects.push(r);else i(this._objects,t),this._objects.push(t);return this.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(t,e){if(!t)return this;var r,n,s,o,a,h=this._activeObject,l=0;if(t===h&&"activeSelection"===t.type)for(a=h._objects,r=0;r<a.length;r++)n=a[r],(s=this._objects.indexOf(n))>0+l&&(o=s-1,i(this._objects,n),this._objects.splice(o,0,n)),l++;else 0!==(s=this._objects.indexOf(t))&&(o=this._findNewLowerIndex(t,s,e),i(this._objects,t),this._objects.splice(o,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(t,e,i){var r,n;if(i){for(r=e,n=e-1;n>=0;--n)if(t.intersectsWithObject(this._objects[n])||t.isContainedWithinObject(this._objects[n])||this._objects[n].isContainedWithinObject(t)){r=n;break}}else r=e-1;return r},bringForward:function(t,e){if(!t)return this;var r,n,s,o,a,h=this._activeObject,l=0;if(t===h&&"activeSelection"===t.type)for(r=(a=h._objects).length;r--;)n=a[r],(s=this._objects.indexOf(n))<this._objects.length-1-l&&(o=s+1,i(this._objects,n),this._objects.splice(o,0,n)),l++;else(s=this._objects.indexOf(t))!==this._objects.length-1&&(o=this._findNewUpperIndex(t,s,e),i(this._objects,t),this._objects.splice(o,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this}
vendor: 13,826 bytes, line 1
1,_findNewUpperIndex:function(t,e,i){var r,n,s;if(i){for(r=e,n=e+1,s=this._objects.length;n<s;++n)if(t.intersectsWithObject(this._objects[n])||t.isContainedWithinObject(this._objects[n])||this._objects[n].isContainedWithinObject(t)){r=n;break}}else r=e+1;return r},moveTo:function(t,e){return i(this._objects,t),this._objects.splice(e,0,t),this.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&(ev.util.cancelAnimFrame(this.isRendering),this.isRendering=0),this.forEachObject(function(t){t.dispose&&t.dispose()}),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,this.lowerCanvasEl.classList.remove("lower-canvas"),ev.util.setStyle(this.lowerCanvasEl,this._originalCanvasStyle),delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute("width",this.width),this.lowerCanvasEl.setAttribute("height",this.height),ev.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this._objects.length+" }>"}}),t(ev.StaticCanvas.prototype,ev.Observable),t(ev.StaticCanvas.prototype,ev.Collection),t(ev.StaticCanvas.prototype,ev.DataURLExporter),t(ev.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(t){var e=a();if(!e||!e.getContext)return null;var i=e.getContext("2d");return i&&"setLineDash"===t?void 0!==i.setLineDash:null}}),ev.StaticCanvas.prototype.toJSON=ev.StaticCanvas.prototype.toObject,ev.isLikelyNode&&(ev.StaticCanvas.prototype.createPNGStream=function(){var t=o(this.lowerCanvasEl);return t&&t.createPNGStream()},ev.StaticCanvas.prototype.createJPEGStream=function(t){var e=o(this.lowerCanvasEl);return e&&e.createJPEGStream(t)})}}(),ev.BaseBrush=ev.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(t){t.strokeStyle=this.color,t.lineWidth=this.width,t.lineCap=this.strokeLineCap,t.miterLimit=this.strokeMiterLimit,t.lineJoin=this.strokeLineJoin,t.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(t){var e=this.canvas.viewportTransform;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5])},_setShadow:function(){if(this.shadow){var t=this.canvas,e=this.shadow,i=t.contextTop,r=t.getZoom();t&&t._isRetinaScaling()&&(r*=ev.devicePixelRatio),i.shadowColor=e.color,i.shadowBlur=e.blur*r,i.shadowOffsetX=e.offsetX*r,i.shadowOffsetY=e.offsetY*r}},needsFullRender:function(){return 1>new ev.Color(this.color).getAlpha()||!!this.shadow},_resetShadow:function(){var t=this.canvas.contextTop;t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0},_isOutSideCanvas:function(t){return t.x<0||t.x>this.canvas.getWidth()||t.y<0||t.y>this.canvas.getHeight()}}),ev.PencilBrush=ev.util.createClass(ev.BaseBrush,{decimate:.4,drawStraightLine:!1,straightLineKey:"shiftKey",initialize:function(t){this.canvas=t,this._points=[]},needsFullRender:function(){return this.callSuper("needsFullRender")||this._hasStraightLine},_drawSegment:function(t,e,i){var r=e.midPointFrom(i);return t.quadraticCurveTo(e.x,e.y,r.x,r.y),r},onMouseDown:function(t,e){this.canvas._isMainEvent(e.e)&&(this.drawStraightLine=e.e[this.straightLineKey],this._prepareForDrawing(t),this._captureDrawingPath(t),this._render())},onMouseMove:function(t,e){if(this.canvas._isMainEvent(e.e)&&(this.drawStraightLine=e.e[this.straightLineKey],(!0!==this.limitedToCanvasSize||!this._isOutSideCanvas(t))&&this._captureDrawingPath(t)&&this._points.length>1)){if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{var i=this._points,r=i.length,n=this.canvas.contextTop;this._saveAndTransform(n),this.oldEnd&&(n.beginPath(),n.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=this._drawSegment(n,i[r-2],i[r-1],!0),n.stroke(),n.restore()}}},onMouseUp:function(t){return!this.canvas._isMainEvent(t.e)||(this.drawStraightLine=!1,this.oldEnd=void 0,this._finalizeAndAddPath(),!1)},_prepareForDrawing:function(t){var e=new ev.Point(t.x,t.y);this._reset(),this._addPoint(e),this.canvas.contextTop.moveTo(e.x,e.y)},_addPoint:function(t){return!(this._points.length>1&&t.eq(this._points[this._points.length-1])||(this.drawStraightLine&&this._points.length>1&&(this._hasStraightLine=!0,this._points.pop()),this._points.push(t),0))},_reset:function(){this._points=[],this._setBrushStyles(this.canvas.contextTop),this._setShadow(),this._hasStraightLine=!1},_captureDrawingPath:function(t){var e=new ev.Point(t.x,t.y);return this._addPoint(e)},_render:function(t){var e,i,r=this._points[0],n=this._points[1];if(t=t||this.canvas.contextTop,this._saveAndTransform(t),t.beginPath(),2===this._points.length&&r.x===n.x&&r.y===n.y){var s=this.width/1e3;r=new ev.Point(r.x,r.y),n=new ev.Point(n.x,n.y),r.x-=s,n.x+=s}for(t.moveTo(r.x,r.y),e=1,i=this._points.length;e<i;e++)this._drawSegment(t,r,n),r=this._points[e],n=this._points[e+1];t.lineTo(r.x,r.y),t.stroke(),t.restore()},convertPointsToSVGPath:function(t){var e=this.width/1e3;return ev.util.getSmoothPathFromPoints(t,e)},_isEmptySVGPath:function(t){return"M 0 0 Q 0 0 0 0 L 0 0"===ev.util.joinPath(t)},createPath:function(t){var e=new ev.Path(t,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray});return this.shadow&&(this.shadow.affectStroke=!0,e.shadow=new ev.Shadow(this.shadow)),e},decimatePoints:function(t,e){if(t.length<=2)return t;var i,r=Math.pow(e/this.canvas.getZoom(),2),n=t.length-1,s=t[0],o=[s];for(i=1;i<n-1;i++)Math.pow(s.x-t[i].x,2)+Math.pow(s.y-t[i].y,2)>=r&&o.push(s=t[i]);return o.push(t[n]),o},_finalizeAndAddPath:function(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var t=this.convertPointsToSVGPath(this._points);if(this._isEmptySVGPath(t))this.canvas.requestRenderAll();else{var e=this.createPath(t);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire("before:path:created",{path:e}),this.canvas.add(e),this.canvas.requestRenderAll(),e.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:e})}}}),ev.CircleBrush=ev.util.createClass(ev.BaseBrush,{width:10,initialize:function(t){this.canvas=t,this.points=[]},drawDot:function(t){var e=this.addPoint(t),i=this.canvas.contextTop;this._saveAndTransform(i),this.dot(i,e),i.restore()},dot:function(t,e){t.fillStyle=e.fill,t.beginPath(),t.arc(e.x,e.y,e.radius,0,2*Math.PI,!1),t.closePath(),t.fill()},onMouseDown:function(t){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(t)},_render:function(){var t,e,i=this.canvas.contextTop,r=this.points;for(this._saveAndTransform(i),t=0,e=r.length;t<e;t++)this.dot(i,r[t]);i.restore()},onMouseMove:function(t){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this.addPoint(t),this._render()):this.drawDot(t))},onMouseUp:function(){var t,e,i=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;var r=[];for(t=0,e=this.points.length;t<e;t++){var n=this.points[t],s=new ev.Circle({radius:n.radius,left:n.x,top:n.y,originX:"center",originY:"center",fill:n.fill});this.shadow&&(s.shadow=new ev.Shadow(this.shadow)),r.push(s)}var o=new ev.Group(r);o.canvas=this.canvas,this.canvas.fire("before:path:created",{path:o}),this.canvas.add(o),this.canvas.fire("path:created",{path:o}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=i,this.canvas.requestRenderAll()},addPoint:function(t){var e=new ev.Point(t.x,t.y),i=ev.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,r=new ev.Color(this.color).setAlpha(ev.util.getRandomInt(0,100)/100).toRgba();return e.radius=i,e.fill=r,this.points.push(e),e}}),ev.SprayBrush=ev.util.createClass(ev.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(t){this.canvas=t,this.sprayChunks=[]},onMouseDown:function(t){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(t),this.render(this.sprayChunkPoints)},onMouseMove:function(t){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||(this.addSprayChunk(t),this.render(this.sprayChunkPoints))},onMouseUp:function(){var t=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var e=[],i=0,r=this.sprayChunks.length;i<r;i++)for(var n=this.sprayChunks[i],s=0,o=n.length;s<o;s++){var a=new ev.Rect({width:n[s].width,height:n[s].width,left:n[s].x+1,top:n[s].y+1,originX:"center",originY:"center",fill:this.color});e.push(a)}this.optimizeOverlapping&&(e=this._getOptimizedRects(e));var h=new ev.Group(e);this.shadow&&h.set("shadow",new ev.Shadow(this.shadow)),this.canvas.fire("before:path:created",{path:h}),this.canvas.add(h),this.canvas.fire("path:created",{path:h}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=t,this.canvas.requestRenderAll()},_getOptimizedRects:function(t){var e,i,r,n={};for(i=0,r=t.length;i<r;i++)n[e=t[i].left+""+t[i].top]||(n[e]=t[i]);var s=[];for(e in n)s.push(n[e]);return s},render:function(t){var e,i,r=this.canvas.contextTop;for(r.fillStyle=this.color,this._saveAndTransform(r),e=0,i=t.length;e<i;e++){var n=t[e];void 0!==n.opacity&&(r.globalAlpha=n.opacity),r.fillRect(n.x,n.y,n.width,n.width)}r.restore()},_render:function(){var t,e,i=this.canvas.contextTop;for(i.fillStyle=this.color,this._saveAndTransform(i),t=0,e=this.sprayChunks.length;t<e;t++)this.render(this.sprayChunks[t]);i.restore()},addSprayChunk:function(t){this.sprayChunkPoints=[];var e,i,r,n,s=this.width/2;for(n=0;n<this.density;n++){e=ev.util.getRandomInt(t.x-s,t.x+s),i=ev.util.getRandomInt(t.y-s,t.y+s),r=this.dotWidthVariance?ev.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var o=new ev.Point(e,i);o.width=r,this.randomOpacity&&(o.opacity=ev.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(o)}this.sprayChunks.push(this.sprayChunkPoints)}}),ev.PatternBrush=ev.util.createClass(ev.PencilBrush,{getPatternSrc:function(){var t=ev.util.createCanvasElement(),e=t.getContext("2d");return t.width=t.height=25,e.fillStyle=this.color,e.beginPath(),e.arc(10,10,10,0,2*Math.PI,!1),e.closePath(),e.fill(),t},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.color",'"'+this.color+'"')},getPattern:function(t){return t.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(t){this.callSuper("_setBrushStyles",t),t.strokeStyle=this.getPattern(t)},createPath:function(t){var e=this.callSuper("createPath",t),i=e._getLeftTopCoords().scalarAdd(e.strokeWidth/2);return e.stroke=new ev.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-i.x,offsetY:-i.y}),e}}),function(){var t=ev.util.getPointer,e=ev.util.degreesToRadians,i=ev.util.isTouchEvent;for(var r in ev.Canvas=ev.util.createClass(ev.StaticCanvas,{initialize:function(t,e){e||(e={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e),this._initInteractive(),this._createCacheCanvas()},uniformScaling:!0,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",interactive:!0,selection:!0,selectionKey:"shiftKey",altSelectionKey:null,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",notAllowedCursor:"not-allowed",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,targets:[],enablePointerEvents:!1,_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=ev.PencilBrush&&new ev.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var t,e,i,r=this.getActiveObjects();if(r.length>0&&!this.preserveObjectStacking){e=[],i=[];for(var n=0,s=this._objects.length;n<s;n++)t=this._objects[n],-1===r.indexOf(t)?e.push(t):i.push(t);r.length>1&&(this._activeObject._objects=i),e.push.apply(e,i)}else e=this._objects;return e},renderAll:function(){!this.contextTopDirty||this._groupSelector||this.isDrawingMode||(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&(this.renderTopLayer(this.contextTop),this.hasLostContext=!1);var t=this.contextContainer;return this.renderCanvas(t,this._chooseObjectsToRender()),this},renderTopLayer:function(t){t.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(t),this.contextTopDirty=!0),t.restore()},renderTop:function(){var t=this.contextTop;return this.clearContext(t),this.renderTopLayer(t),this.fire("after:render"),this},_normalizePointer:function(t,e){var i=t.calcTransformMatrix(),r=ev.util.invertTransform(i),n=this.restorePointerVpt(e);return ev.util.transformPoint(n,r)}
vendor: 3,721 bytes, line 1
1,isTargetTransparent:function(t,e,i){if(t.shouldCache()&&t._cacheCanvas&&t!==this._activeObject){var r=this._normalizePointer(t,{x:e,y:i}),n=Math.max(t.cacheTranslationX+r.x*t.zoomX,0),s=Math.max(t.cacheTranslationY+r.y*t.zoomY,0);return ev.util.isTransparent(t._cacheContext,Math.round(n),Math.round(s),this.targetFindTolerance)}var o=this.contextCache,a=t.selectionBackgroundColor,h=this.viewportTransform;return t.selectionBackgroundColor="",this.clearContext(o),o.save(),o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),t.render(o),o.restore(),t.selectionBackgroundColor=a,ev.util.isTransparent(o,e,i,this.targetFindTolerance)},_isSelectionKeyPressed:function(t){return Array.isArray(this.selectionKey)?!!this.selectionKey.find(function(e){return!0===t[e]}):t[this.selectionKey]},_shouldClearSelection:function(t,e){var i=this.getActiveObjects(),r=this._activeObject;return!e||e&&r&&i.length>1&&-1===i.indexOf(e)&&r!==e&&!this._isSelectionKeyPressed(t)||e&&!e.evented||e&&!e.selectable&&r&&r!==e},_shouldCenterTransform:function(t,e,i){var r;if(t)return"scale"===e||"scaleX"===e||"scaleY"===e||"resizing"===e?r=this.centeredScaling||t.centeredScaling:"rotate"===e&&(r=this.centeredRotation||t.centeredRotation),r?!i:i},_getOriginFromCorner:function(t,e){var i={x:t.originX,y:t.originY};return"ml"===e||"tl"===e||"bl"===e?i.x="right":"mr"!==e&&"tr"!==e&&"br"!==e||(i.x="left"),"tl"===e||"mt"===e||"tr"===e?i.y="bottom":"bl"!==e&&"mb"!==e&&"br"!==e||(i.y="top"),i},_getActionFromCorner:function(t,e,i,r){if(!e||!t)return"drag";var n=r.controls[e];return n.getActionName(i,n,r)},_setupCurrentTransform:function(t,i,r){if(i){var n=this.getPointer(t),s=i.__corner,o=i.controls[s],a=r&&s?o.getActionHandler(t,i,o):ev.controlsUtils.dragHandler,h=this._getActionFromCorner(r,s,t,i),l=this._getOriginFromCorner(i,s),c=t[this.centeredKey],u={target:i,action:h,actionHandler:a,corner:s,scaleX:i.scaleX,scaleY:i.scaleY,skewX:i.skewX,skewY:i.skewY,offsetX:n.x-i.left,offsetY:n.y-i.top,originX:l.x,originY:l.y,ex:n.x,ey:n.y,lastX:n.x,lastY:n.y,theta:e(i.angle),width:i.width*i.scaleX,shiftKey:t.shiftKey,altKey:c,original:ev.util.saveObjectTransform(i)};this._shouldCenterTransform(i,h,c)&&(u.originX="center",u.originY="center"),u.original.originX=l.x,u.original.originY=l.y,this._currentTransform=u,this._beforeTransform(t)}},setCursor:function(t){this.upperCanvasEl.style.cursor=t},_drawSelection:function(t){var e=this._groupSelector,i=new ev.Point(e.ex,e.ey),r=ev.util.transformPoint(i,this.viewportTransform),n=new ev.Point(e.ex+e.left,e.ey+e.top),s=ev.util.transformPoint(n,this.viewportTransform),o=Math.min(r.x,s.x),a=Math.min(r.y,s.y),h=Math.max(r.x,s.x),l=Math.max(r.y,s.y),c=this.selectionLineWidth/2;this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(o,a,h-o,l-a)),this.selectionLineWidth&&this.selectionBorderColor&&(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,o+=c,a+=c,h-=c,l-=c,ev.Object.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(o,a,h-o,l-a))},findTarget:function(t,e){if(!this.skipTargetFind){var r,n,s=this.getPointer(t,!0),o=this._activeObject,a=this.getActiveObjects(),h=i(t),l=a.length>1&&!e||1===a.length;if(this.targets=[],l&&o._findTargetCorner(s,h)||a.length>1&&!e&&o===this._searchPossibleTargets([o],s))return o;if(1===a.length&&o===this._searchPossibleTargets([o],s)){if(!this.preserveObjectStacking)return o;r=o,n=this.targets,this.targets=[]}var c=this._searchPossibleTargets(this._objects,s);return t[this.altSelectionKey]&&c&&r&&c!==r&&(c=r,this.targets=n),c}},_checkTarget:function(t,e,i){if(e&&e.visible&&e.evented&&e.containsPoint(t)&&(!this.perPixelTargetFind&&!e.perPixelTargetFind||e.isEditing||!this.isTargetTransparent
vendor: 2,402 bytes, line 1
1(e,i.x,i.y)))return!0},_searchPossibleTargets:function(t,e){for(var i,r,n=t.length;n--;){var s=t[n],o=s.group?this._normalizePointer(s.group,e):e;if(this._checkTarget(o,s,e)){(i=t[n]).subTargetCheck&&i instanceof ev.Group&&(r=this._searchPossibleTargets(i._objects,e))&&this.targets.push(r);break}}return i},restorePointerVpt:function(t){return ev.util.transformPoint(t,ev.util.invertTransform(this.viewportTransform))},getPointer:function(e,i){if(this._absolutePointer&&!i)return this._absolutePointer;if(this._pointer&&i)return this._pointer;var r,n=t(e),s=this.upperCanvasEl,o=s.getBoundingClientRect(),a=o.width||0,h=o.height||0;a&&h||("top"in o&&"bottom"in o&&(h=Math.abs(o.top-o.bottom)),"right"in o&&"left"in o&&(a=Math.abs(o.right-o.left))),this.calcOffset(),n.x=n.x-this._offset.left,n.y=n.y-this._offset.top,i||(n=this.restorePointerVpt(n));var l=this.getRetinaScaling();return 1!==l&&(n.x/=l,n.y/=l),r=0===a||0===h?{width:1,height:1}:{width:s.width/a,height:s.height/h},{x:n.x*r.width,y:n.y*r.height}},_createUpperCanvas:function(){var t=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,""),e=this.lowerCanvasEl,i=this.upperCanvasEl;i?i.className="":(i=this._createCanvasElement(),this.upperCanvasEl=i),ev.util.addClass(i,"upper-canvas "+t),this.wrapperEl.appendChild(i),this._copyCanvasStyle(e,i),this._applyCanvasStyle(i),this.contextTop=i.getContext("2d")},getTopContext:function(){return this.contextTop},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute("width",this.width),this.cacheCanvasEl.setAttribute("height",this.height),this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=ev.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),ev.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),ev.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.width||t.width,i=this.height||t.height;ev.util.setStyle(t,{position:"absolute",width:e+"px",height:i+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none","-ms-touch-action":this.allowTouchScrolling?"manipulation":"none"}),t.width=e,t.height=i,ev.util.makeElementUnselectable(t)},_copyCanvasStyle:function(t,e){e.style.cssText=t.style.cssText},getSelectionContext:function(){return this.contextTop}
vendor: 28,948 bytes, line 1
1,getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var t=this._activeObject;return t?"activeSelection"===t.type&&t._objects?t._objects.slice(0):[t]:[]},_onObjectRemoved:function(t){t===this._activeObject&&(this.fire("before:selection:cleared",{target:t}),this._discardActiveObject(),this.fire("selection:cleared",{target:t}),t.fire("deselected")),t===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper("_onObjectRemoved",t)},_fireSelectionEvents:function(t,e){var i=!1,r=this.getActiveObjects(),n=[],s=[];t.forEach(function(t){-1===r.indexOf(t)&&(i=!0,t.fire("deselected",{e:e,target:t}),s.push(t))}),r.forEach(function(r){-1===t.indexOf(r)&&(i=!0,r.fire("selected",{e:e,target:r}),n.push(r))}),t.length>0&&r.length>0?i&&this.fire("selection:updated",{e:e,selected:n,deselected:s}):r.length>0?this.fire("selection:created",{e:e,selected:n}):t.length>0&&this.fire("selection:cleared",{e:e,deselected:s})},setActiveObject:function(t,e){var i=this.getActiveObjects();return this._setActiveObject(t,e),this._fireSelectionEvents(i,e),this},_setActiveObject:function(t,e){return this._activeObject!==t&&!!this._discardActiveObject(e,t)&&!t.onSelect({e:e})&&(this._activeObject=t,!0)},_discardActiveObject:function(t,e){var i=this._activeObject;if(i){if(i.onDeselect({e:t,object:e}))return!1;this._activeObject=null}return!0},discardActiveObject:function(t){var e=this.getActiveObjects(),i=this.getActiveObject();return e.length&&this.fire("before:selection:cleared",{target:i,e:t}),this._discardActiveObject(t),this._fireSelectionEvents(e,t),this},dispose:function(){var t=this.wrapperEl;return this.removeListeners(),t.removeChild(this.upperCanvasEl),t.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach((function(t){ev.util.cleanUpJsdomNode(this[t]),this[t]=void 0}).bind(this)),t.parentNode&&t.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,ev.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(t){var e=this._activeObject;e&&e._renderControls(t)},_toObject:function(t,e,i){var r=this._realizeGroupTransformOnObject(t),n=this.callSuper("_toObject",t,e,i);return this._unwindGroupTransformOnObject(t,r),n},_realizeGroupTransformOnObject:function(t){if(t.group&&"activeSelection"===t.group.type&&this._activeObject===t.group){var e={};return["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"].forEach(function(i){e[i]=t[i]}),ev.util.addTransformToObject(t,this._activeObject.calcOwnMatrix()),e}return null},_unwindGroupTransformOnObject:function(t,e){e&&t.set(e)},_setSVGObject:function(t,e,i){var r=this._realizeGroupTransformOnObject(e);this.callSuper("_setSVGObject",t,e,i),this._unwindGroupTransformOnObject(e,r)},setViewportTransform:function(t){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),ev.StaticCanvas.prototype.setViewportTransform.call(this,t)}}),ev.StaticCanvas)"prototype"!==r&&(ev.Canvas[r]=ev.StaticCanvas[r])}(),function(){var t=ev.util.addListener,e=ev.util.removeListener,i={passive:!1};function r(t,e){return t.button&&t.button===e-1}ev.util.object.extend(ev.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(t,"add")},_getEventPrefix:function(){return this.enablePointerEvents?"pointer":"mouse"},addOrRemove:function(t,e){var r=this.upperCanvasEl,n=this._getEventPrefix();t(ev.window,"resize",this._onResize),t(r,n+"down",this._onMouseDown),t(r,n+"move",this._onMouseMove,i),t(r,n+"out",this._onMouseOut),t(r,n+"enter",this._onMouseEnter),t(r,"wheel",this._onMouseWheel),t(r,"contextmenu",this._onContextMenu),t(r,"dblclick",this._onDoubleClick),t(r,"dragover",this._onDragOver),t(r,"dragenter",this._onDragEnter),t(r,"dragleave",this._onDragLeave),t(r,"drop",this._onDrop),this.enablePointerEvents||t(r,"touchstart",this._onTouchStart,i),"undefined"!=typeof eventjs&&e in eventjs&&(eventjs[e](r,"gesture",this._onGesture),eventjs[e](r,"drag",this._onDrag),eventjs[e](r,"orientation",this._onOrientationChange),eventjs[e](r,"shake",this._onShake),eventjs[e](r,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(e,"remove");var t=this._getEventPrefix();e(ev.document,t+"up",this._onMouseUp),e(ev.document,"touchend",this._onTouchEnd,i),e(ev.document,t+"move",this._onMouseMove,i),e(ev.document,"touchmove",this._onMouseMove,i)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,"dragenter"),this._onDragLeave=this._simpleEventHandler.bind(this,"dragleave"),this._onDrop=this._onDrop.bind(this),this.eventsBound=!0)},_onGesture:function(t,e){this.__onTransformGesture&&this.__onTransformGesture(t,e)},_onDrag:function(t,e){this.__onDrag&&this.__onDrag(t,e)},_onMouseWheel:function(t){this.__onMouseWheel(t)},_onMouseOut:function(t){var e=this._hoveredTarget;this.fire("mouse:out",{target:e,e:t}),this._hoveredTarget=null,e&&e.fire("mouseout",{e:t});var i=this;this._hoveredTargets.forEach(function(r){i.fire("mouse:out",{target:e,e:t}),r&&e.fire("mouseout",{e:t})}),this._hoveredTargets=[]},_onMouseEnter:function(t){this._currentTransform||this.findTarget(t)||(this.fire("mouse:over",{target:null,e:t}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(t,e){this.__onOrientationChange&&this.__onOrientationChange(t,e)},_onShake:function(t,e){this.__onShake&&this.__onShake(t,e)},_onLongPress:function(t,e){this.__onLongPress&&this.__onLongPress(t,e)},_onDragOver:function(t){t.preventDefault();var e=this._simpleEventHandler("dragover",t);this._fireEnterLeaveEvents(e,t)},_onDrop:function(t){return this._simpleEventHandler("drop:before",t),this._simpleEventHandler("drop",t)},_onContextMenu:function(t){return this.stopContextMenu&&(t.stopPropagation(),t.preventDefault()),!1},_onDoubleClick:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"dblclick"),this._resetTransformEventData(t)},getPointerId:function(t){var e=t.changedTouches;return e?e[0]&&e[0].identifier:this.enablePointerEvents?t.pointerId:-1},_isMainEvent:function(t){return!0===t.isPrimary||!1!==t.isPrimary&&("touchend"===t.type&&0===t.touches.length||!t.changedTouches||t.changedTouches[0].identifier===this.mainTouchId)},_onTouchStart:function(r){r.preventDefault(),null===this.mainTouchId&&(this.mainTouchId=this.getPointerId(r)),this.__onMouseDown(r),this._resetTransformEventData();var n=this.upperCanvasEl,s=this._getEventPrefix();t(ev.document,"touchend",this._onTouchEnd,i),t(ev.document,"touchmove",this._onMouseMove,i),e(n,s+"down",this._onMouseDown)},_onMouseDown:function(r){this.__onMouseDown(r),this._resetTransformEventData();var n=this.upperCanvasEl,s=this._getEventPrefix();e(n,s+"move",this._onMouseMove,i),t(ev.document,s+"up",this._onMouseUp),t(ev.document,s+"move",this._onMouseMove,i)},_onTouchEnd:function(r){if(!(r.touches.length>0)){this.__onMouseUp(r),this._resetTransformEventData(),this.mainTouchId=null;var n=this._getEventPrefix();e(ev.document,"touchend",this._onTouchEnd,i),e(ev.document,"touchmove",this._onMouseMove,i);var s=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(function(){t(s.upperCanvasEl,n+"down",s._onMouseDown),s._willAddMouseDown=0},400)}},_onMouseUp:function(r){this.__onMouseUp(r),this._resetTransformEventData();var n=this.upperCanvasEl,s=this._getEventPrefix();this._isMainEvent(r)&&(e(ev.document,s+"up",this._onMouseUp),e(ev.document,s+"move",this._onMouseMove,i),t(n,s+"move",this._onMouseMove,i))},_onMouseMove:function(t){!this.allowTouchScrolling&&t.preventDefault&&t.preventDefault(),this.__onMouseMove(t)},_onResize:function(){this.calcOffset()},_shouldRender:function(t){var e=this._activeObject;return!!(!!e!=!!t||e&&t&&e!==t)||(e&&e.isEditing,!1)},__onMouseUp:function(t){var e,i=this._currentTransform,n=this._groupSelector,s=!1,o=!n||0===n.left&&0===n.top;if(this._cacheTransformEventData(t),e=this._target,this._handleEvent(t,"up:before"),r(t,3))this.fireRightClick&&this._handleEvent(t,"up",3,o);else{if(r(t,2))return this.fireMiddleClick&&this._handleEvent(t,"up",2,o),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)this._onMouseUpInDrawingMode(t);else if(this._isMainEvent(t)){if(i&&(this._finalizeCurrentTransform(t),s=i.actionPerformed),!o){var a,h,l=e===this._activeObject;this._maybeGroupObjects(t),s||(s=this._shouldRender(e)||!l&&e===this._activeObject)}if(e){if(a=e._findTargetCorner(this.getPointer(t,!0),ev.util.isTouchEvent(t)),e.selectable&&e!==this._activeObject&&"up"===e.activeOn)this.setActiveObject(e,t),s=!0;else{var c=e.controls[a],u=c&&c.getMouseUpHandler(t,e,c);u&&u(t,i,(h=this.getPointer(t)).x,h.y)}e.isMoving=!1}if(i&&(i.target!==e||i.corner!==a)){var f=i.target&&i.target.controls[i.corner],d=f&&f.getMouseUpHandler(t,e,c);h=h||this.getPointer(t),d&&d(t,i,h.x,h.y)}this._setCursorFromEvent(t,e),this._handleEvent(t,"up",1,o),this._groupSelector=null,this._currentTransform=null,e&&(e.__corner=0),s?this.requestRenderAll():o||this.renderTop()}}},_simpleEventHandler:function(t,e){var i=this.findTarget(e),r=this.targets,n={e:e,target:i,subTargets:r};if(this.fire(t,n),i&&i.fire(t,n),!r)return i;for(var s=0;s<r.length;s++)r[s].fire(t,n);return i},_handleEvent:function(t,e,i,r){var n=this._target,s=this.targets||[],o={e:t,target:n,subTargets:s,button:i||1,isClick:r||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};"up"===e&&(o.currentTarget=this.findTarget(t),o.currentSubTargets=this.targets),this.fire("mouse:"+e,o),n&&n.fire("mouse"+e,o);for(var a=0;a<s.length;a++)s[a].fire("mouse"+e,o)},_finalizeCurrentTransform:function(t){var e=this._currentTransform,i=e.target,r={e:t,target:i,transform:e,action:e.action};i._scaling&&(i._scaling=!1),i.setCoords(),(e.actionPerformed||this.stateful&&i.hasStateChanged())&&this._fire("modified",r)},_onMouseDownInDrawingMode:function(t){this._isCurrentlyDrawing=!0,this.getActiveObject()&&this.discardActiveObject(t).requestRenderAll();var e=this.getPointer(t);this.freeDrawingBrush.onMouseDown(e,{e:t,pointer:e}),this._handleEvent(t,"down")},_onMouseMoveInDrawingMode:function(t){if(this._isCurrentlyDrawing){var e=this.getPointer(t);this.freeDrawingBrush.onMouseMove(e,{e:t,pointer:e})}this.setCursor(this.freeDrawingCursor),this._handleEvent(t,"move")},_onMouseUpInDrawingMode:function(t){var e=this.getPointer(t);this._isCurrentlyDrawing=this.freeDrawingBrush.onMouseUp({e:t,pointer:e}),this._handleEvent(t,"up")},__onMouseDown:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"down:before");var e=this._target;if(r(t,3))this.fireRightClick&&this._handleEvent(t,"down",3);else if(r(t,2))this.fireMiddleClick&&this._handleEvent(t,"down",2);else if(this.isDrawingMode)this._onMouseDownInDrawingMode(t);else if(this._isMainEvent(t)&&!this._currentTransform){var i=this._pointer;this._previousPointer=i;var n=this._shouldRender(e),s=this._shouldGroup(t,e);if(this._shouldClearSelection(t,e)?this.discardActiveObject(t):s&&(this._handleGrouping(t,e),e=this._activeObject),!this.selection||e&&(e.selectable||e.isEditing||e===this._activeObject)||(this._groupSelector={ex:this._absolutePointer.x,ey:this._absolutePointer.y,top:0,left:0}),e){var o=e===this._activeObject;e.selectable&&"down"===e.activeOn&&this.setActiveObject(e,t);var a=e._findTargetCorner(this.getPointer(t,!0),ev.util.isTouchEvent(t));if(e.__corner=a,e===this._activeObject&&(a||!s)){this._setupCurrentTransform(t,e,o);var h=e.controls[a],l=(i=this.getPointer(t),h&&h.getMouseDownHandler(t,e,h));l&&l(t,this._currentTransform,i.x,i.y)}}this._handleEvent(t,"down"),(n||s)&&this.requestRenderAll()}},_resetTransformEventData:function(){this._target=null,this._pointer=null,this._absolutePointer=null},_cacheTransformEventData:function(t){this._resetTransformEventData(),this._pointer=this.getPointer(t,!0),this._absolutePointer=this.restorePointerVpt(this._pointer),this._target=this._currentTransform?this._currentTransform.target:this.findTarget(t)||null},_beforeTransform:function(t){var e=this._currentTransform;this.stateful&&e.target.saveState(),this.fire("before:transform",{e:t,transform:e})},__onMouseMove:function(t){var e,i;if(this._handleEvent(t,"move:before"),this._cacheTransformEventData(t),this.isDrawingMode)this._onMouseMoveInDrawingMode(t);else if(this._isMainEvent(t)){var r=this._groupSelector;r?(i=this._absolutePointer,r.left=i.x-r.ex,r.top=i.y-r.ey,this.renderTop()):this._currentTransform?this._transformObject(t):(e=this.findTarget(t)||null,this._setCursorFromEvent(t,e),this._fireOverOutEvents(e,t)),this._handleEvent(t,"move"),this._resetTransformEventData()}},_fireOverOutEvents:function(t,e){var i=this._hoveredTarget,r=this._hoveredTargets,n=this.targets,s=Math.max(r.length,n.length);this.fireSyntheticInOutEvents(t,e,{oldTarget:i,evtOut:"mouseout",canvasEvtOut:"mouse:out",evtIn:"mouseover",canvasEvtIn:"mouse:over"});for(var o=0;o<s;o++)this.fireSyntheticInOutEvents(n[o],e,{oldTarget:r[o],evtOut:"mouseout",evtIn:"mouseover"});this._hoveredTarget=t,this._hoveredTargets=this.targets.concat()},_fireEnterLeaveEvents:function(t,e){var i=this._draggedoverTarget,r=this._hoveredTargets,n=this.targets,s=Math.max(r.length,n.length);this.fireSyntheticInOutEvents(t,e,{oldTarget:i,evtOut:"dragleave",evtIn:"dragenter"});for(var o=0;o<s;o++)this.fireSyntheticInOutEvents(n[o],e,{oldTarget:r[o],evtOut:"dragleave",evtIn:"dragenter"});this._draggedoverTarget=t},fireSyntheticInOutEvents:function(t,e,i){var r,n,s,o=i.oldTarget,a=o!==t,h=i.canvasEvtIn,l=i.canvasEvtOut;a&&(r={e:e,target:t,previousTarget:o},n={e:e,target:o,nextTarget:t}),s=t&&a,o&&a&&(l&&this.fire(l,n),o.fire(i.evtOut,n)),s&&(h&&this.fire(h,r),t.fire(i.evtIn,r))},__onMouseWheel:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"wheel"),this._resetTransformEventData()},_transformObject:function(t){var e=this.getPointer(t),i=this._currentTransform;i.reset=!1,i.shiftKey=t.shiftKey,i.altKey=t[this.centeredKey],this._performTransformAction(t,i,e),i.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(t,e,i){var r=i.x,n=i.y,s=e.action,o=!1,a=e.actionHandler;a&&(o=a(t,e,r,n)),"drag"===s&&o&&(e.target.isMoving=!0,this.setCursor(e.target.moveCursor||this.moveCursor)),e.actionPerformed=e.actionPerformed||o},_fire:ev.controlsUtils.fireEvent,_setCursorFromEvent:function(t,e){if(!e)return this.setCursor(this.defaultCursor),!1;var i=e.hoverCursor||this.hoverCursor,r=this._activeObject&&"activeSelection"===this._activeObject.type?this._activeObject:null,n=(!r||!r.contains(e))&&e._findTargetCorner(this.getPointer(t,!0));n?this.setCursor(this.getCornerCursor(n,e,t)):(e.subTargetCheck&&this.targets.concat().reverse().map(function(t){i=t.hoverCursor||i}),this.setCursor(i))},getCornerCursor:function(t,e,i){var r=e.controls[t];return r.cursorStyleHandler(i,r,e)}})}(),eu=Math.min,ef=Math.max,ev.util.object.extend(ev.Canvas.prototype,{_shouldGroup:function(t,e){var i=this._activeObject;return i&&this._isSelectionKeyPressed(t)&&e&&e.selectable&&this.selection&&(i!==e||"activeSelection"===i.type)&&!e.onSelect({e:t})},_handleGrouping:function(t,e){var i=this._activeObject;i.__corner||(e!==i||(e=this.findTarget(t,!0))&&e.selectable)&&(i&&"activeSelection"===i.type?this._updateActiveSelection(e,t):this._createActiveSelection(e,t))},_updateActiveSelection:function(t,e){var i=this._activeObject,r=i._objects.slice(0);i.contains(t)?(i.removeWithUpdate(t),this._hoveredTarget=t,this._hoveredTargets=this.targets.concat(),1===i.size()&&this._setActiveObject(i.item(0),e)):(i.addWithUpdate(t),this._hoveredTarget=i,this._hoveredTargets=this.targets.concat()),this._fireSelectionEvents(r,e)},_createActiveSelection:function(t,e){var i=this.getActiveObjects(),r=this._createGroup(t);this._hoveredTarget=r,this._setActiveObject(r,e),this._fireSelectionEvents(i,e)},_createGroup:function(t){var e=this._objects,i=e.indexOf(this._activeObject)<e.indexOf(t)?[this._activeObject,t]:[t,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new ev.ActiveSelection(i,{canvas:this})},_groupSelectedObjects:function(t){var e,i=this._collectObjects(t);1===i.length?this.setActiveObject(i[0],t):i.length>1&&(e=new ev.ActiveSelection(i.reverse(),{canvas:this}),this.setActiveObject(e,t))},_collectObjects:function(t){for(var e,i=[],r=this._groupSelector.ex,n=this._groupSelector.ey,s=r+this._groupSelector.left,o=n+this._groupSelector.top,a=new ev.Point(eu(r,s),eu(n,o)),h=new ev.Point(ef(r,s),ef(n,o)),l=!this.selectionFullyContained,c=r===s&&n===o,u=this._objects.length;u--&&!((e=this._objects[u])&&e.selectable&&e.visible&&(l&&e.intersectsWithRect(a,h,!0)||e.isContainedWithinRect(a,h,!0)||l&&e.containsPoint(a,null,!0)||l&&e.containsPoint(h,null,!0))&&(i.push(e),c)););return i.length>1&&(i=i.filter(function(e){return!e.onSelect({e:t})})),i},_maybeGroupObjects:function(t){this.selection&&this._groupSelector&&this._groupSelectedObjects(t),this.setCursor(this.defaultCursor),this._groupSelector=null}}),ev.util.object.extend(ev.StaticCanvas.prototype,{toDataURL:function(t){t||(t={});var e=t.format||"png",i=t.quality||1,r=(t.multiplier||1)*(t.enableRetinaScaling?this.getRetinaScaling():1),n=this.toCanvasElement(r,t);return ev.util.toDataURL(n,e,i)},toCanvasElement:function(t,e){t=t||1;var i=((e=e||{}).width||this.width)*t,r=(e.height||this.height)*t,n=this.getZoom(),s=this.width,o=this.height,a=n*t,h=this.viewportTransform,l=(h[4]-(e.left||0))*t,c=(h[5]-(e.top||0))*t,u=this.interactive,f=this.enableRetinaScaling,d=ev.util.createCanvasElement(),g=this.contextTop;return d.width=i,d.height=r,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=[a,0,0,a,l,c],this.width=i,this.height=r,this.calcViewportBoundaries(),this.renderCanvas(d.getContext("2d"),this._objects),this.viewportTransform=h,this.width=s,this.height=o,this.calcViewportBoundaries(),this.interactive=u,this.enableRetinaScaling=f,this.contextTop=g,d}}),ev.util.object.extend(ev.StaticCanvas.prototype,{loadFromJSON:function(t,e,i){if(t){var r="string"==typeof t?JSON.parse(t):ev.util.object.clone(t),n=this,s=r.clipPath,o=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete r.clipPath,this._enlivenObjects(r.objects,function(t){n.clear(),n._setBgOverlay(r,function(){s?n._enlivenObjects([s],function(i){n.clipPath=i[0],n.__setupCanvas.call(n,r,t,o,e)}):n.__setupCanvas.call(n,r,t,o,e)})},i),this}},__setupCanvas:function(t,e,i,r){var n=this;e.forEach(function(t,e){n.insertAt(t,e)}),this.renderOnAddRemove=i,delete t.objects,delete t.backgroundImage,delete t.overlayImage,delete t.background,delete t.overlay,this._setOptions(t),this.renderAll(),r&&r()},_setBgOverlay:function(t,e){var i={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(t.backgroundImage||t.overlayImage||t.background||t.overlay){var r=function(){i.backgroundImage&&i.overlayImage&&i.backgroundColor&&i.overlayColor&&e&&e()};this.__setBgOverlay("backgroundImage",t.backgroundImage,i,r),this.__setBgOverlay("overlayImage",t.overlayImage,i,r),this.__setBgOverlay("backgroundColor",t.background,i,r),this.__setBgOverlay("overlayColor",t.overlay,i,r)}else e&&e()},__setBgOverlay:function(t,e,i,r){var n=this;if(!e)return i[t]=!0,void(r&&r());"backgroundImage"===t||"overlayImage"===t?ev.util.enlivenObjects([e],function(e){n[t]=e[0],i[t]=!0,r&&r()}):this["set"+ev.util.string.capitalize(t,!0)](e,function(){i[t]=!0,r&&r()})},_enlivenObjects:function(t,e,i){t&&0!==t.length?ev.util.enlivenObjects(t,function(t){e&&e(t)},null,i):e&&e([])},_toDataURL:function(t,e){this.clone(function(i){e(i.toDataURL(t))})},_toDataURLWithMultiplier:function(t,e,i){this.clone(function(r){i(r.toDataURLWithMultiplier(t,e))})},clone:function(t,e){var i=JSON.stringify(this.toJSON(e));this.cloneWithoutData(function(e){e.loadFromJSON(i,function(){t&&t(e)})})},cloneWithoutData:function(t){var e=ev.util.createCanvasElement();e.width=this.width,e.height=this.height;var i=new ev.Canvas(e);this.backgroundImage?(i.setBackgroundImage(this.backgroundImage.src,function(){i.renderAll(),t&&t(i)}),i.backgroundImageOpacity=this.backgroundImageOpacity,i.backgroundImageStretch=this.backgroundImageStretch):t&&t(i)}}),l=(h=t.fabric||(t.fabric={})).util.object.extend,c=h.util.object.clone,u=h.util.toFixed,f=h.util.string.capitalize,d=h.util.degreesToRadians,g=!h.isLikelyNode,h.Object||(h.Object=h.util.createClass(h.CommonMethods,{type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,touchCornerSize:24,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:"rgb(178,204,255)",borderDashArray:null,cornerColor:"rgb(178,204,255)",cornerStrokeColor:null,cornerStyle:"rect",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"",selectionBackgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,perPixelTargetFind:!1,includeDefaultValues:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:g,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:"fill",activeOn:"down",stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "),cacheProperties:"fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "),colorProperties:"fill stroke backgroundColor".split(" "),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(t){t&&this.setOptions(t)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=h.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(t){var e=h.perfLimitSizeTotal,i=t.width,r=t.height,n=h.maxCacheSideLimit,s=h.minCacheSideLimit;if(i<=n&&r<=n&&i*r<=e)return i<s&&(t.width=s),r<s&&(t.height=s),t;var o=h.util.limitDimsByArea(i/r,e),a=h.util.capValue,l=a(s,o.x,n),c=a(s,o.y,n);return i>l&&(t.zoomX/=i/l,t.width=l,t.capped=!0),r>c&&(t.zoomY/=r/c,t.height=c,t.capped=!0),t},_getCacheCanvasDimensions:function(){var t=this.getTotalObjectScaling(),e=this._getTransformedDimensions(0,0),i=e.x*t.scaleX/this.scaleX,r=e.y*t.scaleY/this.scaleY;return{width:i+2,height:r+2,zoomX:t.scaleX,zoomY:t.scaleY,x:i,y:r}},_updateCacheCanvas:function(){var t=this.canvas;if(this.noScaleCache&&t&&t._currentTransform){var e=t._currentTransform.target,i=t._currentTransform.action;if(this===e&&i.slice&&"scale"===i.slice(0,5))return!1}var r,n,s=this._cacheCanvas,o=this._limitCacheSize(this._getCacheCanvasDimensions()),a=h.minCacheSideLimit,l=o.width,c=o.height,u=o.zoomX,f=o.zoomY,d=l!==this.cacheWidth||c!==this.cacheHeight,g=this.zoomX!==u||this.zoomY!==f,p=d||g,m=0,v=0,y=!1;if(d){var _=this._cacheCanvas.width,b=this._cacheCanvas.height,x=l>_||c>b;y=x||(l<.9*_||c<.9*b)&&_>a&&b>a,x&&!o.capped&&(l>a||c>a)&&(m=.1*l,v=.1*c)}return this instanceof h.Text&&this.path&&(p=!0,y=!0,m+=this.getHeightOfLine(0)*this.zoomX,v+=this.getHeightOfLine(0)*this.zoomY),!!p&&(y?(s.width=Math.ceil(l+m),s.height=Math.ceil(c+v)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,s.width,s.height)),r=o.x/2,n=o.y/2,this.cacheTranslationX=Math.round(s.width/2-r)+r,this.cacheTranslationY=Math.round(s.height/2-n)+n,this.cacheWidth=l,this.cacheHeight=c,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(u,f),this.zoomX=u,this.zoomY=f,!0)},setOptions:function(t){this._setOptions(t),this._initGradient(t.fill,"fill"),this._initGradient(t.stroke,"stroke"),this._initPattern(t.fill,"fill"),this._initPattern(t.stroke,"stroke")},transform:function(t){var e=this.group&&!this.group._transformDone||this.group&&this.canvas&&t===this.canvas.contextTop,i=this.calcTransformMatrix(!e);t.transform(i[0],i[1],i[2],i[3],i[4],i[5])},toObject:function(t){var e=h.Object.NUM_FRACTION_DIGITS,i={type:this.type,version:h.version,originX:this.originX,originY:this.originY,left:u(this.left,e),top:u(this.top,e),width:u(this.width,e),height:u(this.height,e),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:u(this.strokeWidth,e),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:u(this.strokeMiterLimit,e),scaleX:u(this.scaleX,e),scaleY:u(this.scaleY,e),angle:u(this.angle,e),flipX:this.flipX,flipY:this.flipY,opacity:u(this.opacity,e),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,skewX:u(this.skewX,e),skewY:u(this.skewY,e)};return this.clipPath&&!this.clipPath.excludeFromExport&&(i.clipPath=this.clipPath.toObject(t),i.clipPath.inverted=this.clipPath.inverted,i.clipPath.absolutePositioned=this.clipPath.absolutePositioned),h.util.populateWithProperties(this,i,t),this.includeDefaultValues||(i=this._removeDefaultValues(i)),i},toDatalessObject:function(t){return this.toObject(t)},_removeDefaultValues:function(t){var e=h.util.getKlass(t.type).prototype;return e.stateProperties.forEach(function(i){"left"!==i&&"top"!==i&&(t[i]===e[i]&&delete t[i],Array.isArray(t[i])&&Array.isArray(e[i])&&0===t[i].length&&0===e[i].length&&delete t[i])}),t},toString:function(){return"#<fabric."+f(this.type)+">"},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var t=h.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(t.scaleX),scaleY:Math.abs(t.scaleY)}},getTotalObjectScaling:function(){var t=this.getObjectScaling(),e=t.scaleX,i=t.scaleY;if(this.canvas){var r=this.canvas.getZoom(),n=this.canvas.getRetinaScaling();e*=r*n,i*=r*n}return{scaleX:e,scaleY:i}},getObjectOpacity:function(){var t=this.opacity;return this.group&&(t*=this.group.getObjectOpacity()),t},_set:function(t,e){var i="scaleX"===t||"scaleY"===t,r=this[t]!==e,n=!1;return i&&(e=this._constrainScale(e)),"scaleX"===t&&e<0?(this.flipX=!this.flipX,e*=-1):"scaleY"===t&&e<0?(this.flipY=!this.flipY,e*=-1):"shadow"!==t||!e||e instanceof h.Shadow?"dirty"===t&&this.group&&this.group.set("dirty",e):e=new h.Shadow(e),this[t]=e,r&&(n=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(t)>-1?(this.dirty=!0,n&&this.group.set("dirty",!0)):n&&this.stateProperties.indexOf(t)>-1&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:h.iMatrix.concat()},isNotVisible:function(){return 0===this.opacity||!this.width&&!this.height&&0===this.strokeWidth||!this.visible},render:function(t){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(t.save(),this._setupCompositeOperation(t),this.drawSelectionBackgroun
vendor: 10,120 bytes, line 1
1d(t),this.transform(t),this._setOpacity(t),this._setShadow(t,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(t)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(t),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"})),t.restore())},renderCache:function(t){t=t||{},this._cacheCanvas&&this._cacheContext||this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext,t.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this._cacheContext=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&"transparent"!==this.stroke&&0!==this.strokeWidth},hasFill:function(){return this.fill&&"transparent"!==this.fill},needsItsOwnCache:function(){return!("stroke"!==this.paintFirst||!this.hasFill()||!this.hasStroke()||"object"!=typeof this.shadow)||!!this.clipPath},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(0!==this.shadow.offsetX||0!==this.shadow.offsetY)},drawClipPathOnCache:function(t,e){if(t.save(),e.inverted?t.globalCompositeOperation="destination-out":t.globalCompositeOperation="destination-in",e.absolutePositioned){var i=h.util.invertTransform(this.calcTransformMatrix());t.transform(i[0],i[1],i[2],i[3],i[4],i[5])}e.transform(t),t.scale(1/e.zoomX,1/e.zoomY),t.drawImage(e._cacheCanvas,-e.cacheTranslationX,-e.cacheTranslationY),t.restore()},drawObject:function(t,e){var i=this.fill,r=this.stroke;e?(this.fill="black",this.stroke="",this._setClippingProperties(t)):this._renderBackground(t),this._render(t),this._drawClipPath(t,this.clipPath),this.fill=i,this.stroke=r},_drawClipPath:function(t,e){e&&(e.canvas=this.canvas,e.shouldCache(),e._transformDone=!0,e.renderCache({forClipping:!0}),this.drawClipPathOnCache(t,e))},drawCacheOnCanvas:function(t){t.scale(1/this.zoomX,1/this.zoomY),t.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(t){if(this.isNotVisible())return!1;if(this._cacheCanvas&&this._cacheContext&&!t&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&this._cacheContext&&!t){var e=this.cacheWidth/this.zoomX,i=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-e/2,-i/2,e,i)}return!0}return!1},_renderBackground:function(t){if(this.backgroundColor){var e=this._getNonTransformedDimensions();t.fillStyle=this.backgroundColor,t.fillRect(-e.x/2,-e.y/2,e.x,e.y),this._removeShadow(t)}},_setOpacity:function(t){this.group&&!this.group._transformDone?t.globalAlpha=this.getObjectOpacity():t.globalAlpha*=this.opacity},_setStrokeStyles:function(t,e){var i=e.stroke;i&&(t.lineWidth=e.strokeWidth,t.lineCap=e.strokeLineCap,t.lineDashOffset=e.strokeDashOffset,t.lineJoin=e.strokeLineJoin,t.miterLimit=e.strokeMiterLimit,i.toLive?"percentage"===i.gradientUnits||i.gradientTransform||i.patternTransform?this._applyPatternForTransformedGradient(t,i):(t.strokeStyle=i.toLive(t,this),this._applyPatternGradientTransform(t,i)):t.strokeStyle=e.stroke)},_setFillStyles:function(t,e){var i=e.fill;i&&(i.toLive?(t.fillStyle=i.toLive(t,this),this._applyPatternGradientTransform(t,e.fill)):t.fillStyle=i)},_setClippingProperties:function(t){t.globalAlpha=1,t.strokeStyle="transparent",t.fillStyle="#000000"},_setLineDash:function(t,e){e&&0!==e.length&&(1&e.length&&e.push.apply(e,e),t.setLineDash(e))},_renderControls:function(t,e){var i,r,n,s=this.getViewportTransform(),o=this.calcTransformMatrix();r=void 0!==(e=e||{}).hasBorders?e.hasBorders:this.hasBorders,n=void 0!==e.hasControls?e.hasControls:this.hasControls,o=h.util.multiplyTransformMatrices(s,o),i=h.util.qrDecompose(o),t.save(),t.translate(i.translateX,i.translateY),t.lineWidth=+this.borderScaleFactor,this.group||(t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(i.angle-=180),t.rotate(d(this.group?i.angle:this.angle)),e.forActiveSelection||this.group?r&&this.drawBordersInGroup(t,i,e):r&&this.drawBorders(t,e),n&&this.drawControls(t,e),t.restore()},_setShadow:function(t){if(this.shadow){var e,i=this.shadow,r=this.canvas,n=r&&r.viewportTransform[0]||1,s=r&&r.viewportTransform[3]||1;e=i.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),r&&r._isRetinaScaling()&&(n*=h.devicePixelRatio,s*=h.devicePixelRatio),t.shadowColor=i.color,t.shadowBlur=i.blur*h.browserShadowBlurConstant*(n+s)*(e.scaleX+e.scaleY)/4,t.shadowOffsetX=i.offsetX*n*e.scaleX,t.shadowOffsetY=i.offsetY*s*e.scaleY}},_removeShadow:function(t){this.shadow&&(t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)},_applyPatternGradientTransform:function(t,e){if(!e||!e.toLive)return{offsetX:0,offsetY:0};var i=e.gradientTransform||e.patternTransform,r=-this.width/2+e.offsetX||0,n=-this.height/2+e.offsetY||0;return"percentage"===e.gradientUnits?t.transform(this.width,0,0,this.height,r,n):t.transform(1,0,0,1,r,n),i&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),{offsetX:r,offsetY:n}},_renderPaintInOrder:function(t){"stroke"===this.paintFirst?(this._renderStroke(t),this._renderFill(t)):(this._renderFill(t),this._renderStroke(t))},_render:function(){},_renderFill:function(t){this.fill&&(t.save(),this._setFillStyles(t,this),"evenodd"===this.fillRule?t.fill("evenodd"):t.fill(),t.restore())},_renderStroke:function(t){if(this.stroke&&0!==this.strokeWidth){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this.strokeUniform&&this.group){var e=this.getObjectScaling();t.scale(1/e.scaleX,1/e.scaleY)}else this.strokeUniform&&t.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(t,this.strokeDashArray),this._setStrokeStyles(t,this),t.stroke(),t.restore()}},_applyPatternForTransformedGradient:function(t,e){var i,r=this._limitCacheSize(this._getCacheCanvasDimensions()),n=h.util.createCanvasElement(),s=this.canvas.getRetinaScaling(),o=r.x/this.scaleX/s,a=r.y/this.scaleY/s;n.width=o,n.height=a,(i=n.getContext("2d")).beginPath(),i.moveTo(0,0),i.lineTo(o,0),i.lineTo(o,a),i.lineTo(0,a),i.closePath(),i.translate(o/2,a/2),i.scale(r.zoomX/this.scaleX/s,r.zoomY/this.scaleY/s),this._applyPatternGradientTransform(i,e),i.fillStyle=e.toLive(t),i.fill(),t.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),t.scale(s*this.scaleX/r.zoomX,s*this.scaleY/r.zoomY),t.strokeStyle=i.createPattern(n,"no-repeat")},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var t=h.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set("scaleX",t.scaleX),this.set("scaleY",t.scaleY),this.angle=t.angle,this.skewX=t.skewX,this.skewY=0}},_removeTransformMatrix:function(t){var e=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),e=h.util.transformPoint(e,this.transformMatrix)),this.transformMatrix=null,t&&(this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this.cropX=t.cropX,this.cropY=t.cropY,e.x+=t.offsetLeft,e.y+=t.offsetTop,this.width=t.width,this.height=t.height),this.setPositionByOrigin(e,"center","center")},clone:function(t,e){var i=this.toObject(e);this.constructor.fromObject?this.constructor.fromObject(i,t):h.Object._fromObject("Object",i,t)},cloneAsImage:function(t,e){var i=this.toCanvasElement(e);return t&&t(new h.Image(i)),this},toCanvasElement:function(t){t||(t={});var e=h.util,i=e.saveObjectTransform(this),r=this.group,n=this.shadow,s=Math.abs,o=(t.multiplier||1)*(t.enableRetinaScaling?h.devicePixelRatio:1);delete this.group,t.withoutTransform&&e.resetObjectTransform(this),t.withoutShadow&&(this.shadow=null);var a,l,c,u,f=h.util.createCanvasElement(),d=this.getBoundingRect(!0,!0),g=this.shadow,p={x:0,y:0};g&&(l=g.blur,a=g.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),p.x=2*Math.round(s(g.offsetX)+l)*s(a.scaleX),p.y=2*Math.round(s(g.offsetY)+l)*s(a.scaleY)),c=d.width+p.x,u=d.height+p.y,f.width=Math.ceil(c),f.height=Math.ceil(u);var m=new h.StaticCanvas(f,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});"jpeg"===t.format&&(m.backgroundColor="#fff"),this.setPositionByOrigin(new h.Point(m.width/2,m.height/2),"center","center");var v=this.canvas;m.add(this);var y=m.toCanvasElement(o||1,t);return this.shadow=n,this.set("canvas",v),r&&(this.group=r),this.set(i).setCoords(),m._objects=[],m.dispose(),m=null,y},toDataURL:function(t){return t||(t={}),h.util.toDataURL(this.toCanvasElement(t),t.format||"png",t.quality||1)},isType:function(t){return arguments.length>1?Array.from(arguments).includes(this.type):this.type===t},complexity:function(){return 1},toJSON:function(t){return this.toObject(t)},rotate:function(t){var e=("center"!==this.originX||"center"!==this.originY)&&this.centeredRotation;return e&&this._setOriginToCenter(),this.set("angle",t),e&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(t,e){e=e||this.canvas.getPointer(t);var i=new h.Point(e.x,e.y),r=this._getLeftTopCoords();return this.angle&&(i=h.util.rotatePoint(i,r,d(-this.angle))),{x:i.x-r.x,y:i.y-r.y}},_setupCompositeOperation:function(t){this.globalCompositeOperation&&(t.globalCompositeOperation=this.globalCompositeOperation)},dispose:function(){h.runningAnimations&&h.runningAnimations.cancelByTarget(this)}}),h.util.createAccessors&&h.util.createAccessors(h.Object),l(h.Object.prototype,h.Observable),h.Object.NUM_FRACTION_DIGITS=2,h.Object.ENLIVEN_PROP
vendor: 10,486 bytes, line 1
1S=["clipPath"],h.Object._fromObject=function(t,e,i,r){var n=h[t];e=c(e,!0),h.util.enlivenPatterns([e.fill,e.stroke],function(t){void 0!==t[0]&&(e.fill=t[0]),void 0!==t[1]&&(e.stroke=t[1]),h.util.enlivenObjectEnlivables(e,e,function(){var t=r?new n(e[r],e):new n(e);i&&i(t)})})},h.Object.__uid=0),ed=ev.util.degreesToRadians,eg={left:-.5,center:0,right:.5},ep={top:-.5,center:0,bottom:.5},ev.util.object.extend(ev.Object.prototype,{translateToGivenOrigin:function(t,e,i,r,n){var s,o,a,h=t.x,l=t.y;return"string"==typeof e?e=eg[e]:e-=.5,"string"==typeof r?r=eg[r]:r-=.5,"string"==typeof i?i=ep[i]:i-=.5,"string"==typeof n?n=ep[n]:n-=.5,o=n-i,((s=r-e)||o)&&(a=this._getTransformedDimensions(),h=t.x+s*a.x,l=t.y+o*a.y),new ev.Point(h,l)},translateToCenterPoint:function(t,e,i){var r=this.translateToGivenOrigin(t,e,i,"center","center");return this.angle?ev.util.rotatePoint(r,t,ed(this.angle)):r},translateToOriginPoint:function(t,e,i){var r=this.translateToGivenOrigin(t,"center","center",e,i);return this.angle?ev.util.rotatePoint(r,t,ed(this.angle)):r},getCenterPoint:function(){var t=new ev.Point(this.left,this.top);return this.translateToCenterPoint(t,this.originX,this.originY)},getPointByOrigin:function(t,e){var i=this.getCenterPoint();return this.translateToOriginPoint(i,t,e)},toLocalPoint:function(t,e,i){var r,n,s=this.getCenterPoint();return r=void 0!==e&&void 0!==i?this.translateToGivenOrigin(s,"center","center",e,i):new ev.Point(this.left,this.top),n=new ev.Point(t.x,t.y),this.angle&&(n=ev.util.rotatePoint(n,s,-ed(this.angle))),n.subtractEquals(r)},setPositionByOrigin:function(t,e,i){var r=this.translateToCenterPoint(t,e,i),n=this.translateToOriginPoint(r,this.originX,this.originY);this.set("left",n.x),this.set("top",n.y)},adjustPosition:function(t){var e,i,r=ed(this.angle),n=this.getScaledWidth(),s=ev.util.cos(r)*n,o=ev.util.sin(r)*n;e="string"==typeof this.originX?eg[this.originX]:this.originX-.5,i="string"==typeof t?eg[t]:t-.5,this.left+=s*(i-e),this.top+=o*(i-e),this.setCoords(),this.originX=t},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var t=this.getCenterPoint();this.originX="center",this.originY="center",this.left=t.x,this.top=t.y},_resetOrigin:function(){var t=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=t.x,this.top=t.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}}),v=(m=ev.util).degreesToRadians,y=m.multiplyTransformMatrices,_=m.transformPoint,m.object.extend(ev.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(t,e){return e?t?this.calcACoords():this.calcLineCoords():(this.aCoords&&this.lineCoords||this.setCoords(!0),t?this.aCoords:this.lineCoords)},getCoords:function(t,e){var i;return i=this._getCoords(t,e),[new ev.Point(i.tl.x,i.tl.y),new ev.Point(i.tr.x,i.tr.y),new ev.Point(i.br.x,i.br.y),new ev.Point(i.bl.x,i.bl.y)]},intersectsWithRect:function(t,e,i,r){var n=this.getCoords(i,r);return"Intersection"===ev.Intersection.intersectPolygonRectangle(n,t,e).status},intersectsWithObject:function(t,e,i){return"Intersection"===ev.Intersection.intersectPolygonPolygon(this.getCoords(e,i),t.getCoords(e,i)).status||t.isContainedWithinObject(this,e,i)||this.isContainedWithinObject(t,e,i)},isContainedWithinObject:function(t,e,i){for(var r=this.getCoords(e,i),n=e?t.aCoords:t.lineCoords,s=0,o=t._getImageLines(n);s<4;s++)if(!t.containsPoint(r[s],o))return!1;return!0},isContainedWithinRect:function(t,e,i,r){var n=this.getBoundingRect(i,r);return n.left>=t.x&&n.left+n.width<=e.x&&n.top>=t.y&&n.top+n.height<=e.y},containsPoint:function(t,e,i,r){var n=this._getCoords(i,r),s=(e=e||this._getImageLines(n),this._findCrossPoints(t,e));return 0!==s&&s%2==1},isOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,i=this.canvas.vptCoords.br;return!!this.getCoords(!0,t).some(function(t){return t.x<=i.x&&t.x>=e.x&&t.y<=i.y&&t.y>=e.y})||!!this.intersectsWithRect(e,i,!0,t)||this._containsCenterOfCanvas(e,i,t)},_containsCenterOfCanvas:function(t,e,i){var r={x:(t.x+e.x)/2,y:(t.y+e.y)/2};return!!this.containsPoint(r,null,!0,i)},isPartiallyOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,i=this.canvas.vptCoords.br;return!!this.intersectsWithRect(e,i,!0,t)||this.getCoords(!0,t).every(function(t){return(t.x>=i.x||t.x<=e.x)&&(t.y>=i.y||t.y<=e.y)})&&this._containsCenterOfCanvas(e,i,t)},_getImageLines:function(t){return{topline:{o:t.tl,d:t.tr},rightline:{o:t.tr,d:t.br},bottomline:{o:t.br,d:t.bl},leftline:{o:t.bl,d:t.tl}}},_findCrossPoints:function(t,e){var i,r,n,s=0;for(var o in e)if(!((n=e[o]).o.y<t.y&&n.d.y<t.y||n.o.y>=t.y&&n.d.y>=t.y||(n.o.x===n.d.x&&n.o.x>=t.x?r=n.o.x:(i=(n.d.y-n.o.y)/(n.d.x-n.o.x),r=-(t.y-0*t.x-(n.o.y-i*n.o.x))/(0-i)),r>=t.x&&(s+=1),2!==s)))break;return s},getBoundingRect:function(t,e){var i=this.getCoords(t,e);return m.makeBoundingBoxFromPoints(i)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(t){return Math.abs(t)<this.minScaleLimit?t<0?-this.minScaleLimit:this.minScaleLimit:0===t?1e-4:t},scale:function(t){return this._set("scaleX",t),this._set("scaleY",t),this.setCoords()},scaleToWidth:function(t,e){var i=this.getBoundingRect(e).width/this.getScaledWidth();return this.scale(t/this.width/i)},scaleToHeight:function(t,e){var i=this.getBoundingRect(e).height/this.getScaledHeight();return this.scale(t/this.height/i)},calcLineCoords:function(){var t=this.getViewportTransform(),e=this.padding,i=v(this.angle),r=m.cos(i)*e,n=m.sin(i)*e,s=r+n,o=r-n,a=this.calcACoords(),h={tl:_(a.tl,t),tr:_(a.tr,t),bl:_(a.bl,t),br:_(a.br,t)};return e&&(h.tl.x-=o,h.tl.y-=s,h.tr.x+=s,h.tr.y-=o,h.bl.x-=s,h.bl.y+=o,h.br.x+=o,h.br.y+=s),h},calcOCoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),i=this.getViewportTransform(),r=y(i,e),n=y(r,t),s=(n=y(n,[1/i[0],0,0,1/i[3],0,0]),this._calculateCurrentDimensions()),o={};return this.forEachControl(function(t,e,i){o[e]=t.positionHandler(s,n,i)}),o},calcACoords:function(){var t=this._calcRotateMatrix(),e=y(this._calcTranslateMatrix(),t),i=this._getTransformedDimensions(),r=i.x/2,n=i.y/2;return{tl:_({x:-r,y:-n},e),tr:_({x:r,y:-n},e),bl:_({x:-r,y:n},e),br:_({x:r,y:n},e)}},setCoords:function(t){return this.aCoords=this.calcACoords(),this.lineCoords=this.group?this.aCoords:this.calcLineCoords(),t||(this.oCoords=this.calcOCoords(),this._setCornerCoords&&this._setCornerCoords()),this},_calcRotateMatrix:function(){return m.calcRotateMatrix(this)},_calcTranslateMatrix:function(){var t=this.getCenterPoint();return[1,0,0,1,t.x,t.y]},transformMatrixKey:function(t){var e="";return!t&&this.group&&(e=this.group.transformMatrixKey(t)+"_"),e+this.top+"_"+this.left+"_"+this.scaleX+"_"+this.scaleY+"_"+this.skewX+"_"+this.skewY+"_"+this.angle+"_"+this.originX+"_"+this.originY+"_"+this.width+"_"+this.height+"_"+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(t){var e=this.calcOwnMatrix();if(t||!this.group)return e;var i=this.transformMatrixKey(t),r=this.matrixCache||(this.matrixCache={});return r.key===i?r.value:(this.group&&(e=y(this.group.calcTransformMatrix(!1),e)),r.key=i,r.value=e,e)},calcOwnMatrix:function(){var t=this.transformMatrixKey(!0),e=this.ownMatrixCache||(this.ownMatrixCache={});if(e.key===t)return e.value;var i=this._calcTranslateMatrix(),r={angle:this.angle,translateX:i[4],translateY:i[5],scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY};return e.key=t,e.value=m.composeMatrix(r),e.value},_getNonTransformedDimensions:function(){var t=this.strokeWidth;return{x:this.width+t,y:this.height+t}},_getTransformedDimensions:function(t,e){void 0===t&&(t=this.skewX),void 0===e&&(e=this.skewY);var i,r,n,s=0===t&&0===e;if(this.strokeUniform?(r=this.width,n=this.height):(r=(i=this._getNonTransformedDimensions()).x,n=i.y),s)return this._finalizeDimensions(r*this.scaleX,n*this.scaleY);var o=m.sizeAfterTransform(r,n,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:t,skewY:e});return this._finalizeDimensions(o.x,o.y)},_finalizeDimensions:function(t,e){return this.strokeUniform?{x:t+this.strokeWidth,y:e+this.strokeWidth}:{x:t,y:e}},_calculateCurrentDimensions:function(){var t=this.getViewportTransform();return _(this._getTransformedDimensions(),t,!0).scalarAdd(2*this.padding)}}),ev.util.object.extend(ev.Object.prototype,{sendToBack:function(){return this.group?ev.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?ev.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(t){return this.group?ev.StaticCanvas.prototype.sendBackwards.call(this.group,this,t):this.canvas&&this.canvas.sendBackwards(this,t),this},bringForward:function(t){return this.group?ev.StaticCanvas.prototype.bringForward.call(this.group,this,t):this.canvas&&this.canvas.bringForward(this,t),this},moveTo:function(t){return this.group&&"activeSelection"!==this.group.type?ev.StaticCanvas.prototype.moveTo.call(this.group,this,t):this.canvas&&this.canvas.moveTo(this,t),this}}),function(){function t(t,e){if(e){if(e.toLive)return t+": url(#SVGID_"+e.id+"); ";var i=new ev.Color(e),r=t+": "+i.toRgb()+"; ",n=i.getAlpha();return 1!==n&&(r+=t+"-opacity: "+n.toString()+"; "),r}return t+": none; "}var e=ev.util.toFixed;ev.util.object.extend(ev.Object.prototype,{getSvgStyles:function(e){var i=this.fillRule?this.fillRule:"nonzero",r=this.strokeWidth?this.strokeWidth:"0",n=this.strokeDashArray?this.strokeDashArray.join(" "):"none",s=this.strokeDashOffset?this.strokeDashOffset:"0",o=this.strokeLineCap?this.strokeLineCap:"butt",a=this.strokeLineJoin?this.strokeLineJoin:"miter",h=this.strokeMiterLimit?this.strokeMiterLimit:"4",l=void 0!==this.opacity?this.opacity:"1",c=this.visible?"":" visibility: hidden;",u=e?"":this.getSvgFilter(),f=t("fill",this.fill);return[t("stroke",this.stroke),"stroke-width: ",r,"; ","stroke-dasharray: ",n,"; ","stroke-linecap: ",o,"; ","stroke-dashoffset: ",s,"; ","stroke-linejoin: ",a,"; ","stroke-miterlimit: ",h,"; ",f,"fill-rule: ",i,";
1 ","opacity: ",l,";",u,c].join("")},getSvgSpanStyles:function(e,i){var r=e.fontFamily?"font-family: "+(-1===e.fontFamily.indexOf("'")&&-1===e.fontFamily.indexOf('"')?"'"+e.fontFamily+"'":e.fontFamily)+"; ":"",n=e.strokeWidth?"stroke-width: "+e.strokeWidth+"; ":"",s=e.fontSize?"font-size: "+e.fontSize+"px; ":"",o=e.fontStyle?"font-style: "+e.fontStyle+"; ":"",a=e.fontWeight?"font-weight: "+e.fontWeight+"; ":"",h=e.fill?t("fill",e.fill):"",l=e.stroke?t("stroke",e.stroke):"",c=this.getSvgTextDecoration(e);return c&&(c="text-decoration: "+c+"; "),[l,n,r,s,o,a,c,h,e.deltaY?"baseline-shift: "+-e.deltaY+"; ":"",i?"white-space: pre; ":""].join("")},getSvgTextDecoration:function(t){return["overline","underline","line-through"].filter(function(e){return t[e.replace("-","")]}).join(" ")},getSvgFilter:function(){return this.shadow?"filter: url(#SVGID_"+this.shadow.id+");":""},getSvgCommons:function(){return[this.id?'id="'+this.id+'" ':"",this.clipPath?'clip-path="url(#'+this.clipPath.clipPathId+')" ':""].join("")},getSvgTransform:function(t,e){var i=t?this.calcTransformMatrix():this.calcOwnMatrix();return'transform="'+ev.util.matrixToSVG(i)+(e||"")+'" '},_setSVGBg:function(t){if(this.backgroundColor){var i=ev.Object.NUM_FRACTION_DIGITS;t.push("		<rect ",this._getFillAttributes(this.backgroundColor),' x="',e(-this.width/2,i),'" y="',e(-this.height/2,i),'" width="',e(this.width,i),'" height="',e(this.height,i),'"></rect>\n')}},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(t),{reviver:t})},toClipPathSVG:function(t){return"	"+this._createBaseClipPathSVGMarkup(this._toSVG(t),{reviver:t})},_createBaseClipPathSVGMarkup:function(t,e){var i=(e=e||{}
vendor: 10,314 bytes, line 1
1).reviver,r=e.additionalTransform||"",n=[this.getSvgTransform(!0,r),this.getSvgCommons()].join(""),s=t.indexOf("COMMON_PARTS");return t[s]=n,i?i(t.join("")):t.join("")},_createBaseSVGMarkup:function(t,e){var i,r,n=(e=e||{}).noStyle,s=e.reviver,o=n?"":'style="'+this.getSvgStyles()+'" ',a=e.withShadow?'style="'+this.getSvgFilter()+'" ':"",h=this.clipPath,l=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",c=h&&h.absolutePositioned,u=this.stroke,f=this.fill,d=this.shadow,g=[],p=t.indexOf("COMMON_PARTS"),m=e.additionalTransform;return h&&(h.clipPathId="CLIPPATH_"+ev.Object.__uid++,r='<clipPath id="'+h.clipPathId+'" >\n'+h.toClipPathSVG(s)+"</clipPath>\n"),c&&g.push("<g ",a,this.getSvgCommons()," >\n"),g.push("<g ",this.getSvgTransform(!1),c?"":a+this.getSvgCommons()," >\n"),i=[o,l,n?"":this.addPaintOrder()," ",m?'transform="'+m+'" ':""].join(""),t[p]=i,f&&f.toLive&&g.push(f.toSVG(this)),u&&u.toLive&&g.push(u.toSVG(this)),d&&g.push(d.toSVG(this)),h&&g.push(r),g.push(t.join("")),g.push("</g>\n"),c&&g.push("</g>\n"),s?s(g.join("")):g.join("")},addPaintOrder:function(){return"fill"!==this.paintFirst?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){var t=ev.util.object.extend,e="stateProperties";function i(e,i,r){var n={};r.forEach(function(t){n[t]=e[t]}),t(e[i],n,!0)}ev.util.object.extend(ev.Object.prototype,{hasStateChanged:function(t){var i="_"+(t=t||e);return Object.keys(this[i]).length<this[t].length||!function t(e,i,r){if(e===i)return!0;if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(var n=0,s=e.length;n<s;n++)if(!t(e[n],i[n]))return!1;return!0}if(e&&"object"==typeof e){var o,a=Object.keys(e);if(!i||"object"!=typeof i||!r&&a.length!==Object.keys(i).length)return!1;for(n=0,s=a.length;n<s;n++)if("canvas"!==(o=a[n])&&"group"!==o&&!t(e[o],i[o]))return!1;return!0}}(this[i],this,!0)},saveState:function(t){var r=t&&t.propertySet||e,n="_"+r;return this[n]?(i(this,n,this[r]),t&&t.stateProperties&&i(this,n,t.stateProperties),this):this.setupState(t)},setupState:function(t){var i=(t=t||{}).propertySet||e;return t.propertySet=i,this["_"+i]={},this.saveState(t),this}})}(),b=ev.util.degreesToRadians,ev.util.object.extend(ev.Object.prototype,{_findTargetCorner:function(t,e){if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;var i,r,n,s=t.x,o=t.y,a=Object.keys(this.oCoords),h=a.length-1;for(this.__corner=0;h>=0;h--)if(n=a[h],this.isControlVisible(n)&&(r=this._getImageLines(e?this.oCoords[n].touchCorner:this.oCoords[n].corner),0!==(i=this._findCrossPoints({x:s,y:o},r))&&i%2==1))return this.__corner=n,n;return!1},forEachControl:function(t){for(var e in this.controls)t(this.controls[e],e,this)},_setCornerCoords:function(){var t=this.oCoords;for(var e in t){var i=this.controls[e];t[e].corner=i.calcCornerCoords(this.angle,this.cornerSize,t[e].x,t[e].y,!1),t[e].touchCorner=i.calcCornerCoords(this.angle,this.touchCornerSize,t[e].x,t[e].y,!0)}},drawSelectionBackground:function(t){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;t.save();var e=this.getCenterPoint(),i=this._calculateCurrentDimensions(),r=this.canvas.viewportTransform;return t.translate(e.x,e.y),t.scale(1/r[0],1/r[3]),t.rotate(b(this.angle)),t.fillStyle=this.selectionBackgroundColor,t.fillRect(-i.x/2,-i.y/2,i.x,i.y),t.restore(),this},drawBorders:function(t,e){e=e||{};var i=this._calculateCurrentDimensions(),r=this.borderScaleFactor,n=i.x+r,s=i.y+r,o=void 0!==e.hasControls?e.hasControls:this.hasControls,a=!1;return t.save(),t.strokeStyle=e.borderColor||this.borderColor,this._setLineDash(t,e.borderDashArray||this.borderDashArray),t.strokeRect(-n/2,-s/2,n,s),o&&(t.beginPath(),this.forEachControl(function(e,i,r){e.withConnection&&e.getVisibility(r,i)&&(a=!0,t.moveTo(e.x*n,e.y*s),t.lineTo(e.x*n+e.offsetX,e.y*s+e.offsetY))}),a&&t.stroke()),t.restore(),this},drawBordersInGroup:function(t,e,i){i=i||{};var r=ev.util.sizeAfterTransform(this.width,this.height,e),n=this.strokeWidth,s=this.strokeUniform,o=this.borderScaleFactor,a=r.x+n*(s?this.canvas.getZoom():e.scaleX)+o,h=r.y+n*(s?this.canvas.getZoom():e.scaleY)+o;return t.save(),this._setLineDash(t,i.borderDashArray||this.borderDashArray),t.strokeStyle=i.borderColor||this.borderColor,t.strokeRect(-a/2,-h/2,a,h),t.restore(),this},drawControls:function(t,e){e=e||{},t.save();var i,r,n=this.canvas.getRetinaScaling();return t.setTransform(n,0,0,n,0,0),t.strokeStyle=t.fillStyle=e.cornerColor||this.cornerColor,this.transparentCorners||(t.strokeStyle=e.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(t,e.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(i=this.group.calcTransformMatrix()),this.forEachControl(function(n,s,o){r=o.oCoords[s],n.getVisibility(o,s)&&(i&&(r=ev.util.transformPoint(r,i)),n.render(t,r.x,r.y,e,o))}),t.restore(),this},isControlVisible:function(t){return this.controls[t]&&this.controls[t].getVisibility(this,t)},setControlVisible:function(t,e){return this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[t]=e,this},setControlsVisibility:function(t){for(var e in t||(t={}),t)this.setControlVisible(e,t[e]);return this},onDeselect:function(){},onSelect:function(){}}),ev.util.object.extend(ev.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(t,e){var i=function(){},r=(e=e||{}).onComplete||i,n=e.onChange||i,s=this;return ev.util.animate({target:this,startValue:t.left,endValue:this.getCenterPoint().x,duration:this.FX_DURATION,onChange:function(e){t.set("left",e),s.requestRenderAll(),n()},onComplete:function(){t.setCoords(),r()}})},fxCenterObjectV:function(t,e){var i=function(){},r=(e=e||{}).onComplete||i,n=e.onChange||i,s=this;return ev.util.animate({target:this,startValue:t.top,endValue:this.getCenterPoint().y,duration:this.FX_DURATION,onChange:function(e){t.set("top",e),s.requestRenderAll(),n()},onComplete:function(){t.setCoords(),r()}})},fxRemove:function(t,e){var i=function(){},r=(e=e||{}).onComplete||i,n=e.onChange||i,s=this;return ev.util.animate({target:this,startValue:t.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(e){t.set("opacity",e),s.requestRenderAll(),n()},onComplete:function(){s.remove(t),r()}})}}),ev.util.object.extend(ev.Object.prototype,{animate:function(){if(arguments[0]&&"object"==typeof arguments[0]){var t,e,i=[],r=[];for(t in arguments[0])i.push(t);for(var n=0,s=i.length;n<s;n++)t=i[n],e=n!==s-1,r.push(this._animate(t,arguments[0][t],arguments[1],e));return r}return this._animate.apply(this,arguments)},_animate:function(t,e,i,r){var n,s=this;e=e.toString(),i=i?ev.util.object.clone(i):{},~t.indexOf(".")&&(n=t.split("."));var o=s.colorProperties.indexOf(t)>-1||n&&s.colorProperties.indexOf(n[1])>-1,a=n?this.get(n[0])[n[1]]:this.get(t);"from"in i||(i.from=a),o||(e=~e.indexOf("=")?a+parseFloat(e.replace("=","")):parseFloat(e));var h={target:this,startValue:i.from,endValue:e,byValue:i.by,easing:i.easing,duration:i.duration,abort:i.abort&&function(t,e,r){return i.abort.call(s,t,e,r)},onChange:function(e,o,a){n?s[n[0]][n[1]]=e:s.set(t,e),r||i.onChange&&i.onChange(e,o,a)},onComplete:function(t,e,n){r||(s.setCoords(),i.onComplete&&i.onComplete(t,e,n))}};return o?ev.util.animateColor(h.startValue,h.endValue,h.duration,h):ev.util.animate(h)}}),function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.extend,r=e.util.object.clone,n={x1:1,x2:1,y1:1,y2:1};function s(t,e){var i=t.origin,r=t.axis1,n=t.axis2,s=t.dimension,o=e.nearest,a=e.center,h=e.farthest;return function(){switch(this.get(i)){case o:return Math.min(this.get(r),this.get(n));case a:return Math.min(this.get(r),this.get(n))+.5*this.get(s);case h:return Math.max(this.get(r),this.get(n))}}}e.Line?e.warn("fabric.Line is already defined"):(e.Line=e.util.createClass(e.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,cacheProperties:e.Object.prototype.cacheProperties.concat("x1","x2","y1","y2"),initialize:function(t,e){t||(t=[0,0,0,0]),this.callSuper("initialize",e),this.set("x1",t[0]),this.set("y1",t[1]),this.set("x2",t[2]),this.set("y2",t[3]),this._setWidthHeight(e)},_setWidthHeight:function(t){t||(t={}),this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left="left"in t?t.left:this._getLeftToOriginX(),this.top="top"in t?t.top:this._getTopToOriginY()},_set:function(t,e){return this.callSuper("_set",t,e),void 0!==n[t]&&this._setWidthHeight(),this},_getLeftToOriginX:s({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:s({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(t){t.beginPath();var e=this.calcLinePoints();t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.lineWidth=this.strokeWidth;var i=t.strokeStyle;t.strokeStyle=this.stroke||t.fillStyle,this.stroke&&this._renderStroke(t),t.strokeStyle=i},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(t){return i(this.callSuper("toObject",t),this.calcLinePoints())},_getNonTransformedDimensions:function(){var t=this.callSuper("_getNonTransformedDimensions");return"butt"===this.strokeLineCap&&(0===this.width&&(t.y-=this.strokeWidth),0===this.height&&(t.x-=this.strokeWidth)),t},calcLinePoints:function(){var t=this.x1<=this.x2?-1:1,e=this.y1<=this.y2?-1:1,i=t*this.width*.5,r=e*this.height*.5;return{x1:i,x2:-(t*this.width*.5),y1:r,y2:-(e*this.height*.5)}},_toSVG:function(){var t=this.calcLinePoints();return["<line ","COMMON_PARTS",'x1="',t.x1,'" y1="',t.y1,'" x2="',t.x2,'" y2="',t.y2,'" />\n']}}),e.Line.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),e.Line.fromElement=function(t,r,n){n=n||{};var s=e.parseAttributes(t,e.Line.ATTRIBUTE_NAMES),o=[s.x1||0,s.y1||0,s.x2||0,s.y2||0];r(new e.Line(o,i(s,n)))},e.Line.fromObject=function(t,i){var n=r(t,!0);n.points=[t.x1,t.y1,t.x2,t.y2],e.Object._fromObject("Line",n,function(t){delete t.points,i&&i(t)},"points")})}(t),C=(x=t.fabric||(t.fabric={})).util.degreesToRadians,x.Circle?x.warn("fabric.Circle is already defined."):(x.Circle=x.util.createClass(x.Object,{type:"circle",radius:0,startAngle:0,endAngle:360,cacheProperties:x.Object.prototype.cacheProperties.concat("radius","startAngle","endAngle"),_set
1:function(t,e){return this.callSuper("_set",t,e),"radius"===t&&this.setRadius(e),this},toObject:function(t){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(t))},_toSVG:function(){var t,e=(this.endAngle-this.startAngle)%360;if(0===e)t=["<circle ","COMMON_PARTS",'cx="0" cy="0" ','r="',this.radius,'" />\n'];else{var i=C(this.startAngle),r=C(this.endAngle),n=this.radius;t=['<path d="M '+x.util.cos(i)*n+" "+x.util.sin(i)*n," A "+n+" "+n," 0 ",+(e>180?"1":"0")+" 1"," "+x.util.cos(r)*n+" "+x.util.sin(r)*n,'" ',"COMMON_PARTS"," />\n"]}return t},_render:function(t){t.beginPath(),t.arc(0,0,this.radius,C(this.startAngle),C(this.endAngle),!1),this._renderPaintInOrder(t)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(t){return this.radius=t,this.set("width",2*t).set("height",2*t)}}),x.Circle.ATTRIBUTE_NAMES=x.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),x.Circle.fromElement=function(t,e){var i=x.parseAttributes(t,x.Circle.ATTRIBUTE_NAMES);if(!("radius"in i&&i.radius>=0))throw Error("value of `r` attribute is required and can not be negative");i.left=(i.left||0)-i.radius,i.top=(i.top||0)-i.radius,e(new x.Circle(i))},x.Circle.fromObject=function(t,e){x.Object._fromObject("Circle",t,e)}),(S=t.fabric||(t.fabric={})).Triangle?S.warn("fabric.Triangle is already defined"):(S.Triangle=S.util.createClass(S.Object,{type:"triangle",width:100,height:100,_render:function(t){var e=this.width/2,i=this.height/2;t.beginPath(),t.moveTo(-e,i),t.lineTo(0,-i),t.lineTo(e,i),t.closePath(),this._renderPaintInOrder(t)},_toSVG:function(){var t=this.width/2,e=this.height/2;return["<polygon ","COMMON_PARTS",'points="',[-t+" "+e,"0 "+-e,t+" "+e].join(","),'" />']}}),S.Triangle.fromObject=function(t,e){return S.Object._fromObject("Triangle",t,e)}),w=t.fabric||(t.fabric={}),T=2*Math.PI,w.Ellipse?w.warn("fabric.Ellipse is already defined."):(w.Ellipse=w.util.createClass(w.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:w.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this.set("rx",t&&t.rx||0),this.set("ry",t&&t.ry||0)},_set:function(t,e){switch(this.callSuper("_set",t,e),t){case"rx":this.rx=e,this.set("width",2*e);break;case"ry":this.ry=e,this.set("height",2*e)}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},_toSVG:function(){return["<ellipse ","COMMON_PARTS",'cx="0" cy="0" ','rx="',this.rx,'" ry="',this.ry,'" />\n']},_render:function(t){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(0,0,this.rx,0,T,!1),t.restore(),this._renderPaintInOrder(t)}}),w.Ellipse.ATTRIBUTE_NAMES=w.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),w.Ellipse.fromElement=function(t,e){var i=w.parseAttributes(t,w.Ellipse.ATTRIBUTE_NAMES);i.left=(i.left||0)-i.rx,i.top=(i.top||0)-i.ry,e(new w.Ellipse(i))},w.Ellipse.fromObject=function(t,e){w.Object._fromObject("Ellipse",t,e)}),k=(O=t.fabric||(t.fabric={})).util.object.extend,O.Rect?O.warn("fabric.Rect is already defined"):(O.Rect=O.util.createClass(O.Object,{stateProperties:O.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:O.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(t){var e=this.rx?Math.min(this.rx,this.width/2):0,i=this.ry?Math.min(this.ry,this.height/2):0,r=this.width,n=this.height,s=-this.width/2,o=-this.height/2,a=0!==e||0!==i;t.beginPath(),t.moveTo(s+e,o),t.lineTo(s+r-e,o),a&&t.bezierCurveTo(s+r-.4477152502*e,o,s+r,o+.4477152502*i,s+r,o+i),t.lineTo(s+r,o+n-i),a&&t.bezierCurveTo(s+r,o+n-.4477152502*i,s+r-.4477152502*e,o+n,s+r-e,o+n),t.lineTo(s+e,o+n),a&&t.bezierCurveTo(s+.4477152502*e,o+n,s,o+n-.4477152502*i,s,o+n-i),t.lineTo(s,o+i),a&&t.bezierCurveTo(s,o+.4477152502*i,s+.4477152502*e,o,s+e,o),t.closePath(),this._renderPaintInOrder(t)},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},_toSVG:function(){return["<rect ","COMMON_PARTS",'x="',-this.width/2,'" y="',-this.height/2,'" rx="',this.rx,'" ry="',this.ry,'" width="',this.width,'" height="',this.height,'" />\n']}}),O.Rect.ATTRIBUTE_NAMES=O.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),O.Rect.fromElement=function(t,e,
vendor: 1,807 bytes, line 1
1i){if(!t)return e(null);i=i||{};var r=O.parseAttributes(t,O.Rect.ATTRIBUTE_NAMES);r.left=r.left||0,r.top=r.top||0,r.height=r.height||0,r.width=r.width||0;var n=new O.Rect(k(i?O.util.object.clone(i):{},r));n.visible=n.visible&&n.width>0&&n.height>0,e(n)},O.Rect.fromObject=function(t,e){return O.Object._fromObject("Rect",t,e)}),P=(E=t.fabric||(t.fabric={})).util.object.extend,A=E.util.array.min,j=E.util.array.max,D=E.util.toFixed,M=E.util.projectStrokeOnPoints,E.Polyline?E.warn("fabric.Polyline is already defined"):(E.Polyline=E.util.createClass(E.Object,{type:"polyline",points:null,exactBoundingBox:!1,cacheProperties:E.Object.prototype.cacheProperties.concat("points"),initialize:function(t,e){e=e||{},this.points=t||[],this.callSuper("initialize",e),this._setPositionDimensions(e)},_projectStrokeOnPoints:function(){return M(this.points,this,!0)},_setPositionDimensions:function(t){var e,i=this._calcDimensions(t),r=this.exactBoundingBox?this.strokeWidth:0;this.width=i.width-r,this.height=i.height-r,t.fromSVG||(e=this.translateToGivenOrigin({x:i.left-this.strokeWidth/2+r/2,y:i.top-this.strokeWidth/2+r/2},"left","top",this.originX,this.originY)),void 0===t.left&&(this.left=t.fromSVG?i.left:e.x),void 0===t.top&&(this.top=t.fromSVG?i.top:e.y),this.pathOffset={x:i.left+this.width/2+r/2,y:i.top+this.height/2+r/2}},_calcDimensions:function(){var t=this.exactBoundingBox?this._projectStrokeOnPoints():this.points,e=A(t,"x")||0,i=A(t,"y")||0;return{left:e,top:i,width:(j(t,"x")||0)-e,height:(j(t,"y")||0)-i}},toObject:function(t){return P(this.callSuper("toObject",t),{points:this.points.concat()})},_toSVG:function(){for(var t=[],e=this.pathOffset.x,i=this.pathOffset.y,r=E.Object.NUM_FRACTION_DIGITS,n=0,s=this.points.length;n<s;n++)t.push(D(this.points[n].x-e,r),",",D(this.points[n].y-i,r)," ");
vendor: 32,337 bytes, line 1
1return["<"+this.type+" ","COMMON_PARTS",'points="',t.join(""),'" />\n']},commonRender:function(t){var e,i=this.points.length,r=this.pathOffset.x,n=this.pathOffset.y;if(!i||isNaN(this.points[i-1].y))return!1;t.beginPath(),t.moveTo(this.points[0].x-r,this.points[0].y-n);for(var s=0;s<i;s++)e=this.points[s],t.lineTo(e.x-r,e.y-n);return!0},_render:function(t){this.commonRender(t)&&this._renderPaintInOrder(t)},complexity:function(){return this.get("points").length}}),E.Polyline.ATTRIBUTE_NAMES=E.SHARED_ATTRIBUTES.concat(),E.Polyline.fromElementGenerator=function(t){return function(e,i,r){if(!e)return i(null);r||(r={});var n=E.parsePointsAttribute(e.getAttribute("points")),s=E.parseAttributes(e,E[t].ATTRIBUTE_NAMES);s.fromSVG=!0,i(new E[t](n,P(s,r)))}},E.Polyline.fromElement=E.Polyline.fromElementGenerator("Polyline"),E.Polyline.fromObject=function(t,e){return E.Object._fromObject("Polyline",t,e,"points")}),F=(I=t.fabric||(t.fabric={})).util.projectStrokeOnPoints,I.Polygon?I.warn("fabric.Polygon is already defined"):(I.Polygon=I.util.createClass(I.Polyline,{type:"polygon",_projectStrokeOnPoints:function(){return F(this.points,this)},_render:function(t){this.commonRender(t)&&(t.closePath(),this._renderPaintInOrder(t))}}),I.Polygon.ATTRIBUTE_NAMES=I.SHARED_ATTRIBUTES.concat(),I.Polygon.fromElement=I.Polyline.fromElementGenerator("Polygon"),I.Polygon.fromObject=function(t,e){I.Object._fromObject("Polygon",t,e,"points")}),R=(L=t.fabric||(t.fabric={})).util.array.min,B=L.util.array.max,W=L.util.object.extend,z=L.util.object.clone,H=L.util.toFixed,L.Path?L.warn("fabric.Path is already defined"):(L.Path=L.util.createClass(L.Object,{type:"path",path:null,cacheProperties:L.Object.prototype.cacheProperties.concat("path","fillRule"),stateProperties:L.Object.prototype.stateProperties.concat("path"),initialize:function(t,e){delete(e=z(e||{})).path,this.callSuper("initialize",e),this._setPath(t||[],e)},_setPath:function(t,e){this.path=L.util.makePathSimpler(Array.isArray(t)?t:L.util.parsePath(t)),L.Polyline.prototype._setPositionDimensions.call(this,e||{})},_renderPathCommands:function(t){var e,i=0,r=0,n=0,s=0,o=0,a=0,h=-this.pathOffset.x,l=-this.pathOffset.y;t.beginPath();for(var c=0,u=this.path.length;c<u;++c)switch((e=this.path[c])[0]){case"L":n=e[1],s=e[2],t.lineTo(n+h,s+l);break;case"M":i=n=e[1],r=s=e[2],t.moveTo(n+h,s+l);break;case"C":n=e[5],s=e[6],o=e[3],a=e[4],t.bezierCurveTo(e[1]+h,e[2]+l,o+h,a+l,n+h,s+l);break;case"Q":t.quadraticCurveTo(e[1]+h,e[2]+l,e[3]+h,e[4]+l),n=e[3],s=e[4],o=e[1],a=e[2];break;case"z":case"Z":n=i,s=r,t.closePath()}},_render:function(t){this._renderPathCommands(t),this._renderPaintInOrder(t)},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(t){return W(this.callSuper("toObject",t),{path:this.path.map(function(t){return t.slice()})})},toDatalessObject:function(t){var e=this.toObject(["sourcePath"].concat(t));return e.sourcePath&&delete e.path,e},_toSVG:function(){return["<path ","COMMON_PARTS",'d="',L.util.joinPath(this.path),'" stroke-linecap="round" ',"/>\n"]},_getOffsetTransform:function(){var t=L.Object.NUM_FRACTION_DIGITS;return" translate("+H(-this.pathOffset.x,t)+", "+H(-this.pathOffset.y,t)+")"},toClipPathSVG:function(t){var e=this._getOffsetTransform();return"	"+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},toSVG:function(t){var e=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},complexity:function(){return this.path.length},_calcDimensions:function(){for(var t,e,i=[],r=[],n=0,s=0,o=0,a=0,h=0,l=this.path.length;h<l;++h){switch((t=this.path[h])[0]){case"L":o=t[1],a=t[2],e=[];break;case"M":n=o=t[1],s=a=t[2],e=[];break;case"C":e=L.util.getBoundsOfCurve(o,a,t[1],t[2],t[3],t[4],t[5],t[6]),o=t[5],a=t[6];break;case"Q":e=L.util.getBoundsOfCurve(o,a,t[1],t[2],t[1],t[2],t[3],t[4]),o=t[3],a=t[4];break;case"z":case"Z":o=n,a=s}e.forEach(function(t){i.push(t.x),r.push(t.y)}),i.push(o),r.push(a)}var c=R(i)||0,u=R(r)||0;return{left:c,top:u,width:(B(i)||0)-c,height:(B(r)||0)-u}}}),L.Path.fromObject=function(t,e){if("string"==typeof t.sourcePath){var i=t.sourcePath;L.loadSVGFromURL(i,function(i){var r=i[0];r.setOptions(t),t.clipPath?L.util.enlivenObjects([t.clipPath],function(t){r.clipPath=t[0],e&&e(r)}):e&&e(r)})}else L.Object._fromObject("Path",t,e,"path")},L.Path.ATTRIBUTE_NAMES=L.SHARED_ATTRIBUTES.concat(["d"]),L.Path.fromElement=function(t,e,i){var r=L.parseAttributes(t,L.Path.ATTRIBUTE_NAMES);r.fromSVG=!0,e(new L.Path(r.d,W(r,i)))}),U=(Y=t.fabric||(t.fabric={})).util.array.min,N=Y.util.array.max,Y.Group||(Y.Group=Y.util.createClass(Y.Object,Y.Collection,{type:"group",strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!1,initialize:function(t,e,i){e=e||{},this._objects=[],i&&this.callSuper("initialize",e),this._objects=t||[];for(var r=this._objects.length;r--;)this._objects[r].group=this;if(i)this._updateObjectsACoords();else{var n=e&&e.centerPoint;void 0!==e.originX&&(this.originX=e.originX),void 0!==e.originY&&(this.originY=e.originY),n||this._calcBounds(),this._updateObjectsCoords(n),delete e.centerPoint,this.callSuper("initialize",e)}this.setCoords()},_updateObjectsACoords:function(){for(var t=this._objects.length;t--;)this._objects[t].setCoords(!0)},_updateObjectsCoords:function(t){t=t||this.getCenterPoint();for(var e=this._objects.length;e--;)this._updateObjectCoords(this._objects[e],t)},_updateObjectCoords:function(t,e){var i=t.left,r=t.top;t.set({left:i-e.x,top:r-e.y}),t.group=this,t.setCoords(!0)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(t){var e=!!this.group;return this._restoreObjectsState(),Y.util.resetObjectTransform(this),t&&(e&&Y.util.removeTransformFromObject(t,this.group.calcTransformMatrix()),this._objects.push(t),t.group=this,t._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,e?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(t){return this._restoreObjectsState(),Y.util.resetObjectTransform(this),this.remove(t),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(t){this.dirty=!0,t.group=this,t._set("canvas",this.canvas)},_onObjectRemoved:function(t){this.dirty=!0,delete t.group},_set:function(t,e){var i=this._objects.length;if(this.useSetOnGroup)for(;i--;)this._objects[i].setOnGroup(t,e);if("canvas"===t)for(;i--;)this._objects[i]._set(t,e);Y.Object.prototype._set.call(this,t,e)},toObject:function(t){var e=this.includeDefaultValues,i=this._objects.filter(function(t){return!t.excludeFromExport}).map(function(i){var r=i.includeDefaultValues;i.includeDefaultValues=e;var n=i.toObject(t);return i.includeDefaultValues=r,n}),r=Y.Object.prototype.toObject.call(this,t);return r.objects=i,r},toDatalessObject:function(t){var e,i=this.sourcePath;if(i)e=i;else{var r=this.includeDefaultValues;e=this._objects.map(function(e){var i=e.includeDefaultValues;e.includeDefaultValues=r;var n=e.toDatalessObject(t);return e.includeDefaultValues=i,n})}var n=Y.Object.prototype.toDatalessObject.call(this,t);return n.objects=e,n},render:function(t){this._transformDone=!0,this.callSuper("render",t),this._transformDone=!1},shouldCache:function(){var t=Y.Object.prototype.shouldCache.call(this);if(t){for(var e=0,i=this._objects.length;e<i;e++)if(this._objects[e].willDrawShadow())return this.ownCaching=!1,!1}return t},willDrawShadow:function(){if(Y.Object.prototype.willDrawShadow.call(this))return!0;for(var t=0,e=this._objects.length;t<e;t++)if(this._objects[t].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(t){for(var e=0,i=this._objects.length;e<i;e++)this._objects[e].render(t);this._drawClipPath(t,this.clipPath)},isCacheDirty:function(t){if(this.callSuper("isCacheDirty",t))return!0;if(!this.statefullCache)return!1;for(var e=0,i=this._objects.length;e<i;e++)if(this._objects[e].isCacheDirty(!0)){if(this._cacheCanvas){var r=this.cacheWidth/this.zoomX,n=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-r/2,-n/2,r,n)}return!0}return!1},_restoreObjectsState:function(){var t=this.calcOwnMatrix();return this._objects.forEach(function(e){Y.util.addTransformToObject(e,t),delete e.group,e.setCoords()}),this},destroy:function(){return this._objects.forEach(function(t){t.set("dirty",!0)}),this._restoreObjectsState()},dispose:function(){this.callSuper("dispose"),this.forEachObject(function(t){t.dispose&&t.dispose()}),this._objects=[]},toActiveSelection:function(){if(this.canvas){var t=this._objects,e=this.canvas;this._objects=[];var i=this.toObject();delete i.objects;var r=new Y.ActiveSelection([]);return r.set(i),r.type="activeSelection",e.remove(this),t.forEach(function(t){t.group=r,t.dirty=!0,e.add(t)}),r.canvas=e,r._objects=t,e._activeObject=r,r.setCoords(),r}},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){return this.forEachObject(function(t){t.setCoords(!0)}),this},_calcBounds:function(t){for(var e,i,r,n,s=[],o=[],a=["tr","br","bl","tl"],h=0,l=this._objects.length,c=a.length;h<l;++h){for(r=(e=this._objects[h]).calcACoords(),n=0;n<c;n++)i=a[n],s.push(r[i].x),o.push(r[i].y);e.aCoords=r}this._getBounds(s,o,t)},_getBounds:function(t,e,i){var r=new Y.Point(U(t),U(e)),n=new Y.Point(N(t),N(e)),s=r.y||0,o=r.x||0,a=n.x-r.x||0,h=n.y-r.y||0;this.width=a,this.height=h,i||this.setPositionByOrigin({x:o,y:s},"left","top")},_toSVG:function(t){for(var e=["<g ","COMMON_PARTS"," >\n"],i=0,r=this._objects.length;i<r;i++)e.push("		",this._objects[i].toSVG(t));return e.push("</g>\n"),e},getSvgStyles:function(){var t=void 0!==this.opacity&&1!==this.opacity?"opacity: "+this.opacity+";":"",e=this.visible?"":" visibility: hidden;";return[t,this.getSvgFilter(),e].join("")},toClipPathSVG:function(t){for(var e=[],i=0,r=this._objects.length;i<r;i++)e.push("	",this._objects[i].toClipPathSVG(t));return this._createBaseClipPathSVGMarkup(e,{reviver:t})}}),Y.Group.fromObject=function(t,e){var i=t.objects,r=Y.util.object.clone(t,!0);delete r.objects,"string"!=typeof i?Y.util.enlivenObjects(i,function(i){Y.util.enlivenObjectEnlivables(t,r,function(){e&&e(new Y.Group(i,r,!0))})}):Y.loadSVGFromURL(i,function(n){var s=Y.util.groupSVGElements(n,t,i),o=r.clipPath;delete r.clipPath,s.set(r),o?Y.util.enlivenObjects([o],function(t){s.clipPath=t[0],e&&e(s)}):e&&e(s)})}),(V=t.fabric||(t.fabric={})).ActiveSelection||(V.ActiveSelection=V.util.createClass(V.Group,{type:"activeSelection",initialize:function(t,e){e=e||{},this._objects=t||[];for(var i=this._objects.length;i--;)this._objects[i].group=this;e.originX&&(this.originX=e.originX),e.originY&&(this.originY=e.originY),this._calcBounds(),this._updateObjectsCoords(),V.Object.prototype.initialize.call(this,e),this.setCoords()},toGroup:function(){var t=this._objects.concat();this._objects=[];var e=V.Object.prototype.toObject.call(this),i=new V.Group([]);if(delete e.type,i.set(e),t.forEach(function(t){t.canvas.remove(t),t.group=i}),i._objects=t,!this.canvas)return i;var r=this.canvas;return r.add(i),r._activeObject=i,i.setCoords(),i},onDeselect:function(){return this.destroy(),!1},toString:function(){return"#<fabric.ActiveSelection: ("+this.complexity()+")>"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(t,e,i){t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper("_renderControls",t,e),void 0===(i=i||{}).hasControls&&(i.hasControls=!1),i.forActiveSelection=!0;for(var r=0,n=this._objects.length;r<n;r++)this._objects[r]._renderControls(t,i);t.restore()}}),V.ActiveSelection.fromObject=function(t,e){V.util.enlivenObjects(t.objects,function(i){delete t.objects,e&&e(new V.ActiveSelection(i,t,!0))})}),G=ev.util.object.extend,t.fabric||(t.fabric={}),t.fabric.Image?ev.warn("fabric.Image is already defined."):(ev.Image=ev.util.createClass(ev.Object,{type:"image",strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:ev.Object.prototype.stateProperties.concat("cropX","cropY"),cacheProperties:ev.Object.prototype.cacheProperties.concat("cropX","cropY"),cacheKey:"",cropX:0,cropY:0,imageSmoothing:!0,initialize:function(t,e){e||(e={}),this.filters=[],this.cacheKey="texture"+ev.Object.__uid++,this.callSuper("initialize",e),this._initElement(t,e)},getElement:function(){return this._element||{}},setElement:function(t,e){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._element=t,this._originalElement=t,this._initConfig(e),0!==this.filters.length&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters(),this},removeTexture:function(t){var e=ev.filterBackend;e&&e.evictCachesForKey&&e.evictCachesForKey(t)},dispose:function(){this.callSuper("dispose"),this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._cacheContext=void 0,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach((function(t){ev.util.cleanUpJsdomNode(this[t]),this[t]=void 0}).bind(this))},getCrossOrigin:function(){return this._originalElement&&(this._originalElement.crossOrigin||null)},getOriginalSize:function(){var t=this.getElement();return{width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}},_stroke:function(t){if(this.stroke&&0!==this.strokeWidth){var e=this.width/2,i=this.height/2;t.beginPath(),t.moveTo(-e,-i),t.lineTo(e,-i),t.lineTo(e,i),t.lineTo(-e,i),t.lineTo(-e,-i),t.closePath()}},toObject:function(t){var e=[];this.filters.forEach(function(t){t&&e.push(t.toObject())});var i=G(this.callSuper("toObject",["cropX","cropY"].concat(t)),{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:e});return this.resizeFilter&&(i.resizeFilter=this.resizeFilter.toObject()),i},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},_toSVG:function(){var t,e=[],i=[],r=this._element,n=-this.width/2,s=-this.height/2,o="",a="";if(!r)return[];if(this.hasCrop()){var h=ev.Object.__uid++;e.push('<clipPath id="imageCrop_'+h+'">\n','	<rect x="'+n+'" y="'+s+'" width="'+this.width+'" height="'+this.height+'" />\n',"</clipPath>\n"),o=' clip-path="url(#imageCrop_'+h+')" '}if(this.imageSmoothing||(a='" image-rendering="optimizeSpeed'),i.push("	<image ","COMMON_PARTS",'xlink:href="',this.getSvgSrc(!0),'" x="',n-this.cropX,'" y="',s-this.cropY,'" width="',r.width||r.naturalWidth,'" height="',r.height||r.height,a,'"',o,"></image>\n"),this.stroke||this.strokeDashArray){var l=this.fill;this.fill=null,t=["	<rect ",'x="',n,'" y="',s,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'"/>\n'],this.fill=l}return"fill"!==this.paintFirst?e.concat(t,i):e.concat(i,t)},getSrc:function(t){var e=t?this._element:this._originalElement;return e?e.toDataURL?e.toDataURL():this.srcFromAttribute?e.getAttribute("src"):e.src:this.src||""},setSrc:function(t,e,i){return ev.util.loadImage(t,function(t,r){this.setElement(t,i),this._setWidthHeight(),e&&e(this,r)},this,i&&i.crossOrigin),this},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},applyResizeFilters:function(){var t=this.resizeFilter,e=this.minimumScaleTrigger,i=this.getTotalObjectScaling(),r=i.scaleX,n=i.scaleY,s=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!t||r>e&&n>e)return this._element=s,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=r,void(this._lastScaleY=n);ev.filterBackend||(ev.filterBackend=ev.initFilterBackend());var o=ev.util.createCanvasElement(),a=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,h=s.width,l=s.height;o.width=h,o.height=l,this._element=o,this._lastScaleX=t.scaleX=r,this._lastScaleY=t.scaleY=n,ev.filterBackend.applyFilters([t],s,h,l,this._element,a),this._filterScalingX=o.width/this._originalElement.width,this._filterScalingY=o.height/this._originalElement.height},applyFilters:function(t){if(t=(t=t||this.filters||[]).filter(function(t){return t&&!t.isNeutralState()}),this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),0===t.length)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var e=this._originalElement,i=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(this._element===this._originalElement){var n=ev.util.createCanvasElement();n.width=i,n.height=r,this._element=n,this._filteredEl=n}else this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,i,r),this._lastScaleX=1,this._lastScaleY=1;return ev.filterBackend||(ev.filterBackend=ev.initFilterBackend()),ev.filterBackend.applyFilters(t,this._originalElement,i,r,this._element,this.cacheKey),this._originalElement.width===this._element.width&&this._originalElement.height===this._element.height||(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(t){ev.util.setImageSmoothing(t,this.imageSmoothing),!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(t),this._renderPaintInOrder(t)},drawCacheOnCanvas:function(t){ev.util.setImageSmoothing(t,this.imageSmoothing),ev.Object.prototype.drawCacheOnCanvas.call(this,t)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(t){var e=this._element;if(e){var i=this._filterScalingX,r=this._filterScalingY,n=this.width,s=this.height,o=Math.min,a=Math.max,h=a(this.cropX,0),l=a(this.cropY,0),c=e.naturalWidth||e.width,u=e.naturalHeight||e.height,f=h*i,d=l*r,g=o(n*i,c-f),p=o(s*r,u-d),m=-n/2,v=-s/2,y=o(n,c/i-h),_=o(s,u/r-l);e&&t.drawImage(e,f,d,g,p,m,v,y,_)}},_needsResize:function(){var t=this.getTotalObjectScaling();return t.scaleX!==this._lastScaleX||t.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(t,e){this.setElement(ev.util.getById(t),e),ev.util.addClass(this.getElement(),ev.Image.CSS_CANVAS)},_initConfig:function(t){t||(t={}),this.setOptions(t),this._setWidthHeight(t)},_initFilters:function(t,e){t&&t.length?ev.util.enlivenObjects(t,function(t){e&&e(t)},"fabric.Image.filters"):e&&e()},_setWidthHeight:function(t){t||(t={});var e=this.getElement();this.width=t.width||e.naturalWidth||e.width||0,this.height=t.height||e.naturalHeight||e.height||0},parsePreserveAspectRatioAttribute:function(){var t,e=ev.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),i=this._element.width,r=this._element.height,n=1,s=1,o=0,a=0,h=0,l=0,c=this.width,u=this.height,f={width:c,height:u};return e&&("none"!==e.alignX||"none"!==e.alignY)?("meet"===e.meetOrSlice&&(t=(c-i*(n=s=ev.util.findScaleToFit(this._element,f)))/2,"Min"===e.alignX&&(o=-t),"Max"===e.alignX&&(o=t),t=(u-r*s)/2,"Min"===e.alignY&&(a=-t),"Max"===e.alignY&&(a=t)),"slice"===e.meetOrSlice&&(t=i-c/(n=s=ev.util.findScaleToCover(this._element,f)),"Mid"===e.alignX&&(h=t/2),"Max"===e.alignX&&(h=t),t=r-u/s,"Mid"===e.alignY&&(l=t/2),"Max"===e.alignY&&(l=t),i=c/n,r=u/s)):(n=c/i,s=u/r),{width:i,height:r,scaleX:n,scaleY:s,offsetLeft:o,offsetTop:a,cropX:h,cropY:l}}}),ev.Image.CSS_CANVAS="canvas-img",ev.Image.prototype.getSvgSrc=ev.Image.prototype.getSrc,ev.Image.fromObject=function(t,e){var i=ev.util.object.clone(t);ev.util.loadImage(i.src,function(t,r){r?e&&e(null,!0):ev.Image.prototype._initFilters.call(i,i.filters,function(r){i.filters=r||[],ev.Image.prototype._initFilters.call(i,[i.resizeFilter],function(r){i.resizeFilter=r[0],ev.util.enlivenObjectEnlivables(i,i,function(){e(new ev.Image(t,i),!1)})})})},null,i.crossOrigin)},ev.Image.fromURL=function(t,e,i){ev.util.loadImage(t,function(t,r){e&&e(new ev.Image(t,i),r)},null,i&&i.crossOrigin)},ev.Image.ATTRIBUTE_NAMES=ev.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")),ev.Image.fromElement=function(t,e,i){var r=ev.parseAttributes(t,ev.Image.ATTRIBUTE_NAMES);ev.Image.fromURL(r["xlink:href"],e,G(i?ev.util.object.clone(i):{},r))}),ev.util.object.extend(ev.Object.prototype,{_getAngleValueForStraighten:function(){var t=this.angle%360;return t>0?90*Math.round((t-1)/90):90*Math.round(t/90)},straighten:function(){return this.rotate(this._getAngleValueForStraighten())},fxStraighten:function(t){var e=function(){},i=(t=t||{}).onComplete||e,r=t.onChange||e,n=this;return ev.util.animate({target:this,startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){n.rotate(t),r()},onComplete:function(){n.setCoords(),i()}})}}),ev.util.object.extend(ev.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.requestRenderAllBound})}}),function(){function t(t){t&&t.tileSize&&(this.tileSize=t.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}ev.isWebglSupported=function(t){if(ev.isLikelyNode)return!1;t=t||ev.WebglFilterBackend.prototype.tileSize;var e=document.createElement("canvas"),i=e.getContext("webgl")||e.getContext("experimental-webgl"),r=!1;if(i){ev.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),r=ev.maxTextureSize>=t;for(var n=["highp","mediump","lowp"],s=0;s<3;s++)if(function(t,e){var i=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(i,"precision "+e+" float;\nvoid main(){}"),t.compileShader(i),!!t.getShaderParameter(i,t.COMPILE_STATUS)}(i,n[s])){ev.webGlPrecision=n[s];break}}return this.isSupported=r,r},ev.WebglFilterBackend=t,t.prototype={tileSize:2048,resources:{},setupGLContext:function(t,e){this.dispose(),this.createWebGLCanvas(t,e),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(t,e)},chooseFastestCopyGLTo2DMethod:function(t,e){var i,r=void 0!==window.performance;try{new ImageData(1,1),i=!0}catch(t){i=!1}var n="undefined"!=typeof ArrayBuffer,s="undefined"!=typeof Uint8ClampedArray;if(r&&i&&n&&s){var o=ev.util.createCanvasElement(),a=new ArrayBuffer(t*e*4);if(ev.forceGLPutImageData)return this.imageBuffer=a,void(this.copyGLTo2D=eb);var h,l,c={imageBuffer:a,destinationWidth:t,destinationHeight:e,targetCanvas:o};o.width=t,o.height=e,h=window.performance.now(),e_.call(c,this.gl,c),l=window.performance.now()-h,h=window.performance.now(),eb.call(c,this.gl,c),l>window.performance.now()-h?(this.imageBuffer=a,this.copyGLTo2D=eb):this.copyGLTo2D=e_}},createWebGLCanvas:function(t,e){var i=ev.util.createCanvasElement();i.width=t,i.height=e;var r={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},n=i.getContext("webgl",r);n||(n=i.getContext("experimental-webgl",r)),n&&(n.clearColor(0,0,0,0),this.canvas=i,this.gl=n)},applyFilters:function(t,e,i,r,n,s){var o,a,h,l,c,u,f=this.gl;s&&(u=this.getCachedTexture(s,e));var d={originalWidth:e.width||e.originalWidth,originalHeight:e.height||e.originalHeight,sourceWidth:i,sourceHeight:r,destinationWidth:i,destinationHeight:r,context:f,sourceTexture:this.createTexture(f,i,r,!u&&e),targetTexture:this.createTexture(f,i,r),originalTexture:u||this.createTexture(f,i,r,!u&&e),passes:t.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:n},g=f.createFramebuffer();return f.bindFramebuffer(f.FRAMEBUFFER,g),t.forEach(function(t){t&&t.applyTo(d)}),a=(o=d.targetCanvas).width,h=o.height,l=d.destinationWidth,c=d.destinationHeight,a===l&&h===c||(o.width=l,o.height=c),this.copyGLTo2D(f,d),f.bindTexture(f.TEXTURE_2D,null),f.deleteTexture(d.sourceTexture),f.deleteTexture(d.targetTexture),f.deleteFramebuffer(g),n.getContext("2d").setTransform(1,0,0,1,0,0),d},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(t,e,i,r,n){var s=t.createTexture();return t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n||t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n||t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),r?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,i,0,t.RGBA,t.UNSIGNED_BYTE,null),s},getCachedTexture:function(t,e){if(this.textureCache[t])return this.textureCache[t];var i=this.createTexture(this.gl,e.width,e.height,e);return this.textureCache[t]=i,i},evictCachesForKey:function(t){this.textureCache[t]&&(this.gl.deleteTexture(this.textureCache[t]),delete this.textureCache[t])},copyGLTo2D:e_,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var t=this.gl,e={renderer:"",vendor:""};if(!t)return e;var i=t.getExtension("WEBGL_debug_renderer_info");if(i){var r=t.getParameter(i.UNMASKED_RENDERER_WEBGL),n=t.getParameter(i.UNMASKED_VENDOR_WEBGL);r&&(e.renderer=r.toLowerCase()),n&&(e.vendor=n.toLowerCase())}return this.gpuInfo=e,e}}}(),function(){var t=function(){};function e(){}ev.Canvas2dFilterBackend=e,e.prototype={evictCachesForKey:t,dispose:t,clearWebGLCaches:t,resources:{},applyFilters:function(t,e,i,r,n){var s=n.getContext("2d");s.drawImage(e,0,0,i,r);var o={sourceWidth:i,sourceHeight:r,imageData:s.getImageData(0,0,i,r),originalEl:e,originalImageData:s.getImageData(0,0,i,r),canvasEl:n,ctx:s,filterBackend:this};return t.forEach(function(t){t.applyTo(o)}),o.imageData.width===i&&o.imageData.height===r||(n.width=o.imageData.width,n.height=o.imageData.height),s.putImageData(o.imageData,0,0),o}}}(),ev.Image=ev.Image||{},ev.Image.filters=ev.Image.filters||{},ev.Image.filters.BaseFilter=ev.util.createClass({type:"BaseFilter",vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvoid main() {\nvTexCoord = aPosition;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D uTexture;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\n}",initialize:function(t){t&&this.setOptions(t)},setOptions:function(t){for(var e in t)this[e]=t[e]},createProgram:function(t,e,i){e=e||this.fragmentSource,i=i||this.vertexSource,"highp"!==ev.webGlPrecision&&(e=e.replace(/precision highp float/g,"precision "+ev.webGlPrecision+" float"));var r=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(r,i),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw Error("Vertex shader compile error for "+this.type+": "+t.getShaderInfoLog(r));var n=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw Error("Fragment shader compile error for "+this.type+": "+t.getShaderInfoLog(n));var s=t.createProgram();if(t.attachShader(s,r),t.attachShader(s,n),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS))throw Error('Shader link error for "${this.type}" '+t.getProgramInfoLog(s));var o=this.getAttributeLocations(t,s),a=this.getUniformLocations(t,s)||{};return a.uStepW=t.getUniformLocation(s,"uStepW"),a.uStepH=t.getUniformLocation(s,"uStepH"),{program:s,attributeLocations:o,uniformLocations:a}},getAttributeLocations:function(t,e){return{aPosition:t.getAttribLocation(e,"aPosition")}},getUniformLocations:function(){return{}},sendAttributeData:function(t,e,i){var r=e.aPosition,n=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,n),t.enableVertexAttribArray(r),t.vertexAttribPointer(r,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW)},_setupFrameBuffer:function(t){var e,i,r=t.context;t.passes>1?(e=t.destinationWidth,i=t.destinationHeight,t.sourceWidth===e&&t.sourceHeight===i||(r.deleteTexture(t.targetTexture),t.targetTexture=t.filterBackend.createTexture(r,e,i)),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t.targetTexture,0)):(r.bindFramebuffer(r.FRAMEBUFFER,null),r.finish())},_swapTextures:function(t){t.passes--,t.pass++;var e=t.targetTexture;t.targetTexture=t.sourceTexture,t.sourceTexture=e},isNeutralState:function(){var t=this.mainParameter,e=ev.Image.filters[this.type].prototype;if(t){if(Array.isArray(e[t])){for(var i=e[t].length;i--;)if(this[t][i]!==e[t][i])return!1;return!0}return e[t]===this[t]}return!1},applyTo:function(t){t.webgl?(this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},retrieveShader:function(t){return t.programCache.hasOwnProperty(this.type)||(t.programCache[this.type]=this.createProgram(t.context)),t.programCache[this.type]},applyToWebGL:function(t){var e=t.context,i=this.retrieveShader(t);0===t.pass&&t.originalTexture?e.bindTexture(e.TEXTURE_2D,t.originalTexture):e.bindTexture(e.TEXTURE_2D,t.sourceTexture),e.useProgram(i.program),this.sendAttributeData(e,i.attributeLocations,t.aPosition),e.uniform1f(i.uniformLocations.uStepW,1/t.sourceWidth),e.uniform1f(i.uniformLocations.uStepH,1/t.sourceHeight),this.sendUniformData(e,i.uniformLocations),e.viewport(0,0,t.destinationWidth,t.destinationHeight),e.drawArrays(e.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(t,e,i){t.activeTexture(i),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE0)},unbindAdditionalTexture:function(t,e){t.activeTexture(e),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(t){this[this.mainParameter]=t},sendUniformData:function(){},createHelpLayer:function(t){if(!t.helpLayer){var e=document.createElement("canvas");e.width=t.sourceWidth,e.height=t.sourceHeight,t.helpLayer=e}},toObject:function(){var t={type:this.type},e=this.mainParameter;return e&&(t[e]=this[e]),t},toJSON:function(){return this.toObject()}}),ev.Image.filters.BaseFilter.fromObject=function(t,e){var i=new ev.Image.filters[t.type](t);return e&&e(i),i},K=(q=t.fabric||(t.fabric={})).Image.filters,J=q.util.createClass,K.ColorMatrix=J(K.BaseFilter,{type:"ColorMatrix",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform mat4 uColorMatrix;\nuniform vec4 uConstants;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor *= uColorMatrix;\ncolor += uConstants;\ngl_FragColor = color;\n}",matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:"matrix",colorsOnly:!0,initialize:function(t){this.callSuper("initialize",t),this.matrix=this.matrix.slice(0)},applyTo2d:function(t){var e,i,r,n,s,o=t.imageData.data,a=o.length,h=this.matrix,l=this.colorsOnly;for(s=0;s<a;s+=4)e=o[s],i=o[s+1],r=o[s+2],l?(o[s]=e*h[0]+i*h[1]+r*h[2]+255*h[4],o[s+1]=e*h[5]+i*h[6]+r*h[7]+255*h[9],o[s+2]=e*h[10]+i*h[11]+r*h[12]+255*h[14]):(n=o[s+3],o[s]=e*h[0]+i*h[1]+r*h[2]+n*h[3]+255*h[4],o[s+1]=e*h[5]+i*h[6]+r*h[7]+n*h[8]+255*h[9],o[s+2]=e*h[10]+i*h[11]+r*h[12]+n*h[13]+255*h[14],o[s+3]=e*h[15]+i*h[16]+r*h[17]+n*h[18]+255*h[19])},getUniformLocations:function(t,e){return{uColorMatrix:t.getUniformLocation(e,"uColorMatrix"),uConstants:t.getUniformLocation(e,"uConstants")}},sendUniformData:function(t,e){var i=this.matrix,r=[i[0],i[1],i[2],i[3],i[5],i[6],i[7],i[8],i[10],i[11],i[12],i[13],i[15],i[16],i[17],i[18]],n=[i[4],i[9],i[14],i[19]];t.uniformMatrix4fv(e.uColorMatrix,!1,r),t.uniform4fv(e.uConstants,n)}}),q.Image.filters.ColorMatrix.fromObject=q.Image.filters.BaseFilter.fromObject,$=(Z=t.fabric||(t.fabric={})).Image.filters,Q=Z.util.createClass,$.Brightness=Q($.BaseFilter,{type:"Brightness",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBrightness;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += uBrightness;\ngl_FragColor = color;\n}",brightness:0,mainParameter:"brightness",applyTo2d:function(t){if(0!==this.brightness){var e,i=t.imageData.data,r=i.length,n=Math.round(255*this.brightness);for(e=0;e<r;e+=4)i[e]=i[e]+n,i[e+1]=i[e+1]+n,i[e+2]=i[e+2]+n}},getUniformLocations:function(t,e){return{uBrightness:t.getUniformLocation(e,"uBrightness")}},sendUniformData:function(t,e){t.uniform1f(e.uBrightness,this.brightness)}}),Z.Image.filters.Brightness.fromObject=Z.Image.filters.BaseFilter.fromObject,te=(tt=t.fabric||(t.fabric={})).util.object.extend,ti=tt.Image.filters,tr=tt.util.createClass,ti.Convolute=tr(ti.BaseFilter,{type:"C
1onvolute",opaque:!1,matrix:[0,0,0,0,1,0,0,0,0],fragmentSource:{Convolute_3_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_3_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_5_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_5_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_7_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_7_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_9_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_9_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}"},retrieveShader:function(t){var e=Math.sqrt(this.matrix.length),i=this.type+"_"+e+"_"+ +!!this.opaque,r=this.fragmentSource[i];return t.programCache.hasOwnProperty(i)||(t.programCache[i]=this.createProgram(t.context,r)),t.programCache[i]},applyTo2d:function(t){var e,i,r,n,s,o,a,h,l,c,u,f,d,g=t.imageData,p=g.data,m=this.matrix,v=Math.round(Math.sqrt(m.length)),y=Math.floor(v/2),_=g.width,b=g.height,x=t.ctx.createImageData(_,b),C=x.data,S=+!!this.opaque;for(u=0;
vendor: 6,889 bytes, line 1
1u<b;u++)for(c=0;c<_;c++){for(s=4*(u*_+c),e=0,i=0,r=0,n=0,d=0;d<v;d++)for(f=0;f<v;f++)o=c+f-y,(a=u+d-y)<0||a>=b||o<0||o>=_||(h=4*(a*_+o),l=m[d*v+f],e+=p[h]*l,i+=p[h+1]*l,r+=p[h+2]*l,S||(n+=p[h+3]*l));C[s]=e,C[s+1]=i,C[s+2]=r,C[s+3]=S?p[s+3]:n}t.imageData=x},getUniformLocations:function(t,e){return{uMatrix:t.getUniformLocation(e,"uMatrix"),uOpaque:t.getUniformLocation(e,"uOpaque"),uHalfSize:t.getUniformLocation(e,"uHalfSize"),uSize:t.getUniformLocation(e,"uSize")}},sendUniformData:function(t,e){t.uniform1fv(e.uMatrix,this.matrix)},toObject:function(){return te(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),tt.Image.filters.Convolute.fromObject=tt.Image.filters.BaseFilter.fromObject,ts=(tn=t.fabric||(t.fabric={})).Image.filters,to=tn.util.createClass,ts.Grayscale=to(ts.BaseFilter,{type:"Grayscale",fragmentSource:{average:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat average = (color.r + color.b + color.g) / 3.0;\ngl_FragColor = vec4(average, average, average, color.a);\n}",lightness:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\ngl_FragColor = vec4(average, average, average, col.a);\n}",luminosity:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\ngl_FragColor = vec4(average, average, average, col.a);\n}"},mode:"average",mainParameter:"mode",applyTo2d:function(t){var e,i,r=t.imageData.data,n=r.length,s=this.mode;for(e=0;e<n;e+=4)"average"===s?i=(r[e]+r[e+1]+r[e+2])/3:"lightness"===s?i=(Math.min(r[e],r[e+1],r[e+2])+Math.max(r[e],r[e+1],r[e+2]))/2:"luminosity"===s&&(i=.21*r[e]+.72*r[e+1]+.07*r[e+2]),r[e]=i,r[e+1]=i,r[e+2]=i},retrieveShader:function(t){var e=this.type+"_"+this.mode;if(!t.programCache.hasOwnProperty(e)){var i=this.fragmentSource[this.mode];t.programCache[e]=this.createProgram(t.context,i)}return t.programCache[e]},getUniformLocations:function(t,e){return{uMode:t.getUniformLocation(e,"uMode")}},sendUniformData:function(t,e){t.uniform1i(e.uMode,1)},isNeutralState:function(){return!1}}),tn.Image.filters.Grayscale.fromObject=tn.Image.filters.BaseFilter.fromObject,th=(ta=t.fabric||(t.fabric={})).Image.filters,tl=ta.util.createClass,th.Invert=tl(th.BaseFilter,{type:"Invert",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uInvert;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nif (uInvert == 1) {\ngl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);\n} else {\ngl_FragColor = color;\n}\n}",invert:!0,mainParameter:"invert",applyTo2d:function(t){var e,i=t.imageData.data,r=i.length;for(e=0;e<r;e+=4)i[e]=255-i[e],i[e+1]=255-i[e+1],i[e+2]=255-i[e+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(t,e){return{uInvert:t.getUniformLocation(e,"uInvert")}},sendUniformData:function(t,e){t.uniform1i(e.uInvert,this.invert)}}),ta.Image.filters.Invert.fromObject=ta.Image.filters.BaseFilter.fromObject,tu=(tc=t.fabric||(t.fabric={})).util.object.extend,tf=tc.Image.filters,td=tc.util.createClass,tf.Noise=td(tf.BaseFilter,{type:"Noise",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uStepH;\nuniform float uNoise;\nuniform float uSeed;\nvarying vec2 vTexCoord;\nfloat rand(vec2 co, float seed, float vScale) {\nreturn fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);\n}\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;\ngl_FragColor = color;\n}",mainParameter:"noise",noise:0,applyTo2d:function(t){if(0!==this.noise){var e,i,r=t.imageData.data,n=r.length,s=this.noise;for(e=0,n=r.length;e<n;e+=4)i=(.5-Math.random())*s,r[e]+=i,r[e+1]+=i,r[e+2]+=i}},getUniformLocations:function(t,e){return{uNoise:t.getUniformLocation(e,"uNoise"),uSeed:t.getUniformLocation(e,"uSeed")}},sendUniformData:function(t,e){t.uniform1f(e.uNoise,this.noise/255),t.uniform1f(e.uSeed,Math.random())},toObject:function(){return tu(this.callSuper("toObject"),{noise:this.noise})}}),tc.Image.filters.Noise.fromObject=tc.Image.filters.BaseFilter.fromObject,tp=(tg=t.fabric||(t.fabric={})).Image.filters,tm=tg.util.createClass,tp.Pixelate=tm(tp.BaseFilter,{type:"Pixelate",blocksize:4,mainParameter:"blocksize",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBlocksize;\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nfloat blockW = uBlocksize * uStepW;\nfloat blockH = uBlocksize * uStepW;\nint posX = int(vTexCoord.x / blockW);\nint posY = int(vTexCoord.y / blockH);\nfloat fposX = float(posX);\nfloat fposY = float(posY);\nvec2 squareCoords = vec2(fposX * blockW, fposY * blockH);\nvec4 color = texture2D(uTexture, squareCoords);\ngl_FragColor = color;\n}",applyTo2d:function(t){var e,i,r,n,s,o,a,h,l,c,u,f=t.imageData,d=f.data,g=f.height,p=f.width;for(i=0;i<g;i+=this.blocksize)for(r=0;r<p;r+=this.blocksize)for(n=d[e=4*i*p+4*r],s=d[e+1],o=d[e+2],a=d[e+3],c=Math.min(i+this.blocksize,g),u=Math.min(r+this.blocksize,p),h=i;h<c;h++)for(l=r;l<u;l++)d[e=4*h*p+4*l]=n,d[e+1]=s,d[e+2]=o,d[e+3]=a},isNeutralState:function(){return 1===this.blocksize},getUniformLocations:function(t,e){return{uBlocksize:t.getUniformLocation(e,"uBlocksize"),uStepW:t.getUniformLocation(e,"uStepW"),uStepH:t.getUniformLocation(e,"uStepH")}},sendUniformData:function(t,e){t.uniform1f(e.uBlocksize,this.blocksize)}}),tg.Image.filters.Pixelate.fromObject=tg.Image.filters.BaseFilter.fromObject,ty=(tv=t.fabric||(t.fabric={})).util.object.extend,t_=tv.Image.filters,tb=tv.util.createClass,t_.RemoveColor=tb(t_.BaseFilter,{type:"RemoveColor",color:"#FFFFFF",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uLow;\nuniform vec4 uHigh;\nvarying vec2 vTexCoord;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\nif(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\ngl_FragColor.a = 0.0;\n}\n}",distance:.02,useAlpha:!1,applyTo2d:function(t){var e,i,r,n,s=t.imageData.data,o=255*this.distance,a=new tv.Color(this.color).getSource(),h=[a[0]-o,a[1]-o,a[2]-o],l=[a[0]+o,a[1]+o,a[2]+o];for(e=0;e<s.length;e+=4)i=s[e],r=s[e+1],n=s[e+2],i>h[0]&&r>h[1]&&n>h[2]&&i<l[0]&&r<l[1]&&n<l[2]&&(s[e+3]=0)},getUniformLocations:function(t,e){return{uLow:t.getUniformLocation(e,"uLow"),uHigh:t.getUniformLocation(e,"uHigh")}},sendUniformData:function(t,e){var i=new tv.Color(this.color).getSource(),r
vendor: 4,279 bytes, line 1
1=parseFloat(this.distance),n=[0+i[0]/255-r,0+i[1]/255-r,0+i[2]/255-r,1],s=[i[0]/255+r,i[1]/255+r,i[2]/255+r,1];t.uniform4fv(e.uLow,n),t.uniform4fv(e.uHigh,s)},toObject:function(){return ty(this.callSuper("toObject"),{color:this.color,distance:this.distance})}}),tv.Image.filters.RemoveColor.fromObject=tv.Image.filters.BaseFilter.fromObject,function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass,n={Brownie:[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0],Vintage:[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0],Kodachrome:[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0],Technicolor:[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0],Polaroid:[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],Sepia:[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0],BlackWhite:[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]};for(var s in n)i[s]=r(i.ColorMatrix,{type:s,matrix:n[s],mainParameter:!1,colorsOnly:!0}),e.Image.filters[s].fromObject=e.Image.filters.BaseFilter.fromObject}(t),tC=(tx=t.fabric).Image.filters,tS=tx.util.createClass,tC.BlendColor=tS(tC.BaseFilter,{type:"BlendColor",color:"#F95C63",mode:"multiply",alpha:1,fragmentSource:{multiply:"gl_FragColor.rgb *= uColor.rgb;\n",screen:"gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n",add:"gl_FragColor.rgb += uColor.rgb;\n",diff:"gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n",subtract:"gl_FragColor.rgb -= uColor.rgb;\n",lighten:"gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n",darken:"gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n",exclusion:"gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n",overlay:"if (uColor.r < 0.5) {\ngl_FragColor.r *= 2.0 * uColor.r;\n} else {\ngl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n}\nif (uColor.g < 0.5) {\ngl_FragColor.g *= 2.0 * uColor.g;\n} else {\ngl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n}\nif (uColor.b < 0.5) {\ngl_FragColor.b *= 2.0 * uColor.b;\n} else {\ngl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n}\n",tint:"gl_FragColor.rgb *= (1.0 - uColor.a);\ngl_FragColor.rgb += uColor.rgb;\n"},buildSource:function(t){return"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ngl_FragColor = color;\nif (color.a > 0.0) {\n"+this.fragmentSource[t]+"}\n}"},retrieveShader:function(t){var e,i=this.type+"_"+this.mode;return t.programCache.hasOwnProperty(i)||(e=this.buildSource(this.mode),t.programCache[i]=this.createProgram(t.context,e)),t.programCache[i]},applyTo2d:function(t){var e,i,r,n,s,o,a,h=t.imageData.data,l=h.length,c=1-this.alpha;e=(a=new tx.Color(this.color).getSource())[0]*this.alpha,i=a[1]*this.alpha,r=a[2]*this.alpha;for(var u=0;u<l;u+=4)switch(n=h[u],s=h[u+1],o=h[u+2],this.mode){case"multiply":h[u]=n*e/255,h[u+1]=s*i/255,h[u+2]=o*r/255;break;case"screen":h[u]=255-(255-n)*(255-e)/255,h[u+1]=255-(255-s)*(255-i)/255,h[u+2]=255-(255-o)*(255-r)/255;break;case"add":h[u]=n+e,h[u+1]=s+i,h[u+2]=o+r;break;case"diff":case"difference":h[u]=Math.abs(n-e),h[u+1]=Math.abs(s-i),h[u+2]=Math.abs(o-r);break;case"subtract":h[u]=n-e,h[u+1]=s-i,h[u+2]=o-r;break;case"darken":h[u]=Math.min(n,e),h[u+1]=Math.min(s,i),h[u+2]=Math.min(o,r);break;case"lighten":h[u]=Math.max(n,e),h[u+1]=Math.max(s,i),h[u+2]=Math.max(o,r);break;case"overlay":h[u]=e<128?2*n*e/255:255-2*(255-n)*(255-e)/255,h[u+1]=i<128?2*s*i/255:255-2*(255-s)*(255-i)/255,h[u+2]=r<128?2*o*r/255:255-2*(255-o)*(255-r)/255;break;case"exclusion":h[u]=e+n-2*e*n/255,h[u+1]=i+s-2*i*s/255,h[u+2]=r+o-2*r*o/255;break;case"tint":h[u]=e+n*c,h[u+1]=i+s*c,h[u+2]=r+o*c}},getUniformLocations:function(t,e){return{uColor:t.getUniformLocation(e,"uColor")}},sendUniformData:function(t,e){var i=new tx.Color(this.color).getSource();i[0]=this.alpha*i[0]/255,i[1]=this.alpha*i[1]/255,i[2]=this.alpha*i[2]/255,i[3]=this.alpha,t.uniform4fv(e.uColor,i)}
1,toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}}),tx.Image.filters.BlendColor.fromObject=tx.Image.filters.BaseFilter.fromObject,tT=(tw=t.fabric).Image.filters,tO=tw.util.createClass,tT.BlendImage=tO(tT.BaseFilter,{type:"BlendImage",image:null,mode:"multiply",alpha:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:{multiply:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.rgba *= color2.rgba;\ngl_FragColor = color;\n}",mask:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.a = color2.a;\ngl_FragColor = color;\n}"},retrieveShader:function(t){var e=this.type+"_"+this.mode,i=this.fragmentSource[this.mode];return t.programCache.hasOwnProperty(e)||(t.programCache[e]=this.createProgram(t.context,i)),t.programCache[e]},applyToWebGL:function(t){var e=t.context,i=this.createTexture(t.filterBackend,this.image);this.bindAdditionalTexture(e,i,e.TEXTURE1),this.callSuper("applyToWebGL",t),this.unbindAdditionalTexture(e,e.TEXTURE1)}
vendor: 14,982 bytes, line 1
1,createTexture:function(t,e){return t.getCachedTexture(e.cacheKey,e._element)},calculateMatrix:function(){var t=this.image,e=t._element.width,i=t._element.height;return[1/t.scaleX,0,0,0,1/t.scaleY,0,-t.left/e,-t.top/i,1]},applyTo2d:function(t){var e,i,r,n,s,o,a,h,l,c,u,f=t.imageData,d=t.filterBackend.resources,g=f.data,p=g.length,m=f.width,v=f.height,y=this.image;d.blendImage||(d.blendImage=tw.util.createCanvasElement()),c=(l=d.blendImage).getContext("2d"),l.width!==m||l.height!==v?(l.width=m,l.height=v):c.clearRect(0,0,m,v),c.setTransform(y.scaleX,0,0,y.scaleY,y.left,y.top),c.drawImage(y._element,0,0,m,v),u=c.getImageData(0,0,m,v).data;for(var _=0;_<p;_+=4)switch(s=g[_],o=g[_+1],a=g[_+2],h=g[_+3],e=u[_],i=u[_+1],r=u[_+2],n=u[_+3],this.mode){case"multiply":g[_]=s*e/255,g[_+1]=o*i/255,g[_+2]=a*r/255,g[_+3]=h*n/255;break;case"mask":g[_+3]=n}},getUniformLocations:function(t,e){return{uTransformMatrix:t.getUniformLocation(e,"uTransformMatrix"),uImage:t.getUniformLocation(e,"uImage")}},sendUniformData:function(t,e){var i=this.calculateMatrix();t.uniform1i(e.uImage,1),t.uniformMatrix3fv(e.uTransformMatrix,!1,i)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}}),tw.Image.filters.BlendImage.fromObject=function(t,e){tw.Image.fromObject(t.image,function(i){var r=tw.util.object.clone(t);r.image=i,e(new tw.Image.filters.BlendImage(r))})},tk=t.fabric||(t.fabric={}),tE=Math.pow,tP=Math.floor,tA=Math.sqrt,tj=Math.abs,tD=Math.round,tM=Math.sin,tI=Math.ceil,tF=tk.Image.filters,tL=tk.util.createClass,tF.Resize=tL(tF.BaseFilter,{type:"Resize",resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(t,e){return{uDelta:t.getUniformLocation(e,"uDelta"),uTaps:t.getUniformLocation(e,"uTaps")}},sendUniformData:function(t,e){t.uniform2fv(e.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),t.uniform1fv(e.uTaps,this.taps)},retrieveShader:function(t){var e=this.getFilterWindow(),i=this.type+"_"+e;if(!t.programCache.hasOwnProperty(i)){var r=this.generateShader(e);t.programCache[i]=this.createProgram(t.context,r)}return t.programCache[i]},getFilterWindow:function(){var t=this.tempScale;return Math.ceil(this.lanczosLobes/t)},getTaps:function(){for(var t=this.lanczosCreate(this.lanczosLobes),e=this.tempScale,i=this.getFilterWindow(),r=Array(i),n=1;n<=i;n++)r[n-1]=t(n*e);return r},generateShader:function(t){for(var e=Array(t),i=this.fragmentSourceTOP,r=1;r<=t;r++)e[r-1]=r+".0 * uDelta";return i+="uniform float uTaps["+t+"];\n",i+="void main() {\n",i+="  vec4 color = texture2D(uTexture, vTexCoord);\n",i+="  float sum = 1.0;\n",e.forEach(function(t,e){i+="  color += texture2D(uTexture, vTexCoord + "+t+") * uTaps["+e+"];\n",i+="  color += texture2D(uTexture, vTexCoord - "+t+") * uTaps["+e+"];\n",i+="  sum += 2.0 * uTaps["+e+"];\n"}),i+="  gl_FragColor = color / sum;\n",i+="}"},fragmentSourceTOP:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\n",applyTo:function(t){t.webgl?(t.passes++,this.width=t.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=t.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),t.destinationWidth=this.dW,this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t),t.sourceWidth=t.destinationWidth,this.height=t.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),t.destinationHeight=this.dH,this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t),t.sourceHeight=t.destinationHeight):this.applyTo2d(t)},isNeutralState:function(){return 1===this.scaleX&&1===this.scaleY},lanczosCreate:function(t){return function(e){if(e>=t||e<=-t)return 0;if(e<11920929e-14&&e>-11920929e-14)return 1;var i=(e*=Math.PI)/t;return tM(e)/e*tM(i)/i}},applyTo2d:function(t){var e=t.imageData,i=this.scaleX,r=this.scaleY;this.rcpScaleX=1/i,this.rcpScaleY=1/r;var n,s=e.width,o=e.height,a=tD(s*i),h=tD(o*r);"sliceHack"===this.resizeType?n=this.sliceByTwo(t,s,o,a,h):"hermite"===this.resizeType?n=this.hermiteFastResize(t,s,o,a,h):"bilinear"===this.resizeType?n=this.bilinearFiltering(t,s,o,a,h):"lanczos"===this.resizeType&&(n=this.lanczosResize(t,s,o,a,h)),t.imageData=n},sliceByTwo:function(t,e,i,r,n){var s,o,a=t.imageData,h=!1,l=!1,c=.5*e,u=.5*i,f=tk.filterBackend.resources,d=0,g=0,p=e,m=0;for(f.sliceByTwo||(f.sliceByTwo=document.createElement("canvas")),((s=f.sliceByTwo).width<1.5*e||s.height<i)&&(s.width=1.5*e,s.height=i),(o=s.getContext("2d")).clearRect(0,0,1.5*e,i),o.putImageData(a,0,0),r=tP(r),n=tP(n);!h||!l;)e=c,i=u,r<tP(.5*c)?c=tP(.5*c):(c=r,h=!0),n<tP(.5*u)?u=tP(.5*u):(u=n,l=!0),o.drawImage(s,d,g,e,i,p,m,c,u),d=p,g=m,m+=u;return o.getImageData(d,g,r,n)},lanczosResize:function(t,e,i,r,n){var s=t.imageData.data,o=t.ctx.createImageData(r,n),a=o.data,h=this.lanczosCreate(this.lanczosLobes),l=this.rcpScaleX,c=this.rcpScaleY,u=2/this.rcpScaleX,f=2/this.rcpScaleY,d=tI(l*this.lanczosLobes/2),g=tI(c*this.lanczosLobes/2),p={},m={},v={};return function t(y){var _,b,x,C,S,w,T,O,k,E,P;for(m.x=(y+.5)*l,v.x=tP(m.x),_=0;_<n;_++){for(m.y=(_+.5)*c,v.y=tP(m.y),S=0,w=0,T=0,O=0,k=0,b=v.x-d;b<=v.x+d;b++)if(!(b<0||b>=e)){p[E=tP(1e3*tj(b-m.x))]||(p[E]={});for(var A=v.y-g;A<=v.y+g;A++)A<0||A>=i||(P=tP(1e3*tj(A-m.y)),p[E][P]||(p[E][P]=h(tA(tE(E*u,2)+tE(P*f,2))/1e3)),(x=p[E][P])>0&&(S+=x,w+=x*s[C=4*(A*e+b)],T+=x*s[C+1],O+=x*s[C+2],k+=x*s[C+3]))}a[C=4*(_*r+y)]=w/S,a[C+1]=T/S,a[C+2]=O/S,a[C+3]=k/S}return++y<r?t(y):o}(0)},bilinearFiltering:function(t,e,i,r,n){var s,o,a,h,l,c,u,f,d,g=0,p=this.rcpScaleX,m=this.rcpScaleY,v=4*(e-1),y=t.imageData.data,_=t.ctx.createImageData(r,n),b=_.data;for(a=0;a<n;a++)for(h=0;h<r;h++)for(l=p*h-(s=tP(p*h)),c=m*a-(o=tP(m*a)),d=4*(o*e+s),u=0;u<4;u++)f=y[d+u]*(1-l)*(1-c)+y[d+4+u]*l*(1-c)+y[d+v+u]*c*(1-l)+y[d+v+4+u]*l*c,b[g++]=f;return _},hermiteFastResize:function(t,e,i,r,n){for(var s=this.rcpScaleX,o=this.rcpScaleY,a=tI(s/2),h=tI(o/2),l=t.imageData.data,c=t.ctx.createImageData(r,n),u=c.data,f=0;f<n;f++)for(var d=0;d<r;d++){for(var g=4*(d+f*r),p=0,m=0,v=0,y=0,_=0,b=0,x=0,C=(f+.5)*o,S=tP(f*o);S<(f+1)*o;S++)for(var w=tj(C-(S+.5))/h,T=(d+.5)*s,O=w*w,k=tP(d*s);k<(d+1)*s;k++){var E=tj(T-(k+.5))/a,P=tA(O+E*E);P>1&&P<-1||(p=2*P*P*P-3*P*P+1)>0&&(x+=p*l[(E=4*(k+S*e))+3],v+=p,l[E+3]<255&&(p=p*l[E+3]/250),y+=p*l[E],_+=p*l[E+1],b+=p*l[E+2],m+=p)}u[g]=y/m,u[g+1]=_/m,u[g+2]=b/m,u[g+3]=x/v}return c},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),tk.Image.filters.Resize.fromObject=tk.Image.filters.BaseFilter.fromObject,tB=(tR=t.fabric||(t.fabric={})).Image.filters,tW=tR.util.createClass,tB.Contrast=tW(tB.BaseFilter,{type:"Contrast",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uContrast;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\ncolor.rgb = contrastF * (color.rgb - 0.5) + 0.5;\ngl_FragColor = color;\n}",contrast:0,mainParameter:"contrast",applyTo2d:function(t){if(0!==this.contrast){var e,i=t.imageData.data,r=i.length,n=Math.floor(255*this.contrast),s=259*(n+255)/(255*(259-n));for(e=0;e<r;e+=4)i[e]=s*(i[e]-128)+128,i[e+1]=s*(i[e+1]-128)+128,i[e+2]=s*(i[e+2]-128)+128}},getUniformLocations:function(t,e){return{uContrast:t.getUniformLocation(e,"uContrast")}},sendUniformData:function(t,e){t.uniform1f(e.uContrast,this.contrast)}}),tR.Image.filters.Contrast.fromObject=tR.Image.filters.BaseFilter.fromObject,tH=(tz=t.fabric||(t.fabric={})).Image.filters,tY=tz.util.createClass,tH.Saturation=tY(tH.BaseFilter,{type:"Saturation",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uSaturation;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat rgMax = max(color.r, color.g);\nfloat rgbMax = max(rgMax, color.b);\ncolor.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\ncolor.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\ncolor.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\ngl_FragColor = color;\n}",saturation:0,mainParameter:"saturation",applyTo2d:function(t){if(0!==this.saturation){var e,i,r=t.imageData.data,n=r.length,s=-this.saturation;for(e=0;e<n;e+=4)i=Math.max(r[e],r[e+1],r[e+2]),r[e]+=i!==r[e]?(i-r[e])*s:0,r[e+1]+=i!==r[e+1]?(i-r[e+1])*s:0,r[e+2]+=i!==r[e+2]?(i-r[e+2])*s:0}},getUniformLocations:function(t,e){return{uSaturation:t.getUniformLocation(e,"uSaturation")}},sendUniformData:function(t,e){t.uniform1f(e.uSaturation,-this.saturation)}}),tz.Image.filters.Saturation.fromObject=tz.Image.filters.BaseFilter.fromObject,tU=(tX=t.fabric||(t.fabric={})).Image.filters,tN=tX.util.createClass,tU.Vibrance=tN(tU.BaseFilter,{type:"Vibrance",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uVibrance;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat max = max(color.r, max(color.g, color.b));\nfloat avg = (color.r + color.g + color.b) / 3.0;\nfloat amt = (abs(max - avg) * 2.0) * uVibrance;\ncolor.r += max != color.r ? (max - color.r) * amt : 0.00;\ncolor.g += max != color.g ? (max - color.g) * amt : 0.00;\ncolor.b += max != color.b ? (max - color.b) * amt : 0.00;\ngl_FragColor = color;\n}",vibrance:0,mainParameter:"vibrance",applyTo2d:function(t){if(0!==this.vibrance){var e,i,r,n=t.imageData.data,s=n.length,o=-this.vibrance;for(e=0;e<s;e+=4)r=2*Math.abs((i=Math.max(n[e],n[e+1],n[e+2]))-(n[e]+n[e+1]+n[e+2])/3)/255*o,n[e]+=i!==n[e]?(i-n[e])*r:0,n[e+1]+=i!==n[e+1]?(i-n[e+1])*r:0,n[e+2]+=i!==n[e+2]?(i-n[e+2])*r:0}},getUniformLocations:function(t,e){return{uVibrance:t.getUniformLocation(e,"uVibrance")}},sendUniformData:function(t,e){t.uniform1f(e.uVibrance,-this.vibrance)}}),tX.Image.filters.Vibrance.fromObject=tX.Image.filters.BaseFilter.fromObject,tG=(tV=t.fabric||(t.fabric={})).Image.filters,tq=tV.util.createClass,tG.Blur=tq(tG.BaseFilter,{type:"Blur",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\nconst float nSamples = 15.0;\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\nfloat random(vec3 scale) {\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n}\nvoid main() {\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfloat offset = random(v3offset);\nfor (float t = -nSamples; t <= nSamples; t++) {\nfloat percent = (t + offset - 0.5) / nSamples;\nfloat weight = 1.0 - abs(percent);\ncolor += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\ntotal += weight;\n}\ngl_FragColor = color / total;\n}",blur:0,mainParameter:"blur",applyTo:function(t){t.webgl?(this.aspectRatio=t.sourceWidth/t.sourceHeight,t.passes++,this._setupFrameBuffer(t),this.horizontal=!0,this.applyToWebGL(t),this._swapTextures(t),this._setupFrameBuffer(t),this.horizontal=!1,this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},applyTo2d:function(t){t.imageData=this.simpleBlur(t)},simpleBlur:function(t){var e,i,r=t.filterBackend.resources,n=t.imageData.width,s=t.imageData.height;r.blurLayer1||(r.blurLayer1=tV.util.createCanvasElement(),r.blurLayer2=tV.util.createCanvasElement()),e=r.blurLayer1,i=r.blurLayer2,e.width===n&&e.height===s||(i.width=e.width=n,i.height=e.height=s);var o,a,h,l,c=e.getContext("2d"),u=i.getContext("2d"),f=.06*this.blur*.5;for(c.putImageData(t.imageData,0,0),u.clearRect(0,0,n,s),l=-15;l<=15;l++)h=f*(a=l/15)*n+(o=(Math.random()-.5)/4),u.globalAlpha=1-Math.abs(a),u.drawImage(e,h,o),c.drawImage(i,0,0),u.globalAlpha=1,u.clearRect(0,0,i.width,i.height);for(l=-15;l<=15;l++)h=f*(a=l/15)*s+(o=(Math.random()-.5)/4),u.globalAlpha=1-Math.abs(a),u.drawImage(e,o,h),c.drawImage(i,0,0),u.globalAlpha=1,u.clearRect(0,0,i.width,i.height);t.ctx.drawImage(e,0,0);var d=t.ctx.getImageData(0,0,e.width,e.height);return c.globalAlpha=1,c.clearRect(0,0,e.width,e.height),d},getUniformLocations:function(t,e){return{delta:t.getUniformLocation(e,"uDelta")}},sendUniformData:function(t,e){var i=this.chooseRightDelta();t.uniform2fv(e.delta,i)},chooseRightDelta:function(){var t,e=1,i=[0,0];return this.horizontal?this.aspectRatio>1&&(e=1/this.aspectRatio):this.aspectRatio<1&&(e=this.aspectRatio),t=e*this.blur*.12,this.horizontal?i[0]=t:i[1]=t,i}}),tG.Blur.fromObject=tV.Image.filters.BaseFilter.fromObject,tJ=(tK=t.fabric||(t.fabric={})).Image.filters,tZ=tK.util.createClass,tJ.Gamma=tZ(tJ.BaseFilter,{type:"Gamma",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec3 uGamma;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec3 correction = (1.0 / uGamma);\ncolor.r = pow(color.r, correction.r);\ncolor.g = pow(color.g, correction.g);\ncolor.b = pow(color.b, correction.b);\ngl_FragColor = color;\ngl_FragColor.rgb *= color.a;\n}",gamma:[1,1,1],mainParameter:"gamma",initialize:function(t){this.gamma=[1,1,1],tJ.BaseFilter.prototype.initialize.call(this,t)},applyTo2d:function(t){var e,i=t.imageData.data,r=this.gamma,n=i.length,s=1/r[0],o=1/r[1],a=1/r[2];for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),e=0,n=256;e<n;e++)this.rVals[e]=255*Math.pow(e/255,s),this.gVals[e]=255*Math.pow(e/255,o),this.bVals[e]=255*Math.pow(e/255,a);for(e=0,n=i.length;e<n;e+=4)i[e]=this.rVals[i[e]],i[e+1]=this.gVals[i[e+1]],i[e+2]=this.bVals[i[e+2]]},getUniformLocations:function(t,e){return{uGamma:t.getUniformLocation(e,"uGamma")}},sendUniformData:function(t,e){t.uniform3fv(e.uGamma,this.gamma)}}),tK.Image.filters.Gamma.fromObject=tK.Image.filters.BaseFilter.fromObject,tQ=(t$=t.fabric||(t.fabric={})).Image.filters,t0=t$.util.createClass,tQ.Composed=t0(tQ.BaseFilter,{type:"Composed",subFilters:[],initialize:function(t){this.callSuper("initialize",t),this.subFilters=this.subFilters.slice(0)},applyTo:function(t){t.passes+=this.subFilters.length-1,this.subFilters.forEach(function(e){e.applyTo(t)})},toObject:function(){return t$.util.object.extend(this.callSuper("toObject"),{subFilters:this.subFilters.map(function(t){return t.toObject()})})},isNeutralState:function(){return!this.subFilters.some(function(t){return!t.isNeutralState()})}}),t$.Image.filters.Composed.fromObject=function(t,e){var i=(t.subFilters||[]).map(function(t){return new t$.Image.filters[t.type](t)}),r=new t$.Image.filters.Composed({subFilters:i});return e&&e(r),r},t2=(t1=t.fabric||(t.fabric={})).Image.filters,t5=t1.util.createClass,t2.HueRotation=t5(t2.ColorMatrix,{type:"HueRotation",rotation:0,mainParameter:"rotation",calculateMatrix:function(){var t=this.rotation*Math.PI,e=t1.util.cos(t),i=t1.util.sin(t),r=1/3,n=Math.sqrt(1/3)*i,s=1-e;this.matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix[0]=e+s/3,this.matrix[1]=r*s-n,this.matrix[2]=r*s+n,this.matrix[5]=r*s+n,this.matrix[6]=e+r*s,this.matrix[7]=r*s-n,this.matrix[
vendor: 4,224 bytes, line 1
110]=r*s-n,this.matrix[11]=r*s+n,this.matrix[12]=e+r*s},isNeutralState:function(t){return this.calculateMatrix(),t2.BaseFilter.prototype.isNeutralState.call(this,t)},applyTo:function(t){this.calculateMatrix(),t2.BaseFilter.prototype.applyTo.call(this,t)}}),t1.Image.filters.HueRotation.fromObject=t1.Image.filters.BaseFilter.fromObject,function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.clone;if(e.Text)e.warn("fabric.Text is already defined");else{var r="fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign".split(" ");e.Text=e.util.createClass(e.Object,{_dimensionAffectingProps:["fontSize","fontWeight","fontFamily","fontStyle","lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide","pathAlign"],_reNewline:/\r?\n/,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,type:"text",fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:"left",fontStyle:"normal",lineHeight:1.16,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},textBackgroundColor:"",stateProperties:e.Object.prototype.stateProperties.concat(r),cacheProperties:e.Object.prototype.cacheProperties.concat(r),stroke:null,shadow:null,path:null,pathStartOffset:0,pathSide:"left",pathAlign:"baseline",_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.315,overline:-.88},_fontSizeMult:1.13,charSpacing:0,styles:null,_measuringContext:null,deltaY:0,direction:"ltr",_styleProperties:["stroke","strokeWidth","fill","fontFamily","fontSize","fontWeight","fontStyle","underline","overline","linethrough","deltaY","textBackgroundColor"],__charBounds:[],CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,initialize:function(t,e){this.styles=e&&e.styles||{},this.text=t,this.__skipDimension=!0,this.callSuper("initialize",e),this.path&&this.setPathInfo(),this.__skipDimension=!1,this.initDimensions(),this.setCoords(),this.setupState({propertySet:"_dimensionAffectingProps"})},setPathInfo:function(){var t=this.path;t&&(t.segmentsInfo=e.util.getPathSegmentsInfo(t.path))},getMeasuringContext:function(){return e._measuringContext||(e._measuringContext=this.canvas&&this.canvas.contextCache||e.util.createCanvasElement().getContext("2d")),e._measuringContext},_splitText:function(){var t=this._splitTextIntoLines(this.text);return this.textLines=t.lines,this._textLines=t.graphemeLines,this._unwrappedTextLines=t._unwrappedLines,this._text=t.graphemeText,t},initDimensions:function(){this.__skipDimension||(this._splitText(),this._clearCache(),this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.saveState({propertySet:"_dimensionAffectingProps"}))},enlargeSpaces:function(){for(var t,e,i,r,n,s,o,a=0,h=this._textLines.length;a<h;a++)if(("justify"===this.textAlign||a!==h-1&&!this.isEndOfWrapping(a))&&(r=0,n=this._textLines[a],(e=this.getLineWidth(a))<this.width&&(o=this.textLines[a].match(this._reSpacesAndTabs)))){i=o.length,t=(this.width-e)/i;for(var l=0,c=n.length;l<=c;l++)s=this.__charBounds[a][l],this._reSpaceAndTab.test(n[l])?(s.width+=t,s.kernedWidth+=t,s.left+=r,r+=t):s.left+=r}},isEndOfWrapping:function(t){return t===this._textLines.length-1},missingNewlineOffset:function(){return 1},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_getCacheCanvasDimensions:function(){var t=this.callSuper("_getCacheCanvasDimensions"),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t},_render:function(t){var e=this.path;e&&!e.isNotVisible()&&e._render(t),this._setTextStyles(t),this._renderTextLinesBackground(t),this._renderTextDecoration(t,"underline"),this._renderText(t),this._renderTextDecoration(t,"overline"),this._renderTextDecoration(t,"linethrough")},_renderText:function(t){"stroke"===this.paintFirst?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))}
vendor: 15,095 bytes, line 1
1,_setTextStyles:function(t,e,i){if(t.textBaseline="alphabetical",this.path)switch(this.pathAlign){case"center":t.textBaseline="middle";break;case"ascender":t.textBaseline="top";break;case"descender":t.textBaseline="bottom"}t.font=this._getFontDeclaration(e,i)},calcTextWidth:function(){for(var t=this.getLineWidth(0),e=1,i=this._textLines.length;e<i;e++){var r=this.getLineWidth(e);r>t&&(t=r)}return t},_renderTextLine:function(t,e,i,r,n,s){this._renderChars(t,e,i,r,n,s)},_renderTextLinesBackground:function(t){if(this.textBackgroundColor||this.styleHas("textBackgroundColor")){for(var e,i,r,n,s,o,a,h=t.fillStyle,l=this._getLeftOffset(),c=this._getTopOffset(),u=0,f=0,d=this.path,g=0,p=this._textLines.length;g<p;g++)if(e=this.getHeightOfLine(g),this.textBackgroundColor||this.styleHas("textBackgroundColor",g)){r=this._textLines[g],i=this._getLineLeftOffset(g),f=0,u=0,n=this.getValueOfPropertyAt(g,0,"textBackgroundColor");for(var m=0,v=r.length;m<v;m++)s=this.__charBounds[g][m],o=this.getValueOfPropertyAt(g,m,"textBackgroundColor"),d?(t.save(),t.translate(s.renderLeft,s.renderTop),t.rotate(s.angle),t.fillStyle=o,o&&t.fillRect(-s.width/2,-e/this.lineHeight*(1-this._fontSizeFraction),s.width,e/this.lineHeight),t.restore()):o!==n?(a=l+i+u,"rtl"===this.direction&&(a=this.width-a-f),t.fillStyle=n,n&&t.fillRect(a,c,f,e/this.lineHeight),u=s.left,f=s.width,n=o):f+=s.kernedWidth;o&&!d&&(a=l+i+u,"rtl"===this.direction&&(a=this.width-a-f),t.fillStyle=o,t.fillRect(a,c,f,e/this.lineHeight)),c+=e}else c+=e;t.fillStyle=h,this._removeShadow(t)}},getFontCache:function(t){var i=t.fontFamily.toLowerCase();e.charWidthsCache[i]||(e.charWidthsCache[i]={});var r=e.charWidthsCache[i],n=t.fontStyle.toLowerCase()+"_"+(t.fontWeight+"").toLowerCase();return r[n]||(r[n]={}),r[n]},_measureChar:function(t,e,i,r){var n,s,o,a,h=this.getFontCache(e),l=i+t,c=this._getFontDeclaration(e)===this._getFontDeclaration(r),u=e.fontSize/this.CACHE_FONT_SIZE;if(i&&void 0!==h[i]&&(o=h[i]),void 0!==h[t]&&(a=n=h[t]),c&&void 0!==h[l]&&(a=(s=h[l])-o),void 0===n||void 0===o||void 0===s){var f=this.getMeasuringContext();this._setTextStyles(f,e,!0)}return void 0===n&&(a=n=f.measureText(t).width,h[t]=n),void 0===o&&c&&i&&(o=f.measureText(i).width,h[i]=o),c&&void 0===s&&(s=f.measureText(l).width,h[l]=s,a=s-o),{width:n*u,kernedWidth:a*u}},getHeightOfChar:function(t,e){return this.getValueOfPropertyAt(t,e,"fontSize")},measureLine:function(t){var e=this._measureLine(t);return 0!==this.charSpacing&&(e.width-=this._getWidthOfCharSpacing()),e.width<0&&(e.width=0),e},_measureLine:function(t){var i,r,n,s,o,a,h=0,l=this._textLines[t],c=Array(l.length),u=0,f=this.path,d="right"===this.pathSide;for(this.__charBounds[t]=c,i=0;i<l.length;i++)r=l[i],s=this._getGraphemeBox(r,t,i,n),c[i]=s,h+=s.kernedWidth,n=r;if(c[i]={left:s?s.left+s.width:0,width:0,kernedWidth:0,height:this.fontSize},f){switch(a=f.segmentsInfo[f.segmentsInfo.length-1].length,(o=e.util.getPointOnPath(f.path,0,f.segmentsInfo)).x+=f.pathOffset.x,o.y+=f.pathOffset.y,this.textAlign){case"left":u=d?a-h:0;break;case"center":u=(a-h)/2;break;case"right":u=d?0:a-h}for(u+=this.pathStartOffset*(d?-1:1),i=d?l.length-1:0;d?i>=0:i<l.length;d?i--:i++)s=c[i],u>a?u%=a:u<0&&(u+=a),this._setGraphemeOnPath(u,s,o),u+=s.kernedWidth}return{width:h,numOfSpaces:0}},_setGraphemeOnPath:function(t,i,r){var n=t+i.kernedWidth/2,s=this.path,o=e.util.getPointOnPath(s.path,n,s.segmentsInfo);i.renderLeft=o.x-r.x,i.renderTop=o.y-r.y,i.angle=o.angle+("right"===this.pathSide?Math.PI:0)},_getGraphemeBox:function(t,e,i,r,n){var s,o=this.getCompleteStyleDeclaration(e,i),a=r?this.getCompleteStyleDeclaration(e,i-1):{},h=this._measureChar(t,o,r,a),l=h.kernedWidth,c=h.width;0!==this.charSpacing&&(c+=s=this._getWidthOfCharSpacing(),l+=s);var u={width:c,left:0,height:o.fontSize,kernedWidth:l,deltaY:o.deltaY};if(i>0&&!n){var f=this.__charBounds[e][i-1];u.left=f.left+f.width+h.kernedWidth-h.width}return u},getHeightOfLine:function(t){if(this.__lineHeights[t])return this.__lineHeights[t];for(var e=this._textLines[t],i=this.getHeightOfChar(t,0),r=1,n=e.length;r<n;r++)i=Math.max(this.getHeightOfChar(t,r),i);return this.__lineHeights[t]=i*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var t,e=0,i=0,r=this._textLines.length;i<r;i++)t=this.getHeightOfLine(i),e+=i===r-1?t/this.lineHeight:t;return e},_getLeftOffset:function(){return"ltr"===this.direction?-this.width/2:this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(t,e){t.save();for(var i=0,r=this._getLeftOffset(),n=this._getTopOffset(),s=0,o=this._textLines.length;s<o;s++){var a=this.getHeightOfLine(s),h=a/this.lineHeight,l=this._getLineLeftOffset(s);this._renderTextLine(e,t,this._textLines[s],r+l,n+i+h,s),i+=a}t.restore()},_renderTextFill:function(t){(this.fill||this.styleHas("fill"))&&this._renderTextCommon(t,"fillText")},_renderTextStroke:function(t){(this.stroke&&0!==this.strokeWidth||!this.isEmptyStyles())&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this._setLineDash(t,this.strokeDashArray),t.beginPath(),this._renderTextCommon(t,"strokeText"),t.closePath(),t.restore())},_renderChars:function(t,i,r,n,s,o){var a,h,l,c,u,f=this.getHeightOfLine(o),d=-1!==this.textAlign.indexOf("justify"),g="",p=0,m=this.path,v=!d&&0===this.charSpacing&&this.isEmptyStyles(o)&&!m,y="ltr"===this.direction,_="ltr"===this.direction?1:-1,b=i.canvas.getAttribute("dir");if(i.save(),b!==this.direction&&(i.canvas.setAttribute("dir",y?"ltr":"rtl"),i.direction=y?"ltr":"rtl",i.textAlign=y?"left":"right"),s-=f*this._fontSizeFraction/this.lineHeight,v)return this._renderChar(t,i,o,0,r.join(""),n,s,f),void i.restore();for(var x=0,C=r.length-1;x<=C;x++)c=x===C||this.charSpacing||m,g+=r[x],l=this.__charBounds[o][x],0===p?(n+=_*(l.kernedWidth-l.width),p+=l.width):p+=l.kernedWidth,d&&!c&&this._reSpaceAndTab.test(r[x])&&(c=!0),c||(a=a||this.getCompleteStyleDeclaration(o,x),h=this.getCompleteStyleDeclaration(o,x+1),c=e.util.hasStyleChanged(a,h,!1)),c&&(m?(i.save(),i.translate(l.renderLeft,l.renderTop),i.rotate(l.angle),this._renderChar(t,i,o,x,g,-p/2,0,f),i.restore()):(u=n,this._renderChar(t,i,o,x,g,u,s,f)),g="",a=h,n+=_*p,p=0);i.restore()},_applyPatternGradientTransformText:function(t){var i,r=e.util.createCanvasElement(),n=this.width+this.strokeWidth,s=this.height+this.strokeWidth;return r.width=n,r.height=s,(i=r.getContext("2d")).beginPath(),i.moveTo(0,0),i.lineTo(n,0),i.lineTo(n,s),i.lineTo(0,s),i.closePath(),i.translate(n/2,s/2),i.fillStyle=t.toLive(i),this._applyPatternGradientTransform(i,t),i.fill(),i.createPattern(r,"no-repeat")},handleFiller:function(t,e,i){var r,n;return i.toLive?"percentage"===i.gradientUnits||i.gradientTransform||i.patternTransform?(r=-this.width/2,n=-this.height/2,t.translate(r,n),t[e]=this._applyPatternGradientTransformText(i),{offsetX:r,offsetY:n}):(t[e]=i.toLive(t,this),this._applyPatternGradientTransform(t,i)):(t[e]=i,{offsetX:0,offsetY:0})},_setStrokeStyles:function(t,e){return t.lineWidth=e.strokeWidth,t.lineCap=this.strokeLineCap,t.lineDashOffset=this.strokeDashOffset,t.lineJoin=this.strokeLineJoin,t.miterLimit=this.strokeMiterLimit,this.handleFiller(t,"strokeStyle",e.stroke)},_setFillStyles:function(t,e){return this.handleFiller(t,"fillStyle",e.fill)},_renderChar:function(t,e,i,r,n,s,o){var a,h,l=this._getStyleDeclaration(i,r),c=this.getCompleteStyleDeclaration(i,r),u="fillText"===t&&c.fill,f="strokeText"===t&&c.stroke&&c.strokeWidth;(f||u)&&(e.save(),u&&(a=this._setFillStyles(e,c)),f&&(h=this._setStrokeStyles(e,c)),e.font=this._getFontDeclaration(c),l&&l.textBackgroundColor&&this._removeShadow(e),l&&l.deltaY&&(o+=l.deltaY),u&&e.fillText(n,s-a.offsetX,o-a.offsetY),f&&e.strokeText(n,s-h.offsetX,o-h.offsetY),e.restore())},setSuperscript:function(t,e){return this._setScript(t,e,this.superscript)},setSubscript:function(t,e){return this._setScript(t,e,this.subscript)},_setScript:function(t,e,i){var r=this.get2DCursorLocation(t,!0),n=this.getValueOfPropertyAt(r.lineIndex,r.charIndex,"fontSize"),s=this.getValueOfPropertyAt(r.lineIndex,r.charIndex,"deltaY"),o={fontSize:n*i.size,deltaY:s+n*i.baseline};return this.setSelectionStyles(o,t,e),this},_getLineLeftOffset:function(t){var e=this.getLineWidth(t),i=this.width-e,r=this.textAlign,n=this.direction,s=0,o=this.isEndOfWrapping(t);return"justify"!==r&&("justify-center"!==r||o)&&("justify-right"!==r||o)&&("justify-left"!==r||o)?("center"===r&&(s=i/2),"right"===r&&(s=i),"justify-center"===r&&(s=i/2),"justify-right"===r&&(s=i),"rtl"===n&&(s-=i),s):0},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]},_shouldClearDimensionCache:function(){var t=this._forceClearCache;return t||(t=this.hasStateChanged("_dimensionAffectingProps")),t&&(this.dirty=!0,this._forceClearCache=!1),t},getLineWidth:function(t){if(void 0!==this.__lineWidths[t])return this.__lineWidths[t];var e=this.measureLine(t).width;return this.__lineWidths[t]=e,e},_getWidthOfCharSpacing:function(){return 0!==this.charSpacing?this.fontSize*this.charSpacing/1e3:0},getValueOfPropertyAt:function(t,e,i){var r=this._getStyleDeclaration(t,e);return r&&void 0!==r[i]?r[i]:this[i]},_renderTextDecoration:function(t,e){if(this[e]||this.styleHas(e)){for(var i,r,n,s,o,a,h,l,c,u,f,d,g,p,m,v,y=this._getLeftOffset(),_=this._getTopOffset(),b=this.path,x=this._getWidthOfCharSpacing(),C=this.offsets[e],S=0,w=this._textLines.length;S<w;S++)if(i=this.getHeightOfLine(S),this[e]||this.styleHas(e,S)){h=this._textLines[S],p=i/this.lineHeight,s=this._getLineLeftOffset(S),u=0,f=0,l=this.getValueOfPropertyAt(S,0,e),v=this.getValueOfPropertyAt(S,0,"fill"),c=_+p*(1-this._fontSizeFraction),r=this.getHeightOfChar(S,0),o=this.getValueOfPropertyAt(S,0,"deltaY");for(var T=0,O=h.length;T<O;T++)if(d=this.__charBounds[S][T],g=this.getValueOfPropertyAt(S,T,e),m=this.getValueOfPropertyAt(S,T,"fill"),n=this.getHeightOfChar(S,T),a=this.getValueOfPropertyAt(S,T,"deltaY"),b&&g&&m)t.save(),t.fillStyle=v,t.translate(d.renderLeft,d.renderTop),t.rotate(d.angle),t.fillRect(-d.kernedWidth/2,C*n+a,d.kernedWidth,this.fontSize/15),t.restore();else if((g!==l||m!==v||n!==r||a!==o)&&f>0){var k=y+s+u;"rtl"===this.direction&&(k=this.width-k-f),l&&v&&(t.fillStyle=v,t.fillRect(k,c+C*r+o,f,this.fontSize/15)),u=d.left,f=d.width,l=g,v=m,r=n,o=a}else f+=d.kernedWidth;k=y+s+u,"rtl"===this.direction&&(k=this.width-k-f),t.fillStyle=m,g&&m&&t.fillRect(k,c+C*r+o,f-x,this.fontSize/15),_+=i}else _+=i;this._removeShadow(t)}},_getFontDeclaration:function(t,i){var r=t||this,n=this.fontFamily,s=e.Text.genericFonts.indexOf(n.toLowerCase())>-1,o=void 0===n||n.indexOf("'")>-1||n.indexOf(",")>-1||n.indexOf('"')>-1||s?r.fontFamily:'"'+r.fontFamily+'"';return[e.isLikelyNode?r.fontWeight:r.fontStyle,e.isLikelyNode?r.fontStyle:r.fontWeight,i?this.CACHE_FONT_SIZE+"px":r.fontSize+"px",o].join(" ")},render:function(t){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",t)))},_splitTextIntoLines:function(t){for(var i=t.split(this._reNewline),r=Array(i.length),n=["\n"],s=[],o=0;o<i.length;o++)r[o]=e.util.string.graphemeSplit(i[o]),s=s.concat(r[o],n);return s.pop(),{_unwrappedLines:r,lines:i,graphemeText:s,graphemeLines:r}},toObject:function(t){var i=r.concat(t),n=this.callSuper("toObject",i);return n.styles=e.util.stylesToArray(this.styles,this.text),n.path&&(n.path=this.path.toObject()),n},set:function(t,e){this.callSuper("set",t,e);var i=!1,r=!1;if("object"==typeof t)for(var n in t)"path"===n&&this.setPathInfo(),i=i||-1!==this._dimensionAffectingProps.indexOf(n),r=r||"path"===n;else i=-1!==this._dimensionAffectingProps.indexOf(t),r="path"===t;return r&&this.setPathInfo(),i&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}}),e.Text.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ")),e.Text.DEFAULT_SVG_FONT_SIZE=16,e.Text.fromElement=function(t,r,n){if(!t)return r(null);var s=e.parseAttributes(t,e.Text.ATTRIBUTE_NAMES),o=s.textAnchor||"left";if((n=e.util.object.extend(n?i(n):{},s)).top=n.top||0,n.left=n.left||0,s.textDecoration){var a=s.textDecoration;-1!==a.indexOf("underline")&&(n.underline=!0),-1!==a.indexOf("overline")&&(n.overline=!0),-1!==a.indexOf("line-through")&&(n.linethrough=!0),delete n.textDecoration}"dx"in s&&(n.left+=s.dx),"dy"in s&&(n.top+=s.dy),"fontSize"in n||(n.fontSize=e.Text.DEFAULT_SVG_FONT_SIZE);var h="";"textContent"in t?h=t.textContent:"firstChild"in t&&null!==t.firstChild&&"data"in t.firstChild&&null!==t.firstChild.data&&(h=t.firstChild.data),h=h.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," ");var l=n.strokeWidth;n.strokeWidth=0;var c=new e.Text(h,n),u=c.getScaledHeight()/c.height,f=((c.height+c.strokeWidth)*c.lineHeight-c.height)*u,d=c.getScaledHeight()+f,g=0;"center"===o&&(g=c.getScaledWidth()/2),"right"===o&&(g=c.getScaledWidth()),c.set({left:c.left-g,top:c.top-(d-c.fontSize*(.07+c._fontSizeFraction))/c.lineHeight,strokeWidth:void 0!==l?l:1}),r(c)},e.Text.fromObject=function(t,r){var n=i(t),s=t.path;return delete n.path,e.Object._fromObject("Text",n,function(i){i.styles=e.util.stylesFromArray(t.styles,t.text),s?e.Object._fromObject("Path",s,function(t){i.set("path",t),r(i)},"path"):r(i)},"text")},e.Text.genericFonts=["sans-serif","serif","cursive","fantasy","monospace"],e.util.createAccessors&&e.util.createAccessors(e.Text)}}(t),ev.util.object.extend(ev.Text.prototype,{isEmptyStyles:function(t){if(!this.styles||void 0!==t&&!this.styles[t])return!0;var e=void 0===t?this.styles:{line:this.styles[t]};for(var i in e)for(var r in e[i])for(var n in e[i][r])return!1;return!0},styleHas:function(t,e){if(!this.styles||!t||""===t||void 0!==e&&!this.styles[e])return!1;var i=void 0===e?this.styles:{0:this.styles[e]};for(var r in i)for(var n in i[r])if(void 0!==i[r][n][t])return!0;return!1},cleanStyle:function(t){if(!this.styles||!t||""===t)return!1;var e,i,r,n=this.styles,s=0,o=!0,a=0;for(var h in n){for(var l in i=0,n[h])s++,(e=n[h][l]).hasOwnProperty(t)?(r?e[t]!==r&&(o=!1):r=e[t],e[t]===this[t]&&delete e[t]):o=!1,0!==Object.keys(e).length?i++:delete n[h][l];0===i&&delete n[h]}for(var c=0;c<this._textLines.length;c++)a+=this._textLines[c].length;o&&s===a&&(this[t]=r,this.removeStyle(t))},removeStyle:function(t){if(this.styles&&t&&""!==t){var e,i,r,n=this.styles;for(i in n){for(r in e=n[i])delete e[r][t],0===Object.keys(e[r]).length&&delete e[r];0===Object.keys(e).length&&delete n[i]}}},_extendStyles:function(t,e){var i=this.get2DCursorLocation(t);this._getLineStyle(i.lineIndex)||this._setLineStyle(i.lineIndex),this._getStyleDeclaration(i.lineIndex,i.charIndex)||this._setStyleDeclaration(i.lineIndex,i.charIndex,{}),ev.util.object.extend(this._getStyleDeclaration(i.lineIndex,i.charIndex),e)},get2DCursorLocation:function(t,e){void 0===t&&(t=this.selectionStart);for(var i=e?this._unwrappedTextLines:this._textLines,r=i.length,n=0;n<r;n++){if(t<=i[n].length)return{lineIndex:n,charIndex:t};t-=i[n].length+this.missingNewlineOffset(n)}
vendor: 5,678 bytes, line 1
1return{lineIndex:n-1,charIndex:i[n-1].length<t?i[n-1].length:t}},getSelectionStyles:function(t,e,i){void 0===t&&(t=this.selectionStart||0),void 0===e&&(e=this.selectionEnd||t);for(var r=[],n=t;n<e;n++)r.push(this.getStyleAtPosition(n,i));return r},getStyleAtPosition:function(t,e){var i=this.get2DCursorLocation(t);return(e?this.getCompleteStyleDeclaration(i.lineIndex,i.charIndex):this._getStyleDeclaration(i.lineIndex,i.charIndex))||{}},setSelectionStyles:function(t,e,i){void 0===e&&(e=this.selectionStart||0),void 0===i&&(i=this.selectionEnd||e);for(var r=e;r<i;r++)this._extendStyles(r,t);return this._forceClearCache=!0,this},_getStyleDeclaration:function(t,e){var i=this.styles&&this.styles[t];return i?i[e]:null},getCompleteStyleDeclaration:function(t,e){for(var i,r=this._getStyleDeclaration(t,e)||{},n={},s=0;s<this._styleProperties.length;s++)n[i=this._styleProperties[s]]=void 0===r[i]?this[i]:r[i];return n},_setStyleDeclaration:function(t,e,i){this.styles[t][e]=i},_deleteStyleDeclaration:function(t,e){delete this.styles[t][e]},_getLineStyle:function(t){return!!this.styles[t]},_setLineStyle:function(t){this.styles[t]={}},_deleteLineStyle:function(t){delete this.styles[t]}}),function(){function t(t){t.textDecoration&&(t.textDecoration.indexOf("underline")>-1&&(t.underline=!0),t.textDecoration.indexOf("line-through")>-1&&(t.linethrough=!0),t.textDecoration.indexOf("overline")>-1&&(t.overline=!0),delete t.textDecoration)}ev.IText=ev.util.createClass(ev.Text,ev.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(t,e){this.callSuper("initialize",t,e),this.initBehavior()},setSelectionStart:function(t){t=Math.max(t,0),this._updateAndFire("selectionStart",t)},setSelectionEnd:function(t){t=Math.min(t,this.text.length),this._updateAndFire("selectionEnd",t)},_updateAndFire:function(t,e){this[t]!==e&&(this._fireSelectionChanged(),this[t]=e),this._updateTextarea()},_fireSelectionChanged:function(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper("initDimensions")},render:function(t){this.clearContextTop(),this.callSuper("render",t),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(t){this.callSuper("_render",t)},clearContextTop:function(t){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var e=this.canvas.contextTop,i=this.canvas.viewportTransform;e.save(),e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this.transform(e),this._clearTextArea(e),t||e.restore()}},renderCursorOrSelection:function(){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var t=this._getCursorBoundaries(),e=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(t,e):this.renderSelection(t,e),e.restore()}},_clearTextArea:function(t){var e=this.width+4,i=this.height+4;t.clearRect(-e/2,-i/2,e,i)},_getCursorBoundaries:function(t){void 0===t&&(t=this.selectionStart);var e=this._getLeftOffset(),i=this._getTopOffset(),r=this._getCursorBoundariesOffsets(t);return{left:e,top:i,leftOffset:r.left,topOffset:r.top}},_getCursorBoundariesOffsets:function(t){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;var e,i,r,n,s=0,o=0,a=this.get2DCursorLocation(t);r=a.charIndex,i=a.lineIndex;for(var h=0;h<i;h++)s+=this.getHeightOfLine(h);e=this._getLineLeftOffset(i);var l=this.__charBounds[i][r];return l&&(o=l.left),0!==this.charSpacing&&r===this._textLines[i].length&&(o-=this._getWidthOfCharSpacing()),n={top:s,left:e+(o>0?o:0)},"rtl"===this.direction&&(n.left*=-1),this.cursorOffsetCache=n,this.cursorOffsetCache},renderCursor:function(t,e){var i=this.get2DCursorLocation(),r=i.lineIndex,n=i.charIndex>0?i.charIndex-1:0,s=this.getValueOfPropertyAt(r,n,"fontSize"),o=this.scaleX*this.canvas.getZoom(),a=this.cursorWidth/o,h=t.topOffset,l=this.getValueOfPropertyAt(r,n,"deltaY");h+=(1-this._fontSizeFraction)*this.getHeightOfLine(r)/this.lineHeight-s*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(t,e),e.fillStyle=this.cursorColor||this.getValueOfPropertyAt(r,n,"fill"),e.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,e.fillRect(t.left+t.leftOffset-a/2,h+t.top+l,a,s)},renderSelection:function(t,e){for(var i=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,r=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,n=-1!==this.textAlign.indexOf("justify"),s=this.get2DCursorLocation(i),o=this.get2DCursorLocation(r),a=s.lineIndex,h=o.lineIndex,l=s.charIndex<0?0:s.charIndex,c=o.charIndex<0?0:o.charIndex,u=a;u<=h;u++){var f,d=this._getLineLeftOffset(u)||0,g=this.getHeightOfLine(u),p=0,m=0;if(u===a&&(p=this.__charBounds[a][l].left),u>=a&&u<h)m=n&&!this.isEndOfWrapping(u)?this.width:this.getLineWidth(u)||5;else if(u===h){if(0===c)m=this.__charBounds[h][c].left;else{var v=this._getWidthOfCharSpacing();m=this.__charBounds[h][c-1].left+this.__charBounds[h][c-1].width-v}}f=g,(this.lineHeight<1||u===h&&this.lineHeight>1)&&(g/=this.lineHeight);var y=t.left+d+p,_=m-p,b=g,x=0;this.inCompositionMode?(e.fillStyle=this.compositionColor||"black",b=1,x=g):e.fillStyle=this.selectionColor,"rtl"===this.direction&&(y=this.width-y-_),e.fillRect(y,t.top+t.to
vendor: 31,445 bytes, line 1
1pOffset+x,_,b),t.topOffset+=f}},getCurrentCharFontSize:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fontSize")},getCurrentCharColor:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fill")},_getCurrentCharIndex:function(){var t=this.get2DCursorLocation(this.selectionStart,!0),e=t.charIndex>0?t.charIndex-1:0;return{l:t.lineIndex,c:e}}}),ev.IText.fromObject=function(e,i){var r=ev.util.stylesFromArray(e.styles,e.text),n=Object.assign({},e,{styles:r});if(t(n),n.styles)for(var s in n.styles)for(var o in n.styles[s])t(n.styles[s][o]);ev.Object._fromObject("IText",n,i,"text")}}(),em=ev.util.object.clone,ev.util.object.extend(ev.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var t=this;this.on("added",function(){var e=t.canvas;e&&(e._hasITextHandlers||(e._hasITextHandlers=!0,t._initCanvasHandlers(e)),e._iTextInstances=e._iTextInstances||[],e._iTextInstances.push(t))})},initRemovedHandler:function(){var t=this;this.on("removed",function(){var e=t.canvas;e&&(e._iTextInstances=e._iTextInstances||[],ev.util.removeFromArray(e._iTextInstances,t),0===e._iTextInstances.length&&(e._hasITextHandlers=!1,t._removeCanvasHandlers(e)))})},_initCanvasHandlers:function(t){t._mouseUpITextHandler=function(){t._iTextInstances&&t._iTextInstances.forEach(function(t){t.__isMousedown=!1})},t.on("mouse:up",t._mouseUpITextHandler)},_removeCanvasHandlers:function(t){t.off("mouse:up",t._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(t,e,i,r){var n;return n={isAborted:!1,abort:function(){this.isAborted=!0}},t.animate("_currentCursorOpacity",e,{duration:i,onComplete:function(){n.isAborted||t[r]()},onChange:function(){t.canvas&&t.selectionStart===t.selectionEnd&&t.renderCursorOrSelection()},abort:function(){return n.isAborted}}),n},_onTickComplete:function(){var t=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout(function(){t._currentTickCompleteState=t._animateCursor(t,0,this.cursorDuration/2,"_tick")},100)},initDelayedCursor:function(t){var e=this,i=t?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout(function(){e._tick()},i)},abortCursorAnimation:function(){var t=this._currentTickState||this._currentTickCompleteState,e=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,t&&e&&e.clearContext(e.contextTop||e.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")},findWordBoundaryLeft:function(t){var e=0,i=t-1;if(this._reSpace.test(this._text[i]))for(;this._reSpace.test(this._text[i]);)e++,i--;for(;/\S/.test(this._text[i])&&i>-1;)e++,i--;return t-e},findWordBoundaryRight:function(t){var e=0,i=t;if(this._reSpace.test(this._text[i]))for(;this._reSpace.test(this._text[i]);)e++,i++;for(;/\S/.test(this._text[i])&&i<this._text.length;)e++,i++;return t+e},findLineBoundaryLeft:function(t){for(var e=0,i=t-1;!/\n/.test(this._text[i])&&i>-1;)e++,i--;return t-e},findLineBoundaryRight:function(t){for(var e=0,i=t;!/\n/.test(this._text[i])&&i<this._text.length;)e++,i++;return t+e},searchWordBoundary:function(t,e){for(var i=this._text,r=this._reSpace.test(i[t])?t-1:t,n=i[r],s=ev.reNonWord;!s.test(n)&&r>0&&r<i.length;)n=i[r+=e];return s.test(n)&&(r+=+(1!==e)),r},selectWord:function(t){t=t||this.selectionStart;var e=this.searchWordBoundary(t,-1),i=this.searchWordBoundary(t,1);this.selectionStart=e,this.selectionEnd=i,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()},selectLine:function(t){t=t||this.selectionStart;var e=this.findLineBoundaryLeft(t),i=this.findLineBoundaryRight(t);return this.selectionStart=e,this.selectionEnd=i,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(t){if(!this.isEditing&&this.editable)return this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(t),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire("editing:entered"),this._fireSelectionChanged(),this.canvas&&(this.canvas.fire("text:editing:entered",{target:this}),this.initMouseMoveHandler(),this.canvas.requestRenderAll()),this},exitEditingOnOthers:function(t){t._iTextInstances&&t._iTextInstances.forEach(function(t){t.selected=!1,t.isEditing&&t.exitEditing()})},initMouseMoveHandler:function(){this.canvas.on("mouse:move",this.mouseMoveHandler)},mouseMoveHandler:function(t){if(this.__isMousedown&&this.isEditing){document.activeElement!==this.hiddenTextarea&&this.hiddenTextarea.focus();var e=this.getSelectionStartFromPointer(t.e),i=this.selectionStart,r=this.selectionEnd;(e===this.__selectionStartOnMouseDown&&i!==r||i!==e&&r!==e)&&(e>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=e):(this.selectionStart=e,this.selectionEnd=this.__selectionStartOnMouseDown),this.selectionStart===i&&this.selectionEnd===r||(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}},_setEditingProps:function(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(t,e,i){var r=i.slice(0,t),n=ev.util.string.graphemeSplit(r).length;if(t===e)return{selectionStart:n,selectionEnd:n};var s=i.slice(t,e);return{selectionStart:n,selectionEnd:n+ev.util.string.graphemeSplit(s).length}},fromGraphemeToStringSelection:function(t,e,i){var r=i.slice(0,t).join("").length;return t===e?{selectionStart:r,selectionEnd:r}:{selectionStart:r,selectionEnd:r+i.slice(t,e).join("").length}},_updateTextarea:function(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){var t=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=t.selectionStart,this.hiddenTextarea.selectionEnd=t.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var t=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=t.selectionEnd,this.inCompositionMode||(this.selectionStart=t.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var t=this._calcTextareaPosition();this.hiddenTextarea.style.left=t.left,this.hiddenTextarea.style.top=t.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var t=this.inCompositionMode?this.compositionStart:this.selectionStart,e=this._getCursorBoundaries(t),i=this.get2DCursorLocation(t),r=i.lineIndex,n=i.charIndex,s=this.getValueOfPropertyAt(r,n,"fontSize")*this.lineHeight,o=e.leftOffset,a=this.calcTransformMatrix(),h={x:e.left+o,y:e.top+e.topOffset+s},l=this.canvas.getRetinaScaling(),c=this.canvas.upperCanvasEl,u=c.width/l,f=c.height/l,d=u-s,g=f-s,p=c.clientWidth/u,m=c.clientHeight/f;return h=ev.util.transformPoint(h,a),(h=ev.util.transformPoint(h,this.canvas.viewportTransform)).x*=p,h.y*=m,h.x<0&&(h.x=0),h.x>d&&(h.x=d),h.y<0&&(h.y=0),h.y>g&&(h.y=g),h.x+=this.canvas._offset.left,h.y+=this.canvas._offset.top,{left:h.x+"px",top:h.y+"px",fontSize:s+"px",charHeight:s}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var t=this._textBeforeEdit!==this.text,e=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,e&&(e.blur&&e.blur(),e.parentNode&&e.parentNode.removeChild(e)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),t&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),t&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var t in this.styles)this._textLines[t]||delete this.styles[t]},removeStyleFromTo:function(t,e){var i,r,n=this.get2DCursorLocation(t,!0),s=this.get2DCursorLocation(e,!0),o=n.lineIndex,a=n.charIndex,h=s.lineIndex,l=s.charIndex;if(o!==h){if(this.styles[o])for(i=a;i<this._unwrappedTextLines[o].length;i++)delete this.styles[o][i];if(this.styles[h])for(i=l;i<this._unwrappedTextLines[h].length;i++)(r=this.styles[h][i])&&(this.styles[o]||(this.styles[o]={}),this.styles[o][a+i-l]=r);for(i=o+1;i<=h;i++)delete this.styles[i];this.shiftLineStyles(h,o-h)}else if(this.styles[o]){r=this.styles[o];var c,u,f=l-a;for(i=a;i<l;i++)delete r[i];for(u in this.styles[o])(c=parseInt(u,10))>=l&&(r[c-f]=r[u],delete r[u])}},shiftLineStyles:function(t,e){var i=em(this.styles);for(var r in this.styles){var n=parseInt(r,10);n>t&&(this.styles[n+e]=i[n],i[n-e]||delete this.styles[n])}},restartCursorIfNeeded:function(){this._currentTickState&&!this._currentTickState.isAborted&&this._currentTickCompleteState&&!this._currentTickCompleteState.isAborted||this.initDelayedCursor()},insertNewlineStyleObject:function(t,e,i,r){var n,s={},o=!1,a=this._unwrappedTextLines[t].length===e;for(var h in i||(i=1),this.shiftLineStyles(t,i),this.styles[t]&&(n=this.styles[t][0===e?e:e-1]),this.styles[t]){var l=parseInt(h,10);l>=e&&(o=!0,s[l-e]=this.styles[t][h],a&&0===e||delete this.styles[t][h])}var c=!1;for(o&&!a&&(this.styles[t+i]=s,c=!0),c&&i--;i>0;)r&&r[i-1]?this.styles[t+i]={0:em(r[i-1])}:n?this.styles[t+i]={0:em(n)}:delete this.styles[t+i],i--;this._forceClearCache=!0},insertCharStyleObject:function(t,e,i,r){this.styles||(this.styles={});var n=this.styles[t],s=n?em(n):{};for(var o in i||(i=1),s){var a=parseInt(o,10);a>=e&&(n[a+i]=s[a],s[a-i]||delete n[a])}if(this._forceClearCache=!0,r)for(;i--;)Object.keys(r[i]).length&&(this.styles[t]||(this.styles[t]={}),this.styles[t][e+i]=em(r[i]));else if(n)for(var h=n[e?e-1:1];h&&i--;)this.styles[t][e+i]=em(h)},insertNewStyleBlock:function(t,e,i){for(var r=this.get2DCursorLocation(e,!0),n=[0],s=0,o=0;o<t.length;o++)"\n"===t[o]?n[++s]=0:n[s]++;for(n[0]>0&&(this.insertCharStyleObject(r.lineIndex,r.charIndex,n[0],i),i=i&&i.slice(n[0]+1)),s&&this.insertNewlineStyleObject(r.lineIndex,r.charIndex+n[0],s),o=1;o<s;o++)n[o]>0?this.insertCharStyleObject(r.lineIndex+o,0,n[o],i):i&&this.styles[r.lineIndex+o]&&i[0]&&(this.styles[r.lineIndex+o][0]=i[0]),i=i&&i.slice(n[o]+1);n[o]>0&&this.insertCharStyleObject(r.lineIndex+o,0,n[o],i)},setSelectionStartEndWithShift:function(t,e,i){i<=t?(e===t?this._selectionDirection="left":"right"===this._selectionDirection&&(this._selectionDirection="left",this.selectionEnd=t),this.selectionStart=i):i>t&&i<e?"right"===this._selectionDirection?this.selectionEnd=i:this.selectionStart=i:(e===t?this._selectionDirection="right":"left"===this._selectionDirection&&(this._selectionDirection="right",this.selectionStart=e),this.selectionEnd=i)},setSelectionInBoundaries:function(){var t=this.text.length;this.selectionStart>t?this.selectionStart=t:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>t?this.selectionEnd=t:this.selectionEnd<0&&(this.selectionEnd=0)}}),ev.util.object.extend(ev.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(t){if(this.canvas){this.__newClickTime=+new Date;var e=t.pointer;this.isTripleClick(e)&&(this.fire("tripleclick",t),this._stopEvent(t.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=e,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y},_stopEvent:function(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(t){this.isEditing&&this.selectWord(this.getSelectionStartFromPointer(t.e))},tripleClickHandler:function(t){this.isEditing&&this.selectLine(this.getSelectionStartFromPointer(t.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(t.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(t){this.canvas&&this.editable&&(!t.e.button||1===t.e.button)&&(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(t){if(this.__isMousedown=!1,!(!this.editable||this.group||t.transform&&t.transform.actionPerformed||t.e.button&&1!==t.e.button)){if(this.canvas){var e=this.canvas._activeObject;if(e&&e!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(t.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(t){var e=this.getSelectionStartFromPointer(t),i=this.selectionStart,r=this.selectionEnd;t.shiftKey?this.setSelectionStartEndWithShift(i,r,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(t){for(var e,i=this.getLocalPointer(t),r=0,n=0,s=0,o=0,a=0,h=0,l=this._textLines.length;h<l&&s<=i.y;h++)s+=this.getHeightOfLine(h)*this.scaleY,a=h,h>0&&(o+=this._textLines[h-1].length+this.missingNewlineOffset(h-1));n=this._getLineLeftOffset(a)*this.scaleX,e=this._textLines[a],"rtl"===this.direction&&(i.x=this.width*this.scaleX-i.x+n);for(var c=0,u=e.length;c<u&&(r=n,(n+=this.__charBounds[a][c].kernedWidth*this.scaleX)<=i.x);c++)o++;return this._getNewSelectionStartFromOffset(i,r,n,o,u)},_getNewSelectionStartFromOffset:function(t,e,i,r,n){var s=t.x-e,o=i-t.x,a=r+(o>s||o<0?0:1);return this.flipX&&(a=n-a),a>this._text.length&&(a=this._text.length),a}}),ev.util.object.extend(ev.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=ev.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var t=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+t.top+"; left: "+t.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding-top: "+t.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):ev.document.body.appendChild(this.hiddenTextarea),ev.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),ev.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),ev.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),ev.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),ev.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),ev.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),ev.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),ev.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),ev.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(ev.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(t){if(this.isEditing){var e="rtl"===this.direction?this.keysMapRtl:this.keysMap;if(t.keyCode in e)this[e[t.keyCode]](t);else{if(!(t.keyCode in this.ctrlKeysMapDown)||!t.ctrlKey&&!t.metaKey)return;this[this.ctrlKeysMapDown[t.keyCode]](t)}t.stopImmediatePropagation(),t.preventDefault(),t.keyCode>=33&&t.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(t){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:t.keyCode in this.ctrlKeysMapUp&&(t.ctrlKey||t.metaKey)&&(this[this.ctrlKeysMapUp[t.keyCode]](t),t.stopImmediatePropagation(),t.preventDefault(),this.canvas&&this.canvas.requestRenderAll())},onInput:function(t){var e=this.fromPaste;if(this.fromPaste=!1,t&&t.stopPropagation(),this.isEditing){var i,r,n,s,o,a=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,h=this._text.length,l=a.length,c=l-h,u=this.selectionStart,f=this.selectionEnd,d=u!==f;if(""===this.hiddenTextarea.value)return this.styles={},this.updateFromTextArea(),this.fire("changed"),void(this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll()));var g=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),p=u>g.selectionStart;d?(i=this._text.slice(u,f),c+=f-u):l<h&&(i=p?this._text.slice(f+c,f):this._text.slice(u,u-c)),r=a.slice(g.selectionEnd-c,g.selectionEnd),i&&i.length&&(r.length&&(n=this.getSelectionStyles(u,u+1,!1),n=r.map(function(){return n[0]})),d?(s=u,o=f):p?(s=f-i.length,o=f):(s=f,o=f+i.length),this.removeStyleFromTo(s,o)),r.length&&(e&&r.join("")===ev.copiedText&&!ev.disableStyleCopyPaste&&(n=ev.copiedTextStyle),this.insertNewStyleBlock(r,u,n)),this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())}},onCompositionStart:function(){this.inCompositionMode=!0},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(t){this.compositionStart=t.target.selectionStart,this.compositionEnd=t.target.selectionEnd,this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(ev.copiedText=this.getSelectedText(),ev.disableStyleCopyPaste?ev.copiedTextStyle=null:ev.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(t){return t&&t.clipboardData||ev.window.clipboardData},_getWidthBeforeCursor:function(t,e){var i,r=this._getLineLeftOffset(t);return e>0&&(r+=(i=this.__charBounds[t][e-1]).left+i.width),r},getDownCursorOffset:function(t,e){var i=this._getSelectionForOffset(t,e),r=this.get2DCursorLocation(i),n=r.lineIndex;if(n===this._textLines.length-1||t.metaKey||34===t.keyCode)return this._text.length-i;var s=r.charIndex,o=this._getWidthBeforeCursor(n,s),a=this._getIndexOnLine(n+1,o);return this._textLines[n].slice(s).length+a+1+this.missingNewlineOffset(n)},_getSelectionForOffset:function(t,e){return t.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(t,e){var i=this._getSelectionForOffset(t,e),r=this.get2DCursorLocation(i),n=r.lineIndex;if(0===n||t.metaKey||33===t.keyCode)return-i;var s=r.charIndex,o=this._getWidthBeforeCursor(n,s),a=this._getIndexOnLine(n-1,o),h=this._textLines[n].slice(0,s),l=this.missingNewlineOffset(n-1);return-this._textLines[n-1].length+a-h.length+(1-l)},_getIndexOnLine:function(t,e){for(var i,r,n=this._textLines[t],s=this._getLineLeftOffset(t),o=0,a=0,h=n.length;a<h;a++)if((s+=i=this.__charBounds[t][a].width)>e){r=!0;var l=Math.abs(s-i-e);o=Math.abs(s-e)<l?a:a-1;break}return r||(o=n.length-1),o},moveCursorDown:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",t)},moveCursorUp:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorUpOrDown("Up",t)},_moveCursorUpOrDown:function(t,e){var i=this["get"+t+"CursorOffset"](e,"right"===this._selectionDirection);e.shiftKey?this.moveCursorWithShift(i):this.moveCursorWithoutShift(i),0!==i&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(t){var e="left"===this._selectionDirection?this.selectionStart+t:this.selectionEnd+t;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,e),0!==t},moveCursorWithoutShift:function(t){return t<0?(this.selectionStart+=t,this.selectionEnd=this.selectionStart):(this.selectionEnd+=t,this.selectionStart=this.selectionEnd),0!==t},moveCursorLeft:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight("Left",t)},_move:function(t,e,i){var r;if(t.altKey)r=this["findWordBoundary"+i](this[e]);else{if(!t.metaKey&&35!==t.keyCode&&36!==t.keyCode)return this[e]+="Left"===i?-1:1,!0;r=this["findLineBoundary"+i](this[e])}if(void 0!==r&&this[e]!==r)return this[e]=r,!0},_moveLeft:function(t,e){return this._move(t,e,"Left")},_moveRight:function(t,e){return this._move(t,e,"Right")},moveCursorLeftWithoutShift:function(t){var e=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(e=this._moveLeft(t,"selectionStart")),this.selectionEnd=this.selectionStart,e},moveCursorLeftWithShift:function(t){return"right"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveLeft(t,"selectionEnd"):0!==this.selectionStart?(this._selectionDirection="left",this._moveLeft(t,"selectionStart")):void 0},moveCursorRight:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",t)},_moveCursorLeftOrRight:function(t,e){var i="moveCursor"+t+"With";this._currentCursorOpacity=1,e.shiftKey?i+="Shift":i+="outShift",this[i](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(t){return"left"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveRight(t,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection="right",this._moveRight(t,"selectionEnd")):void 0},moveCursorRightWithoutShift:function(t){var e=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(e=this._moveRight(t,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,e},removeChars:function(t,e){void 0===e&&(e=t+1),this.removeStyleFromTo(t,e),this._text.splice(t,e-t),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(t,e,i,r){void 0===r&&(r=i),r>i&&this.removeStyleFromTo(i,r);var n=ev.util.string.graphemeSplit(t);this.insertNewStyleBlock(n,i,e),this._text=[].concat(this._text.slice(0,i),n,this._text.slice(r)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),t3=ev.util.toFixed,t4=/  +/g,ev.util.object.extend(ev.Text.prototype,{_toSVG:function(){var t=this._getSVGLeftTopOffsets(),e=this._getSVGTextAndBg(t.textTop,t.textLeft);return this._wrapSVGTextAndBg(e)},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(t){var e=this.getSvgTextDecoration(this);return[t.textBgRects.join(""),'		<text xml:space="preserve" ',this.fontFamily?'font-family="'+this.fontFamily.replace(/"/g,"'")+'" ':"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",e?'text-decoration="'+e+'" ':"",'style="',this.getSvgStyles(!0),'"',this.addPaintOrder()," >",t.textSpans.join(""),"</text>\n"]},_getSVGTextAndBg:function(t,e){var i,r=[],n=[],s=t;this._setSVGBg(n);for(var o=0,a=this._textLines.length;o<a;o++)i=this._getLineLeftOffset(o),(this.textBackgroundColor||this.styleHas("textBackgroundColor",o))&&this._setSVGTextLineBg(n,o,e+i,s),this._setSVGTextLineText(r,o,e+i,s),s+=this.getHeightOfLine(o);return{textSpans:r,textBgRects:n}},_createTextCharSpan:function(t,e,i,r){var n=t!==t.trim()||t.match(t4),s=this.getSvgSpanStyles(e,n),o=e.deltaY,a="",h=ev.Object.NUM_FRACTION_DIGITS;return o&&(a=' dy="'+t3(o,h)+'" '),['<tspan x="',t3(i,h),'" y="',t3(r,h),'" ',a,s?'style="'+s+'"':"",">",ev.util.string.escapeXml(t),"</tspan>"].join("")},_setSVGTextLineText:function(t,e,i,r){var n,s,o,a,h,l=this.getHeightOfLine(e),c=-1!==this.textAlign.indexOf("justify"),u="",f=0,d=this._textLines[e];r+=l*(1-this._fontSizeFraction)/this.lineHeight;for(var g=0,p=d.length-1;g<=p;g++)h=g===p||this.charSpacing,u+=d[g],o=this.__charBounds[e][g],0===f?(i+=o.kernedWidth-o.width,f+=o.width):f+=o.kernedWidth,c&&!h&&this._reSpaceAndTab.test(d[g])&&(h=!0),h||(n=n||this.getCompleteStyleDeclaration(e,g),s=this.getCompleteStyleDeclaration(e,g+1),h=ev.util.hasStyleChanged(n,s,!0)),h&&(a=this._getStyleDeclaration(e,g)||{},t.push(this._createTextCharSpan(u,a,i,r)),u="",n=s,i+=f,f=0)},_pushTextBgRect:function(t,e,i,r,n,s){var o=ev.Object.NUM_FRACTION_DIGITS;t.push("		<rect ",this._getFillAttributes(e),' x="',t3(i,o),'" y="',t3(r,o),'" width="',t3(n,o),'" height="',t3(s,o),'"></rect>\n')},_setSVGTextLineBg:function(t,e,i,r){for(var n,s,o=this._textLines[e],a=this.getHeightOfLine(e)/this.lineHeight,h=0,l=0,c=this.getValueOfPropertyAt(e,0,"textBackgroundColor"),u=0,f=o.length;u<f;u++)n=this.__charBounds[e][u],(s=this.getValueOfPropertyAt(e,u,"textBackgroundColor"))!==c?(c&&this._pushTextBgRect(t,c,i+l,r,h,a),l=n.left,h=n.width,c=s):h+=n.kernedWidth;s&&this._pushTextBgRect(t,s,i+l,r,h,a)},_getFillAttributes:function(t){var e=t&&"string"==typeof t?new ev.Color(t):"";return e&&e.getSource()&&1!==e.getAlpha()?'opacity="'+e.getAlpha()+'" fill="'+e.setAlpha(1).toRgb()+'"':'fill="'+t+'"'},_getSVGLineTopOffset:function(t){for(var e,i=0,r=0;r<t;r++)i+=this.getHeightOfLine(r);return e=this.getHeightOfLine(r),{lineTop:i,offset:(this._fontSizeMult-this._fontSizeFraction)*e/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(t){return ev.Object.prototype.getSvgStyles.call(this,t)+" white-space: pre;"}}),(t6=t.fabric||(t.fabric={})).Textbox=t6.util.createClass(t6.IText,t6.Observable,{type:"textbox",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:t6.Text.prototype._dimensionAffectingProps.concat("width"),_wordJoiners:/[ \t\r]/,splitByGrapheme:!1,initDimensions:function(){this.__skipDimension||(this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(t){for(var e=0,i=0,r=0,n={},s=0;s<t.graphemeLines.length;s++)"\n"===t.graphemeText[r]&&s>0?(i=0,r++,e++):!this.splitByGrapheme&&this._reSpaceAndTab.test(t.graphemeText[r])&&s>0&&(i++,r++),n[s]={line:e,offset:i},r+=t.graphemeLines[s].length,i+=t.graphemeLines[s].length;return n},styleHas:function(t,e){if(this._styleMap&&!this.isWrapping){var i=this._styleMap[e];i&&(e=i.line)}return t6.Text.prototype.styleHas.call(this,t,e)},isEmptyStyles:function(t){if(!this.styles)return!0;var e,i,r=0,n=!1,s=this._styleMap[t],o=this._styleMap[t+1];for(var a in s&&(t=s.line,r=s.offset),o&&(n=o.line===t,e=o.offset),i=void 0===t?this.styles:{line:this.styles[t]})for(var h in i[a])if(h>=r&&(!n||h<e))for(var l in i[a][h])return!1;return!0},_getStyleDeclaration:function(t,e){if(this._styleMap&&!this.isWrapping){var i=this._styleMap[t];if(!i)return null;t=i.line,e=i.offset+e}return this.callSuper("_getStyleDeclaration",t,e)},_setStyleDeclaration:function(t,e,i){var r=this._styleMap[t];t=r.line,e=r.offset+e,this.styles[t][e]=i},_deleteStyleDeclaration:function(t,e){var i=this._styleMap[t];t=i.line,e=i.offset+e,delete this.styles[t][e]},_getLineStyle:function(t){var e=this._styleMap[t];return!!this.styles[e.line]},_setLineStyle:function(t){var e=this._styleMap[t];this.styles[e.line]={}},_wrapText:function(t,e){var i,r=[];for(this.isWrapping=!0,i=0;i<t.length;i++)r=r.concat(this._wrapLine(t[i],i,e));return this.isWrapping=!1,r}
1,_measureWord:function(t,e,i){var r,n=0;i=i||0;for(var s=0,o=t.length;s<o;s++)n+=this._getGraphemeBox(t[s],e,s+i,r,!0).kernedWidth,r=t[s];return n},_wrapLine:function(t,e,i,r){var n=0,s=this.splitByGrapheme,o=[],a=[],h=s?t6.util.string.graphemeSplit(t):t.split(this._wordJoiners),l="",c=0,u=s?"":" ",f=0,d=0,g=0,p=!0,m=this._getWidthOfCharSpacing();r=r||0,0===h.length&&h.push([]),i-=r;for(var v=0;v<h.length;v++)l=s?h[v]:t6.util.string.graphemeSplit(h[v]),f=this._measureWord(l,e,c),c+=l.length,(n+=d+f-m)>i&&!p?(o.push(a),a=[],n=f,p=!0):n+=m,p||s||a.push(u),a=a.concat(l),d=s?0:this._measureWord([u],e,c),c++,p=!1,f>g&&(g=f);return v&&o.push(a),g+r>this.dynamicMinWidth&&(this.dynamicMinWidth=g-m+r),o},isEndOfWrapping:function(t){return!this._styleMap[t+1]||this._styleMap[t+1].line!==this._styleMap[t].line},missingNewlineOffset:function(t){return this.splitByGrapheme?+!!this.isEndOfWrapping(t):1},_splitTextIntoLines:function(t){for(var e=t6.Text.prototype._splitTextIntoLines.call(this,t),i=this._wrapText(e.lines,this.width),r=Array(i.length),n=0;n<i.length;n++)r[n]=i[n].join("");return e.lines=r,e.graphemeLines=i,e},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},_removeExtraneousStyles:function(){var t={};for(var e in this._styleMap)this._textLines[e]&&(t[this._styleMap[e].line]=1);for(var e in this.styles)t[e]||delete this.styles[e]},toObject:function(t){return this.callSuper("toObject",["minWidth","splitByGrapheme"].concat(t))}}),t6.Textbox.fromObject=function(t,e){var i=t6.util.stylesFromArray(t.styles,t.text),r=Object.assign({},t,{styles:i});return t6.Object._fromObject("Textbox",r,e,"text")},function(){var t=ev.controlsUtils,e=t.scaleSkewCursorStyleHandler,i=t.scaleCursorStyleHandler,r=t.scalingEqually,n=t.scalingYOrSkewingX,s=t.scalingXOrSkewingY,o=t.scaleOrSkewActionName,a=ev.Object.prototype.controls;if(a.ml=new ev.Control({x:-.5,y:0,cursorStyleHandler:e,actionHandler:s,getActionName:o}),a.mr=new ev.Control({x:.5,y:0,cursorStyleHandler:e,actionHandler:s,getActionName:o}),a.mb=new ev.Control({x:0,y:.5,cursorStyleHandler:e,actionHandler:n,getActionName:o}),a.mt=new ev.Control({x:0,y:-.5,cursorStyleHandler:e,actionHandler:n,getActionName:o}),a.tl=new ev.Control({x:-.5,y:-.5,cursorStyleHandler:i,actionHandler:r}),a.tr=new ev.Control({x:.5,y:-.5,cursorStyleHandler:i,actionHandler:r}),a.bl=new ev.Control({x:-.5,y:.5,cursorStyleHandler:i,actionHandler:r}),a.br=new ev.Control({x:.5,y:.5,cursorStyleHandler:i,actionHandler:r}),a.mtr=new ev.Control({x:0,y:-.5,actionHandler:t.rotationWithSnapping,cursorStyleHandler:t.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:"rotate"}),ev.Textbox){var h=ev.Textbox.prototype.controls={};h.mtr=a.mtr,h.tr=a.tr,h.br=a.br,h.tl=a.tl,h.bl=a.bl,h.mt=a.mt,h.mb=a.mb,h.mr=new ev.Control({x:.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"}),h.ml=new ev.Control({x:-.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"})}}()}(H);var U=H.fabric;class N{_initializeCanvas(){return void 0!==this.canvas||(this.canvas=new U.Canvas("canvas",{preserveObjectStacking:!0,objectCaching:!1,backgroundColor:"#fff"}),this.cropX=0,this.cropY=0,this.bottomX=0,this.bottomY=0,this.scaleX=0,this.initScaleX=0,this.strips=null,this.stripCount=0,this.stripWidth=0,this.ruler=null,this.configuratorConfig=[],this.strokeWidth=3,this.textBoxWidth=70,this.textBoxFontSize=15,this.rulerDashWidth=1,this.rulerDashColor="rgb(0,0,0)",this.stripDashWidth=1,this.stripDashColor="rgb(255,0,0)",this.trapezeHeight=75+this.strokeWidth,this.trapezeInnerColor="rgba(255,255,255,.5)",this.trapezeLineColor="rgb(0,0,0)",this.roomWidth=this.canvas.getWidth()-2*this.trapezeHeight,this.roomHeight=this.canvas.getHeight()-2*this.trapezeHeight,window.addEventListener("load",this._resize.bind(this)),window.addEventListener("resize",this._resize.bind(this)),this._resize(this)),this.canvas}_setConfiguratorOptions(t){this.configuratorConfig=t}async _addImage(t){this.canvas.remove(this.image);var e=this;for(await U.Image.fromURL(t,function(t){t.scaleToWidth(e.roomWidth-2*e.strokeWidth),t.sendToBack(),t.setControlsVisibility({ml:!1,mb:!1,mr:!1,mt:!1,mtr:!1}),e.image=t,e.canvas.add(t),e.canvas.renderAll();var i=t.getObjectScaling();e.initScaleX=i.scaleX,e.scaleX=i.scaleX},{crossOrigin:"anonymous",lockMovementX:!1,lockMovementY:!1,lockScalingX:!1,lockScalingY:!1,lockRotation:!0,hasControls:!0,cornerColor:"rgba(255,0,0,1)",cornerSize:25,cornerStrokeColor:"rgba(255,0,0,1)",left:this.trapezeHeight+this.strokeWidth,top:this.trapezeHeight+this.strokeWidth,hasBorders:!0,borderColor:"rgba(255,0,0,.6)",borderDashArray:[5]});void 0===this.image;)await this._sleep(100)}_sleep(t){return new Promise(e=>setTimeout(e,t))}_updateImage(t){void 0!==this.image&&this.image.setSrc(t+"?cache="+Math.floor(0x3b9ac9ff*Math.random()))}
1_insertFrame(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(void 0===this.frame||null!==t){this.configuratorConfig.wallWidth>0&&t>0&&(this.roomHeight=this.roomWidth*t);var e=this._drawTrapeze(0,0,0,this.roomWidth+2*this.trapezeHeight-this.strokeWidth),i=this._drawTrapeze(90,this.roomWidth+2*this.trapezeHeight,0,this.roomHeight+2*this.trapezeHeight-this.strokeWidth),r=this._drawTrapeze(180,this.roomWidth+2*this.trapezeHeight,this.roomHeight+2*this.trapezeHeight,this.roomWidth+2*this.trapezeHeight-this.strokeWidth),n=this._drawTrapeze(270,0,this.roomHeight+2*this.trapezeHeight,this.roomHeight+2*this.trapezeHeight-this.strokeWidth);this.frame=new U.Group([e,i,r,n],{lockMovementX:!0,lockMovementY:!0,lockScalingX:!0,lockScalingY:!0,lockRotation:!0,hasControls:!1,selectable:!1,evented:!1,id:"frame",fill:this.trapezeInnerColor,objectCaching:!1}),this.canvas.on({"after:render":this._eventCallback.bind(this),"object:adding":this._eventCallback.bind(this),"object:modified":this._onModified.bind(this),"object:moving":this._eventCallback.bind(this)}),this._resize(this,this.roomHeight+2*this.trapezeHeight),this.canvas.add(this.frame),this.canvas.bringToFront(this.frame),this.canvas.renderAll()}}_updateFrameSize(t){this.canvas.setActiveObject(this.frame);let e=this.canvas.getObjects().filter(function(t){return"frame"===t.id});for(var i=0;i<e.length;i++){for(var r=0;r<e[i].length;r++)this.canvas.remove(e[i][r]);this.canvas.remove(e[i])}this.frame=null,this.canvas.renderAll(),this._insertFrame(t),this._showStrips(!0),this._showRuler(!0)}_drawTrapeze(t,e,i,r){var n=new U.Polygon([new U.Point(0,0),new U.Point(r,0),new U.Point(r-this.trapezeHeight,this.trapezeHeight),new U.Point(this.trapezeHeight,this.trapezeHeight)],{fill:this.trapezeInnerColor,hasBorders:!1,lockMovementX:!0,lockMovementY:!0,lockScalingX:!0,lockScalingY:!0,lockRotation:!0,hasControls:!1,selectable:!1,evented:!1}),s=new U.Line([0,0,r,0],{stroke:this.trapezeInnerColor,strokeWidth:this.strokeWidth,hasBorders:!0}),o=new U.Line([r,0,r-this.trapezeHeight,this.trapezeHeight],{stroke:this.trapezeInnerColor,strokeWidth:this.strokeWidth,hasBorders:!0}),a=new U.Line([r-this.trapezeHeight,this.trapezeHeight,this.trapezeHeight,this.trapezeHeight],{stroke:this.trapezeLineColor,strokeWidth:this.strokeWidth,hasBorders:!0}),h=new U.Line([this.trapezeHeight,this.trapezeHeight,0,0],{stroke:this.trapezeInnerColor,strokeWidth:this.strokeWidth,hasBorders:!0});return new U.Group([n,s,o,a,h],{lockMovementX:!0,lockMovementY:!0,lockScalingX:!0,lockScalingY:!0,lockRotation:!0,hasControls:!1,selectable:!1,evented:!1,id:"frame",objectCaching:!1,left:e,top:i,angle:t})}_calcStripAmount(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:75;return this.stripCount=Math.ceil(this.configuratorConfig.wallWidth/t),this.stripCount}_showStrips(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:75;if(this.stripWidth=e,null!==this.strips){this.canvas.setActiveObject(this.strips);let e=this.canvas.getObjects().filter(function(t){return"strips"===t.id});for(var i=0;i<e.length;i++){for(var r=0;r<e[i].length;r++)this.canvas.remove(e[i][r]);this.canvas.remove(e[i])}this.strips=null,this.canvas.renderAll(),!0===t&&this._showStrips(!1,this.stripWidth)}else{if(this._calcStripAmount(this.stripWidth),!0===t)return;var n=(this.roomWidth-2*this.strokeWidth)/parseInt(this.configuratorConfig.wallWidth)*e;this.strips=new U.Group([],{lockMovementX:!0,lockMovementY:!0,lockScalingX:!0,lockScalingY:!0,lockRotation:!0,hasControls:!1,selectable:!1,evented:!1,id:"strips"});for(var i=0;i<this.stripCount-1;i++){var s=new U.Line([this.trapezeHeight+this.strokeWidth+n*(i+1),this.trapezeHeight+this.strokeWidth,this.trapezeHeight+this.strokeWidth+n*(i+1),this.roomHeight+this.trapezeHeight-this.strokeWidth],{strokeDashArray:[5,5],stroke:this.stripDashColor,strokeWidth:this.stripDashWidth});this.strips.addWithUpdate(s)}this.canvas.add(this.strips).renderAll()}}_showRuler(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.ruler){let r=this.canvas.getObjects().filter(function(t){return"rulerX"===t.id||"rulerY"===t.id});for(var e=0;e<r.length;e++){for(var i=0;i<r[e].length;i++)this.canvas.remove(r[e][i]);this.canvas.remove(r[e])}this.ruler=null,this.canvas.renderAll(),!0===t&&this._showRuler(this.configuratorConfig.wallWidth,this.configuratorConfig.wallHeight,!1)}else{if(!0===t)return;
1var r=new U.Line([this.trapezeHeight+this.strokeWidth,this.trapezeHeight+this.roomHeight/2,this.trapezeHeight+this.roomWidth-this.strokeWidth,this.trapezeHeight+this.roomHeight/2],{strokeDashArray:[5,5],stroke:this.rulerDashColor,strokeWidth:this.rulerDashWidth}),n=new U.Textbox(parseInt(this.configuratorConfig.wallHeight/2)+" cm",{left:this.strokeWidth,top:this.trapezeHeight+parseInt(this.roomHeight/2)-this.textBoxFontSize/2,fontSize:this.textBoxFontSize,fill:"white",textAlign:"center",width:this.textBoxWidth,backgroundColor:"black",id:"textBox"}),s=new U.Group([r,n],{lockMovementX:!0,lockScalingY:!0,lockScalingX:!0,lockRotation:!0,hasControls:!1,id:"rulerY",hasBorders:!1,hoverCursor:"s-resize"});s.on("moving",this._onRulerMoveY.bind(this));var o=new U.Line([this.trapezeHeight+parseInt(this.roomWidth/2),this.trapezeHeight+this.strokeWidth,this.trapezeHeight+parseInt(this.roomWidth/2),this.roomHeight+this.trapezeHeight-this.strokeWidth],{strokeDashArray:[5,5],stroke:"black",strokeWidth:this.rulerDashWidth}),a=new U.Textbox(parseInt(this.configuratorConfig.wallWidth/2)+" cm",{left:this.trapezeHeight+parseInt(this.roomWidth/2)-this.textBoxWidth/2,top:this.trapezeHeight-25,fontSize:this.textBoxFontSize,fill:"white",textAlign:"center",width:this.textBoxWidth,backgroundColor:"black",id:"textBox"}),h=new U.Group([o,a],{lockScalingX:!0,lockScalingY:!0,lockRotation:!0,lockMovementY:!0,hasControls:!1,id:"rulerX",hasBorders:!1,hoverCursor:"e-resize"});h.on("moving",this._onRulerMoveX.bind(this)),this.canvas.add(s).add(h).renderAll(),this.ruler=[s,h]}}_onModified(t){if(null!==this.image){var e=this.image.getCoords();this.cropX=parseInt(e[0].x-(this.trapezeHeight+this.strokeWidth)),this.cropY=parseInt(e[0].y-(this.trapezeHeight+this.strokeWidth)),this.bottomX=parseInt(e[2].x-(this.trapezeHeight+this.strokeWidth+this.roomWidth)),this.bottomY=parseInt(e[2].y-(this.trapezeHeight+this.strokeWidth+this.roomHeight));var i=this.image.getObjectScaling();if(this.scaleX=i.scaleX,this.canvas.bringToFront(this.frame),null!==this.strips&&this.canvas.bringToFront(this.strips),null!==this.ruler)for(var r=0;r<this.ruler.length;r++)this.canvas.bringToFront(this.ruler[r])}}_eventCallback(){if(this.canvas.bringToFront(this.frame),null!==this.strips&&this.canvas.bringToFront(this.strips),null!==this.ruler)for(var t=0;t<this.ruler.length;t++)this.canvas.bringToFront(this.ruler[t])}_adjustCroppingPosition(t,e,i,r){let n=this.canvas.getObjects("image");this.cropX=t,this.cropY=e,this.scaleX=i,this.scaleY=i,n[0].set("left",this.trapezeHeight+this.strokeWidth+parseInt(t)),n[0].set("top",this.trapezeHeight+this.strokeWidth+parseInt(e)),n[0].set("scaleX",parseFloat(i)),n[0].set("scaleY",parseFloat(i))}_onRulerMoveX(t){let e=this.canvas.getObjects().filter(function(t){return"rulerX"===t.id});if(0===e.length)return;let i=e[0].getObjects().filter(function(t){return"textBox"===t.id});var r=(e[0].left+this.textBoxWidth/2-(this.trapezeHeight+this.strokeWidth))/(this.roomWidth-2*this.strokeWidth)*this.configuratorConfig.wallWidth;r<0?(r=0,e[0].set("left",this.trapezeHeight+this.strokeWidth-this.textBoxWidth/2)):r>=this.configuratorConfig.wallWidth&&(r=this.configuratorConfig.wallWidth,e[0].set("left",this.roomWidth+this.trapezeHeight-this.strokeWidth-this.textBoxWidth/2)),i[0].set("text",String(parseInt(r))+" cm")}_onRulerMoveY(t){let e=this.canvas.getObjects().filter(function(t){return"rulerY"===t.id});if(0===e.length)return;let i=e[0].getObjects().filter(function(t){return"textBox"===t.id});var r=(e[0].top+this.textBoxFontSize/2-(this.trapezeHeight+this.strokeWidth))/(this.roomHeight-2*this.strokeWidth)*this.configuratorConfig.wallHeight;r<0?(r=0,e[0].set("top",this.trapezeHeight+this.strokeWidth-this.textBoxFontSize/2)):r>=this.configuratorConfig.wallHeight&&(r=this.configuratorConfig.wallHeight,e[0].set("top",this.roomHeight+this.trapezeHeight-this.strokeWidth-this.textBoxFontSize/2)),i[0].set("text",String(parseInt(r))+" cm")}_resize(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=document.querySelector("#canvasPreviewContainer");if(null===e&&(e=this.canvas.getHeight()),0>=this.canvas.getHeight()||i.clientWidth<=0)return;let r=this.canvas.getWidth()/e,n=i.scrollWidth,s=n/this.canvas.getWidth(),o=this.canvas.getZoom()*s;this.canvas.setDimensions({width:n,height:n/r}),this.canvas.setViewportTransform([o,0,0,o,0,0])}}let{PluginBaseClass:V}=window,{PluginBaseClass:G}=window,q=window.PluginManager;
1q.register("ConfiguratorPlugin",class extends V{init(){this._helper=new e,this._canvas=new N,this.modalElement=document.getElementById("magicwallsModal"),this.configuratorId=document.querySelector("#configurator").dataset.configuratorid,this.configuratorConfig=this._helper._getConfiguratorConfigFromLocalStorage(this.configuratorId),this.wallRatio=0,this.tempalteImage=document.querySelector("#configurator").dataset.templateproductimage,this.templateproductnumber=document.querySelector("#configurator").dataset.templateproductnumber,this.configuratorId&&this._initializeByConfiguratorId(),this.tempalteImage&&this._initializeByTemplate(),this._registerListEvents(),this._helper._removeOldConfigurations()}_registerListEvents(){document.querySelector("#imageFileInput").addEventListener("change",this._initializeFile.bind(this)),document.querySelector("#saveButton").addEventListener("click",this._checkProcess.bind(this)),document.querySelector("#mirrorImage").addEventListener("change",this._saveProcess.bind(this)),document.querySelector("#cartButton").addEventListener("click",this._putInCart.bind(this)),document.querySelector("#showStrips").addEventListener("click",this._showStrips.bind(this)),document.querySelector("#showRuler").addEventListener("click",this._showRuler.bind(this)),document.querySelector("#wallWidth").addEventListener("change",this._checkWallSize.bind(this)),document.querySelector("#wallHeight").addEventListener("change",this._checkWallSize.bind(this)),document.querySelectorAll("#qualityProductId").forEach(t=>{t.addEventListener("click",this._saveProcess.bind(this))})}async _checkProcess(){if(1===parseInt(document.getElementById("magicwallsModal").dataset.magicwallstep)&&this.tempalteImage){await this._initializeFile(this.tempalteImage),await this._saveProcess();return}await this._saveProcess()}async _initializeByConfiguratorId(){await this._loadConfiguratorData(),this._openModal(),this.modalElement.dataset.magicwallstep=3,document.querySelector("#configurator").dataset.step=3,this._helper._handleStep(3,1),this._helper._presetInputs(this.configuratorConfig),this.configuratorConfig.originalWebPath&&await this._initializeFile(this.configuratorConfig.originalWebPath,!0),this._canvas._adjustCroppingPosition(this.configuratorConfig.cropX,this.configuratorConfig.cropY,this.configuratorConfig.scaleX,this.configuratorConfig.scaleY),this._setProperties(),this._adjustWallSize(),this._saveProcess()}_initializeByTemplate(){document.querySelector("#magicwalls__create_btn").click()}_openModal(){if(window.bootstrap&&this.modalElement){window.bootstrap.Modal.getOrCreateInstance(this.modalElement).show();return}document.querySelector("#magicwalls__create_btn").click()}async _loadConfiguratorData(){let t=`/hbhmagicwallsconfiguratorLoad/${this.configuratorId}`,e=await fetch(t,{method:"GET",headers:{"X-Requested-With":"XMLHttpRequest"}}),i=await e.json();!0===i.success&&(this._helper._handleResponse(i),this.configuratorConfig=this._helper._getConfiguratorConfigFromLocalStorage(this.configuratorId))}_checkWallSize(t){var e=document.querySelector("#wallWidth"),i=document.querySelector("#wallWidth_error"),r=document.querySelector("#wallHeight"),n=document.querySelector("#wallHeight_error");""!==e.value&&e.value<75?i.classList.remove("d-none"):i.classList.add("d-none"),""!==r.value&&r.value<100?n.classList.remove("d-none"):n.classList.add("d-none"),e.value>=75&&r.value>=100?document.querySelector("#saveButton").disabled=!1:document.querySelector("#saveButton").disabled=!0}async _initializeFile(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=new FormData,r=document.querySelector("#wallWidth")?document.querySelector("#wallWidth").value:"",n=document.querySelector("#wallHeight")?document.querySelector("#wallHeight").value:"",s=this.configuratorConfig.wallWidth?this.configuratorConfig.wallWidth:r,o=this.configuratorConfig.wallHeight?this.configuratorConfig.wallHeight:n;void 0===t.target?(i.append("fileUrl",t),i.append("useOldFile",e),i.append("imageType","template")):(i.append("file",t.target.files[0]),i.append("imageType","custom")),i.append("configuratorId",this.configuratorId),i.append("wallWidth",s),i.append("wallHeight",o),await fetch("/hbhmagicwallsconfiguratorFileUpload",{method:"POST",body:i}).then(t=>t.json()).then(async t=>{this._helper._handleResponse(t),!0===t.success&&(this.configuratorId=document.querySelector("#configurator").dataset.configuratorid,this.configuratorConfig=this._helper._getConfiguratorConfigFromLocalStorage(this.configuratorId),this._canvas._initializeCanvas(),this._canvas._setConfiguratorOptions(this.configuratorConfig),await this._canvas._addImage(this.configuratorConfig.editedWebPath),this._canvas._insertFrame
1(),this._handleImageQuality(t.configuratorData[this.configuratorId].imageQuality))})}_handleImageQuality(t){let e=document.querySelector("#imageQuality");switch(t){case"green":e.innerHTML="<p style='font-weight: bold !important; color:green !important'>Ihre Bildqualtität ist sehr gut.</p>";break;case"yellow":e.innerHTML="<p style='font-weight: bold !important; color:#FCD12A !important'>Ihre Bildqualtität ist angemessen.</p>";break;case"red":e.innerHTML="<p style='font-weight: bold !important; color:red !important'>Ihre Bildqualtität ist nicht gut. Bitte laden Sie ein Bild mit besserer Auflösung hoch.</p>"}}_createCanvasScreenshot(){return void 0!==this._canvas.canvas?("undefined"===this._canvas.canvas.strip&&this._canvas._showStrips(!0),this._canvas.canvas.toDataURL({format:"jpeg"})):""}async _saveProcess(){let t=this._helper._collectFormData(this);var e=await fetch("/hbhmagicwallsconfiguratorSaveProcess",{method:"POST",body:t}),i=await e.json();this._helper._handleResponse(i),!0===i.success&&(this.configuratorId=document.querySelector("#configurator").dataset.configuratorid,this.configuratorConfig=this._helper._getConfiguratorConfigFromLocalStorage(this.configuratorId),this._canvas._setConfiguratorOptions(this.configuratorConfig),this._setProperties(),this._adjustWallSize(),this._canvas._updateImage(this.configuratorConfig.editedWebPath))}_setProperties(){this.wallRatio=this.configuratorConfig.wallHeight/this.configuratorConfig.wallWidth,this._helper._printWallMeasures(this.configuratorConfig.wallWidth,this.configuratorConfig.wallHeight)}_adjustWallSize(){void 0!==this._canvas&&void 0!==this._canvas.canvas&&this.wallRatio>0&&this._canvas._updateFrameSize(this.wallRatio)}async _putInCart(){await this._saveProcess();let t=new FormData;var e=this;Object.keys(this.configuratorConfig).forEach(function(i){var r=e.configuratorConfig[i];t.append(i,r)}),fetch("/hbhmagicwallsconfiguratorPutIntoCart",{method:"POST",body:t}).then(t=>t.json()).then(t=>{this._helper._handleResponse(t),!0===t.success&&(this.configuratorId=document.querySelector("#configurator").dataset.configuratorid,this.configuratorConfig=this._helper._getConfiguratorConfigFromLocalStorage(this.configuratorId),this._canvas._setConfiguratorOptions(this.configuratorConfig),this._setProperties(),this._adjustWallSize()),document.querySelector(".header-cart").click()})}async _putInWishlist(){await this._saveProcess();let t=new FormData;var e=this;Object.keys(this.configuratorConfig).forEach(function(i){var r=e.configuratorConfig[i];t.append(i,r)}),fetch("/hbhmagicwallsconfiguratorAddWishlist",{method:"POST",body:t}).then(t=>t.json()).then(t=>{!0===t.success&&(this.configuratorId=document.querySelector("#configurator").dataset.configuratorid,this.configuratorConfig=this._helper._getConfiguratorConfigFromLocalStorage(this.configuratorId))})}_calcStripAmount(t){return this._canvas._calcStripAmount(t)}_showStrips(){this._canvas._showStrips(!1,75)}_showRuler(){this._canvas._showRuler(!1)}_activateStep(t){if(Number.isInteger(t)&&!(t<1)&&!(t>4)){var e=document.querySelector("#hbh_magicwall_step_"+t);if(e){for(var i=document.querySelectorAll("[id*='hbh_magicwall_step_']"),r=0;r<i.length;r++)i[r].classList.contains("d-none")||i[r].classList.add("d-none"),i[r].classList.remove("d-block");e.classList.remove("d-none"),e.classList.add("d-block"),document.querySelector("#configurator").dataset.step=t}}}_nextStep(){var t=parseInt(document.querySelector("#configurator").dataset.step);Number.isInteger(t)||(t=parseInt(document.getElementById("magicwallsModal").dataset.magicwallstep)||1),this._activateStep(this._helper._resolveStepTransition(t,1))}_previousStep(){var t=parseInt(document.querySelector("#configurator").dataset.step);Number.isInteger(t)||(t=parseInt(document.getElementById("magicwallsModal").dataset.magicwallstep)||1),this._activateStep(this._helper._resolveStepTransition(t,-1))}},"#step3"),q.register("ModalPlugin",class extends G{init(){this._helper=new e,this._registerEventListener(),this._showImage()}_registerEventListener(){var t=this;let e=document.querySelector("#saveButton"),i=document.querySelector("#backButton");e.addEventListener("click",function(){let e=parseInt(document.getElementById("magicwallsModal").dataset.magicwallstep)||1;if(e<4&&!1===t._handleErrors(e)){let i=t._helper._resolveStepTransition(e,1);document.getElementById("magicwallsModal").dataset.magicwallstep=i,t._helper._handleStep(i,e)}}),i.addEventListener("click",function(){let e=parseInt(document.getElementById("magicwallsModal").dataset.magicwallstep)||1;if(e>1){let i=t._helper._resolveStepTransition(e,-1);document.getElementById("magicwallsModal").dataset.magicwallstep=i,t._helper._handleStep(i,e)}})}_handleErrors(t){let e=!1;switch(t){case 1:let i=document.getElementById("wallWidth"),r=document.getElementById("wallHeight");i&&!i.value?(e=!0,i.parentElement.style.border="1px solid red"):parseInt(i.value)>2e3?(e=!0,i.parentElement.style.border="1px solid red"):i.parentElement.style.border="none",r&&!r.value?(e=!0,r.parentElement.style.border="1px solid red"):parseInt(r.value)>600?(e=!0,r.parentElement.style.border="1px solid red"):r.parentElement.style.border="none";break;case 2:let n=document.getElementById("imageFileInput"),s=document.querySelector("#configurator").dataset.templateproductimage;n&&!n.value&&""===s?(n.parentElement.style.border="2px dashed red",e=!0):n.parentElement.style.border="2px dashed #e3e3e3"}return!0===e&&console.error("[HbHMagicWallsConfigurator]: Got errors on Step "+t),e}_toggleDisplays(t){t.classList.contains("d-none")?(t.classList.remove("d-none"),t.classList.add("d-block")):(t.classList.remove("d-block"),t.classList.add("d-none"))}_showProgressbar(){var t=document.getElementById("progressbar");document.getElementById("progress"),t.style.width="50%"}_showImage(){var t=document.getElementById("drop-zone"),e=document.getElementById("imageFileInput"),i=document.getElementById("image-preview"),r=document.getElementById("drop-zone-ready"),n=document.getElementById("drop-zone-before"),s=this;t.addEventListener("dragover",function(t){t.preventDefault()}),t.addEventListener("click",function(t){t.preventDefault();let o=document.createElement("input");o.type="file",o.onchange=t=>{var a=o.files;a[0].type.match("image.*")&&(e.files=a,s._triggerEvent(e,"change"),i.style.display="block",n.style.display="none",r.style.display="flex",i.src=URL.createObjectURL(a[0]))},o.click()}),t.addEventListener("drop",function(t){t.preventDefault();var o=t.dataTransfer.files;o[0].type.match("image.*")&&(e.files=o,s._triggerEvent(e,"change"),i.style.display="block",n.style.display="none",r.style.display="flex",i.src=URL.createObjectURL(o[0]))}),e.addEventListener("change",function(){var t=this.files[0];t&&(i.src=URL.createObjectURL(t))})}_triggerEvent(t,e){if("createEvent"in document){var i=document.createEvent("HTMLEvents");i.initEvent(e,!1,!0),t.dispatchEvent(i)}else{var i=document.createEventObject();
1i.eventType=e,t.fireEvent("on"+i.eventType,i)}}},"#magicwallsModal")})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.