UNPKG

gas.gl

Version:

HighPerformance Geojson Data Render with WebGL

1 lines 1.58 MB
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("leaflet"),require("lodash"),require("isomorphic-fetch"),require("d3"));else if("function"==typeof define&&define.amd)define(["leaflet","lodash","isomorphic-fetch","d3"],e);else{var n="object"==typeof exports?e(require("leaflet"),require("lodash"),require("isomorphic-fetch"),require("d3")):e(t.L,t._,t.fetch,t.d3);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(window,(function(t,e,n,r){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=419)}([function(t,e){function n(t,e,n,r){if(void 0===t)throw new Error("geometry is required");if(e&&e.constructor!==Object)throw new Error("properties must be an Object");if(n&&4!==n.length)throw new Error("bbox must be an Array of 4 numbers");if(r&&-1===["string","number"].indexOf(typeof r))throw new Error("id must be a number or a string");var i={type:"Feature"};return r&&(i.id=r),n&&(i.bbox=n),i.properties=e||{},i.geometry=t,i}function r(t,e,r,i){if(!t)throw new Error("No coordinates passed");if(void 0===t.length)throw new Error("Coordinates must be an array");if(t.length<2)throw new Error("Coordinates must be at least 2 numbers long");if(!p(t[0])||!p(t[1]))throw new Error("Coordinates must contain numbers");return n({type:"Point",coordinates:t},e,r,i)}function i(t,e,r,i){if(!t)throw new Error("No coordinates passed");for(var o=0;o<t.length;o++){var s=t[o];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++){if(0===o&&0===a&&!p(s[0][0])||!p(s[0][1]))throw new Error("Coordinates must contain numbers");if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}}return n({type:"Polygon",coordinates:t},e,r,i)}function o(t,e,r,i){if(!t)throw new Error("No coordinates passed");if(t.length<2)throw new Error("Coordinates must be an array of two or more positions");if(!p(t[0][1])||!p(t[0][1]))throw new Error("Coordinates must contain numbers");return n({type:"LineString",coordinates:t},e,r,i)}function s(t,e,r,i){if(!t)throw new Error("No coordinates passed");return n({type:"MultiLineString",coordinates:t},e,r,i)}function a(t,e,r,i){if(!t)throw new Error("No coordinates passed");return n({type:"MultiPoint",coordinates:t},e,r,i)}function u(t,e,r,i){if(!t)throw new Error("No coordinates passed");return n({type:"MultiPolygon",coordinates:t},e,r,i)}var l={miles:3960,nauticalmiles:3441.145,degrees:57.2957795,radians:1,inches:250905600,yards:6969600,meters:6373e3,metres:6373e3,centimeters:6373e5,centimetres:6373e5,kilometers:6373,kilometres:6373,feet:20908792.65},c={kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,centimetres:1e4,millimeter:1e6,acres:247105e-9,miles:386e-9,yards:1.195990046,feet:10.763910417,inches:1550.003100006};function h(t,e){if(null==t)throw new Error("radians is required");var n=l[e||"kilometers"];if(!n)throw new Error("units is invalid");return t*n}function f(t,e){if(null==t)throw new Error("distance is required");var n=l[e||"kilometers"];if(!n)throw new Error("units is invalid");return t/n}function d(t){if(null==t)throw new Error("radians is required");return 180*(t%(2*Math.PI))/Math.PI}function p(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}t.exports={feature:n,geometry:function(t,e,n){if(!t)throw new Error("type is required");if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(n&&4!==n.length)throw new Error("bbox must be an Array of 4 numbers");var l;switch(t){case"Point":l=r(e).geometry;break;case"LineString":l=o(e).geometry;break;case"Polygon":l=i(e).geometry;break;case"MultiPoint":l=a(e).geometry;break;case"MultiLineString":l=s(e).geometry;break;case"MultiPolygon":l=u(e).geometry;break;default:throw new Error(t+" is invalid")}return n&&(l.bbox=n),l},featureCollection:function(t,e,n){if(!t)throw new Error("No features passed");if(!Array.isArray(t))throw new Error("features must be an Array");if(e&&4!==e.length)throw new Error("bbox must be an Array of 4 numbers");if(n&&-1===["string","number"].indexOf(typeof n))throw new Error("id must be a number or a string");var r={type:"FeatureCollection"};return n&&(r.id=n),e&&(r.bbox=e),r.features=t,r},geometryCollection:function(t,e,r,i){if(!t)throw new Error("geometries is required");if(!Array.isArray(t))throw new Error("geometries must be an Array");return n({type:"GeometryCollection",geometries:t},e,r,i)},point:r,multiPoint:a,lineString:o,multiLineString:s,polygon:i,multiPolygon:u,radiansToDistance:h,distanceToRadians:f,distanceToDegrees:function(t,e){return d(f(t,e))},radians2degrees:d,degrees2radians:function(t){if(null==t)throw new Error("degrees is required");return t%360*Math.PI/180},bearingToAngle:function(t){if(null==t)throw new Error("bearing is required");var e=t%360;return e<0&&(e+=360),e},convertDistance:function(t,e,n){if(null==t)throw new Error("distance is required");if(!(t>=0))throw new Error("distance must be a positive number");return h(f(t,e),n||"kilometers")},convertArea:function(t,e,n){if(null==t)throw new Error("area is required");if(!(t>=0))throw new Error("area must be a positive number");var r=c[e||"meters"];if(!r)throw new Error("invalid original units");var i=c[n||"kilometers"];if(!i)throw new Error("invalid final units");return t/r*i},round:function(t,e){if(null==t||isNaN(t))throw new Error("num is required");if(e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n},isNumber:p}},function(t,e,n){"use strict";function r(t,e,n){if(null!==t){var i,o,s,a,u,l,c,h,f,d,p=0,g=0,v=t.type,m="FeatureCollection"===v,y="Feature"===v,x=m?t.features.length:1;for(i=0;i<x;i++)for(c=(d=!!(f=m?t.features[i].geometry:y?t.geometry:t)&&"GeometryCollection"===f.type)?f.geometries.length:1,o=0;o<c;o++){var E=0;if(null!==(l=d?f.geometries[o]:f)){h=l.coordinates;var C=l.type;switch(p=!n||"Polygon"!==C&&"MultiPolygon"!==C?0:1,C){case null:break;case"Point":e(h,g,i,E),g++,E++;break;case"LineString":case"MultiPoint":for(s=0;s<h.length;s++)e(h[s],g,i,E),g++,"MultiPoint"===C&&E++;"LineString"===C&&E++;break;case"Polygon":case"MultiLineString":for(s=0;s<h.length;s++){for(a=0;a<h[s].length-p;a++)e(h[s][a],g,i,E),g++;"MultiLineString"===C&&E++}"Polygon"===C&&E++;break;case"MultiPolygon":for(s=0;s<h.length;s++){for(a=0;a<h[s].length;a++)for(u=0;u<h[s][a].length-p;u++)e(h[s][a][u],g,i,E),g++;E++}break;case"GeometryCollection":for(s=0;s<l.geometries.length;s++)r(l.geometries[s],e,n);break;default:throw new Error("Unknown Geometry Type")}}}}}function i(t,e,n,i){var o=n;return r(t,(function(t,r,i,s){o=0===r&&void 0===n?t:e(o,t,r,i,s)}),i),o}function o(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length;n++)e(t.features[n].properties,n);break;case"Feature":e(t.properties,0)}}function s(t,e,n){var r=n;return o(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function a(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)e(t.features[n],n)}function u(t,e,n){var r=n;return a(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function l(t){var e=[];return r(t,(function(t){e.push(t)})),e}function c(t,e){var n,r,i,o,s,a,u,l,c=0,h="FeatureCollection"===t.type,f="Feature"===t.type,d=h?t.features.length:1;for(n=0;n<d;n++){for(a=h?t.features[n].geometry:f?t.geometry:t,l=h?t.features[n].properties:f?t.properties:{},s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":e(o,c,l);break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)e(o.geometries[r],c,l);break;default:throw new Error("Unknown Geometry Type")}else e(null,c,l);c++}}function h(t,e,n){var r=n;return c(t,(function(t,i,o){r=0===i&&void 0===n?t:e(r,t,i,o)})),r}function f(t,e){c(t,(function(t,n,r){var i,o=null===t?null:t.type;switch(o){case null:case"Point":case"LineString":case"Polygon":return void e(v(t,r),n,0)}switch(o){case"MultiPoint":i="Point";break;case"MultiLineString":i="LineString";break;case"MultiPolygon":i="Polygon"}t.coordinates.forEach((function(t,o){e(v({type:i,coordinates:t},r),n,o)}))}))}function d(t,e,n){var r=n;return f(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r}function p(t,e){f(t,(function(t,n,r){var o=0;if(t.geometry){var s=t.geometry.type;"Point"!==s&&"MultiPoint"!==s&&i(t,(function(i,s){var a=m([i,s],t.properties);return e(a,n,r,o),o++,s}))}}))}function g(t,e,n){var r=n,i=!1;return p(t,(function(t,o,s,a){r=!1===i&&void 0===n?t:e(r,t,o,s,a),i=!0})),r}function v(t,e){if(void 0===t)throw new Error("No geometry passed");return{type:"Feature",properties:e||{},geometry:t}}function m(t,e){if(!t)throw new Error("No coordinates passed");if(t.length<2)throw new Error("Coordinates must be an array of two or more positions");return{type:"Feature",properties:e||{},geometry:{type:"LineString",coordinates:t}}}function y(t,e){if(!t)throw new Error("geojson is required");var n=t.geometry?t.geometry.type:t.type;if(!n)throw new Error("invalid geojson");if("FeatureCollection"===n)throw new Error("FeatureCollection is not supported");if("GeometryCollection"===n)throw new Error("GeometryCollection is not supported");var r=t.geometry?t.geometry.coordinates:t.coordinates;if(!r)throw new Error("geojson must contain coordinates");switch(n){case"LineString":return void e(r,0,0);case"Polygon":case"MultiLineString":for(var i=0,o=0;o<r.length;o++)"MultiLineString"===n&&(i=o),e(r[o],o,i);return;case"MultiPolygon":for(var s=0;s<r.length;s++)for(var a=0;a<r[s].length;a++)e(r[s][a],a,s);return;default:throw new Error(n+" geometry not supported")}}function x(t,e,n){var r=n;return y(t,(function(t,i,o){r=0===i&&void 0===n?t:e(r,t,i,o)})),r}n.r(e),n.d(e,"coordEach",(function(){return r})),n.d(e,"coordReduce",(function(){return i})),n.d(e,"propEach",(function(){return o})),n.d(e,"propReduce",(function(){return s})),n.d(e,"featureEach",(function(){return a})),n.d(e,"featureReduce",(function(){return u})),n.d(e,"coordAll",(function(){return l})),n.d(e,"geomEach",(function(){return c})),n.d(e,"geomReduce",(function(){return h})),n.d(e,"flattenEach",(function(){return f})),n.d(e,"flattenReduce",(function(){return d})),n.d(e,"segmentEach",(function(){return p})),n.d(e,"segmentReduce",(function(){return g})),n.d(e,"feature",(function(){return v})),n.d(e,"lineString",(function(){return m})),n.d(e,"lineEach",(function(){return y})),n.d(e,"lineReduce",(function(){return x}))},function(t,e){function n(t){if(!t)throw new Error("obj is required");var e;if(t.length?e=t:t.coordinates?e=t.coordinates:t.geometry&&t.geometry.coordinates&&(e=t.geometry.coordinates),e)return r(e),e;throw new Error("No valid coordinates")}function r(t){if(t.length>1&&"number"==typeof t[0]&&"number"==typeof t[1])return!0;if(Array.isArray(t[0])&&t[0].length)return r(t[0]);throw new Error("coordinates must only contain numbers")}function i(t){if(!t)throw new Error("geojson is required");if(void 0!==t.geometry)return t.geometry;if(t.coordinates||t.geometries)return t;throw new Error("geojson must be a valid Feature or Geometry Object")}t.exports={geojsonType:function(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)},collectionOf:function(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+n+", FeatureCollection required");for(var r=0;r<t.features.length;r++){var i=t.features[r];if(!i||"Feature"!==i.type||!i.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!i.geometry||i.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+i.geometry.type)}},featureOf:function(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)},getCoord:function(t){if(!t)throw new Error("obj is required");var e=n(t);if(e.length>1&&"number"==typeof e[0]&&"number"==typeof e[1])return e;throw new Error("Coordinate is not a valid Point")},getCoords:n,containsNumber:r,getGeom:i,getGeomType:function(t){if(!t)throw new Error("geojson is required");var e=i(t);if(e)return e.type}}},function(t,e,n){"use strict";e.__esModule=!0;var r,i=n(215),o=(r=i)&&r.__esModule?r:{default:r};e.default=o.default||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}},function(t,e){var n=t.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(2).getCoord,i=n(0).radiansToDistance;t.exports=function(t,e,n){var o=Math.PI/180,s=r(t),a=r(e),u=o*(a[1]-s[1]),l=o*(a[0]-s[0]),c=o*s[1],h=o*a[1],f=Math.pow(Math.sin(u/2),2)+Math.pow(Math.sin(l/2),2)*Math.cos(c)*Math.cos(h);return i(2*Math.atan2(Math.sqrt(f),Math.sqrt(1-f)),n)}},function(t,e,n){var r=n(1).coordEach;t.exports=function(t){var e=[1/0,1/0,-1/0,-1/0];return r(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}},function(t,e,n){var r=n(2),i=r.getCoord,o=r.getCoords;function s(t,e,n){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,o=e.length-1;i<e.length;o=i++){var s=e[i][0],a=e[i][1],u=e[o][0],l=e[o][1];if(t[1]*(s-u)+a*(u-t[0])+l*(t[0]-s)==0&&(s-t[0])*(u-t[0])<=0&&(a-t[1])*(l-t[1])<=0)return!n;a>t[1]!=l>t[1]&&t[0]<(u-s)*(t[1]-a)/(l-a)+s&&(r=!r)}return r}t.exports=function(t,e,n){if(!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=i(t),a=o(e),u=e.geometry?e.geometry.type:e.type,l=e.bbox;if(l&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(r,l))return!1;"Polygon"===u&&(a=[a]);for(var c=0,h=!1;c<a.length&&!h;c++)if(s(r,a[c][0],n)){for(var f=!1,d=1;d<a[c].length&&!f;)s(r,a[c][d],!n)&&(f=!0),d++;f||(h=!0)}return h}},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){var r=n(80)("wks"),i=n(56),o=n(8).Symbol,s="function"==typeof o;(t.exports=function(t){return r[t]||(r[t]=s&&o[t]||(s?o:i)("Symbol."+t))}).store=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=h(n(3)),i=h(n(275)),o=h(n(19)),s=h(n(39)),a=h(n(34));e.getScale=d,e.lineToPixels=p,e.polygonToPixels=g,e.pixelToPoint=m,e.getPolygonCoords=y,e.getKey=function(t){if("object"!==(void 0===t?"undefined":(0,a.default)(t)))return(0,l.default)(t);if(Array.isArray(t))return v(t);var e=[],n=!0,r=!1,i=void 0;try{for(var u,c=(0,s.default)((0,o.default)(t).sort());!(n=(u=c.next()).done);n=!0){var h=u.value;e.push(h+"_"+t[h])}}catch(t){r=!0,i=t}finally{try{!n&&c.return&&c.return()}finally{if(r)throw i}}return v(e)},e.getValueByKeys=function(t,e,n){return t.split(".").reduce((function(t,e){return t&&null!=t[e]?t[e]:n||null}),e)},e.pointToPixel=x,e.arcToPixel=E,e.meterToPixel=function(t,e,n,r){var i=r.latLngToContainerPoint([0,0]),o=(a=L.latLng([0,0]),u=t,l=a.toBounds(2*u),[(l._southWest.lat+l._northEast.lat)/2,l._northEast.lng]),s=function(t,e){var n=t.toBounds(2*e);return[n._southWest.lat,(n._southWest.lng+n._northEast.lng)/2]}(L.latLng([0,0]),e);var a,u,l;return t=Math.abs(r.latLngToContainerPoint(o).x-i.x),e=Math.abs(r.latLngToContainerPoint(s).y-i.y),{width:t<n?n:t,height:e<n?n:e}},e.meterPerPixel=function(t){return 40075016.686*Math.abs(Math.cos(180*t.getCenter().lat/Math.PI))/Math.pow(2,t.getZoom()+8)},e.arcPerPixel=function(t){var e=t.latLngToContainerPoint([0,0]);return t.latLngToContainerPoint([1,1]).x-e.x},e.isAnyRenderOptionsChange=C,e.between=b,e.distance=w,e.isPointOnLine=S,e.geoJsonToMarkerList=function(t){return t.features.map((function(t){if(t.geometry&&"point"===t.geometry.type.toLowerCase()){var e=(0,i.default)(t.geometry.coordinates,2),n=e[0],o=e[1],s=t.properties||{};return(0,r.default)({},s,{position:[o,n]})}return null})).filter((function(t){return null!==t}))};var u=h(n(15)),l=h(n(279));n(11);var c=n(2);function h(t){return t&&t.__esModule?t:{default:t}}function f(t,e){return L.point(t.x,t.y).add(e)}function d(t,e){if(null==e)throw new Error("scaleOpts cannot be empty");return u.default.isArray(e)?e:u.default.isObject(e)?function(t,e){var n=e.domain,r=e.range;if(!u.default.isArray(r)||0===r.length)throw new Error("range must be an not empty array");if(null==n||0===n.length)return r[0];if(!u.default.isArray(n))throw new Error("domain must be an array or void 0");var i=Math.min(n.length,r.length);if(isNaN(t))return r[0];for(var o=0,s=0;s<i-1&&n[s]<t;s++)o=s+1;return r[o]}(t,e):e}function p(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;try{for(var i=[],o=void 0,s=0,a=t.geometry.coordinates.length;s<a;s++){var u=t.geometry.coordinates[s],l=n.latLngToContainerPoint([u[1],u[0]]),c=l;o||e.contains([c.x,c.y])&&(o=!0),r&&(c=f(c,r));var h=i[i.length-1]||{};h.x===c.x&&h.y===c.y||i.push(c)}return 1===i.length&&i.push({x:i[0].x+.1,y:i[0].y+.1}),o?i:null}catch(t){return null}}function g(t,n,r){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=[],s=void 0,a=0,u=t.geometry.coordinates.length;a<u;a++){var l=t.geometry.coordinates[a],c=e.lineToPixels({geometry:{coordinates:l}},n,r,i);if(c&&(c.forEach((function(t){o.push(t)})),!s))for(var h=0,f=c.length;h<f;++h)if(n.contains(c[h])){s=!0;break}}return 1===o.length&&o.push({x:o[0].x+.1,y:o[0].y+.1}),s?o:null}function v(t){return(0,l.default)(t.join("_"))}function m(t,e,n){return n.containerPointToLatLng(L.point(t,e))}function y(t){var e=(0,c.getCoords)(t).reduce((function(t,e){return t.concat(e)}));return e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]||e.push(e[0]),[e]}function x(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=t.geometry.coordinates,o=n.latLngToContainerPoint([i[1],i[0]]),s=o;return e.contains(s)?(r&&(s=f(o,r)),s):null}function E(t,e,n,r){var i=r.latLngToContainerPoint([0,0]);return{width:(t=Math.abs(r.latLngToContainerPoint([0,t]).x-i.x))<n?n:t,height:(e=Math.abs(r.latLngToContainerPoint([e,0]).y-i.y))<n?n:e}}function C(t,e,n){for(var r=0,i=n.length;r<i;r++){var o=n[r];if(t[o]&&!u.default.isEqual(t[o],e[o]))return!0}return!1}function b(t,e,n){if(e>n){var r=n;n=e,e=r}return e<=t&&t<=n}function w(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function A(t,e,n){return t+n*(e-t)}function _(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,s=((n-t.x)*i+(r-t.y)*o)/(i*i+o*o);return{x:A(t.x,e.x,s),y:A(t.y,e.y,s)}}function S(t,e,n,r){for(var i=r/2,o={x:t,y:e},s=0,a=n.length;s<a-1;s++){var u=n[s],l=n[s+1];if(u.x!==l.x){if(u.y!==l.y){if(b(t,u.x,l.x))if(w(_(u,l,t,e),o)<=i)return!0}else if(b(e,u.y+i,u.y-i)&&b(t,u.x,l.x))return!0}else if(b(t,u.x+i,u.x-i)&&b(e,u.y,l.y))return!0}return!1}e.default={getScale:d,polygonToPixels:g,lineToPixels:p,pointToPixel:x,arcToPixel:E,isAnyRenderOptionsChange:C,isPointOnLine:S,distance:w,between:b,pixelToPoint:m,getPolygonCoords:y}},function(e,n){e.exports=t},function(t,e,n){var r=n(8),i=n(4),o=n(37),s=n(23),a=n(24),u=function(t,e,n){var l,c,h,f=t&u.F,d=t&u.G,p=t&u.S,g=t&u.P,v=t&u.B,m=t&u.W,y=d?i:i[e]||(i[e]={}),x=y.prototype,E=d?r:p?r[e]:(r[e]||{}).prototype;for(l in d&&(n=e),n)(c=!f&&E&&void 0!==E[l])&&a(y,l)||(h=c?E[l]:n[l],y[l]=d&&"function"!=typeof E[l]?n[l]:v&&c?o(h,r):m&&E[l]==h?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(h):g&&"function"==typeof h?o(Function.call,h):h,g&&((y.virtual||(y.virtual={}))[l]=h,t&u.R&&x&&!x[l]&&s(x,l,h)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e,n){"use strict";var r=s(n(90)),i=s(n(19)),o=s(n(34));function s(t){return t&&t.__esModule?t:{default:t}}/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */var a,u,l,c,h,f,d,p,g,v,m,y,x,E,C,b,w,A,_,S,D=D||{version:"3.6.2"};if(e.fabric=D,"undefined"!=typeof document&&"undefined"!=typeof window)document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?D.document=document:D.document=document.implementation.createHTMLDocument(""),D.window=window;else{var F=new(n(!function(){var t=new Error("Cannot find module 'jsdom'");throw t.code="MODULE_NOT_FOUND",t}()).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;D.document=F.document,D.jsdomImplForWrapper=n(280).implForWrapper,D.nodeCanvas=n(281).Canvas,D.window=F,DOMParser=D.window.DOMParser}function T(t,e){var n=t.canvas,r=e.targetCanvas,i=r.getContext("2d");i.translate(0,r.height),i.scale(1,-1);var o=n.height-r.height;i.drawImage(n,0,o,r.width,r.height,0,0,r.width,r.height)}function I(t,e){var n=e.targetCanvas.getContext("2d"),r=e.destinationWidth,i=e.destinationHeight,o=r*i*4,s=new Uint8Array(this.imageBuffer,0,o),a=new Uint8ClampedArray(this.imageBuffer,0,o);t.readPixels(0,0,r,i,t.RGBA,t.UNSIGNED_BYTE,s);var u=new ImageData(a,r,i);n.putImageData(u,0,0)}D.isTouchSupported="ontouchstart"in D.window||"ontouchstart"in D.document||D.window&&D.window.navigator&&D.window.navigator.maxTouchPoints>0,D.isLikelyNode=!1,D.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"],D.DPI=96,D.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",D.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,D.reNonWord=/[ \n\.,;!\?\-]/,D.fontPaths={},D.iMatrix=[1,0,0,1,0,0],D.svgNS="http://www.w3.org/2000/svg",D.perfLimitSizeTotal=2097152,D.maxCacheSideLimit=4096,D.minCacheSideLimit=256,D.charWidthsCache={},D.textureSize=2048,D.disableStyleCopyPaste=!1,D.enableGLFiltering=!0,D.devicePixelRatio=D.window.devicePixelRatio||D.window.webkitDevicePixelRatio||D.window.mozDevicePixelRatio||1,D.browserShadowBlurConstant=1,D.arcToSegmentsCache={},D.boundsOfCurveCache={},D.cachesBoundsOfCurve=!0,D.forceGLPutImageData=!1,D.initFilterBackend=function(){return D.enableGLFiltering&&D.isWebglSupported&&D.isWebglSupported(D.textureSize)?(console.log("max texture size: "+D.maxTextureSize),new D.WebglFilterBackend({tileSize:D.textureSize})):D.Canvas2dFilterBackend?new D.Canvas2dFilterBackend:void 0},"undefined"!=typeof document&&"undefined"!=typeof window&&(window.fabric=D),function(){function t(t,e){if(this.__eventListeners[t]){var n=this.__eventListeners[t];e?n[n.indexOf(e)]=!1:D.util.array.fill(n,!1)}}function e(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var n in t)this.on(n,t[n]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this}function n(e,n){if(!this.__eventListeners)return this;if(0===arguments.length)for(e in this.__eventListeners)t.call(this,e);else if(1===arguments.length&&"object"===(0,o.default)(arguments[0]))for(var r in e)t.call(this,r,e[r]);else t.call(this,e,n);return this}function r(t,e){if(!this.__eventListeners)return this;var n=this.__eventListeners[t];if(!n)return this;for(var r=0,i=n.length;r<i;r++)n[r]&&n[r].call(this,e||{});return this.__eventListeners[t]=n.filter((function(t){return!1!==t})),this}D.Observable={observe:e,stopObserving:n,fire:r,on:e,off:n,trigger:r}}(),D.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var t=0,e=arguments.length;t<e;t++)this._onObjectAdded(arguments[t]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(t,e,n){var r=this._objects;return n?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,n=!1,r=0,i=arguments.length;r<i;r++)-1!==(t=e.indexOf(arguments[r]))&&(n=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[r]));return this.renderOnAddRemove&&n&&this.requestRenderAll(),this},forEachObject:function(t,e){for(var n=this.getObjects(),r=0,i=n.length;r<i;r++)t.call(e,n[r],r,n);return this},getObjects:function(t){return void 0===t?this._objects.concat():this._objects.filter((function(e){return e.type===t}))},item:function(t){return this._objects[t]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(t){return this._objects.indexOf(t)>-1},complexity:function(){return this._objects.reduce((function(t,e){return t+=e.complexity?e.complexity():0}),0)}},D.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof D.Gradient||this.set(e,new D.Gradient(t))},_initPattern:function(t,e,n){!t||!t.source||t instanceof D.Pattern?n&&n():this.set(e,new D.Pattern(t,n))},_initClipping:function(t){if(t.clipTo&&"string"==typeof t.clipTo){var e=D.util.getFunctionBody(t.clipTo);void 0!==e&&(this.clipTo=new Function("ctx",e))}},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"===(void 0===t?"undefined":(0,o.default)(t))?this._setObject(t):"function"==typeof e&&"clipTo"!==t?this._set(t,e(this.get(t))):this._set(t,e),this},_set:function(t,e){this[t]=e},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},get:function(t){return this[t]}},a=e,u=Math.sqrt,l=Math.atan2,c=Math.pow,h=Math.PI/180,f=Math.PI/2,D.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/f){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/f){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)},removeFromArray:function(t,e){var n=t.indexOf(e);return-1!==n&&t.splice(n,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*h},radiansToDegrees:function(t){return t/h},rotatePoint:function(t,e,n){t.subtractEquals(e);var r=D.util.rotateVector(t,n);return new D.Point(r.x,r.y).addEquals(e)},rotateVector:function(t,e){var n=D.util.sin(e),r=D.util.cos(e);return{x:t.x*r-t.y*n,y:t.x*n+t.y*r}},transformPoint:function(t,e,n){return n?new D.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new D.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t,e){if(e)for(var n=0;n<t.length;n++)t[n]=D.util.transformPoint(t[n],e);var r=[t[0].x,t[1].x,t[2].x,t[3].x],i=D.util.array.min(r),o=D.util.array.max(r)-i,s=[t[0].y,t[1].y,t[2].y,t[3].y],a=D.util.array.min(s);return{left:i,top:a,width:o,height:D.util.array.max(s)-a}},invertTransform:function(t){var e=1/(t[0]*t[3]-t[1]*t[2]),n=[e*t[3],-e*t[1],-e*t[2],e*t[0]],r=D.util.transformPoint({x:t[4],y:t[5]},n,!0);return n[4]=-r.x,n[5]=-r.y,n},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t,e){var n=/\D{0,2}$/.exec(t),r=parseFloat(t);switch(e||(e=D.Text.DEFAULT_SVG_FONT_SIZE),n[0]){case"mm":return r*D.DPI/25.4;case"cm":return r*D.DPI/2.54;case"in":return r*D.DPI;case"pt":return r*D.DPI/72;case"pc":return r*D.DPI/72*12;case"em":return r*e;default:return r}},falseFunction:function(){return!1},getKlass:function(t,e){return t=D.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),D.util.resolveNamespace(e)[t]},getSvgAttributes:function(t){var e=["instantiated_by_use","style","id","class"];switch(t){case"linearGradient":e=e.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":e=e.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":e=e.concat(["offset","stop-color","stop-opacity"])}return e},resolveNamespace:function(t){if(!t)return D;var e,n=t.split("."),r=n.length,i=a||D.window;for(e=0;e<r;++e)i=i[n[e]];return i},loadImage:function(t,e,n,r){if(t){var i=D.util.createImage(),o=function(){e&&e.call(n,i),i=i.onload=i.onerror=null};i.onload=o,i.onerror=function(){D.log("Error loading "+i.src),e&&e.call(n,null,!0),i=i.onload=i.onerror=null},0!==t.indexOf("data")&&r&&(i.crossOrigin=r),"data:image/svg"===t.substring(0,14)&&(i.onload=null,D.util.loadImageInDom(i,o)),i.src=t}else e&&e.call(n,t)},loadImageInDom:function(t,e){var n=D.document.createElement("div");n.style.width=n.style.height="1px",n.style.left=n.style.top="-100%",n.style.position="absolute",n.appendChild(t),D.document.querySelector("body").appendChild(n),t.onload=function(){e(),n.parentNode.removeChild(n),n=null}},enlivenObjects:function(t,e,n,r){var i=[],o=0,s=(t=t||[]).length;function a(){++o===s&&e&&e(i.filter((function(t){return t})))}s?t.forEach((function(t,e){t&&t.type?D.util.getKlass(t.type,n).fromObject(t,(function(n,o){o||(i[e]=n),r&&r(t,n,o),a()})):a()})):e&&e(i)},enlivenPatterns:function(t,e){function n(){++i===o&&e&&e(r)}var r=[],i=0,o=(t=t||[]).length;o?t.forEach((function(t,e){t&&t.source?new D.Pattern(t,(function(t){r[e]=t,n()})):(r[e]=t,n())})):e&&e(r)},groupSVGElements:function(t,e,n){var r;return t&&1===t.length?t[0]:(e&&(e.width&&e.height?e.centerPoint={x:e.width/2,y:e.height/2}:(delete e.width,delete e.height)),r=new D.Group(t,e),void 0!==n&&(r.sourcePath=n),r)},populateWithProperties:function(t,e,n){if(n&&"[object Array]"===Object.prototype.toString.call(n))for(var r=0,i=n.length;r<i;r++)n[r]in t&&(e[n[r]]=t[n[r]])},drawDashedLine:function(t,e,n,r,i,o){var s=r-e,a=i-n,c=u(s*s+a*a),h=l(a,s),f=o.length,d=0,p=!0;for(t.save(),t.translate(e,n),t.moveTo(0,0),t.rotate(h),e=0;c>e;)(e+=o[d++%f])>c&&(e=c),t[p?"lineTo":"moveTo"](e,0),p=!p;t.restore()},createCanvasElement:function(){return D.document.createElement("canvas")},copyCanvasElement:function(t){var e=D.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e},toDataURL:function(t,e,n){return t.toDataURL("image/"+e,n)},createImage:function(){return D.document.createElement("img")},clipContext:function(t,e){e.save(),e.beginPath(),t.clipTo(e),e.clip()},multiplyTransformMatrices:function(t,e,n){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],n?0:t[0]*e[4]+t[2]*e[5]+t[4],n?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var e=l(t[1],t[0]),n=c(t[0],2)+c(t[1],2),r=u(n),i=(t[0]*t[3]-t[2]*t[1])/r,o=l(t[0]*t[2]+t[1]*t[3],n);return{angle:e/h,scaleX:r,scaleY:i,skewX:o/h,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return D.iMatrix.concat();var e=D.util.degreesToRadians(t.angle),n=D.util.cos(e),r=D.util.sin(e);return[n,r,-r,n,0,0]},calcDimensionsMatrix:function(t){var e=void 0===t.scaleX?1:t.scaleX,n=void 0===t.scaleY?1:t.scaleY,r=[t.flipX?-e:e,0,0,t.flipY?-n:n,0,0],i=D.util.multiplyTransformMatrices,o=D.util.degreesToRadians;return t.skewX&&(r=i(r,[1,0,Math.tan(o(t.skewX)),1],!0)),t.skewY&&(r=i(r,[1,Math.tan(o(t.skewY)),0,1],!0)),r},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],n=D.util.multiplyTransformMatrices;return t.angle&&(e=n(e,D.util.calcRotateMatrix(t))),(t.scaleX||t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=n(e,D.util.calcDimensionsMatrix(t))),e},customTransformMatrix:function(t,e,n){return D.util.composeMatrix({scaleX:t,scaleY:e,skewX:n})},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}},getFunctionBody:function(t){return(String(t).match(/function[^{]*\{([\s\S]*)\}/)||{})[1]},isTransparent:function(t,e,n,r){r>0&&(e>r?e-=r:e=0,n>r?n-=r:n=0);var i,o=!0,s=t.getImageData(e,n,2*r||1,2*r||1),a=s.data.length;for(i=3;i<a&&!1!=(o=s.data[i]<=0);i+=4);return s=null,o},parsePreserveAspectRatioAttribute:function(t){var e,n="meet",r=t.split(" ");return r&&r.length&&("meet"!==(n=r.pop())&&"slice"!==n?(e=n,n="meet"):r.length&&(e=r.pop())),{meetOrSlice:n,alignX:"none"!==e?e.slice(1,4):"none",alignY:"none"!==e?e.slice(5,8):"none"}},clearFabricFontCache:function(t){(t=(t||"").toLowerCase())?D.charWidthsCache[t]&&delete D.charWidthsCache[t]:D.charWidthsCache={}},limitDimsByArea:function(t,e){var n=Math.sqrt(e*t),r=Math.floor(e/n);return{x:Math.floor(n),y:r}},capValue:function(t,e,n){return Math.max(t,Math.min(e,n))},findScaleToFit:function(t,e){return Math.min(e.width/t.width,e.height/t.height)},findScaleToCover:function(t,e){return Math.max(e.width/t.width,e.height/t.height)},matrixToSVG:function(t){return"matrix("+t.map((function(t){return D.util.toFixed(t,D.Object.NUM_FRACTION_DIGITS)})).join(" ")+")"}},function(){var t=Array.prototype.join;function e(e,i,o,s,a,u,l){var c=t.call(arguments);if(D.arcToSegmentsCache[c])return D.arcToSegmentsCache[c];var h=Math.PI,f=l*h/180,d=D.util.sin(f),p=D.util.cos(f),g=0,v=0,m=-p*e*.5-d*i*.5,y=-p*i*.5+d*e*.5,x=(o=Math.abs(o))*o,E=(s=Math.abs(s))*s,C=y*y,b=m*m,w=x*E-x*C-E*b,A=0;if(w<0){var _=Math.sqrt(1-w/(x*E));o*=_,s*=_}else A=(a===u?-1:1)*Math.sqrt(w/(x*C+E*b));var S=A*o*y/s,F=-A*s*m/o,T=p*S-d*F+.5*e,I=d*S+p*F+.5*i,M=r(1,0,(m-S)/o,(y-F)/s),B=r((m-S)/o,(y-F)/s,(-m-S)/o,(-y-F)/s);0===u&&B>0?B-=2*h:1===u&&B<0&&(B+=2*h);for(var P=Math.ceil(Math.abs(B/h*2)),O=[],L=B/P,N=8/3*Math.sin(L/4)*Math.sin(L/4)/Math.sin(L/2),R=M+L,k=0;k<P;k++)O[k]=n(M,R,p,d,o,s,T,I,N,g,v),g=O[k][4],v=O[k][5],M=R,R+=L;return D.arcToSegmentsCache[c]=O,O}function n(t,e,n,r,i,o,s,a,u,l,c){var h=D.util.cos(t),f=D.util.sin(t),d=D.util.cos(e),p=D.util.sin(e),g=n*i*d-r*o*p+s,v=r*i*d+n*o*p+a;return[l+u*(-n*i*f-r*o*h),c+u*(-r*i*f+n*o*h),g+u*(n*i*p+r*o*d),v+u*(r*i*p-n*o*d),g,v]}function r(t,e,n,r){var i=Math.atan2(e,t),o=Math.atan2(r,n);return o>=i?o-i:2*Math.PI-(i-o)}function i(e,n,r,i,o,s,a,u){var l;if(D.cachesBoundsOfCurve&&(l=t.call(arguments),D.boundsOfCurveCache[l]))return D.boundsOfCurveCache[l];var c,h,f,d,p,g,v,m,y=Math.sqrt,x=Math.min,E=Math.max,C=Math.abs,b=[],w=[[],[]];h=6*e-12*r+6*o,c=-3*e+9*r-9*o+3*a,f=3*r-3*e;for(var A=0;A<2;++A)if(A>0&&(h=6*n-12*i+6*s,c=-3*n+9*i-9*s+3*u,f=3*i-3*n),C(c)<1e-12){if(C(h)<1e-12)continue;0<(d=-f/h)&&d<1&&b.push(d)}else(v=h*h-4*f*c)<0||(0<(p=(-h+(m=y(v)))/(2*c))&&p<1&&b.push(p),0<(g=(-h-m)/(2*c))&&g<1&&b.push(g));for(var _,S,F,T=b.length,I=T;T--;)_=(F=1-(d=b[T]))*F*F*e+3*F*F*d*r+3*F*d*d*o+d*d*d*a,w[0][T]=_,S=F*F*F*n+3*F*F*d*i+3*F*d*d*s+d*d*d*u,w[1][T]=S;w[0][I]=e,w[1][I]=n,w[0][I+1]=a,w[1][I+1]=u;var M=[{x:x.apply(null,w[0]),y:x.apply(null,w[1])},{x:E.apply(null,w[0]),y:E.apply(null,w[1])}];return D.cachesBoundsOfCurve&&(D.boundsOfCurveCache[l]=M),M}D.util.drawArc=function(t,n,r,i){for(var o=i[0],s=i[1],a=i[2],u=i[3],l=i[4],c=[[],[],[],[]],h=e(i[5]-n,i[6]-r,o,s,u,l,a),f=0,d=h.length;f<d;f++)c[f][0]=h[f][0]+n,c[f][1]=h[f][1]+r,c[f][2]=h[f][2]+n,c[f][3]=h[f][3]+r,c[f][4]=h[f][4]+n,c[f][5]=h[f][5]+r,t.bezierCurveTo.apply(t,c[f])},D.util.getBoundsOfArc=function(t,n,r,o,s,a,u,l,c){for(var h,f=0,d=0,p=[],g=e(l-t,c-n,r,o,a,u,s),v=0,m=g.length;v<m;v++)h=i(f,d,g[v][0],g[v][1],g[v][2],g[v][3],g[v][4],g[v][5]),p.push({x:h[0].x+t,y:h[0].y+n}),p.push({x:h[1].x+t,y:h[1].y+n}),f=g[v][4],d=g[v][5];return p},D.util.getBoundsOfCurve=i}(),function(){var t=Array.prototype.slice;function e(t,e,n){if(t&&0!==t.length){var r=t.length-1,i=e?t[r][e]:t[r];if(e)for(;r--;)n(t[r][e],i)&&(i=t[r][e]);else for(;r--;)n(t[r],i)&&(i=t[r]);return i}}D.util.array={fill:function(t,e){for(var n=t.length;n--;)t[n]=e;return t},invoke:function(e,n){for(var r=t.call(arguments,2),i=[],o=0,s=e.length;o<s;o++)i[o]=r.length?e[o][n].apply(e[o],r):e[o][n].call(e[o]);return i},min:function(t,n){return e(t,n,(function(t,e){return t<e}))},max:function(t,n){return e(t,n,(function(t,e){return t>=e}))}}}(),function(){function t(e,n,r){if(r)if(!D.isLikelyNode&&n instanceof Element)e=n;else if(n instanceof Array){e=[];for(var i=0,s=n.length;i<s;i++)e[i]=t({},n[i],r)}else if(n&&"object"===(void 0===n?"undefined":(0,o.default)(n)))for(var a in n)"canvas"===a?e[a]=t({},n[a]):n.hasOwnProperty(a)&&(e[a]=t({},n[a],r));else e=n;else for(var a in n)e[a]=n[a];return e}D.util.object={extend:t,clone:function(e,n){return t({},e,n)}},D.util.object.extend(D.util,D.Observable)}(),function(){function t(t,e){var n=t.charCodeAt(e);if(isNaN(n))return"";if(n<55296||n>57343)return t.charAt(e);if(55296<=n&&n<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";var 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 i=t.charCodeAt(e-1);if(55296>i||i>56319)throw"Low surrogate without preceding high surrogate";return!1}D.util.string={camelize:function(t){return t.replace(/-+(.)?/g,(function(t,e){return e?e.toUpperCase():""}))},capitalize:function(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:function(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},graphemeSplit:function(e){var n,r=0,i=[];for(r=0;r<e.length;r++)!1!==(n=t(e,r))&&i.push(n);return i}}}(),function(){var t=Array.prototype.slice,e=function(){},n=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),r=function(t,e,r){for(var i in e)i in t.prototype&&"function"==typeof t.prototype[i]&&(e[i]+"").indexOf("callSuper")>-1?t.prototype[i]=function(t){return function(){var n=this.constructor.superclass;this.constructor.superclass=r;var i=e[t].apply(this,arguments);if(this.constructor.superclass=n,"initialize"!==t)return i}}(i):t.prototype[i]=e[i],n&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};function i(){}function o(e){for(var n=null,r=this;r.constructor.superclass;){var i=r.constructor.superclass.prototype[e];if(r[e]!==i){n=i;break}r=r.constructor.superclass.prototype}return n?arguments.length>1?n.apply(this,t.call(arguments,1)):n.call(this):console.log("tried to callSuper "+e+", method not found in prototype chain",this)}D.util.createClass=function(){var n=null,s=t.call(arguments,0);function a(){this.initialize.apply(this,arguments)}"function"==typeof s[0]&&(n=s.shift()),a.superclass=n,a.subclasses=[],n&&(i.prototype=n.prototype,a.prototype=new i,n.subclasses.push(a));for(var u=0,l=s.length;u<l;u++)r(a,s[u],n);return a.prototype.initialize||(a.prototype.initialize=e),a.prototype.constructor=a,a.prototype.callSuper=o,a}}(),d=!!D.document.createElement("div").attachEvent,D.util.addListener=function(t,e,n,r){t&&t.addEventListener(e,n,!d&&r)},D.util.removeListener=function(t,e,n,r){t&&t.removeEventListener(e,n,!d&&r)},D.util.getPointer=function(t){var e=t.target,n=D.util.getScrollLeftTop(e),r=function(t){var e=t.changedTouches;return e&&e[0]?e[0]:t}(t);return{x:r.clientX+n.left,y:r.clientY+n.top}},p=D.document.createElement("div"),g="string"==typeof p.style.opacity,v="string"==typeof p.style.filter,m=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,y=function(t){return t},g?y=function(t,e){return t.style.opacity=e,t}:v&&(y=function(t,e){var n=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(n.zoom=1),m.test(n.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",n.filter=n.filter.replace(m,e)):n.filter+=" alpha(opacity="+100*e+")",t}),D.util.setStyle=function(t,e){var n=t.style;if(!n)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?y(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var r in e)"opacity"===r?y(t,e[r]):n["float"===r||"cssFloat"===r?void 0===n.styleFloat?"cssFloat":"styleFloat":r]=e[r];return t},function(){var t=Array.prototype.slice;var e,n,r,i,o=function(e){return t.call(e,0)};try{e=o(D.document.childNodes)instanceof Array}catch(t){}function s(t,e){var n=D.document.createElement(t);for(var r in e)"class"===r?n.className=e[r]:"for"===r?n.htmlFor=e[r]:n.setAttribute(r,e[r]);return n}function a(t){for(var e=0,n=0,r=D.document.documentElement,i=D.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===D.document?(e=i.scrollLeft||r.scrollLeft||0,n=i.scrollTop||r.scrollTop||0):(e+=t.scrollLeft||0,n+=t.scrollTop||0),1!==t.nodeType||"fixed"!==t.style.position););return{left:e,top:n}}e||(o=function(t){for(var e=new Array(t.length),n=t.length;n--;)e[n]=t[n];return e}),n=D.document.defaultView&&D.document.defaultView.getComputedStyle?function(t,e){var n=D.document.defaultView.getComputedStyle(t,null);return n?n[e]:void 0}:function(t,e){var n=t.style[e];return!n&&t.currentStyle&&(n=t.currentStyle[e]),n},r=D.document.documentElement.style,i="userSelect"in r?"userSelect":"MozUserSelect"in r?"MozUserSelect":"WebkitUserSelect"in r?"WebkitUserSelect":"KhtmlUserSelect"in r?"KhtmlUserSelect":"",D.util.makeElementUnselectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=D.util.falseFunction),i?t.style[i]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},D.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),i?t.style[i]="":"string"==typeof t.unselectable&&(t.unselectable=""),t},D.util.getScript=function(t,e){var n=D.document.getElementsByTagName("head")[0],r=D.document.createElement("script"),i=!0;r.onload=r.onreadystatechange=function(t){if(i){if("string"==typeof this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)return;i=!1,e(t||D.window.event),r=r.onload=r.onreadystatechange=null}},r.src=t,n.appendChild(r)},D.util.getById=function(t){return"string"==typeof t?D.document.getElementById(t):t},D.util.toArray=o,D.util.makeElement=s,D.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},D.util.wrapElement=function(t,e,n){return"string"==typeof e&&(e=s(e,n)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},D.util.getScrollLeftTop=a,D.util.getElementOffset=function(t){var e,r,i=t&&t.ownerDocument,o={left:0,top:0},s={left:0,top:0},u={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!i)return s;for(var l in u)s[u[l]]+=parseInt(n(t,l),10)||0;return e=i.documentElement,void 0!==t.getBoundingClientRect&&(o=t.getBoundingClientRect()),r=a(t),{left:o.left+r.left-(e.clientLeft||0)+s.left,top:o.top+r.top-(e.clientTop||0)+s.top}},D.util.getElementStyle=n,D.util.getNodeCanvas=function(t){var e=D.jsdomImplForWrapper(t);return e._canvas||e._image},D.util.cleanUpJsdomNode=function(t){if(D.isLikelyNode){var e=D.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}D.util.request=function(e,n){n||(n={});var r=n.method?n.method.toUpperCase():"GET",i=n.onComplete||function(){},o=new D.window.XMLHttpRequest,s=n.body||n.parameters;return o.onreadystatechange=function(){4===o.readyState&&(i(o),o.onreadystatechange=t)},"GET"===r&&(s=null,"string"==typeof n.parameters&&(e=function(t,e){return t+(/\?/.test(t)?"&":"?")+e}(e,n.parameters))),o.open(r,e,!0),"POST"!==r&&"PUT"!==r||o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(s),o}}(),D.log=console.log,D.warn=console.warn,function(){function t(){return!1}function e(t,e,n,r){return-n*Math.cos(t/r*(Math.PI/2))+n+e}var n=D.window.requestAnimationFrame||D.window.webkitRequestAnimationFrame||D.window.mozRequestAnimationFrame||D.window.oRequestAnimationFrame||D.window.msRequestAnimationFrame||function(t){return D.window.setTimeout(t,1e3/60)},r=D.window.cancelAnimationFrame||D.window.clearTimeout;function i(){return n.apply(D.window,arguments)}D.util.animate=function(n){i((function(r){n||(n={});var o,s=r||+new Date,a=n.duration||500,u=s+a,l=n.onChange||t,c=n.abort||t,h=n.onComplete||t,f=n.easing||e,d="startValue"in n?n.startValue:0,p="endValue"in n?n.endValue:100,g=n.byValue||p-d;n.onStart&&n.onStart(),function t(e){var n=(o=e||+new Date)>u?a:o-s,r=n/a,v=f(n,d,g,a),m=Math.abs((v-d)/g);if(!c())return o>u?(l(p,1,1),void h(p,1,1)):(l(v,m,r),void i(t));h(p,1,1)}(s)}))},D.util.requestAnimFrame=i,D.util.cancelAnimFrame=function(){return r.apply(D.window,arguments)}}(),D.util.animateColor=function(t,e,n,r){var i=new D.Color(t).getSource(),o=new D.Color(e).getSource();r=r||{},D.util.animate(D.util.object.extend(r,{duration:n||500,startValue:i,endValue:o,byValue:o,easing:function(t,e,n,i){var o,s,a,u,l=r.colorEasing?r.colorEasing(t,i):1-Math.cos(t/i*(Math.PI/2));return o=e,s=n,a=l,u="rgba("+parseInt(o[0]+a*(s[0]-o[0]),10)+","+parseInt(o[1]+a*(s[1]-o[1]),10)+","+parseInt(o[2]+a*(s[2]-o[2]),10),u+=","+(o&&s?parseFloat(o[3]+a*(s[3]-o[3])):1),u+=")"}}))},function(){function t(t,e,n,r){return t<Math.abs(e)?(t=e,r=n/4):r=0===e&&0===t?n/(2*Math.PI)*Math.asin(1):n/(2*Math.PI)*Math.asin(e/t),{a:t,c:e,p:n,s:r}}function e(t,e,n){return t.a*Math.pow(2,10*(e-=1))*Math.sin((e*n-t.s)*(2*Math.PI)/t.p)}function n(t,e,n,i){return n-r(i-t,0,n,i)+e}function r(t,e,n,r){return(t/=r)<1/2.75?n*(7.5625*t*t)+e:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e}D.util.ease={easeInQuad:function(t,e,n,r){return n*(t/=r)*t+e},easeOutQuad:function(t,e,n,r){return-n*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,n,r){return n*(t/=r)*t*t+e},easeOutCubic:function(t,e,n,r){return n*((t=t/r-1)*t*t+1)+e},easeInOutCubic:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t*t+e:n/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,n,r){return n*(t/=r)*t*t*t+e},easeOutQuart:function(t,e,n,r){return-n*((t=t/r-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t*t*t+e:-n/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,n,r){return n*(t/=r)*t*t*t*t+e},easeOutQuint:function(t,e,n,r){return n*((t=t/r-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,n,r){return-n*Math.cos(t/r*(Math.PI/2))+n+e},easeOutSine:function(t,e,n,r){return n*Math.sin(t/r*(Math.PI/2))+e},easeInOutSine:function(t,e,n,r){return-n/2*(Math.cos(Math.PI*t/r)-1)+e},easeInExpo:function(t,e,n,r){return 0===t?e:n*Math.pow(2,10*(t/r-1))+e},easeOutExpo:function(t,e,n,r){return t===r?e+n:n*(1-Math.pow(2,-10*t/r))+e},easeInOutExpo:function(t,e,n,r){return 0===t?e:t===r?e+n:(t/=r/2)<1?n/2*Math.pow(2,10*(t-1))+e:n/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,n,r){return-n*(Math.sqrt(1-(t/=r)*t)-1)+e},easeOutCirc:function(t,e,n,r){return n*Math.sqrt(1-(t=t/r-1)*t)+e},easeInOutCirc:function(t,e,n,r){return(t/=r/2)<1?-n/2*(Math.sqrt(1-t*t)-1)+e:n/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(n,r,i,o){var s=0;return 0===n?r:1===(n/=o)?r+i:(s||(s=.3*o),-e(t(i,i,s,1.70158),n,o)+r)},easeOutElastic:function(e,n,r,i){var o=0;if(0===e)return n;if(1===(e/=i))return n+r;o||(o=.3*i);var s=t(r,r,o,1.70158);return s.a*Math.pow(2,-10*e)*Math.sin((e*i-s.s)*(2*Math.PI)/s.p)+s.c+n},easeInOutElastic:function(n,r,i,o){var s=0;if(0===n)return r;if(2===(n/=o/2))return r+i;s||(s=o*(.3*1.5));var a=t(i,i,s,1.70158);return n<1?-.5*e(a,n,o)+r:a.a*Math.pow(2,-10*(n-=1))*Math.sin((n*o-a.s)*(2*Math.PI)/a.p)*.5+a.c+r},easeInBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),n*(t/=r)*t*((i+1)*t-i)+e},easeOutBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),n*((t=t/r-1)*t*((i+1)*t+i)+1)+e},easeInOutBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),(t/=r/2)<1?n/2*(t*t*((1+(i*=1.525))*t-i))+e:n/2*((t-=2)*t*((1+(i*=1.525))*t+i)+2)+e},easeInBounce:n,easeOutBounce:r,easeInOutBounce:function(t,e,i,o){return t<o/2?.5*n(2*t,0,i,o)+e:.5*r(2*t-o,0,i,o)+.5*i+e}}}(),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,r=e.util.object.clone,i=e.util.toFixed,o=e.util.parseUnit,s=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":"strokeU