diff --git a/.gitignore b/.gitignore index b4f5a3c6..609c8391 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ node_modules/* .idea/* .vscode/* +!.vscode/launch.json devtools/temp test/e2e/server/content/infinite-canvas.js test/e2e/server/content/test-case/rhino.jpg diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..0268d66b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,22 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Debug test", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}/node_modules/.bin/jest", + "args": ["${fileBasenameNoExtension}", "--config","./test/jest.config.js"], + "autoAttachChildProcesses": true, + "windows": { + "program": "${workspaceFolder}/node_modules/jest/bin/jest" + } + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 8c3984c6..6f32fc77 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ var context = infiniteCanvas.getContext("2d"); Include `InfiniteCanvas` in your web page: ```html - + ``` or install it using npm: diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index d29cdf1c..00000000 --- a/babel.config.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - presets: [ - [ - '@babel/preset-env', - { - targets: { - node: 'current', - }, - }, - ] - ], - plugins: [ - ["module-resolver", { - "root": ["."], - "alias": { - "e2e-test-page": "./test/e2e/test-page/index.ts" - } - }] - ] -} \ No newline at end of file diff --git a/dist/infinite-canvas.js b/dist/infinite-canvas.js index a7638b65..0cc3fec0 100644 --- a/dist/infinite-canvas.js +++ b/dist/infinite-canvas.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.InfiniteCanvas=e():t.InfiniteCanvas=e()}(this,(()=>(()=>{var t={306:(t,e,n)=>{"use strict";n.r(e),n.d(e,{InfiniteCanvas:()=>_r});var o,r,i=function(){function t(t){this.viewBox=t}return t.prototype.restore=function(){this.viewBox.restoreState()},t.prototype.save=function(){this.viewBox.saveState()},t}(),s=function(){function t(t,e){this.x=t,this.y=e}return t.prototype.mod=function(){return Math.sqrt(this.modSq())},t.prototype.modSq=function(){return this.x*this.x+this.y*this.y},t.prototype.minus=function(e){return new t(this.x-e.x,this.y-e.y)},t.prototype.plus=function(e){return new t(this.x+e.x,this.y+e.y)},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.cross=function(t){return this.x*t.y-this.y*t.x},t.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},t.prototype.getPerpendicular=function(){return new t(-this.y,this.x)},t.prototype.scale=function(e){return new t(e*this.x,e*this.y)},t.prototype.projectOn=function(t){return t.scale(this.dot(t)/t.modSq())},t.prototype.matrix=function(e,n,o,r){return new t(e*this.x+n*this.y,o*this.x+r*this.y)},t.prototype.inSameDirectionAs=function(t){return 0===this.cross(t)&&this.dot(t)>=0},t.prototype.isInOppositeDirectionAs=function(t){return 0===this.cross(t)&&this.dot(t)<0},t.prototype.isOnSameSideOfOriginAs=function(t,e){return this.isInSmallerAngleBetweenPoints(t,e)||t.isInSmallerAngleBetweenPoints(this,e)||e.isInSmallerAngleBetweenPoints(this,t)},t.prototype.isInSmallerAngleBetweenPoints=function(t,e){var n=t.cross(e);return n>0?t.cross(this)>=0&&this.cross(e)>=0:n<0?t.cross(this)<=0&&this.cross(e)<=0:!(t.dot(e)>0)||0===this.cross(t)&&this.dot(t)>0},t.origin=new t(0,0),t}(),a=function(){function t(t,e,n,o,r,i){this.a=t,this.b=e,this.c=n,this.d=o,this.e=r,this.f=i,this.scale=Math.sqrt(t*o-e*n)}return t.prototype.getMaximumLineWidthScale=function(){var t=this.a+this.c,e=this.b+this.d,n=this.a-this.c,o=this.b-this.d;return Math.sqrt(Math.max(t*t+e*e,n*n+o*o))},t.prototype.getRotationAngle=function(){var t=this.a/this.scale,e=this.b/this.scale;if(0===t)return e>0?Math.PI/2:3*Math.PI/2;var n=Math.atan(e/t);return t>0?e>0?n:0===e?0:2*Math.PI+n:e>0?Math.PI+n:0===e?Math.PI:Math.PI+n},t.prototype.applyToPointAtInfinity=function(t){return{direction:this.untranslated().apply(t.direction)}},t.prototype.apply=function(t){return new s(this.a*t.x+this.c*t.y+this.e,this.b*t.x+this.d*t.y+this.f)},t.prototype.untranslated=function(){var e=this.apply(s.origin),n=e.x,o=e.y;return this.before(t.translation(-n,-o))},t.prototype.before=function(e){return new t(e.a*this.a+e.c*this.b,e.b*this.a+e.d*this.b,e.a*this.c+e.c*this.d,e.b*this.c+e.d*this.d,e.a*this.e+e.c*this.f+e.e,e.b*this.e+e.d*this.f+e.f)},t.prototype.equals=function(t){return this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d&&this.e===t.e&&this.f===t.f},t.prototype.inverse=function(){var e=this.a*this.d-this.b*this.c;if(0==e)throw"error calculating inverse: zero determinant";return new t(this.d/e,-this.b/e,-this.c/e,this.a/e,(this.c*this.f-this.d*this.e)/e,(this.b*this.e-this.a*this.f)/e)},t.translation=function(e,n){return new t(1,0,0,1,e,n)},t.scale=function(e){return new t(e,0,0,e,0,0)},t.zoom=function(e,n,o,r,i){var s=1-o;return void 0!==r?new t(o,0,0,o,e*s+r,n*s+i):new t(o,0,0,o,e*s,n*s)},t.translateZoom=function(e,n,o,r,i,s,a,c){var u=o-e,p=r-n,f=u*u+p*p;if(0===f)throw new Error("divide by 0");var l=a-i,h=c-s,y=l*l+h*h,d=Math.sqrt(y/f);return t.zoom(e,n,d,i-e,s-n)},t.rotation=function(e,n,o){var r=Math.cos(o),i=Math.sin(o),s=1-r;return new t(r,i,-i,r,e*s+n*i,-e*i+n*s)},t.translateRotateZoom=function(e,n,o,r,i,s,a,c){var u=o-e,p=r-n,f=u*u+p*p;if(0===f)throw new Error("divide by 0");var l=a-i,h=c-s,y=e*r-n*o,d=o*u+r*p,v=e*u+n*p,g=(u*l+p*h)/f,m=(u*h-p*l)/f;return new t(g,m,-m,g,(i*d-a*v-y*h)/f,(s*d-c*v+y*l)/f)},t.identity=new t(1,0,0,1,0,0),t}(),c=function(){function t(t){this.propertyName=t}return t.prototype.changeInstanceValue=function(t,e){return this.valuesAreEqual(t[this.propertyName],e)?t:t.changeProperty(this.propertyName,e)},t.prototype.isEqualForInstances=function(t,e){return this.valuesAreEqual(t[this.propertyName],e[this.propertyName])},t.prototype.getInstructionToChange=function(t,e,n){return this.valuesAreEqual(t[this.propertyName],e[this.propertyName])?function(){}:this.changeToNewValue(e[this.propertyName],n)},t.prototype.valueIsTransformableForInstance=function(t){return!0},t}(),u=(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),p=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return u(e,t),e.prototype.valuesAreEqual=function(t,e){return t.equals(e)},e.prototype.changeToNewValue=function(t,e){return e.getTransformationInstruction(t)},e}(c))("transformation"),f=function(){function t(t){this.viewBox=t}return t.prototype.getTransform=function(){if(DOMMatrix){var t=this.viewBox.state.current.transformation;return new DOMMatrix([t.a,t.b,t.c,t.d,t.e,t.f])}},t.prototype.resetTransform=function(){this.viewBox.changeState((function(t){return p.changeInstanceValue(t,a.identity)}))},t.prototype.rotate=function(t){this.addTransformation(a.rotation(0,0,t))},t.prototype.scale=function(t,e){this.addTransformation(new a(t,0,0,e,0,0))},t.prototype.setTransform=function(t,e,n,o,r,i){var s,c,u,f,l,h;"number"==typeof t?(s=t,c=e,u=n,f=o,l=r,h=i):void 0!==t.a?(s=t.a,c=t.b,u=t.c,f=t.d,l=t.e,h=t.f):(s=t.m11,c=t.m12,u=t.m21,f=t.m22,l=t.m41,h=t.m42),this.viewBox.changeState((function(t){return p.changeInstanceValue(t,new a(s,c,u,f,l,h))}))},t.prototype.transform=function(t,e,n,o,r,i){this.addTransformation(new a(t,e,n,o,r,i))},t.prototype.translate=function(t,e){this.addTransformation(a.translation(t,e))},t.prototype.addTransformation=function(t){var e=this.viewBox.state.current.transformation,n=t.before(e);this.viewBox.changeState((function(t){return p.changeInstanceValue(t,n)}))},t}(),l=function(){},h=function(){},y=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),d=function(t){function e(e){var n=t.call(this)||this;return n.fillStrokeStyle=e,n}return y(e,t),e.prototype.setTransform=function(t){this.fillStrokeStyle.setTransform(t)},e.prototype.getInstructionToSetUntransformed=function(t){var e=this;return function(n){n[t]=e.fillStrokeStyle}},e.prototype.getInstructionToSetTransformed=function(t){var e=this;return function(n){n[t]=e.fillStrokeStyle}},e}(h),v=function(){function t(t){this.propName=t}return t.prototype.changeInstanceValue=function(t,e){return t.changeProperty(this.propName,e)},t.prototype.isEqualForInstances=function(t,e){return t[this.propName]===e[this.propName]},t.prototype.getInstructionToChange=function(t,e){var n=this,o=e[this.propName];return this.isEqualForInstances(t,e)?o instanceof h&&t.fillAndStrokeStylesTransformed!==e.fillAndStrokeStylesTransformed?e.fillAndStrokeStylesTransformed?o.getInstructionToSetTransformed(this.propName):o.getInstructionToSetUntransformed(this.propName):function(){}:o instanceof h?e.fillAndStrokeStylesTransformed?o.getInstructionToSetTransformed(this.propName):o.getInstructionToSetUntransformed(this.propName):function(t){t[n.propName]=e[n.propName]}},t.prototype.valueIsTransformableForInstance=function(t){return!(t[this.propName]instanceof d)},t}(),g=new v("fillStyle"),m=new v("strokeStyle"),b=function(){function t(t){this.viewBox=t}return Object.defineProperty(t.prototype,"fillStyle",{set:function(t){this.viewBox.changeState((function(e){return g.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeStyle",{set:function(t){this.viewBox.changeState((function(e){return m.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),t.prototype.createLinearGradient=function(t,e,n,o){return this.viewBox.createLinearGradient(t,e,n,o)},t.prototype.createPattern=function(t,e){return this.viewBox.createPattern(t,e)},t.prototype.createRadialGradient=function(t,e,n,o,r,i){return this.viewBox.createRadialGradient(t,e,n,o,r,i)},t.prototype.createConicGradient=function(t,e,n){return this.viewBox.createConicGradient(t,e,n)},t}(),P=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),w=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.valuesAreEqual=function(t,e){return t===e},e.prototype.changeToNewValue=function(t){return function(e){e.shadowColor=t}},e}(c))("shadowColor"),O=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),C=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return O(e,t),e.prototype.changeToNewValue=function(t){return function(e,n){var o=n.untranslated().apply(t),r=o.x,i=o.y;e.shadowOffsetX=r,e.shadowOffsetY=i}},e.prototype.valuesAreEqual=function(t,e){return t.x===e.x&&t.y==e.y},e.prototype.valuesAreEqualWhenTransformed=function(t,e){return 0===t.x&&0===t.y&&0===e.x&&0===e.y},e}(c),I=new C("shadowOffset"),T=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),S=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return T(e,t),e.prototype.valuesAreEqual=function(t,e){return t===e},e.prototype.changeToNewValue=function(t){return function(e,n){e.shadowBlur=t*n.scale}},e}(c),_=new S("shadowBlur"),x=function(){function t(t){this.viewBox=t}return Object.defineProperty(t.prototype,"shadowBlur",{get:function(){return this.viewBox.state.current.shadowBlur},set:function(t){this.viewBox.changeState((function(e){return _.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetX",{get:function(){return this.viewBox.state.current.shadowOffset.x},set:function(t){var e=new s(t,this.viewBox.state.current.shadowOffset.y);this.viewBox.changeState((function(t){return I.changeInstanceValue(t,e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetY",{get:function(){return this.viewBox.state.current.shadowOffset.y},set:function(t){var e=new s(this.viewBox.state.current.shadowOffset.x,t);this.viewBox.changeState((function(t){return I.changeInstanceValue(t,e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowColor",{get:function(){return this.viewBox.state.current.shadowColor},set:function(t){this.viewBox.changeState((function(e){return w.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),t}(),j=function(){},A=function(){function t(t){this.viewBox=t}return t.prototype.clearRect=function(t,e,n,o){this.viewBox.clearArea(t,e,n,o)},t.prototype.fillRect=function(t,e,n,o){this.viewBox.fillRect(t,e,n,o,(function(t){return t.fill()}))},t.prototype.strokeRect=function(t,e,n,o){this.viewBox.strokeRect(t,e,n,o)},t}(),B=function(){function t(t){this.viewBox=t}return t.prototype.isFillRule=function(t){return"evenodd"===t||"nonzero"===t},t.prototype.beginPath=function(){this.viewBox.beginPath()},t.prototype.clip=function(t,e){var n=this.isFillRule(t)?function(e){e.clip(t)}:function(t){t.clip()};this.viewBox.clipPath(n)},t.prototype.fill=function(t,e){if(t&&!this.isFillRule(t)||this.viewBox.currentPathCanBeFilled()){var n=this.isFillRule(t)?function(e){e.fill(t)}:function(t){t.fill()};this.viewBox.fillPath(n)}},t.prototype.isPointInPath=function(t,e,n,o){return!0},t.prototype.isPointInStroke=function(t,e,n){return!0},t.prototype.stroke=function(t){this.viewBox.strokePath()},t}(),L=function(){function t(){}return t.prototype.drawFocusIfNeeded=function(t,e){},t.prototype.scrollPathIntoView=function(t){},t}();!function(t){t[t.Relative=0]="Relative",t[t.Absolute=1]="Absolute"}(r||(r={}));var D=function(){function t(t,e,n){this.point=t,this.halfPlane1=e,this.halfPlane2=n,this.normal1=e.normalTowardInterior,this.normal2=n.normalTowardInterior}return t.prototype.isExpandableToContainPoint=function(t){return this.halfPlane1.interiorContainsPoint(t)||this.halfPlane2.interiorContainsPoint(t)},t.prototype.isInSameHalfPlaneAs=function(t){return this.halfPlane1.containsPoint(t)||this.halfPlane2.containsPoint(t)},t.prototype.getHalfPlaneContaining=function(t){return this.halfPlane1.containsPoint(t)?this.halfPlane1:this.halfPlane2},t.prototype.expandToContainPoint=function(e){var n=this.halfPlane1.interiorContainsPoint(e)?this.halfPlane1:this.halfPlane2,o=e.minus(this.point).getPerpendicular();this.isContainedByHalfPlaneWithNormal(o)||(o=o.scale(-1));var r=new E(this.point,o);return{newHalfPlane:r,newVertex:new t(this.point,n,r)}},t.prototype.isContainedByHalfPlaneWithNormal=function(t){return t.isInSmallerAngleBetweenPoints(this.normal1,this.normal2)},t.prototype.containsPoint=function(t){return this.halfPlane1.containsPoint(t)&&this.halfPlane2.containsPoint(t)},t.prototype.containsLineSegmentWithDirection=function(t){return this.containsPoint(this.point.plus(t))||this.containsPoint(this.point.minus(t))},t.prototype.isContainedByVertex=function(t){return this.isContainedByHalfPlaneWithNormal(t.normal1)&&this.isContainedByHalfPlaneWithNormal(t.normal2)},t}(),E=function(){function t(t,e){this.base=t,this.normalTowardInterior=e,this.lengthOfNormal=e.mod()}return t.prototype.getDistanceFromEdge=function(t){return t.minus(this.base).dot(this.normalTowardInterior)/this.lengthOfNormal},t.prototype.transform=function(e){var n=e.apply(this.base),o=e.apply(this.base.plus(this.normalTowardInterior.getPerpendicular())),r=e.apply(this.base.plus(this.normalTowardInterior));return t.throughPointsAndContainingPoint(n,o,r)},t.prototype.complement=function(){return new t(this.base,this.normalTowardInterior.scale(-1))},t.prototype.expandByDistance=function(e){return new t(this.base.plus(this.normalTowardInterior.scale(-e/this.normalTowardInterior.mod())),this.normalTowardInterior)},t.prototype.expandToIncludePoint=function(e){return this.containsPoint(e)?this:new t(e,this.normalTowardInterior)},t.prototype.containsPoint=function(t){return this.getDistanceFromEdge(t)>=0},t.prototype.interiorContainsPoint=function(t){return this.getDistanceFromEdge(t)>0},t.prototype.containsInfinityInDirection=function(t){return t.dot(this.normalTowardInterior)>=0},t.prototype.isContainedByHalfPlane=function(t){return this.normalTowardInterior.inSameDirectionAs(t.normalTowardInterior)&&t.getDistanceFromEdge(this.base)>=0},t.prototype.intersectWithLine=function(t,e){return{point:(n=this.base,o=this.normalTowardInterior.getPerpendicular(),r=t,i=e,s=r.minus(n),a=i.cross(o),c=i.getPerpendicular().dot(s)/a,n.plus(o.scale(c))),halfPlane:this};var n,o,r,i,s,a,c},t.prototype.isParallelToLine=function(t,e){return 0===this.normalTowardInterior.getPerpendicular().cross(e)},t.prototype.getIntersectionWith=function(t){var e=this.intersectWithLine(t.base,t.normalTowardInterior.getPerpendicular());return new D(e.point,this,t)},t.throughPointsAndContainingPoint=function(e,n,o){for(var r=0,i=t.withBorderPoints(e,n);ro&&(n=s.point,o=a)}return n?t.plus(n.minus(t).projectOn(e)):t},t.prototype.expandToIncludePoint=function(e){if(this.containsPoint(e))return this;for(var n=[],o=[],r=0,i=this.halfPlanes;r1)return!1}return!0},t.prototype.getTangentPlanesThroughInfinityInDirection=function(t){for(var e=[],n=0,o=this.vertices;n0?1:-1,0))),Number.isFinite(o)&&i.push(new E(new s(e+o,0),new s(o>0?-1:1,0)))),Number.isFinite(n)&&(i.push(new E(new s(0,n),new s(0,r>0?1:-1))),Number.isFinite(r)&&i.push(new E(new s(0,n+r),new s(0,r>0?-1:1)))),new t(i)},t}(),R=function(){function t(t){this.viewBox=t}return t.prototype.fillText=function(t,e,n,o){var i=void 0===o?function(o){o.fillText(t,e,n)}:function(r){r.fillText(t,e,n,o)};this.viewBox.addDrawing(i,this.getDrawnRectangle(e,n,t),r.Relative,!0)},t.prototype.measureText=function(t){return this.viewBox.measureText(t)},t.prototype.strokeText=function(t,e,n,o){var i=void 0===o?function(o){o.strokeText(t,e,n)}:function(r){r.strokeText(t,e,n,o)};this.viewBox.addDrawing(i,this.getDrawnRectangle(e,n,t),r.Relative,!0)},t.prototype.getDrawnRectangle=function(t,e,n){var o,r=this.viewBox.measureText(n);o=void 0!==r.actualBoundingBoxRight?Math.abs(r.actualBoundingBoxRight-r.actualBoundingBoxLeft):r.width;var i=void 0!==r.actualBoundingBoxAscent?r.actualBoundingBoxAscent+r.actualBoundingBoxDescent:1,s=void 0!==r.actualBoundingBoxAscent?r.actualBoundingBoxAscent:0;return W.createRectangle(t,e-s,o,i)},t}(),k=function(){function t(t){this.viewBox=t}return t.prototype.drawImage=function(){var t,e,n,o,i,s,a,c,u,p=Array.prototype.slice.apply(arguments);arguments.length<=5?(t=p[0],s=p[1],a=p[2],c=p[3],u=p[4]):(t=p[0],e=p[1],n=p[2],o=p[3],i=p[4],s=p[5],a=p[6],c=p[7],u=p[8]);var f=this.getDrawnLength(t.width,e,o,c),l=this.getDrawnLength(t.height,n,i,u),h=W.createRectangle(s,a,f,l),y=this.getDrawImageInstruction(arguments.length,t,e,n,o,i,s,a,c,u);this.viewBox.addDrawing(y,h,r.Relative,!0)},t.prototype.getDrawImageInstruction=function(t,e,n,o,r,i,s,a,c,u){switch(t){case 3:return function(t){t.drawImage(e,s,a)};case 5:return function(t){t.drawImage(e,s,a,c,u)};case 9:return function(t){t.drawImage(e,n,o,r,i,s,a,c,u)};default:throw new TypeError("Failed to execute 'drawImage' on 'CanvasRenderingContext2D': Valid arities are: [3, 5, 9], but ".concat(t," arguments provided."))}},t.prototype.getDrawnLength=function(t,e,n,o){var r=this.getLength(t);return void 0!==o?o:void 0!==e?void 0!==n?n:r-e:r},t.prototype.getLength=function(t){return"number"==typeof t?t:t.baseVal.value},t}(),N=function(){function t(t){this.viewBox=t}return t.prototype.createImageData=function(t,e){},t.prototype.getImageData=function(t,e,n,o){},t.prototype.putImageData=function(t,e,n,o,i,s,a){var c;t=function(t,e,n,o,r){e=void 0===e?0:e,n=void 0===n?0:n,o=void 0===o?t.width:o,r=void 0===r?t.height:r;for(var i=t.data,s=new Uint8ClampedArray(4*o*r),a=0;a-1;)this.removeAtIndex(e)},t.prototype.contains=function(t){return!!this.added.find(t)},t.prototype.setInitialState=function(t){this.initiallyWithState.setInitialState(t)},t.prototype.setInitialStateWithClippedPaths=function(t){this.initiallyWithState.setInitialStateWithClippedPaths(t)},t.prototype.execute=function(t,e){this.initiallyWithState.execute(t,e);for(var n=0,o=this.added;n0))return void t.prototype.changeCurrentInstanceTo.call(this,n,o);this.restore(),this.save()}if(n.clippedPaths){var r=this.currentState,i=r.current.clippedPaths;if(n.clippedPaths===i)t.prototype.changeCurrentInstanceTo.call(this,n,o);else{var s=n.clippedPaths.except(i);this.convertToState(s.initialState,o),this.addChangeToState(s.latestClippedPath.state,s.getInstructionToRecreate(o)),this.convertToState(r.replaceCurrent(n),o)}}else t.prototype.changeCurrentInstanceTo.call(this,n,o)}},e.prototype.convertToState=function(t,e){var n=this.currentState.getInstructionToConvertToState(t,e);this.addChangeToState(t,n)},e.canConvert=function(t,e){return!t.clippedPaths||!!e.clippedPaths&&e.clippedPaths.contains(t.clippedPaths)},e}(mt),wt=function(){function t(t,e){void 0===e&&(e=[]),this.current=t,this.stack=e}return t.prototype.replaceCurrent=function(e){return new t(e,this.stack)},t.prototype.withCurrentState=function(e){return new t(e,this.stack)},t.prototype.currentlyTransformed=function(t){return this.withCurrentState(this.current.changeProperty("fillAndStrokeStylesTransformed",t))},t.prototype.withClippedPath=function(e){return new t(this.current.withClippedPath(e),this.stack)},t.prototype.saved=function(){return new t(this.current,(this.stack||[]).concat([this.current]))},t.prototype.restored=function(){return this.stack&&0!==this.stack.length?new t(this.stack[this.stack.length-1],this.stack.slice(0,this.stack.length-1)):this},t.prototype.convertToLastSavedInstance=function(t,e){for(var n=this.stack.length-1;n>e;n--)t.restore()},t.prototype.convertFromLastSavedInstance=function(t,e,n){for(var o=e+1;o=0},t.prototype.lineSegmentIsOnSameLine=function(t){return 0===this.direction.cross(t.direction)&&this.pointIsOnSameLine(t.point1)},t.prototype.getPointsInSameDirection=function(t,e){return this.comesBefore(e,t)?{point1:e,point2:t}:{point1:t,point2:e}},t.prototype.pointIsBetweenPoints=function(t,e,n){return t.minus(e).dot(this.direction)*t.minus(n).dot(this.direction)<=0},t.prototype.intersectsConvexPolygon=function(t){if(this.isContainedByConvexPolygon(t))return!0;for(var e=0,n=t.getIntersectionsWithLine(this.base,this.direction);e0?e=i.point:n=i.point)}return e&&n?new Nt(e,n):e?new Rt(e,this.direction):new Rt(n,this.direction.scale(-1))},e.prototype.intersectWithLine=function(t){return this.intersectsLine(t)?this:Lt},e.prototype.intersectWithLineSegment=function(t){return this.lineSegmentIsOnSameLine(t)?t:Lt},e.prototype.intersectWithRay=function(t){return this.intersectsRay(t)?t:Lt},e.prototype.isContainedByConvexPolygon=function(t){return t.containsPoint(this.base)&&t.containsInfinityInDirection(this.direction)&&t.containsInfinityInDirection(this.direction.scale(-1))},e.prototype.isContainedByLine=function(t){return this.intersectsSubsetOfLine(t)},e.prototype.isContainedByLineSegment=function(t){return!1},e.prototype.isContainedByRay=function(t){return!1},e.prototype.contains=function(t){return t.isContainedByLine(this)},e.prototype.intersectsLine=function(t){return this.intersectsSubsetOfLine(t)},e.prototype.intersectsSubsetOfLine=function(t){return this.pointIsOnSameLine(t.base)&&0===this.direction.cross(t.direction)},e.prototype.intersectsLineSegment=function(t){return this.lineSegmentIsOnSameLine(t)},e.prototype.intersectsRay=function(t){return this.intersectsSubsetOfLine(t)},e.prototype.intersects=function(t){return t.intersectsLine(this)},e.prototype.expandToIncludePoint=function(t){return this.pointIsOnSameLine(t)?this:W.createFromHalfPlane(E.throughPointsAndContainingPoint(this.base,this.base.plus(this.direction),t))},e.prototype.expandToIncludeInfinityInDirection=function(t){var e=t.cross(this.direction),n=this.direction.getPerpendicular();return 0===e?this:e>0?W.createFromHalfPlane(new E(this.base,n.scale(-1))):W.createFromHalfPlane(new E(this.base,n))},e.prototype.transform=function(t){var n=t.apply(this.base);return new e(n,t.apply(this.base.plus(this.direction)).minus(n))},e.prototype.interiorContainsPoint=function(t){return this.pointIsOnSameLine(t)},e}(Dt),Wt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Rt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Wt(e,t),e.prototype.intersectWith=function(t){return t.intersectWithRay(this)},e.prototype.intersectWithConvexPolygon=function(t){if(!this.intersectsConvexPolygon(t))return Lt;if(this.isContainedByConvexPolygon(t))return this;for(var n,o=t.getIntersectionsWithLine(this.base,this.direction),r=this.base,i=0,s=o;i0?r=a.point:n=a.point)}return n?new Nt(r,n):new e(r,this.direction)},e.prototype.intersectWithRay=function(t){return this.isContainedByRay(t)?this:t.isContainedByRay(this)?t:this.interiorContainsPoint(t.base)?new Nt(this.base,t.base):Lt},e.prototype.intersectWithLine=function(t){return t.intersectWithRay(this)},e.prototype.intersectWithLineSegment=function(t){if(t.isContainedByRay(this))return t;if(!this.lineSegmentIsOnSameLine(t))return Lt;var e=this.getPointsInSameDirection(t.point1,t.point2).point2;return this.comesBefore(e,this.base)?Lt:new Nt(this.base,e)},e.prototype.isContainedByConvexPolygon=function(t){return t.containsPoint(this.base)&&t.containsInfinityInDirection(this.direction)},e.prototype.isContainedByRay=function(t){return t.containsPoint(this.base)&&t.containsInfinityInDirection(this.direction)},e.prototype.isContainedByLine=function(t){return t.intersectsSubsetOfLine(this)},e.prototype.isContainedByLineSegment=function(t){return!1},e.prototype.contains=function(t){return t.isContainedByRay(this)},e.prototype.intersectsRay=function(t){return this.isContainedByRay(t)||t.isContainedByRay(this)||this.interiorContainsPoint(t.base)},e.prototype.intersectsLine=function(t){return t.intersectsSubsetOfLine(this)},e.prototype.intersectsLineSegment=function(t){if(t.isContainedByRay(this))return!0;if(!this.lineSegmentIsOnSameLine(t))return!1;var e=this.getPointsInSameDirection(t.point1,t.point2).point2;return!this.comesBefore(e,this.base)},e.prototype.intersects=function(t){return t.intersectsRay(this)},e.prototype.expandToIncludePoint=function(t){return this.containsPoint(t)?this:this.pointIsOnSameLine(t)?new e(t,this.direction):W.createTriangleWithInfinityInDirection(this.base,t,this.direction)},e.prototype.expandToIncludeInfinityInDirection=function(t){return t.inSameDirectionAs(this.direction)?this:0===this.direction.cross(t)?new Ft(this.base,this.direction):W.createTriangleWithInfinityInTwoDirections(this.base,this.direction,t)},e.prototype.transform=function(t){var n=t.apply(this.base);return new e(n,t.apply(this.base.plus(this.direction)).minus(n))},e.prototype.interiorContainsPoint=function(t){return this.pointIsOnSameLine(t)&&!this.comesBefore(t,this.base)},e.prototype.containsInfinityInDirection=function(t){return this.direction.inSameDirectionAs(t)},e.prototype.containsPoint=function(t){return this.pointIsOnSameLine(t)&&this.comesBefore(this.base,t)},e}(Dt),kt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Nt=function(t){function e(e,n){var o=t.call(this,e,n.minus(e))||this;return o.point1=e,o.point2=n,o}return kt(e,t),e.prototype.intersectWith=function(t){return t.intersectWithLineSegment(this)},e.prototype.intersectWithLineSegment=function(t){if(this.isContainedByLineSegment(t))return this;if(t.isContainedByLineSegment(this))return t;if(!this.lineSegmentIsOnSameLine(t))return Lt;var n=this.getPointsInSameDirection(t.point1,t.point2),o=n.point1,r=n.point2;return this.comesBefore(r,this.point1)||this.comesBefore(this.point2,o)?Lt:this.comesBefore(this.point1,o)?new e(o,this.point2):new e(this.point1,r)},e.prototype.intersectWithRay=function(t){return t.intersectWithLineSegment(this)},e.prototype.intersectWithLine=function(t){return t.intersectWithLineSegment(this)},e.prototype.isContainedByRay=function(t){return t.containsPoint(this.point1)&&t.containsPoint(this.point2)},e.prototype.isContainedByLine=function(t){return t.intersectsSubsetOfLine(this)},e.prototype.isContainedByLineSegment=function(t){return t.containsPoint(this.point1)&&t.containsPoint(this.point2)},e.prototype.intersectWithConvexPolygon=function(t){if(!this.intersectsConvexPolygon(t))return Lt;if(this.isContainedByConvexPolygon(t))return this;for(var n=t.getIntersectionsWithLine(this.point1,this.direction),o=this.point1,r=this.point2,i=0,s=n;i0?o=a.point:r=a.point)}return new e(o,r)},e.prototype.isContainedByConvexPolygon=function(t){return t.containsPoint(this.point1)&&t.containsPoint(this.point2)},e.prototype.contains=function(t){return t.isContainedByLineSegment(this)},e.prototype.pointIsStrictlyBetweenPoints=function(t,e,n){return t.minus(e).dot(this.direction)*t.minus(n).dot(this.direction)<0},e.prototype.containsPoint=function(t){return this.pointIsOnSameLine(t)&&this.pointIsBetweenPoints(t,this.point1,this.point2)},e.prototype.interiorContainsPoint=function(t){return this.pointIsOnSameLine(t)&&this.pointIsStrictlyBetweenPoints(t,this.point1,this.point2)},e.prototype.intersectsRay=function(t){return t.intersectsLineSegment(this)},e.prototype.intersectsLineSegment=function(t){if(this.isContainedByLineSegment(t)||t.isContainedByLineSegment(this))return!0;if(!this.lineSegmentIsOnSameLine(t))return!1;var e=this.getPointsInSameDirection(t.point1,t.point2),n=e.point1,o=e.point2;return!this.comesBefore(o,this.point1)&&!this.comesBefore(this.point2,n)},e.prototype.intersectsLine=function(t){return t.intersectsSubsetOfLine(this)},e.prototype.intersects=function(t){return t.intersectsLineSegment(this)},e.prototype.expandToIncludePoint=function(t){return this.containsPoint(t)?this:this.pointIsOnSameLine(t)?this.comesBefore(t,this.point1)?new e(t,this.point2):new e(this.point1,t):W.createTriangle(this.point1,t,this.point2)},e.prototype.expandToIncludeInfinityInDirection=function(t){return t.inSameDirectionAs(this.direction)?new Rt(this.point1,t):0===t.cross(this.direction)?new Rt(this.point2,t):W.createTriangleWithInfinityInDirection(this.point1,this.point2,t)},e.prototype.transform=function(t){return new e(t.apply(this.point1),t.apply(this.point2))},e}(Dt),Vt=new(function(){function t(){}return t.prototype.addPoint=function(t){return F},t.prototype.addPointAtInfinity=function(t){return this},t.prototype.addArea=function(t){return F},t}()),Mt=function(){function t(t){this.towardsMiddle=t}return t.prototype.addPoint=function(t){return W.createFromHalfPlane(new E(t,this.towardsMiddle))},t.prototype.addPointAtInfinity=function(t){return t.dot(this.towardsMiddle)>=0?this:Vt},t.prototype.addArea=function(t){var e=this.towardsMiddle.getPerpendicular();return t.expandToIncludeInfinityInDirection(this.towardsMiddle).expandToIncludeInfinityInDirection(e).expandToIncludeInfinityInDirection(e.scale(-1))},t}(),Ht=function(){function t(t,e){this.direction1=t,this.direction2=e}return t.prototype.addPoint=function(t){return W.createTriangleWithInfinityInTwoDirections(t,this.direction1,this.direction2)},t.prototype.addPointAtInfinity=function(e){return e.isInSmallerAngleBetweenPoints(this.direction1,this.direction2)?this:0===e.cross(this.direction1)?new Mt(this.direction2.projectOn(this.direction1.getPerpendicular())):0===e.cross(this.direction2)?new Mt(this.direction1.projectOn(this.direction2.getPerpendicular())):this.direction1.isInSmallerAngleBetweenPoints(e,this.direction2)?new t(e,this.direction2):this.direction2.isInSmallerAngleBetweenPoints(e,this.direction1)?new t(e,this.direction1):Vt},t.prototype.addArea=function(t){return t.expandToIncludeInfinityInDirection(this.direction1).expandToIncludeInfinityInDirection(this.direction2)},t}(),qt=function(){function t(t){this.direction=t}return t.prototype.addPoint=function(t){return new Ft(t,this.direction)},t.prototype.addPointAtInfinity=function(t){return 0===t.cross(this.direction)?this:new Mt(t.projectOn(this.direction.getPerpendicular()))},t.prototype.addArea=function(t){return t.expandToIncludeInfinityInDirection(this.direction).expandToIncludeInfinityInDirection(this.direction.scale(-1))},t}(),Gt=function(){function t(t){this.direction=t}return t.prototype.addPointAtInfinity=function(t){return t.inSameDirectionAs(this.direction)?this:0===t.cross(this.direction)?new qt(this.direction):new Ht(this.direction,t)},t.prototype.addPoint=function(t){return new Rt(t,this.direction)},t.prototype.addArea=function(t){return t.expandToIncludeInfinityInDirection(this.direction)},t}(),Xt=function(){function t(t,e,n){this._area=t,this.firstPoint=e,this.subsetOfLineAtInfinity=n}return Object.defineProperty(t.prototype,"area",{get:function(){return this._area||Lt},enumerable:!1,configurable:!0}),t.prototype.addPoint=function(t){this._area?this._area=this._area.expandToIncludePoint(t):this.firstPoint?t.equals(this.firstPoint)||(this._area=new Nt(this.firstPoint,t)):this.subsetOfLineAtInfinity?this._area=this.subsetOfLineAtInfinity.addPoint(t):this.firstPoint=t},t.prototype.addPosition=function(t){rt(t)?this.addInfinityInDirection(t.direction):this.addPoint(t)},t.prototype.addInfinityInDirection=function(t){this._area?this._area=this._area.expandToIncludeInfinityInDirection(t):this.firstPoint?this._area=new Rt(this.firstPoint,t):this.subsetOfLineAtInfinity?(this.subsetOfLineAtInfinity=this.subsetOfLineAtInfinity.addPointAtInfinity(t),this.subsetOfLineAtInfinity===Vt&&(this._area=F)):this.subsetOfLineAtInfinity=new Gt(t)},t.prototype.transformedWith=function(t){return new Bt(this,t)},t.prototype.copy=function(){return new t(this._area,this.firstPoint,this.subsetOfLineAtInfinity)},t}(),Yt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ut=function(t){function e(e,n,o,r,i,s){var a=t.call(this,e,o,s)||this;return a.infinity=n,a.instruction=r,a.stateConversion=i,a}return Yt(e,t),e.prototype.executeInstruction=function(t,e){this.instruction(t,e,this.infinity)},e.prototype.replaceInstruction=function(t){this.instruction=t},e.prototype.copy=function(t){return new e(this.initialState,t.getInfinity(this.state),this.state,this.instruction,this.stateConversion,this.rectangle)},e.create=function(t,n,o,r){return new e(t,n,t,o,(function(){}),r)},e}(Ct),zt=function(){function t(t){this.shape=t}return t.prototype.getInstructionToDrawLineTo=function(t,e){return this.getInstructionToExtendShapeWithLineTo(this.shape.transform(e.current.transformation.inverse()),t)},t.prototype.getInstructionToMoveToBeginning=function(t){return this.getInstructionToMoveToBeginningOfShape(this.shape.transform(t.current.transformation.inverse()))},Object.defineProperty(t.prototype,"currentPosition",{get:function(){return this.shape.currentPosition},enumerable:!1,configurable:!0}),t.prototype.moveToInfinityFromPointInDirection=function(t,e){return function(n,o,r){r.moveToInfinityFromPointInDirection(n,o,t,e)}},t.prototype.lineFromInfinityFromPointToInfinityFromPoint=function(t,e,n){return function(o,r,i){i.drawLineFromInfinityFromPointToInfinityFromPoint(o,r,t,e,n)}},t.prototype.lineFromInfinityFromPointToPoint=function(t,e){return function(n,o,r){r.drawLineFromInfinityFromPointToPoint(n,o,t,e)}},t.prototype.lineToInfinityFromPointInDirection=function(t,e){return function(n,o,r){r.drawLineToInfinityFromPointInDirection(n,o,t,e)}},t.prototype.lineToInfinityFromInfinityFromPoint=function(t,e,n){return function(o,r,i){i.drawLineToInfinityFromInfinityFromPoint(o,r,t,e,n)}},t.prototype.lineTo=function(t){return function(e,n){var o=n.apply(t),r=o.x,i=o.y;e.lineTo(r,i)}},t.prototype.moveTo=function(t){return function(e,n){var o=n.apply(t),r=o.x,i=o.y;e.moveTo(r,i)}},t}(),Kt=function(){function t(t,e,n,o){this.initialPosition=t,this.firstFinitePoint=e,this.lastFinitePoint=n,this.currentPosition=o}return t.prototype.transform=function(e){return new t(e.applyToPointAtInfinity(this.initialPosition),e.apply(this.firstFinitePoint),e.apply(this.lastFinitePoint),e.applyToPointAtInfinity(this.currentPosition))},t}(),Zt=function(){function t(t,e,n){this.initialPosition=t,this.firstFinitePoint=e,this.currentPosition=n}return t.prototype.transform=function(e){return new t(e.applyToPointAtInfinity(this.initialPosition),e.apply(this.firstFinitePoint),e.apply(this.currentPosition))},t}();function Jt(){for(var t=[],e=0;e0||t>0&&e<0)}function be(t,e,n,o){return me(t,n)&&me(e,o)}var Pe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),we=function(t){function e(e,n,o){var r=t.call(this,e)||this;return r._initiallyWithState=e,r.rectangle=n,r.pathInfinityProvider=o,r.areaBuilder=new Xt,r}return Pe(e,t),Object.defineProperty(e.prototype,"area",{get:function(){return this.areaBuilder.area},enumerable:!1,configurable:!0}),e.prototype.getCurrentlyDrawableArea=function(){if(this.area)return this.state.current.clippingRegion?this.state.current.clippingRegion.intersectWith(this.area):this.area},e.prototype.containsFinitePoint=function(){for(var t=0,e=this.added;t0?ye:de,r)):(this.lineTo(n>0?ge:ve,r),Number.isFinite(o)?this.lineTo(new s(t,e+o),r):this.lineTo(o>0?ye:de,r)),this.lineTo(new s(t,e),r)):(Number.isFinite(n)?this.lineTo(new s(t+n,0),r):this.lineTo(n>0?ge:ve,r),this.lineTo(o>0?ye:de,r),this.lineTo(new s(t,0),r),this.lineTo(e<0?de:ye,r)):(this.lineTo(new s(0,e),r),this.lineTo(n>0?ge:ve,r),Number.isFinite(o)?this.lineTo(new s(0,e+o),r):this.lineTo(o>0?ye:de,r),this.lineTo(t<0?ve:ge,r)),this.closePath(),this.moveToPositionDeterminedBy(t,e,r))},e.prototype.addPathInstruction=function(t,e){if(0===this.added.length){if(!t.initialPoint)return;this.moveTo(t.initialPoint,e)}var n=this.added[this.added.length-1],o=At(n.currentPosition,e.current.transformation.inverse());t.changeArea(this.areaBuilder.transformedWith(e.current.transformation),o);var r=Tt.create(e,t.instruction,this.rectangle);n.addPathInstruction(t,r,e)},e.prototype.hasDrawingAcrossBorderOf=function(t){return!t.contains(this.area)&&this.area.intersects(t)},e.prototype.isContainedBy=function(t){return t.contains(this.drawnArea)},e.prototype.intersects=function(t){return!!this.area&&this.area.intersects(t)},e.prototype.getClippedArea=function(t){return t?this.area.intersectWith(t):this.area},e.prototype.recreatePath=function(){for(var t=this.rectangle.getForPath(),n=new e(this._initiallyWithState.copy(),this.rectangle,t),o=0,r=this.added;o0||t>0&&e<0)}function Te(t,e,n,o){return Ie(t,n)&&Ie(e,o)}var Se,_e=function(){function t(t,e){this.onChange=t,this.rectangle=e,this.previousInstructionsWithPath=jt.create(e),this.state=this.previousInstructionsWithPath.state}return t.prototype.beginPath=function(){this.replaceCurrentInstructionsWithPath(we.create(this.state,this.rectangle,this.rectangle.getForPath()))},t.prototype.changeState=function(t){this.state=this.state.withCurrentState(t(this.state.current))},t.prototype.saveState=function(){this.state=this.state.saved(),this.setInstructionToRestoreState()},t.prototype.restoreState=function(){this.state=this.state.restored(),this.setInstructionToRestoreState()},t.prototype.allSubpathsAreClosable=function(){return!this.currentInstructionsWithPath||this.currentInstructionsWithPath.allSubpathsAreClosable()},t.prototype.currentPathContainsFinitePoint=function(){return this.currentInstructionsWithPath&&this.currentInstructionsWithPath.containsFinitePoint()},t.prototype.currentSubpathIsClosable=function(){return!this.currentInstructionsWithPath||this.currentInstructionsWithPath.currentSubpathIsClosable()},t.prototype.fillPath=function(t){this.drawPath(t,(function(t,e,n){t.fillPath(e,n)}))},t.prototype.strokePath=function(){this.drawPath((function(t){t.stroke()}),(function(t,e,n){t.strokePath(e,n)}))},t.prototype.fillRect=function(t,e,n,o,r){this.drawRect(t,e,n,o,r,(function(t,e,n){t.fillPath(e,n)}))},t.prototype.strokeRect=function(t,e,n,o){this.drawRect(t,e,n,o,(function(t){t.stroke()}),(function(t,e,n){t.strokePath(e,n)}))},t.prototype.drawPath=function(t,e){if(this.currentInstructionsWithPath){var n=this.state.current.isTransformable();n||(t=this.rectangle.transformRelatively(t)),this.state=this.state.currentlyTransformed(n);var o=this.currentInstructionsWithPath.recreatePath();e(this.currentInstructionsWithPath,t,this.state),this.previousInstructionsWithPath.add(this.currentInstructionsWithPath),o.setInitialStateWithClippedPaths(this.previousInstructionsWithPath.state),this.currentInstructionsWithPath=o,this.setInstructionToRestoreState(),this.onChange()}},t.prototype.drawRect=function(t,e,n,o,r,i){this.state.current.isTransformable()||(r=this.rectangle.transformRelatively(r));var s=this.state.currentlyTransformed(this.state.current.isTransformable()),a=we.create(s,this.rectangle,this.rectangle.getForPath());a.rect(t,e,n,o,s),i(a,r,s),this.drawBeforeCurrentPath(a),this.onChange()},t.prototype.addDrawing=function(t,e,n,o){n===r.Relative?(t=this.rectangle.transformRelatively(t),e=e.transform(this.state.current.transformation)):n===r.Absolute&&(t=this.rectangle.transformAbsolutely(t));var i=e;this.state.current.clippingRegion&&o&&(i=e.intersectWith(this.state.current.clippingRegion));var s=Ce.createDrawing(this.state.currentlyTransformed(!1),t,i,this.rectangle);this.drawBeforeCurrentPath(s),this.onChange()},t.prototype.clipPath=function(t){this.clipCurrentPath(t)},t.prototype.replaceCurrentInstructionsWithPath=function(t){for(var e=[],n=1;n0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]0?ge.direction:ve.direction).x,d=Number.isFinite(r)?n+r:a.getPointInFrontInDirection(new s(0,0),r>0?ge.direction:ve.direction).x,v=Number.isFinite(o)?o:a.getPointInFrontInDirection(new s(0,0),o>0?ye.direction:de.direction).y,g=Number.isFinite(i)?o+i:a.getPointInFrontInDirection(new s(0,0),i>0?ye.direction:de.direction).y;t.clearRect(y,v,d-y,g-v),t.restore()},t.prototype.moveToInfinityFromPointInDirection=function(t,e,n,o){var r=this.getTransformedViewbox().getPointInFrontInDirection(n,o);this.moveToTransformed(t,r,e)},t.prototype.drawLineToInfinityFromInfinityFromPoint=function(t,e,n,o,r){var i=this.getTransformedViewbox(),s=i.getPointInFrontInDirection(n,o),a=i.getPointInFrontInDirection(n,r),c=i.expandToIncludePoint(n).expandToIncludePoint(s).expandToIncludePoint(a).vertices.map((function(t){return t.point})).filter((function(t){return!t.equals(s)&&!t.equals(a)&&!t.equals(n)&&t.minus(n).isInSmallerAngleBetweenPoints(o,r)}));c.sort((function(t,e){return t.minus(n).isInSmallerAngleBetweenPoints(e.minus(n),o)?-1:1}));for(var u=s,p=0,f=0,l=c;f-1&&(this.listeners.splice(e,1),0===this.listeners.length&&(this.observer.disconnect(),this.observer=void 0))},t}();function mn(t){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e,f:t.f}}var bn=function(){return bn=Object.assign||function(t){for(var e,n=1,o=arguments.length;n-1&&this.anchors.splice(e,1)},t}(),Mo=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ho=function(t){function e(e,n,o,r,i,s){var a=t.call(this,e,n,o,r)||this;return a.deltaX=i,a.deltaY=s,a}return Mo(e,t),e.prototype.toInfiniteCanvasCoordinates=function(n){var o=t.prototype.toInfiniteCanvasCoordinates.call(this,n),r=o.offsetX,i=o.offsetY,a=o.movementX,c=o.movementY,u=n.inverseInfiniteCanvasContextBase.untranslated().apply(new s(this.deltaX,this.deltaY));return new e(r,i,a,c,u.x,u.y)},e.create=function(n){var o=t.create.call(this,n);return new e(o.offsetX,o.offsetY,o.movementX,o.movementY,n.deltaX,n.deltaY)},e}(Oo),qo=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Go=function(t){function e(e,n,o,r){var i=t.call(this,e,n,o,r)||this;return i.deltaX=r.deltaX,i.deltaY=r.deltaY,i}return qo(e,t),Object.defineProperty(e.prototype,"deltaMode",{get:function(){return this.event.deltaMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deltaZ",{get:function(){return this.event.deltaZ},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"DOM_DELTA_LINE",{get:function(){return this.event.DOM_DELTA_LINE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"DOM_DELTA_PAGE",{get:function(){return this.event.DOM_DELTA_PAGE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"DOM_DELTA_PIXEL",{get:function(){return this.event.DOM_DELTA_PIXEL},enumerable:!1,configurable:!0}),e}(xo),Xo=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Yo=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.props=Ho.create(e),o}return Xo(e,t),e.prototype.createResultEvent=function(t){return new Go(this,this.preventableDefault,this.event,this.props.toInfiniteCanvasCoordinates(t))},e}(wo);function Uo(t,e){for(var n=[],o=0;o{var{InfiniteCanvas:o}=n(306);t.exports=o}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,n),i.exports}return n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(225)})())); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.InfiniteCanvas=e():t.InfiniteCanvas=e()}(this,(()=>(()=>{var t={582:(t,e,n)=>{"use strict";n.r(e),n.d(e,{InfiniteCanvas:()=>Jr});var o=function(){function t(t){this.viewBox=t}return t.prototype.restore=function(){this.viewBox.restoreState()},t.prototype.save=function(){this.viewBox.saveState()},t}(),r=function(){function t(t,e){this.x=t,this.y=e}return t.prototype.mod=function(){return Math.sqrt(this.modSq())},t.prototype.modSq=function(){return this.x*this.x+this.y*this.y},t.prototype.minus=function(e){return new t(this.x-e.x,this.y-e.y)},t.prototype.plus=function(e){return new t(this.x+e.x,this.y+e.y)},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.cross=function(t){return this.x*t.y-this.y*t.x},t.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},t.prototype.getPerpendicular=function(){return new t(-this.y,this.x)},t.prototype.scale=function(e){return new t(e*this.x,e*this.y)},t.prototype.projectOn=function(t){return t.scale(this.dot(t)/t.modSq())},t.prototype.matrix=function(e,n,o,r){return new t(e*this.x+n*this.y,o*this.x+r*this.y)},t.prototype.inSameDirectionAs=function(t){return 0===this.cross(t)&&this.dot(t)>=0},t.prototype.isInOppositeDirectionAs=function(t){return 0===this.cross(t)&&this.dot(t)<0},t.prototype.isOnSameSideOfOriginAs=function(t,e){return this.isInSmallerAngleBetweenPoints(t,e)||t.isInSmallerAngleBetweenPoints(this,e)||e.isInSmallerAngleBetweenPoints(this,t)},t.prototype.isInSmallerAngleBetweenPoints=function(t,e){var n=t.cross(e);return n>0?t.cross(this)>=0&&this.cross(e)>=0:n<0?t.cross(this)<=0&&this.cross(e)<=0:!(t.dot(e)>0)||0===this.cross(t)&&this.dot(t)>0},t.origin=new t(0,0),t}();function i(t){return t.toFixed(10).replace(/\.?0+$/,"")}var a,s=function(){function t(t,e,n,o,r,i){this.a=t,this.b=e,this.c=n,this.d=o,this.e=r,this.f=i,this.scale=Math.sqrt(t*o-e*n)}return t.prototype.getMaximumLineWidthScale=function(){var t=this.a+this.c,e=this.b+this.d,n=this.a-this.c,o=this.b-this.d;return Math.sqrt(Math.max(t*t+e*e,n*n+o*o))},t.prototype.getRotationAngle=function(){var t=this.a/this.scale,e=this.b/this.scale;if(0===t)return e>0?Math.PI/2:3*Math.PI/2;var n=Math.atan(e/t);return t>0?e>0?n:0===e?0:2*Math.PI+n:e>0?Math.PI+n:0===e?Math.PI:Math.PI+n},t.prototype.applyToPointAtInfinity=function(t){return{direction:this.untranslated().apply(t.direction)}},t.prototype.apply=function(t){return new r(this.a*t.x+this.c*t.y+this.e,this.b*t.x+this.d*t.y+this.f)},t.prototype.untranslated=function(){var e=this.apply(r.origin),n=e.x,o=e.y;return this.before(t.translation(-n,-o))},t.prototype.before=function(e){return new t(e.a*this.a+e.c*this.b,e.b*this.a+e.d*this.b,e.a*this.c+e.c*this.d,e.b*this.c+e.d*this.d,e.a*this.e+e.c*this.f+e.e,e.b*this.e+e.d*this.f+e.f)},t.prototype.equals=function(t){return this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d&&this.e===t.e&&this.f===t.f},t.prototype.inverse=function(){var e=this.a*this.d-this.b*this.c;if(0==e)throw"error calculating inverse: zero determinant";return new t(this.d/e,-this.b/e,-this.c/e,this.a/e,(this.c*this.f-this.d*this.e)/e,(this.b*this.e-this.a*this.f)/e)},t.translation=function(e,n){return new t(1,0,0,1,e,n)},t.scale=function(e){return new t(e,0,0,e,0,0)},t.zoom=function(e,n,o,r,i){var a=1-o;return void 0!==r?new t(o,0,0,o,e*a+r,n*a+i):new t(o,0,0,o,e*a,n*a)},t.translateZoom=function(e,n,o,r,i,a,s,c){var u=o-e,p=r-n,f=u*u+p*p;if(0===f)throw new Error("divide by 0");var l=s-i,h=c-a,y=l*l+h*h,d=Math.sqrt(y/f);return t.zoom(e,n,d,i-e,a-n)},t.rotation=function(e,n,o){var r=Math.cos(o),i=Math.sin(o),a=1-r;return new t(r,i,-i,r,e*a+n*i,-e*i+n*a)},t.translateRotateZoom=function(e,n,o,r,i,a,s,c){var u=o-e,p=r-n,f=u*u+p*p;if(0===f)throw new Error("divide by 0");var l=s-i,h=c-a,y=e*r-n*o,d=o*u+r*p,v=e*u+n*p,g=(u*l+p*h)/f,m=(u*h-p*l)/f;return new t(g,m,-m,g,(i*d-s*v-y*h)/f,(a*d-c*v+y*l)/f)},t.create=function(e){return e instanceof t?e:new t(e.a,e.b,e.c,e.d,e.e,e.f)},t.prototype.toString=function(){return"x: (".concat(i(this.a),", ").concat(i(this.b),"), y: (").concat(i(this.c),", ").concat(i(this.d),"), d: (").concat(i(this.e),", ").concat(i(this.f),")")},t.identity=new t(1,0,0,1,0,0),t}(),c=function(){function t(t){this.propertyName=t}return t.prototype.changeInstanceValue=function(t,e){return this.valuesAreEqual(t[this.propertyName],e)?t:t.changeProperty(this.propertyName,e)},t.prototype.isEqualForInstances=function(t,e){return this.valuesAreEqual(t[this.propertyName],e[this.propertyName])},t.prototype.getInstructionToChange=function(t,e,n){return this.valuesAreEqual(t[this.propertyName],e[this.propertyName])?function(){}:this.changeToNewValue(e[this.propertyName],n)},t.prototype.valueIsTransformableForInstance=function(t){return!0},t}(),u=(a=function(t,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},a(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),p=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return u(e,t),e.prototype.valuesAreEqual=function(t,e){return t.equals(e)},e.prototype.changeToNewValue=function(t,e){return function(n){var o=e.getTransformationForInstruction(t),r=o.a,i=o.b,a=o.c,s=o.d,c=o.e,u=o.f;n.setTransform(r,i,a,s,c,u)}},e}(c))("transformation"),f=function(){function t(t){this.viewBox=t}return t.prototype.getTransform=function(){if(DOMMatrix){var t=this.viewBox.state.current.transformation;return new DOMMatrix([t.a,t.b,t.c,t.d,t.e,t.f])}},t.prototype.resetTransform=function(){this.viewBox.changeState((function(t){return p.changeInstanceValue(t,s.identity)}))},t.prototype.rotate=function(t){this.addTransformation(s.rotation(0,0,t))},t.prototype.scale=function(t,e){this.addTransformation(new s(t,0,0,e,0,0))},t.prototype.setTransform=function(t,e,n,o,r,i){var a,c,u,f,l,h;"number"==typeof t?(a=t,c=e,u=n,f=o,l=r,h=i):void 0!==t.a?(a=t.a,c=t.b,u=t.c,f=t.d,l=t.e,h=t.f):(a=t.m11,c=t.m12,u=t.m21,f=t.m22,l=t.m41,h=t.m42),this.viewBox.changeState((function(t){return p.changeInstanceValue(t,new s(a,c,u,f,l,h))}))},t.prototype.transform=function(t,e,n,o,r,i){this.addTransformation(new s(t,e,n,o,r,i))},t.prototype.translate=function(t,e){this.addTransformation(s.translation(t,e))},t.prototype.addTransformation=function(t){var e=this.viewBox.state.current.transformation,n=t.before(e);this.viewBox.changeState((function(t){return p.changeInstanceValue(t,n)}))},t}(),l=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),h=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e.prototype.valuesAreEqual=function(t,e){return t===e},e.prototype.changeToNewValue=function(t,e){return function(e){return e.globalAlpha=t}},e}(c))("globalAlpha"),y=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),d=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return y(e,t),e.prototype.valuesAreEqual=function(t,e){return t===e},e.prototype.changeToNewValue=function(t,e){return function(e){return e.globalCompositeOperation=t}},e}(c))("globalCompositeOperation"),v=function(){function t(t){this.viewBox=t}return Object.defineProperty(t.prototype,"globalAlpha",{get:function(){return this.viewBox.state.current.globalAlpha},set:function(t){this.viewBox.changeState((function(e){return h.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"globalCompositeOperation",{get:function(){return this.viewBox.state.current.globalCompositeOperation},set:function(t){this.viewBox.changeState((function(e){return d.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),t}(),g=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),m=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return g(e,t),e.prototype.valuesAreEqual=function(t,e){return t===e},e.prototype.changeToNewValue=function(t,e){return function(e){e.imageSmoothingEnabled=t}},e}(c))("imageSmoothingEnabled"),b=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),P=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b(e,t),e.prototype.valuesAreEqual=function(t,e){return t===e},e.prototype.changeToNewValue=function(t){return function(e){e.imageSmoothingQuality=t}},e}(c))("imageSmoothingQuality"),w=function(){function t(t){this.viewBox=t}return Object.defineProperty(t.prototype,"imageSmoothingEnabled",{get:function(){return this.viewBox.state.current.imageSmoothingEnabled},set:function(t){this.viewBox.changeState((function(e){return m.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"imageSmoothingQuality",{get:function(){return this.viewBox.state.current.imageSmoothingQuality},set:function(t){this.viewBox.changeState((function(e){return P.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),t}(),O=function(){},C=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),T=function(t){function e(e){var n=t.call(this)||this;return n.fillStrokeStyle=e,n}return C(e,t),e.prototype.setTransform=function(t){this.fillStrokeStyle.setTransform(t)},e.prototype.getInstructionToSetUntransformed=function(t){var e=this;return function(n){n[t]=e.fillStrokeStyle}},e.prototype.getInstructionToSetTransformed=function(t){var e=this;return function(n){n[t]=e.fillStrokeStyle}},e}(O),I=function(){function t(t){this.propName=t}return t.prototype.changeInstanceValue=function(t,e){return t.changeProperty(this.propName,e)},t.prototype.isEqualForInstances=function(t,e){return t[this.propName]===e[this.propName]},t.prototype.getInstructionToChange=function(t,e){var n=this,o=e[this.propName];return this.isEqualForInstances(t,e)?o instanceof O&&t.fillAndStrokeStylesTransformed!==e.fillAndStrokeStylesTransformed?e.fillAndStrokeStylesTransformed?o.getInstructionToSetTransformed(this.propName):o.getInstructionToSetUntransformed(this.propName):function(){}:o instanceof O?e.fillAndStrokeStylesTransformed?o.getInstructionToSetTransformed(this.propName):o.getInstructionToSetUntransformed(this.propName):function(t){t[n.propName]=e[n.propName]}},t.prototype.valueIsTransformableForInstance=function(t){return!(t[this.propName]instanceof T)},t}(),S=new I("fillStyle"),x=new I("strokeStyle"),_=function(){function t(t){this.viewBox=t}return Object.defineProperty(t.prototype,"fillStyle",{set:function(t){this.viewBox.changeState((function(e){return S.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeStyle",{set:function(t){this.viewBox.changeState((function(e){return x.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),t.prototype.createLinearGradient=function(t,e,n,o){return this.viewBox.createLinearGradient(t,e,n,o)},t.prototype.createPattern=function(t,e){return this.viewBox.createPattern(t,e)},t.prototype.createRadialGradient=function(t,e,n,o,r,i){return this.viewBox.createRadialGradient(t,e,n,o,r,i)},t.prototype.createConicGradient=function(t,e,n){return this.viewBox.createConicGradient(t,e,n)},t}(),j=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),B=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return j(e,t),e.prototype.valuesAreEqual=function(t,e){return t===e},e.prototype.changeToNewValue=function(t){return function(e){e.shadowColor=t}},e}(c))("shadowColor"),A=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),E=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return A(e,t),e.prototype.changeToNewValue=function(t,e){return function(n){var o=s.translation(t.x,t.y),i=e.translateInfiniteCanvasContextTransformationToBitmapTransformation(o).apply(r.origin),a=i.x,c=i.y;n.shadowOffsetX=a,n.shadowOffsetY=c}},e.prototype.valuesAreEqual=function(t,e){return t.x===e.x&&t.y==e.y},e}(c))("shadowOffset"),L=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),D=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.changeToNewValue=function(t,e){return function(n){var o=s.translation(t,0),i=e.translateInfiniteCanvasContextTransformationToBitmapTransformation(o).apply(r.origin).mod();n.shadowBlur=i}},e.prototype.valuesAreEqual=function(t,e){return t===e},e}(c))("shadowBlur"),F=function(){function t(t){this.viewBox=t}return Object.defineProperty(t.prototype,"shadowBlur",{get:function(){return this.viewBox.state.current.shadowBlur},set:function(t){this.viewBox.changeState((function(e){return D.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetX",{get:function(){return this.viewBox.state.current.shadowOffset.x},set:function(t){var e=new r(t,this.viewBox.state.current.shadowOffset.y);this.viewBox.changeState((function(t){return E.changeInstanceValue(t,e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetY",{get:function(){return this.viewBox.state.current.shadowOffset.y},set:function(t){var e=new r(this.viewBox.state.current.shadowOffset.x,t);this.viewBox.changeState((function(t){return E.changeInstanceValue(t,e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowColor",{get:function(){return this.viewBox.state.current.shadowColor},set:function(t){this.viewBox.changeState((function(e){return B.changeInstanceValue(e,t)}))},enumerable:!1,configurable:!0}),t}(),W="[+-]?(?:\\d*\\.)?\\d+(?:e[+-]?\\d+)?",k="[+-]?(?:0*\\.)?0+(?:e[+-]?\\d+)?",R="(?:ch|em|ex|ic|rem|vh|vw|vmax|vmin|vb|vi|cqw|cqh|cqi|cqb|cqmin|cqmax|px|cm|mm|Q|in|pc|pt)",N="(?:".concat(k,"|").concat(W).concat(R,")"),V="blur\\((".concat(N,")\\)"),M="[^())\\s]+(?:\\([^)]*?\\))?",q="drop-shadow\\((".concat(N,")\\s+(").concat(N,")\\s*?(?:(?:(").concat(N,")\\s*?(").concat(M,")?)|(").concat(M,"))?\\)"),H="".concat(V,"|").concat(q);function G(t,e){var n=t.match(new RegExp("(?:(".concat(k,")|(").concat(W,")(").concat(R,"))")));return n[1]?0:e.getNumberOfPixels(Number.parseFloat(n[2]),n[3])}var X,Y=function(){function t(t){this.stringRepresentation=t}return t.prototype.toTransformedString=function(){return this.stringRepresentation},t.prototype.getShadowOffset=function(){return null},t}(),z=function(){function t(t,e){this.stringRepresentation=t,this.size=e}return t.prototype.toTransformedString=function(t){var e=t.translateInfiniteCanvasContextTransformationToBitmapTransformation(s.translation(this.size,0)).apply(r.origin).mod();return"blur(".concat(e,"px)")},t.prototype.getShadowOffset=function(){return null},t.tryCreate=function(e,n){var o=e.match(new RegExp(V));return null===o?null:new t(e,G(o[1],n))},t}(),U=function(){function t(t,e,n,o,r){this.stringRepresentation=t,this.offsetX=e,this.offsetY=n,this.blurRadius=o,this.color=r}return t.prototype.toTransformedString=function(t){var e=t.translateInfiniteCanvasContextTransformationToBitmapTransformation(s.translation(this.offsetX,this.offsetY)).apply(r.origin),n=e.x,o=e.y;if(null!==this.blurRadius){var i=t.translateInfiniteCanvasContextTransformationToBitmapTransformation(s.translation(this.blurRadius,0)).apply(r.origin).mod();return this.color?"drop-shadow(".concat(n,"px ").concat(o,"px ").concat(i,"px ").concat(this.color,")"):"drop-shadow(".concat(n,"px ").concat(o,"px ").concat(i,"px)")}return this.color?"drop-shadow(".concat(n,"px ").concat(o,"px ").concat(this.color,")"):"drop-shadow(".concat(n,"px ").concat(o,"px)")},t.prototype.getShadowOffset=function(){return new r(this.offsetX,this.offsetY)},t.tryCreate=function(e,n){var o=e.match(new RegExp(q));return null===o?null:o[5]?new t(e,G(o[1],n),G(o[2],n),null,o[5]):o[4]?new t(e,G(o[1],n),G(o[2],n),G(o[3],n),o[4]):o[3]?new t(e,G(o[1],n),G(o[2],n),G(o[3],n),null):new t(e,G(o[1],n),G(o[2],n),null,null)},t}(),K=function(){function t(t,e){this.stringRepresentation=t,this.parts=e}return t.prototype.toString=function(){return this.parts.map((function(t){return t.stringRepresentation})).join(" ")},t.prototype.toTransformedString=function(t){return this.parts.map((function(e){return e.toTransformedString(t)})).join(" ")},t.prototype.getShadowOffset=function(){for(var t=0,e=this.parts;t=0},t.prototype.interiorContainsPoint=function(t){return this.getDistanceFromEdge(t)>0},t.prototype.containsInfinityInDirection=function(t){return t.dot(this.normalTowardInterior)>=0},t.prototype.isContainedByHalfPlane=function(t){return this.normalTowardInterior.inSameDirectionAs(t.normalTowardInterior)&&t.getDistanceFromEdge(this.base)>=0},t.prototype.intersectWithLine=function(t,e){return{point:(n=this.base,o=this.normalTowardInterior.getPerpendicular(),r=t,i=e,a=r.minus(n),s=i.cross(o),c=i.getPerpendicular().dot(a)/s,n.plus(o.scale(c))),halfPlane:this};var n,o,r,i,a,s,c},t.prototype.isParallelToLine=function(t,e){return 0===this.normalTowardInterior.getPerpendicular().cross(e)},t.prototype.getIntersectionWith=function(t){var e=this.intersectWithLine(t.base,t.normalTowardInterior.getPerpendicular());return new nt(e.point,this,t)},t.throughPointsAndContainingPoint=function(e,n,o){for(var r=0,i=t.withBorderPoints(e,n);r1)return!1}return!0},t.prototype.getTangentPlanesThroughInfinityInDirection=function(t){for(var e=[],n=0,o=this.vertices;n0?1:-1,0))),Number.isFinite(o)&&a.push(new ot(new r(e+o,0),new r(o>0?-1:1,0)))),Number.isFinite(n)&&(a.push(new ot(new r(0,n),new r(0,i>0?1:-1))),Number.isFinite(i)&&a.push(new ot(new r(0,n+i),new r(0,i>0?-1:1)))),new t(a)},t}(),at=function(){function t(t){this.viewBox=t}return t.prototype.fillText=function(t,e,n,o){var r=void 0===o?function(o){o.fillText(t,e,n)}:function(r){r.fillText(t,e,n,o)};this.viewBox.addDrawing(r,this.getDrawnRectangle(e,n,t),X.Relative,!0)},t.prototype.measureText=function(t){return this.viewBox.measureText(t)},t.prototype.strokeText=function(t,e,n,o){var r=void 0===o?function(o){o.strokeText(t,e,n)}:function(r){r.strokeText(t,e,n,o)};this.viewBox.addDrawing(r,this.getDrawnRectangle(e,n,t),X.Relative,!0)},t.prototype.getDrawnRectangle=function(t,e,n){var o,r=this.viewBox.measureText(n);o=void 0!==r.actualBoundingBoxRight?Math.abs(r.actualBoundingBoxRight-r.actualBoundingBoxLeft):r.width;var i=void 0!==r.actualBoundingBoxAscent?r.actualBoundingBoxAscent+r.actualBoundingBoxDescent:1,a=void 0!==r.actualBoundingBoxAscent?r.actualBoundingBoxAscent:0;return it.createRectangle(t,e-a,o,i)},t}(),st=function(){function t(t){this.viewBox=t}return t.prototype.drawImage=function(){var t,e,n,o,r,i,a,s,c,u=Array.prototype.slice.apply(arguments);arguments.length<=5?(t=u[0],i=u[1],a=u[2],s=u[3],c=u[4]):(t=u[0],e=u[1],n=u[2],o=u[3],r=u[4],i=u[5],a=u[6],s=u[7],c=u[8]);var p=this.getDrawnLength(t.width,e,o,s),f=this.getDrawnLength(t.height,n,r,c),l=it.createRectangle(i,a,p,f),h=this.getDrawImageInstruction(arguments.length,t,e,n,o,r,i,a,s,c);this.viewBox.addDrawing(h,l,X.Relative,!0)},t.prototype.getDrawImageInstruction=function(t,e,n,o,r,i,a,s,c,u){switch(t){case 3:return function(t){t.drawImage(e,a,s)};case 5:return function(t){t.drawImage(e,a,s,c,u)};case 9:return function(t){t.drawImage(e,n,o,r,i,a,s,c,u)};default:throw new TypeError("Failed to execute 'drawImage' on 'CanvasRenderingContext2D': Valid arities are: [3, 5, 9], but ".concat(t," arguments provided."))}},t.prototype.getDrawnLength=function(t,e,n,o){var r=this.getLength(t);return void 0!==o?o:void 0!==e?void 0!==n?n:r-e:r},t.prototype.getLength=function(t){return"number"==typeof t?t:t.baseVal.value},t}(),ct=function(){function t(t,e,n){this.area=t,this.latestClippedPath=e,this.previouslyClippedPaths=n}return t.prototype.withClippedPath=function(e){return new t(e.area.intersectWith(this.area),e,this)},Object.defineProperty(t.prototype,"initialState",{get:function(){return this.previouslyClippedPaths?this.previouslyClippedPaths.initialState:this.latestClippedPath.initialState},enumerable:!1,configurable:!0}),t.prototype.except=function(e){if(e!==this)return this.previouslyClippedPaths?new t(this.area,this.latestClippedPath,this.previouslyClippedPaths.except(e)):this},t.prototype.contains=function(t){return!!t&&(this===t||!!this.previouslyClippedPaths&&this.previouslyClippedPaths.contains(t))},t.prototype.getInstructionToRecreate=function(t){var e=this,n=function(t,n){e.latestClippedPath.execute(t,n)};if(this.previouslyClippedPaths){var o=this.previouslyClippedPaths.getInstructionToRecreate(t),r=this.previouslyClippedPaths.latestClippedPath.state.getInstructionToConvertToState(this.latestClippedPath.initialState,t);return function(t,e){o(t,e),r(t,e),n(t,e)}}return n},t}(),ut=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),pt=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ut(e,t),e.prototype.valuesAreEqual=function(t,e){return t===e},e.prototype.changeToNewValue=function(t){return function(e){e.direction=t}},e}(c))("direction"),ft=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),lt=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ft(e,t),e.prototype.valuesAreEqual=function(t,e){return t===e},e.prototype.changeToNewValue=function(t){return function(e){e.font=t}},e}(c))("font"),ht=function(){function t(t){this.propertyName=t}return t.prototype.changeInstanceValue=function(t,e){return this.valuesAreEqual(t[this.propertyName],e)?t:t.changeProperty(this.propertyName,e)},t.prototype.isEqualForInstances=function(t,e){return this.valuesAreEqual(t[this.propertyName],e[this.propertyName])},t.prototype.valueIsTransformableForInstance=function(t){return!0},t.prototype.changeToNewValue=function(t,e){return e?this.changeToNewValueTransformed(t):this.changeToNewValueUntransformed(t)},t.prototype.getInstructionToChange=function(t,e){var n=t[this.propertyName],o=e[this.propertyName];return this.valuesAreEqual(n,o)&&(t.fillAndStrokeStylesTransformed===e.fillAndStrokeStylesTransformed||this.valuesAreEqualWhenTransformed(n,o))?function(){}:this.changeToNewValue(o,e.fillAndStrokeStylesTransformed)},t}(),yt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),dt=function(t){function e(e){return t.call(this,e)||this}return yt(e,t),e.prototype.valuesAreEqual=function(t,e){return t===e},e.prototype.changeToNewValueTransformed=function(t){var e=this;return function(n,o){n[e.propertyName]=t*o.scale}},e.prototype.changeToNewValueUntransformed=function(t){var e=this;return function(n){n[e.propertyName]=t}},e.prototype.valuesAreEqualWhenTransformed=function(t,e){return 0===t&&0===e},e}(ht),vt=new dt("lineWidth"),gt=new dt("lineDashOffset"),mt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),bt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return mt(e,t),e.prototype.valuesAreEqual=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n-1;)this.removeAtIndex(e)},t.prototype.contains=function(t){return!!this.added.find(t)},t.prototype.setInitialState=function(t){this.initiallyWithState.setInitialState(t)},t.prototype.setInitialStateWithClippedPaths=function(t){this.initiallyWithState.setInitialStateWithClippedPaths(t)},t.prototype.beforeIndex=function(t){return 0===t?this.initiallyWithState.state:this.added[t-1].state},t.prototype.removeAtIndex=function(t){t===this.added.length-1?1===this.added.length?this.addedLast=void 0:this.addedLast=this.added[t-1]:this.reconstructState(this.beforeIndex(t),this.added[t+1]),this.added.splice(t,1)},t}(),zt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ut=function(t){function e(e){var n=t.call(this,e)||this;return n._initiallyWithState=e,n}return zt(e,t),e.prototype.execute=function(t,e){this._initiallyWithState.execute(t,e);for(var n=0,o=this.added;n0))return void t.prototype.changeCurrentInstanceTo.call(this,n,o);this.restore(),this.save()}if(n.clippedPaths){var r=this.currentState,i=r.current.clippedPaths;if(n.clippedPaths===i)t.prototype.changeCurrentInstanceTo.call(this,n,o);else{var a=n.clippedPaths.except(i);this.convertToState(a.initialState,o),this.addChangeToState(a.latestClippedPath.state,a.getInstructionToRecreate(o)),this.convertToState(r.replaceCurrent(n),o)}}else t.prototype.changeCurrentInstanceTo.call(this,n,o)}},e.prototype.convertToState=function(t,e){var n=this.currentState.getInstructionToConvertToState(t,e);this.addChangeToState(t,n)},e.canConvert=function(t,e){return!t.clippedPaths||!!e.clippedPaths&&e.clippedPaths.contains(t.clippedPaths)},e}(Kt),Zt=function(){function t(t,e){void 0===e&&(e=[]),this.current=t,this.stack=e}return t.prototype.replaceCurrent=function(e){return new t(e,this.stack)},t.prototype.withCurrentState=function(e){return new t(e,this.stack)},t.prototype.currentlyTransformed=function(t){return this.withCurrentState(this.current.changeProperty("fillAndStrokeStylesTransformed",t))},t.prototype.withClippedPath=function(e){return new t(this.current.withClippedPath(e),this.stack)},t.prototype.saved=function(){return new t(this.current,(this.stack||[]).concat([this.current]))},t.prototype.restored=function(){return this.stack&&0!==this.stack.length?new t(this.stack[this.stack.length-1],this.stack.slice(0,this.stack.length-1)):this},t.prototype.convertToLastSavedInstance=function(t,e){for(var n=this.stack.length-1;n>e;n--)t.restore()},t.prototype.convertFromLastSavedInstance=function(t,e,n){for(var o=e+1;or&&(o=s,r=c)}return o?e.plus(o.minus(e).projectOn(n)):e}(t.getVertices(),e,n)}var fe=function(){function t(t,e,n){this.rectangle=t,this.state=e,this.drawnStroke=n}return t.prototype.addPathAroundViewbox=function(t){this.rectangle.addPathAroundViewbox(t,this.drawnStroke.lineWidth)},t.prototype.getTransformedViewbox=function(){var t=this.state.current.transformation.before(this.rectangle.getBitmapTransformationToInfiniteCanvasContext()),e=this.rectangle.polygon;e=e.transform(t.inverse()).expandByDistance(this.drawnStroke.lineWidth);for(var n=0,o=this.drawnStroke.shadowOffsets;n0?ue.direction:ce.direction).x,d=Number.isFinite(i)?n+i:pe(s,new r(0,0),i>0?ue.direction:ce.direction).x,v=Number.isFinite(o)?o:pe(s,new r(0,0),o>0?ae.direction:se.direction).y,g=Number.isFinite(a)?o+a:pe(s,new r(0,0),a>0?ae.direction:se.direction).y;t.clearRect(y,v,d-y,g-v),t.restore()},t.prototype.moveToInfinityFromPointInDirection=function(t,e,n,o){var r=pe(this.getTransformedViewbox(),n,o);this.moveToTransformed(t,r,e)},t.prototype.drawLineToInfinityFromInfinityFromPoint=function(t,e,n,o,r){var i=this.getTransformedViewbox(),a=pe(i,n,o),s=pe(i,n,r),c=i.expandToIncludePoint(n).expandToIncludePoint(a).expandToIncludePoint(s).getVertices().filter((function(t){return!t.equals(a)&&!t.equals(s)&&!t.equals(n)&&t.minus(n).isInSmallerAngleBetweenPoints(o,r)}));c.sort((function(t,e){return t.minus(n).isInSmallerAngleBetweenPoints(e.minus(n),o)?-1:1}));for(var u=a,p=0,f=0,l=c;f=0},t.prototype.lineSegmentIsOnSameLine=function(t){return 0===this.direction.cross(t.direction)&&this.pointIsOnSameLine(t.point1)},t.prototype.expandLineByDistance=function(t){var e=this.direction.getPerpendicular(),n=new ot(this.base,e).expandByDistance(t),o=new ot(this.base,e.scale(-1)).expandByDistance(t);return new it([n,o])},t.prototype.getPointsInSameDirection=function(t,e){return this.comesBefore(e,t)?{point1:e,point2:t}:{point1:t,point2:e}},t.prototype.pointIsBetweenPoints=function(t,e,n){return t.minus(e).dot(this.direction)*t.minus(n).dot(this.direction)<=0},t.prototype.intersectsConvexPolygon=function(t){if(this.isContainedByConvexPolygon(t))return!0;for(var e=0,n=t.getIntersectionsWithLine(this.base,this.direction);e0?e=i.point:n=i.point)}return e&&n?new Se(e,n):e?new Te(e,this.direction):new Te(n,this.direction.scale(-1))},e.prototype.intersectWithLine=function(t){return this.intersectsLine(t)?this:be},e.prototype.intersectWithLineSegment=function(t){return this.lineSegmentIsOnSameLine(t)?t:be},e.prototype.intersectWithRay=function(t){return this.intersectsRay(t)?t:be},e.prototype.isContainedByConvexPolygon=function(t){return t.containsPoint(this.base)&&t.containsInfinityInDirection(this.direction)&&t.containsInfinityInDirection(this.direction.scale(-1))},e.prototype.isContainedByLine=function(t){return this.intersectsSubsetOfLine(t)},e.prototype.isContainedByLineSegment=function(t){return!1},e.prototype.isContainedByRay=function(t){return!1},e.prototype.contains=function(t){return t.isContainedByLine(this)},e.prototype.intersectsLine=function(t){return this.intersectsSubsetOfLine(t)},e.prototype.intersectsSubsetOfLine=function(t){return this.pointIsOnSameLine(t.base)&&0===this.direction.cross(t.direction)},e.prototype.intersectsLineSegment=function(t){return this.lineSegmentIsOnSameLine(t)},e.prototype.intersectsRay=function(t){return this.intersectsSubsetOfLine(t)},e.prototype.intersects=function(t){return t.intersectsLine(this)},e.prototype.expandToIncludePoint=function(t){return this.pointIsOnSameLine(t)?this:it.createTriangleWithInfinityInDirection(this.base,t,this.direction).expandToIncludeInfinityInDirection(this.direction.scale(-1))},e.prototype.expandByDistance=function(t){return this.expandLineByDistance(t)},e.prototype.expandToIncludeInfinityInDirection=function(t){var e=t.cross(this.direction),n=this.direction.getPerpendicular();return 0===e?this:e>0?it.createFromHalfPlane(new ot(this.base,n.scale(-1))):it.createFromHalfPlane(new ot(this.base,n))},e.prototype.transform=function(t){var n=t.apply(this.base);return new e(n,t.apply(this.base.plus(this.direction)).minus(n))},e.prototype.interiorContainsPoint=function(t){return this.pointIsOnSameLine(t)},e}(Pe),Ce=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Te=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ce(e,t),e.prototype.getVertices=function(){return[this.base]},e.prototype.intersectWith=function(t){return t.intersectWithRay(this)},e.prototype.join=function(t){return t.expandToIncludePoint(this.base).expandToIncludeInfinityInDirection(this.direction)},e.prototype.intersectWithConvexPolygon=function(t){if(!this.intersectsConvexPolygon(t))return be;if(this.isContainedByConvexPolygon(t))return this;for(var n,o=t.getIntersectionsWithLine(this.base,this.direction),r=this.base,i=0,a=o;i0?r=s.point:n=s.point)}return n?new Se(r,n):new e(r,this.direction)},e.prototype.intersectWithRay=function(t){return this.isContainedByRay(t)?this:t.isContainedByRay(this)?t:this.interiorContainsPoint(t.base)?new Se(this.base,t.base):be},e.prototype.intersectWithLine=function(t){return t.intersectWithRay(this)},e.prototype.intersectWithLineSegment=function(t){if(t.isContainedByRay(this))return t;if(!this.lineSegmentIsOnSameLine(t))return be;var e=this.getPointsInSameDirection(t.point1,t.point2).point2;return this.comesBefore(e,this.base)?be:new Se(this.base,e)},e.prototype.isContainedByConvexPolygon=function(t){return t.containsPoint(this.base)&&t.containsInfinityInDirection(this.direction)},e.prototype.isContainedByRay=function(t){return t.containsPoint(this.base)&&t.containsInfinityInDirection(this.direction)},e.prototype.isContainedByLine=function(t){return t.intersectsSubsetOfLine(this)},e.prototype.isContainedByLineSegment=function(t){return!1},e.prototype.contains=function(t){return t.isContainedByRay(this)},e.prototype.intersectsRay=function(t){return this.isContainedByRay(t)||t.isContainedByRay(this)||this.interiorContainsPoint(t.base)},e.prototype.intersectsLine=function(t){return t.intersectsSubsetOfLine(this)},e.prototype.intersectsLineSegment=function(t){if(t.isContainedByRay(this))return!0;if(!this.lineSegmentIsOnSameLine(t))return!1;var e=this.getPointsInSameDirection(t.point1,t.point2).point2;return!this.comesBefore(e,this.base)},e.prototype.intersects=function(t){return t.intersectsRay(this)},e.prototype.expandToIncludePoint=function(t){return this.containsPoint(t)?this:this.pointIsOnSameLine(t)?new e(t,this.direction):it.createTriangleWithInfinityInDirection(this.base,t,this.direction)},e.prototype.expandByDistance=function(t){var e=this.expandLineByDistance(t),n=new ot(this.base,this.direction).expandByDistance(t);return e.intersectWithConvexPolygon(new it([n]))},e.prototype.expandToIncludeInfinityInDirection=function(t){return t.inSameDirectionAs(this.direction)?this:0===this.direction.cross(t)?new Oe(this.base,this.direction):it.createTriangleWithInfinityInTwoDirections(this.base,this.direction,t)},e.prototype.transform=function(t){var n=t.apply(this.base);return new e(n,t.apply(this.base.plus(this.direction)).minus(n))},e.prototype.interiorContainsPoint=function(t){return this.pointIsOnSameLine(t)&&!this.comesBefore(t,this.base)},e.prototype.containsInfinityInDirection=function(t){return this.direction.inSameDirectionAs(t)},e.prototype.containsPoint=function(t){return this.pointIsOnSameLine(t)&&this.comesBefore(this.base,t)},e}(Pe),Ie=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Se=function(t){function e(e,n){var o=t.call(this,e,n.minus(e))||this;return o.point1=e,o.point2=n,o}return Ie(e,t),e.prototype.getVertices=function(){return[this.point1,this.point2]},e.prototype.join=function(t){return t.expandToIncludePoint(this.point1).expandToIncludePoint(this.point2)},e.prototype.intersectWith=function(t){return t.intersectWithLineSegment(this)},e.prototype.intersectWithLineSegment=function(t){if(this.isContainedByLineSegment(t))return this;if(t.isContainedByLineSegment(this))return t;if(!this.lineSegmentIsOnSameLine(t))return be;var n=this.getPointsInSameDirection(t.point1,t.point2),o=n.point1,r=n.point2;return this.comesBefore(r,this.point1)||this.comesBefore(this.point2,o)?be:this.comesBefore(this.point1,o)?new e(o,this.point2):new e(this.point1,r)},e.prototype.intersectWithRay=function(t){return t.intersectWithLineSegment(this)},e.prototype.intersectWithLine=function(t){return t.intersectWithLineSegment(this)},e.prototype.isContainedByRay=function(t){return t.containsPoint(this.point1)&&t.containsPoint(this.point2)},e.prototype.isContainedByLine=function(t){return t.intersectsSubsetOfLine(this)},e.prototype.isContainedByLineSegment=function(t){return t.containsPoint(this.point1)&&t.containsPoint(this.point2)},e.prototype.intersectWithConvexPolygon=function(t){if(!this.intersectsConvexPolygon(t))return be;if(this.isContainedByConvexPolygon(t))return this;for(var n=t.getIntersectionsWithLine(this.point1,this.direction),o=this.point1,r=this.point2,i=0,a=n;i0?o=s.point:r=s.point)}return new e(o,r)},e.prototype.isContainedByConvexPolygon=function(t){return t.containsPoint(this.point1)&&t.containsPoint(this.point2)},e.prototype.contains=function(t){return t.isContainedByLineSegment(this)},e.prototype.pointIsStrictlyBetweenPoints=function(t,e,n){return t.minus(e).dot(this.direction)*t.minus(n).dot(this.direction)<0},e.prototype.containsPoint=function(t){return this.pointIsOnSameLine(t)&&this.pointIsBetweenPoints(t,this.point1,this.point2)},e.prototype.interiorContainsPoint=function(t){return this.pointIsOnSameLine(t)&&this.pointIsStrictlyBetweenPoints(t,this.point1,this.point2)},e.prototype.intersectsRay=function(t){return t.intersectsLineSegment(this)},e.prototype.intersectsLineSegment=function(t){if(this.isContainedByLineSegment(t)||t.isContainedByLineSegment(this))return!0;if(!this.lineSegmentIsOnSameLine(t))return!1;var e=this.getPointsInSameDirection(t.point1,t.point2),n=e.point1,o=e.point2;return!this.comesBefore(o,this.point1)&&!this.comesBefore(this.point2,n)},e.prototype.intersectsLine=function(t){return t.intersectsSubsetOfLine(this)},e.prototype.intersects=function(t){return t.intersectsLineSegment(this)},e.prototype.expandByDistance=function(t){var e=this.expandLineByDistance(t),n=new ot(this.base,this.direction).expandByDistance(t),o=new ot(this.point2,this.direction.scale(-1)).expandByDistance(t);return e.intersectWithConvexPolygon(new it([n,o]))},e.prototype.expandToIncludePoint=function(t){return this.containsPoint(t)?this:this.pointIsOnSameLine(t)?this.comesBefore(t,this.point1)?new e(t,this.point2):new e(this.point1,t):it.createTriangle(this.point1,t,this.point2)},e.prototype.expandToIncludeInfinityInDirection=function(t){return t.inSameDirectionAs(this.direction)?new Te(this.point1,t):0===t.cross(this.direction)?new Te(this.point2,t):it.createTriangleWithInfinityInDirection(this.point1,this.point2,t)},e.prototype.transform=function(t){return new e(t.apply(this.point1),t.apply(this.point2))},e}(Pe),xe=new(function(){function t(){}return t.prototype.addPoint=function(t){return rt},t.prototype.addPointAtInfinity=function(t){return this},t.prototype.addArea=function(t){return rt},t}()),_e=function(){function t(t){this.towardsMiddle=t}return t.prototype.addPoint=function(t){return it.createFromHalfPlane(new ot(t,this.towardsMiddle))},t.prototype.addPointAtInfinity=function(t){return t.dot(this.towardsMiddle)>=0?this:xe},t.prototype.addArea=function(t){var e=this.towardsMiddle.getPerpendicular();return t.expandToIncludeInfinityInDirection(this.towardsMiddle).expandToIncludeInfinityInDirection(e).expandToIncludeInfinityInDirection(e.scale(-1))},t}(),je=function(){function t(t,e){this.direction1=t,this.direction2=e}return t.prototype.addPoint=function(t){return it.createTriangleWithInfinityInTwoDirections(t,this.direction1,this.direction2)},t.prototype.addPointAtInfinity=function(e){return e.isInSmallerAngleBetweenPoints(this.direction1,this.direction2)?this:0===e.cross(this.direction1)?new _e(this.direction2.projectOn(this.direction1.getPerpendicular())):0===e.cross(this.direction2)?new _e(this.direction1.projectOn(this.direction2.getPerpendicular())):this.direction1.isInSmallerAngleBetweenPoints(e,this.direction2)?new t(e,this.direction2):this.direction2.isInSmallerAngleBetweenPoints(e,this.direction1)?new t(e,this.direction1):xe},t.prototype.addArea=function(t){return t.expandToIncludeInfinityInDirection(this.direction1).expandToIncludeInfinityInDirection(this.direction2)},t}(),Be=function(){function t(t){this.direction=t}return t.prototype.addPoint=function(t){return new Oe(t,this.direction)},t.prototype.addPointAtInfinity=function(t){return 0===t.cross(this.direction)?this:new _e(t.projectOn(this.direction.getPerpendicular()))},t.prototype.addArea=function(t){return t.expandToIncludeInfinityInDirection(this.direction).expandToIncludeInfinityInDirection(this.direction.scale(-1))},t}(),Ae=function(){function t(t){this.direction=t}return t.prototype.addPointAtInfinity=function(t){return t.inSameDirectionAs(this.direction)?this:0===t.cross(this.direction)?new Be(this.direction):new je(this.direction,t)},t.prototype.addPoint=function(t){return new Te(t,this.direction)},t.prototype.addArea=function(t){return t.expandToIncludeInfinityInDirection(this.direction)},t}(),Ee=function(){function t(t,e,n){this._area=t,this.firstPoint=e,this.subsetOfLineAtInfinity=n}return Object.defineProperty(t.prototype,"area",{get:function(){return this._area||be},enumerable:!1,configurable:!0}),t.prototype.addPoint=function(t){this._area?this._area=this._area.expandToIncludePoint(t):this.firstPoint?t.equals(this.firstPoint)||(this._area=new Se(this.firstPoint,t)):this.subsetOfLineAtInfinity?this._area=this.subsetOfLineAtInfinity.addPoint(t):this.firstPoint=t},t.prototype.addPosition=function(t){Wt(t)?this.addInfinityInDirection(t.direction):this.addPoint(t)},t.prototype.addInfinityInDirection=function(t){this._area?this._area=this._area.expandToIncludeInfinityInDirection(t):this.firstPoint?this._area=new Te(this.firstPoint,t):this.subsetOfLineAtInfinity?(this.subsetOfLineAtInfinity=this.subsetOfLineAtInfinity.addPointAtInfinity(t),this.subsetOfLineAtInfinity===xe&&(this._area=rt)):this.subsetOfLineAtInfinity=new Ae(t)},t.prototype.transformedWith=function(t){return new me(this,t)},t.prototype.copy=function(){return new t(this._area,this.firstPoint,this.subsetOfLineAtInfinity)},t}(),Le=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),De=function(t){function e(e,n,o,r,i){var a=t.call(this,e,n,i)||this;return a.instruction=o,a.stateConversion=r,a}return Le(e,t),e.prototype.replaceInstruction=function(t){this.instruction=t},e.prototype.copy=function(){return new e(this.initialState,this.state,this.instruction,this.stateConversion,this.rectangle)},e.prototype.makeExecutable=function(t){var e=t.getInfinity(this.state),n=this.instruction;return new ne(this.initialState,this.state,(function(t,o){return n(t,o,e)}),this.stateConversion,this.rectangle)},e.create=function(t,n,o){return new e(t,t,n,(function(){}),o)},e}(te),Fe=function(){function t(t){this.shape=t}return t.prototype.getInstructionToDrawLineTo=function(t,e){return this.getInstructionToExtendShapeWithLineTo(this.shape.transform(e.current.transformation.inverse()),t)},t.prototype.getInstructionToMoveToBeginning=function(t){return this.getInstructionToMoveToBeginningOfShape(this.shape.transform(t.current.transformation.inverse()))},Object.defineProperty(t.prototype,"currentPosition",{get:function(){return this.shape.currentPosition},enumerable:!1,configurable:!0}),t.prototype.moveToInfinityFromPointInDirection=function(t,e){return function(n,o,r){r.moveToInfinityFromPointInDirection(n,o,t,e)}},t.prototype.lineFromInfinityFromPointToInfinityFromPoint=function(t,e,n){return function(o,r,i){i.drawLineFromInfinityFromPointToInfinityFromPoint(o,r,t,e,n)}},t.prototype.lineFromInfinityFromPointToPoint=function(t,e){return function(n,o,r){r.drawLineFromInfinityFromPointToPoint(n,o,t,e)}},t.prototype.lineToInfinityFromPointInDirection=function(t,e){return function(n,o,r){r.drawLineToInfinityFromPointInDirection(n,o,t,e)}},t.prototype.lineToInfinityFromInfinityFromPoint=function(t,e,n){return function(o,r,i){i.drawLineToInfinityFromInfinityFromPoint(o,r,t,e,n)}},t.prototype.lineTo=function(t){return function(e,n){var o=n.apply(t),r=o.x,i=o.y;e.lineTo(r,i)}},t.prototype.moveTo=function(t){return function(e,n){var o=n.apply(t),r=o.x,i=o.y;e.moveTo(r,i)}},t}(),We=function(){function t(t,e,n,o){this.initialPosition=t,this.firstFinitePoint=e,this.lastFinitePoint=n,this.currentPosition=o}return t.prototype.transform=function(e){return new t(e.applyToPointAtInfinity(this.initialPosition),e.apply(this.firstFinitePoint),e.apply(this.lastFinitePoint),e.applyToPointAtInfinity(this.currentPosition))},t}(),ke=function(){function t(t,e,n){this.initialPosition=t,this.firstFinitePoint=e,this.currentPosition=n}return t.prototype.transform=function(e){return new t(e.applyToPointAtInfinity(this.initialPosition),e.apply(this.firstFinitePoint),e.apply(this.currentPosition))},t}();function Re(){for(var t=[],e=0;e0||t>0&&e<0)}function nn(t,e,n,o){return en(t,n)&&en(e,o)}var on=function(){function t(t){this.area=t}return t.prototype.hasDrawingAcrossBorderOf=function(t){return!this.isContainedBy(t)&&this.intersects(t)},t.prototype.isContainedBy=function(t){return t.contains(this.area)},t.prototype.intersects=function(t){return this.area.intersects(t)},t}(),rn=function(){function t(t,e){this.instructions=t,this.drawingArea=new on(e)}return Object.defineProperty(t.prototype,"state",{get:function(){return this.instructions.state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"initialState",{get:function(){return this.instructions.initialState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stateOfFirstInstruction",{get:function(){return this.instructions.stateOfFirstInstruction},enumerable:!1,configurable:!0}),t.prototype.setArea=function(t){this.drawingArea=new on(t)},t.prototype.setInitialState=function(t){this.instructions.setInitialState(t)},t.prototype.setInitialStateWithClippedPaths=function(t){this.instructions.setInitialStateWithClippedPaths(t)},t.prototype.addClippedPath=function(t){this.instructions.addClippedPath(t)},t.prototype.execute=function(t,e){this.instructions.execute(t,e)},t}(),an=function(){function t(t,e){this.instructions=t,this.area=e}return Object.defineProperty(t.prototype,"state",{get:function(){return this.instructions.state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"initialState",{get:function(){return this.instructions.initialState},enumerable:!1,configurable:!0}),t.prototype.execute=function(t,e){this.instructions.execute(t,e)},t}(),sn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),cn=function(t){function e(e,n){var o=t.call(this,e)||this;return o._initiallyWithState=e,o.rectangle=n,o.areaBuilder=new Ee,o}return sn(e,t),Object.defineProperty(e.prototype,"area",{get:function(){return this.areaBuilder.area},enumerable:!1,configurable:!0}),e.prototype.containsFinitePoint=function(){for(var t=0,e=this.added;t0&&(r=r.expandByDistance(n.lineWidth/2));var i=ve.create(e,t,this.rectangle);return o.addInstruction(i),new rn(this.makeExecutable(n),r)}},e.prototype.makeExecutable=function(t){for(var e=new Ut(this._initiallyWithState.makeExecutable()),n=new le(this.rectangle,t),o=0,r=this.added;o0?ae:se,i)):(this.lineTo(n>0?ue:ce,i),Number.isFinite(o)?this.lineTo(new r(t,e+o),i):this.lineTo(o>0?ae:se,i)),this.lineTo(new r(t,e),i)):(Number.isFinite(n)?this.lineTo(new r(t+n,0),i):this.lineTo(n>0?ue:ce,i),this.lineTo(o>0?ae:se,i),this.lineTo(new r(t,0),i),this.lineTo(e<0?se:ae,i)):(this.lineTo(new r(0,e),i),this.lineTo(n>0?ue:ce,i),Number.isFinite(o)?this.lineTo(new r(0,e+o),i):this.lineTo(o>0?ae:se,i),this.lineTo(t<0?ce:ue,i)),this.closePath(),this.moveToPositionDeterminedBy(t,e,i))},e.prototype.addPathInstruction=function(t,e){if(0===this.added.length){if(!t.initialPoint)return;this.moveTo(t.initialPoint,e)}var n=this.added[this.added.length-1],o=ge(n.currentPosition,e.current.transformation.inverse());t.changeArea(this.areaBuilder.transformedWith(e.current.transformation),o);var r=ve.create(e,t.instruction,this.rectangle);n.addPathInstruction(t,r,e)},e.prototype.getInstructionsToClip=function(){return new an(this.makeExecutable({lineWidth:0,lineDashPeriod:0,shadowOffsets:[]}),this.area)},e.prototype.recreatePath=function(){for(var t=new e(this._initiallyWithState.copy(),this.rectangle),n=0,o=this.added;n0||t>0&&e<0)}function pn(t,e,n,o){return un(t,n)&&un(e,o)}var fn,ln=function(){function t(t,e,n,o,r,i){this.instruction=t,this.factory=e,this.takeClippingRegionIntoAccount=n,this.transformationKind=o,this.state=r,this.tempState=i}return t.prototype.build=function(t,e){var n=this.getModifiedInstruction(e),o=this.factory(t,n);return o.setArea(this.changeAreaOfDrawing(o.drawingArea.area,this.tempState||this.state,this.takeClippingRegionIntoAccount)),o},t.prototype.getModifiedInstruction=function(t){var e=this.instruction,n=function(t,e){return t===X.Relative?function(t){var n=e.getBitmapTransformationToTransformedInfiniteCanvasContext(),o=n.a,r=n.b,i=n.c,a=n.d,s=n.e,c=n.f;t.transform(o,r,i,a,s,c)}:t===X.Absolute?function(t){var n=e.getBitmapTransformationToInfiniteCanvasContext(),o=n.a,r=n.b,i=n.c,a=n.d,s=n.e,c=n.f;t.setTransform(o,r,i,a,s,c)}:null}(this.transformationKind,t);return this.tempState&&(n=Re(n,this.takeClippingRegionIntoAccount?this.state.getInstructionToConvertToStateWithClippedPath(this.tempState,t):this.state.getInstructionToConvertToState(this.tempState,t))),e=function(t,e){return e?function(n,o){n.save(),e(n,o),t(n,o),n.restore()}:t}(e,n),e},t.prototype.changeAreaOfDrawing=function(t,e,n){var o=t;if(0!==e.current.shadowBlur||!e.current.shadowOffset.equals(r.origin)){var i=o.expandByDistance(e.current.shadowBlur).transform(s.translation(e.current.shadowOffset.x,e.current.shadowOffset.y));o=o.join(i)}return e.current.clippingRegion&&n&&(o=o.intersectWith(e.current.clippingRegion)),o},t.create=function(e){return new t(e.instruction,e.build,e.takeClippingRegionIntoAccount,e.transformationKind,e.state,e.tempState)},t}(),hn=function(){function t(t,e){this.onChange=t,this.rectangle=e,this.previousInstructionsWithPath=ye.create(e),this.state=this.previousInstructionsWithPath.state}return t.prototype.beginPath=function(){var t=cn.create(this.state,this.rectangle);t.setInitialStateWithClippedPaths(this.previousInstructionsWithPath.state),this.currentInstructionsWithPath=t},t.prototype.changeState=function(t){this.state=this.state.withCurrentState(t(this.state.current))},t.prototype.saveState=function(){this.state=this.state.saved()},t.prototype.restoreState=function(){this.state=this.state.restored()},t.prototype.allSubpathsAreClosable=function(){return!this.currentInstructionsWithPath||this.currentInstructionsWithPath.allSubpathsAreClosable()},t.prototype.currentPathContainsFinitePoint=function(){return this.currentInstructionsWithPath&&this.currentInstructionsWithPath.containsFinitePoint()},t.prototype.currentSubpathIsClosable=function(){return!this.currentInstructionsWithPath||this.currentInstructionsWithPath.currentSubpathIsClosable()},t.prototype.fillPath=function(t){this.drawPath(t,(function(t,e,n){return t.fillPath(e,n)}))},t.prototype.strokePath=function(){this.drawPath((function(t){t.stroke()}),(function(t,e,n){return t.strokePath(e,n)}))},t.prototype.fillRect=function(t,e,n,o,r){this.drawRect(t,e,n,o,r,(function(t,e,n){return t.fillPath(e,n)}))},t.prototype.strokeRect=function(t,e,n,o){this.drawRect(t,e,n,o,(function(t){t.stroke()}),(function(t,e,n){return t.strokePath(e,n)}))},t.prototype.drawPath=function(t,e){var n=this;if(this.currentInstructionsWithPath){var o=this.state.current.isTransformable(),r=o?X.None:X.Relative;this.state=this.state.currentlyTransformed(o),this.incorporateDrawingInstruction(ln.create({instruction:t,build:function(t,o){return e(t,o,n.state)},transformationKind:r,state:this.state,takeClippingRegionIntoAccount:!0})),this.onChange()}},t.prototype.drawRect=function(t,e,n,o,r,i){var a=this,s=this.state.current.isTransformable(),c=s?X.None:X.Relative,u=this.state.currentlyTransformed(s);this.incorporateDrawingInstruction(ln.create({instruction:r,build:function(r,s){var c=cn.create(u,a.rectangle);return c.rect(t,e,n,o,u),i(c,s,u)},transformationKind:c,state:u,takeClippingRegionIntoAccount:!0})),this.onChange()},t.prototype.addDrawing=function(t,e,n,o,r){var i,a=this,s=this.state.currentlyTransformed(!1);n===X.Relative&&(e=e.transform(this.state.current.transformation)),r&&(i=s.withCurrentState(r(s.current))),this.incorporateDrawingInstruction(ln.create({instruction:t,build:function(t,n){return new rn(ne.create(s,n,a.rectangle),e)},transformationKind:n,state:s,tempState:i,takeClippingRegionIntoAccount:o})),this.onChange()},t.prototype.clipPath=function(t){this.clipCurrentPath(t)},t.prototype.incorporateDrawingInstruction=function(t){if(this.currentInstructionsWithPath){var e=this.currentInstructionsWithPath.recreatePath();this.addToPreviousInstructions(t),e.setInitialStateWithClippedPaths(this.previousInstructionsWithPath.state),this.currentInstructionsWithPath=e}else this.addToPreviousInstructions(t),this.state=this.previousInstructionsWithPath.state},t.prototype.addToPreviousInstructions=function(t){var e=t.build(this.currentInstructionsWithPath,this.rectangle);e.setInitialStateWithClippedPaths(this.previousInstructionsWithPath.state),this.previousInstructionsWithPath.add(e)},t.prototype.clipCurrentPath=function(t){this.currentInstructionsWithPath&&(this.currentInstructionsWithPath.clipPath(t,this.state),this.state=this.currentInstructionsWithPath.state)},t.prototype.addPathInstruction=function(t){this.currentInstructionsWithPath&&this.currentInstructionsWithPath.addPathInstruction(t,this.state)},t.prototype.closePath=function(){this.currentInstructionsWithPath&&this.currentInstructionsWithPath.closePath()},t.prototype.moveTo=function(t){this.currentInstructionsWithPath&&this.currentInstructionsWithPath.moveTo(t,this.state)},t.prototype.canAddLineTo=function(t){return!this.currentInstructionsWithPath||this.currentInstructionsWithPath.canAddLineTo(t,this.state)},t.prototype.lineTo=function(t){this.currentInstructionsWithPath&&this.currentInstructionsWithPath.lineTo(t,this.state)},t.prototype.rect=function(t,e,n,o){this.currentInstructionsWithPath&&this.currentInstructionsWithPath.rect(t,e,n,o,this.state)},t.prototype.intersects=function(t){return this.previousInstructionsWithPath.intersects(t)},t.prototype.clearContentsInsideArea=function(t){this.previousInstructionsWithPath.clearContentsInsideArea(t),this.currentInstructionsWithPath&&this.currentInstructionsWithPath.setInitialStateWithClippedPaths(this.previousInstructionsWithPath.state)},t.prototype.clearArea=function(t,e,n,o){if(nn(t,e,n,o)){var r=pn(t,e,n,o)?rt:it.createRectangle(t,e,n,o),i=r.transform(this.state.current.transformation);this.intersects(i)&&(this.clearContentsInsideArea(i),this.previousInstructionsWithPath.hasDrawingAcrossBorderOf(i)&&(this.previousInstructionsWithPath.addClearRect(r,this.state,t,e,n,o),this.currentInstructionsWithPath&&this.currentInstructionsWithPath.setInitialStateWithClippedPaths(this.state)),this.onChange())}},t.prototype.execute=function(t,e){this.previousInstructionsWithPath.length&&this.previousInstructionsWithPath.execute(t,e);for(var n=this.previousInstructionsWithPath.state.stack.length,o=0;o0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]-1&&(this.listeners.splice(e,1),0===this.listeners.length&&(this.observer.disconnect(),this.observer=void 0))},t}();function Mn(t){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e,f:t.f}}var qn=function(){return qn=Object.assign||function(t){for(var e,n=1,o=arguments.length;n-1&&this.anchors.splice(e,1)},t}(),pr=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),fr=function(t){function e(e,n,o,r,i,a){var s=t.call(this,e,n,o,r)||this;return s.deltaX=i,s.deltaY=a,s}return pr(e,t),e.prototype.toInfiniteCanvasCoordinates=function(n){var o=t.prototype.toInfiniteCanvasCoordinates.call(this,n),i=o.offsetX,a=o.offsetY,s=o.movementX,c=o.movementY,u=n.inverseInfiniteCanvasContextBase.untranslated().apply(new r(this.deltaX,this.deltaY));return new e(i,a,s,c,u.x,u.y)},e.create=function(n){var o=t.create.call(this,n);return new e(o.offsetX,o.offsetY,o.movementX,o.movementY,n.deltaX,n.deltaY)},e}(Xo),lr=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),hr=function(t){function e(e,n,o,r){var i=t.call(this,e,n,o,r)||this;return i.deltaX=r.deltaX,i.deltaY=r.deltaY,i}return lr(e,t),Object.defineProperty(e.prototype,"deltaMode",{get:function(){return this.event.deltaMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deltaZ",{get:function(){return this.event.deltaZ},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"DOM_DELTA_LINE",{get:function(){return this.event.DOM_DELTA_LINE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"DOM_DELTA_PAGE",{get:function(){return this.event.DOM_DELTA_PAGE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"DOM_DELTA_PIXEL",{get:function(){return this.event.DOM_DELTA_PIXEL},enumerable:!1,configurable:!0}),e}(Jo),yr=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),dr=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.props=fr.create(e),o}return yr(e,t),e.prototype.createResultEvent=function(t){return new hr(this,this.preventableDefault,this.event,this.props.toInfiniteCanvasCoordinates(t))},e}(Go);function vr(t,e){for(var n=[],o=0;o{var{InfiniteCanvas:o}=n(582);t.exports=o}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,n),i.exports}return n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(225)})())); \ No newline at end of file diff --git a/dist/types/infinite-canvas-rendering-context-2d.d.ts b/dist/types/infinite-canvas-rendering-context-2d.d.ts index bcf05335..9f1b353a 100644 --- a/dist/types/infinite-canvas-rendering-context-2d.d.ts +++ b/dist/types/infinite-canvas-rendering-context-2d.d.ts @@ -2,7 +2,7 @@ * This interface inherits all properties and methods from [`CanvasRenderingContext2D`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) * * @remarks - * `InfiniteCanvasRenderingContext2D` currently does **not** support [`getImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData), [`createImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createImageData), [`globalAlpha`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalAlpha), [`globalCompositeOperation`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation), [`isPointInPath()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInPath), [`isPointInStroke()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInStroke), [`filter`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter), [`imageSmoothingEnabled`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled), [`imageSmoothingQuality`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality), [`lineJoin`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin), [`miterLimit`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/miterLimit), [`drawFocusIfNeeded()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawFocusIfNeeded) and [`scrollPathIntoView()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/scrollPathIntoView) + * `InfiniteCanvasRenderingContext2D` currently does **not** support [`getImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData), [`createImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createImageData), [`isPointInPath()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInPath), [`isPointInStroke()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInStroke), [`drawFocusIfNeeded()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawFocusIfNeeded) and [`scrollPathIntoView()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/scrollPathIntoView) */ export interface InfiniteCanvasRenderingContext2D extends CanvasRenderingContext2D { /** diff --git a/docs/api/interfaces/InfiniteCanvasRenderingContext2D.md b/docs/api/interfaces/InfiniteCanvasRenderingContext2D.md index 8a0f4461..4b9586e6 100644 --- a/docs/api/interfaces/InfiniteCanvasRenderingContext2D.md +++ b/docs/api/interfaces/InfiniteCanvasRenderingContext2D.md @@ -6,7 +6,7 @@ This interface inherits all properties and methods from [`CanvasRenderingContext **`Remarks`** -`InfiniteCanvasRenderingContext2D` currently does **not** support [`getImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData), [`createImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createImageData), [`globalAlpha`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalAlpha), [`globalCompositeOperation`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation), [`isPointInPath()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInPath), [`isPointInStroke()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInStroke), [`filter`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter), [`imageSmoothingEnabled`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled), [`imageSmoothingQuality`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality), [`lineJoin`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin), [`miterLimit`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/miterLimit), [`drawFocusIfNeeded()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawFocusIfNeeded) and [`scrollPathIntoView()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/scrollPathIntoView) +`InfiniteCanvasRenderingContext2D` currently does **not** support [`getImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData), [`createImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createImageData), [`isPointInPath()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInPath), [`isPointInStroke()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInStroke), [`drawFocusIfNeeded()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawFocusIfNeeded) and [`scrollPathIntoView()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/scrollPathIntoView) ## Hierarchy diff --git a/docs/dev/page/index.css b/docs/dev/page/index.css index d970bd97..995ce5a3 100644 --- a/docs/dev/page/index.css +++ b/docs/dev/page/index.css @@ -50,4 +50,12 @@ iframe{ border: none; height: 100%; width: 100%; +} +.state-container button{ + margin-left: 5px; + background-color: #1e1e1e; + color: rgb(240, 240, 240); + border: 1px solid rgb(240, 240, 240); + cursor: pointer; + border-radius: 2px; } \ No newline at end of file diff --git a/docs/dev/page/index.html b/docs/dev/page/index.html index 22d828a5..ab1699c7 100644 --- a/docs/dev/page/index.html +++ b/docs/dev/page/index.html @@ -3,6 +3,7 @@ InfiniteCanvas in Stackblitz + @@ -11,7 +12,7 @@