1 line
60 KiB
JavaScript
1 line
60 KiB
JavaScript
!function(t,e){for(var i in e)t[i]=e[i]}(this,function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=3)}([function(t,e,i){"use strict";i.r(e),i.d(e,"noop",function(){return o}),i.d(e,"sqrt2",function(){return a}),i.d(e,"sqrt3",function(){return s}),i.d(e,"invSqrt2",function(){return u}),i.d(e,"clone",function(){return c}),i.d(e,"has",function(){return l}),i.d(e,"hypotenuse",function(){return h}),i.d(e,"isObject",function(){return f}),i.d(e,"random",function(){return p}),i.d(e,"range",function(){return v}),i.d(e,"rangeInclusive",function(){return g}),i.d(e,"getQueryStringParameters",function(){return y}),i.d(e,"getQueryStringObj",function(){return d}),i.d(e,"parseString",function(){return w}),i.d(e,"toFixed",function(){return T}),i.d(e,"getColor",function(){return x}),i.d(e,"grayscale",function(){return O}),i.d(e,"extend",function(){return S}),i.d(e,"quickCanvas",function(){return P});var n=i(1);function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){}var a=Math.sqrt(2),s=Math.sqrt(3),u=1/a;function c(t){return JSON.parse(JSON.stringify(t))}function l(t,e){return t&&(t.hasOwnProperty(e)||e in t)}function h(t,e){return null==e&&(e=t),Math.sqrt(t*t+e*e)}function f(t){return!(!t||"object"!==r(t)||Array.isArray(t))}function p(t,e){return Array.isArray(t)?t[p(t.length-1)]:"object"===r(t)?t[p(Object.keys(t))]:(null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1)))}function v(t,e){if(null==e&&(e=t,t=0),t>e){var i=t;t=e,e=i}return Array.from(Array(Math.abs(e-t)),function(e,i){return i+t})}function g(t,e){return null==e&&(e=t,t=0),v(Math.min(t,e),Math.max(t,e)+1)}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.location.search,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"=",n={};return t.replace(/(^\?)/,"").split(e).forEach(function(t){t=t.split(i),n[t[0]]=t[1]}),n}function d(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.location.search,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"=";return Object(n.mapObj)(y(t,e,i),w)}var m=/^{.*}$/,b=/^\[.*\]$/;function w(t){return"string"!=typeof t?t:"true"===t.toLowerCase()||"false"!==t.toLowerCase()&&("null"===t.toLowerCase()?null:"undefined"===t.toLowerCase()?void 0:isNaN(Number(t))?m.test(t)||b.test(t)?JSON.parse(decodeURIComponent(t)):t:Number(t))}function T(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:NaN;return"number"!=typeof t||isNaN(t)?i:Number(t.toFixed(e))}function x(t){var e=t.red,i=t.green,n=t.blue,r=t.alpha;return null!=r?"rgba(".concat(e,", ").concat(i,", ").concat(n,", ").concat(r,")"):"rgb(".concat(e,", ").concat(i,", ").concat(n,")")}var k={red:.299,green:.587,blue:.114};function O(t){var e=t.red,i=t.green,n=t.blue;return k.red*e+k.green*i+k.blue*n}function S(t){for(var e=Object.assign({},t),i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];return r.forEach(function(t){Object(n.forEach)(t,function(i,n){l(t,n)&&(f(i)&&f(e[n])?e[n]=S(e[n],i):e[n]=i)})}),e}function P(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,n=document.createElement("canvas");return n.height=e,n.width=i,t(n.getContext("2d"),n.height,n.width),n}},function(t,e,i){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){var e={log:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0})(t)&&console.log(t),e},value:function(){return t}};return l(S,function(i,n){e[n]=function(){return t=i.apply(void 0,[t].concat(Array.prototype.slice.call(arguments))),e}}),e}function o(t){return s(t,function(t){return null!=t})}function a(t,e){if(Array.isArray(t)){for(var i=t.length,n=0;n<i;n++)if(t[n]===e)return!0}else for(var r in t)if(t[r]===e)return!0;return!1}function s(t,e){var i={};return Array.isArray(t)?t.filter(e):(l(t,function(t,n){e(t,n)&&(i[n]=t)}),i)}function u(t,e){if(Array.isArray(t))return t.find(e);for(var i in t)if(e(t[i]))return t[i]}function c(t){return Array.isArray(t)?t.reduce(function(t,e){return t.concat(Array.isArray(e)?c(e):e)},[]):x(function(t,e){return t.concat(e)},[])}function l(t,e){if(Array.isArray(t))t.forEach(e);else for(var i in t)e(t[i],i,t);return t}function h(t,e){var i={};return l(t,function(t){var n="string"==typeof e?t[e]:e(t);i[n]=i[n]||[],i[n].push(t)}),i}function f(t){return t}function p(t,e){var i=[];return Array.isArray(t)?t.map(e):(l(t,function(n,r){i.push(e(n,r,t))}),i)}function v(t){return!(!t||"object"!==n(t)||Array.isArray(t))}function g(t,e){return t&&t.hasOwnProperty(e)}function y(t,e){var i={};return Array.isArray(t)?l(t,function(n,r){var o=e(n,r,t);v(o)&&g(o,"key")&&g(o,"value")?i[o.key]=o.value:i[r]=o}):l(t,function(n,r){var o=e(n,r,t);v(o)&&g(o,"key")&&g(o,"value")?i[o.key]=o.value:i[r]=o}),i}function d(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,i=-1/0;if(e){var n=-1/0;l(t,function(t,r,o){var a=e(t,r,o);(a>n||a===-1/0&&i===-1/0)&&(i=t,n=a)})}else l(t,function(t){return i=t>i?t:i});return i}function m(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,i=1/0;if(e){var n=1/0;l(t,function(t,r,o){var a=e(t,r,o);(a<n||a===1/0&&i===1/0)&&(i=t,n=a)})}else l(t,function(t){return i=t<i?t:i});return i}function b(t,e){var i={};return l(t,function(t,n){a(e,n)||(i[n]=t)}),i}function w(t,e){var i={};return e.forEach(function(e){t.hasOwnProperty(e)&&(i[e]=t[e])}),i}function T(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;return Array.from(Array(t),function(t,i){return e(i)})}function x(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null!=t[0]?t[0]:0;return Array.isArray(t)?t.reduce(e,i):(l(t,function(t,n,r){i=e(i,t,n,r)}),i)}function k(t,e){return s(t,function(t,i,n){return!e(t,i,n)})}function O(t){return!!u(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:f)}i.r(e),i.d(e,"chain",function(){return r}),i.d(e,"compact",function(){return o}),i.d(e,"contains",function(){return a}),i.d(e,"filter",function(){return s}),i.d(e,"find",function(){return u}),i.d(e,"flatten",function(){return c}),i.d(e,"forEach",function(){return l}),i.d(e,"groupBy",function(){return h}),i.d(e,"identity",function(){return f}),i.d(e,"map",function(){return p}),i.d(e,"mapObj",function(){return y}),i.d(e,"max",function(){return d}),i.d(e,"min",function(){return m}),i.d(e,"omit",function(){return b}),i.d(e,"pick",function(){return w}),i.d(e,"range",function(){return T}),i.d(e,"reduce",function(){return x}),i.d(e,"reject",function(){return k}),i.d(e,"some",function(){return O}),i.d(e,"_",function(){return S});var S={compact:o,contains:a,filter:s,find:u,flatten:c,forEach:l,groupBy:h,identity:f,map:p,mapObj:y,max:d,min:m,omit:b,pick:w,range:T,reduce:x,reject:k,some:O}},,function(t,e,i){t.exports=i(4)},function(t,e,i){"use strict";i.r(e);var n=i(0),r=i(1);function o(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var s={debug:!1,element:document.body,desktopPress:!1,tap:n.noop,tapStart:n.noop,move:n.noop,doubletap:n.noop,press:n.noop,pressStart:n.noop,zoom:n.noop,moveThreshold:5,doubletapThreshold:500,pressThreshold:300,wheelFactor:-100},u=["contextmenu","mousedown","mouseup","mousemove","touchstart","touchend","touchmove","touchcancel","wheel"],c=["eventHandler","tapStart","pressStart"].concat(u),l=function(){function t(e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.settings=Object.assign({},s,e),this.state={tapStartTime:null},c.forEach(function(t){return i[t]=i[t].bind(i)}),u.forEach(function(t){return i.settings.element.addEventListener(t,function(e){return i.eventHandler(e,t)})})}var e,i,r;return e=t,(i=[{key:"eventHandler",value:function(t,e){t.timeStampUTC=Date.now(),this.settings.debug&&console.debug("[".concat("onTap","][").concat(e,"]"),t),this[e](t)}},{key:"contextmenu",value:function(t){t.preventDefault()}},{key:"tapStart",value:function(t){var e=this;if(!this.state.tapStartTime){var i=t.mobile;this.state.tapStartTime=t.timeStampUTC,(i||this.settings.desktopPress)&&(clearTimeout(this.state.pressTO),this.state.pressTO=setTimeout(function(){e.pressStart({mobile:i,timeStampUTC:Date.now(),offsetX:e.state.lastX,offsetY:e.state.lastY})},this.settings.pressThreshold)),this.settings.tapStart(t)}}},{key:"mousedown",value:function(t){Object.assign(t,{mobile:!1}),this.state.lastX=t.offsetX,this.state.lastY=t.offsetY,t.which&&1!==t.which?this.settings.pressStart(t):this.tapStart(t)}},{key:"touchstart",value:function(t){t.preventDefault(),Object.assign(t,{mobile:!0});var e=o(t.touches);t.offsetX=e.reduce(function(t,e){return t+e.pageX},0)/e.length,t.offsetY=e.reduce(function(t,e){return t+e.pageY},0)/e.length,this.state.lastX=t.offsetX,this.state.lastY=t.offsetY,t.touches.length>1&&(this.state.scaleStart=Object(n.hypotenuse)(e[0].pageX-e[1].pageX,e[0].pageY-e[1].pageY),this.state.pinching=!0,this.state.lastPinch=1,clearTimeout(this.state.pressTO)),this.tapStart(t)}},{key:"pressStart",value:function(t){this.settings.pressStart(t)}},{key:"mouseup",value:function(t){if(Object.assign(t,{mobile:!1,duration:t.timeStampUTC-this.state.tapStartTime}),!this.state.moving){var e=t.which&&1!==t.which||t.altKey||t.ctrlKey||t.metaKey,i=this.settings.desktopPress&&t.duration>=this.settings.pressThreshold;e||i?this.settings.press(t):(clearTimeout(this.state.pressTO),this.settings.tap(t))}this.state.moving=null,this.state.lastX=null,this.state.lastY=null,this.state.tapStartTime=null,clearTimeout(this.state.pressTO)}},{key:"touchend",value:function(t){t.preventDefault(),Object.assign(t,{mobile:!0,duration:t.timeStampUTC-this.state.tapStartTime});var e=o(t.touches);e.length?(t.offsetX=e.reduce(function(t,e){return t+e.pageX},0)/e.length,t.offsetY=e.reduce(function(t,e){return t+e.pageY},0)/e.length,this.state.lastX=t.offsetX,this.state.lastY=t.offsetY):(t.offsetX=this.state.lastX,t.offsetY=this.state.lastY),this.state.moving||this.state.pinching||(t.duration>=this.settings.pressThreshold?this.settings.press(t):(clearTimeout(this.state.pressTO),this.settings.tap(t))),t.touches.length<=1&&(this.state.pinching=!1,this.state.scaleStart=null,this.state.lastPinch=null),0===t.touches.length&&(this.state.moving=null,this.state.lastX=null,this.state.lastY=null,this.state.tapStartTime=null)}},{key:"mousemove",value:function(t){this.state.tapStartTime&&(this.state.moving||(Math.abs(t.offsetX-this.state.lastX)>this.settings.moveThreshold||Math.abs(t.offsetY-this.state.lastY)>this.settings.moveThreshold)&&(this.state.moving=!0,clearTimeout(this.state.pressTO)),this.state.moving&&(Object.assign(t,{mobile:!1,deltaX:t.offsetX-this.state.lastX,deltaY:t.offsetY-this.state.lastY}),this.settings.move(t),this.state.lastX=t.offsetX,this.state.lastY=t.offsetY))}},{key:"touchmove",value:function(t){if(t.preventDefault(),this.state.tapStartTime){var e=o(t.touches);Object(n.has)(t,"scale")||(t.scale=e.length<2?1:Object(n.hypotenuse)(e[0].pageX-e[1].pageX,e[0].pageY-e[1].pageY)/this.state.scaleStart),Object.assign(t,{offsetX:e.reduce(function(t,e){return t+e.pageX},0)/e.length,offsetY:e.reduce(function(t,e){return t+e.pageY},0)/e.length,scaleStep:t.scale/this.state.lastPinch,mobile:!0}),this.state.pinching&&(this.settings.zoom(t),this.state.lastPinch=t.scale),this.state.moving||(Math.abs(t.offsetX-this.state.lastX)>this.settings.moveThreshold||Math.abs(t.offsetY-this.state.lastY)>this.settings.moveThreshold)&&(this.state.moving=!0,clearTimeout(this.state.pressTO)),this.state.moving&&(Object.assign(t,{deltaX:t.offsetX-this.state.lastX,deltaY:t.offsetY-this.state.lastY}),this.settings.move(t),this.state.lastX=t.offsetX,this.state.lastY=t.offsetY)}}},{key:"touchcancel",value:function(t){console.log("touchcancel",t)}},{key:"wheel",value:function(t){Object.assign(t,{scaleStep:1+t.deltaY/this.settings.wheelFactor,mobile:!1}),this.settings.zoom(t)}}])&&a(e.prototype,i),r&&a(e,r),t}();function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var p=function(){function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),"object"===h(e)&&(i=e.y,e=e.x),this.x=Math.round(e)+0,this.y=Math.round(i)+0}var e,i,n;return e=t,(i=[{key:"getX",value:function(){return this.x}},{key:"getY",value:function(){return this.y}},{key:"setX",value:function(t){this.x=t}},{key:"setY",value:function(t){this.y=t}},{key:"getPoint",value:function(){return{x:this.x,y:this.y}}}])&&f(e.prototype,i),n&&f(e,n),t}();function v(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var g=function(){function t(e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.lastNow=null,["getContext","getSize","onResize","render"].map(function(t){return i[t]=i[t].bind(i)}),this.draw=e.draw||n.noop,this.resize=e.resize||n.noop,this.container=e.element||document.body,window.addEventListener("resize",this.onResize),this.canvas=document.createElement("canvas"),this.canvas.width=this.container.offsetWidth,this.canvas.height=this.container.offsetHeight,this.context=this.canvas.getContext("2d"),this.container.appendChild(this.canvas),requestAnimationFrame(this.render)}var e,i,r;return e=t,(i=[{key:"getContext",value:function(){return this.context}},{key:"getSize",value:function(){return{canvasWidth:this.container.offsetWidth,canvasHeight:this.container.offsetHeight}}},{key:"onResize",value:function(t){var e=this.container.offsetWidth,i=this.container.offsetHeight,n=this.canvas.width,r=this.canvas.height,o=e-n,a=i-r;this.canvas.width=e,this.canvas.height=i,Object.assign(t,{height:i,width:e,oldHeight:r,oldWidth:n,deltaX:o,deltaY:a}),this.resize(t)}},{key:"render",value:function(t){var e=this;this.context.lastUTC=this.context.utc||null,this.context.utc=Date.now(),this.context.now=t,this.context.lastNow=this.lastNow;var i=this.draw(this.context);this.lastNow=t,i?setTimeout(function(){return requestAnimationFrame(e.render)},i):requestAnimationFrame(this.render)}}])&&v(e.prototype,i),r&&v(e,r),t}(),y="hex",d="square",m={HEX:y,CIRCLE:"circle",SQUARE:d},b={HEX:y,SQUARE:d},w="flat",T="pointy",x={FLAT:w,POINTY:T},k={FILL:"fill",OUTLINE:"outline"};function O(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=[],n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(i.push(a.value),!e||i.length!==e);n=!0);}catch(t){r=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function S(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function P(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var j={mine:{border:{scale:.38,color:{red:255,blue:255,green:255,alpha:.8},horns:{scale:.07,distance:.36}},body:{scale:.36,color:{red:32,blue:32,green:32},horns:{scale:.05,distance:.36}}},pip:{border:{scale:.17,color:{red:255,blue:255,green:255,alpha:.9}},body:{scale:.15,color:{red:0,blue:0,green:0}},distance:.6},sides:6,slices:24};var Y=function(){function t(e){var i,r,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.settings=Object.assign({},j,e);var a,s,u,c,l=this.settings.sides,h=this.settings.slices;this.slicesX=Object(n.range)(h).map(function(t){return Object(n.toFixed)(Math.cos(t/h*l*(2*Math.PI)/l))}),this.slicesY=Object(n.range)(h).map(function(t){return Object(n.toFixed)(Math.sin(t/h*l*(2*Math.PI)/l))}),this.pipCache={},this.mineCache={},this.pipVertices=(S(o={},y,(S(i={},w,function(t,e){var i=[];t=[0].concat(t),e=[0].concat(e);var n=function(i){return[t[i],e[i]]};return i[1]=[0].map(n),i[2]=[1,13].map(n),i[3]=[5,13,21].map(n),i[4]=[0,1,9,17].map(n),i[5]=[0,5,9,17,21].map(n),i[6]=[1,5,9,13,17,21].map(n),i[7]=[0,1,5,9,13,17,21].map(n),i}(this.slicesX,this.slicesY)),S(i,T,function(t,e){var i=[];t=[0].concat(t),e=[0].concat(e);var n=function(i){return[t[i],e[i]]};return i[1]=[0].map(n),i[2]=[7,19].map(n),i[3]=[7,15,23].map(n),i[4]=[0,3,11,19].map(n),i[5]=[0,3,11,15,23].map(n),i[6]=[3,7,11,15,19,23].map(n),i[7]=[0,3,7,11,15,19,23].map(n),i}(this.slicesX,this.slicesY)),i)),S(o,d,(S(r={},w,(a=[],s=[0,n.invSqrt2,n.invSqrt2,-n.invSqrt2,-n.invSqrt2,n.invSqrt2,-n.invSqrt2,0,0],u=[0,n.invSqrt2,-n.invSqrt2,-n.invSqrt2,n.invSqrt2,0,0,-n.invSqrt2,n.invSqrt2],c=function(t){return[s[t],u[t]]},a[1]=[0].map(c),a[2]=[1,3].map(c),a[3]=[0,1,3].map(c),a[4]=[1,2,3,4].map(c),a[5]=[0,1,2,3,4].map(c),a[6]=[1,2,3,4,5,6].map(c),a[7]=[0,1,2,3,4,5,6].map(c),a[8]=[1,2,3,4,5,6,7,8].map(c),a[9]=[0,1,2,3,4,5,6,7,8].map(c),a)),S(r,T,function(){var t=[],e=[0,1,0,-1,0,.5,-.5,.5,-.5],i=[0,0,-1,0,1,-.5,.5,.5,-.5],n=function(t){return[e[t],i[t]]};return t[1]=[0].map(n),t[2]=[1,3].map(n),t[3]=[0,1,3].map(n),t[4]=[1,2,3,4].map(n),t[5]=[0,1,2,3,4].map(n),t[6]=[1,2,3,4,5,6].map(n),t[7]=[0,1,2,3,4,5,6].map(n),t[8]=[1,2,3,4,5,6,7,8].map(n),t[9]=[0,1,2,3,4,5,6,7,8].map(n),t}()),r)),o),this.horns=this.pipVertices[y][w][6].concat(this.pipVertices[y][T][6])}var e,i,r;return e=t,(i=[{key:"background",value:function(t,e,i,r){t.beginPath(),t.rect(0,0,i,e),t.fillStyle=Object(n.getColor)(r),t.closePath(),t.fill()}},{key:"pip",value:function(t,e,i,n,r,o,a,s){var u=i+s*r,c=n+s*o;t.moveTo(u,c),t.arc(u,c,a,0,2*Math.PI,!0)}},{key:"setPipCache",value:function(t,e){var i=this,r=e*this.settings.pip.distance,o=e*this.settings.pip.body.scale,a=e*this.settings.pip.border.scale;this.pipCache.scale=e,this.pipCache.height=2*(Math.ceil(a)+1),this.pipCache.width=this.pipCache.height;var s=this.pipCache.height/2;this.pipCache.pip=Object(n.quickCanvas)(function(t,e,r){t.beginPath(),t.arc(s,s,a,0,2*Math.PI,!0),t.closePath(),t.fillStyle=Object(n.getColor)(i.settings.pip.border.color),t.fill(),t.beginPath(),t.arc(s,s,o,0,2*Math.PI,!0),t.closePath(),t.fillStyle=Object(n.getColor)(i.settings.pip.body.color),t.fill()},this.pipCache.height,this.pipCache.width);var u=e-s;this.pipCache.pips=t.map(function(t){return Object(n.quickCanvas)(function(e){t.forEach(function(t){var n=O(t,2),o=n[0],a=n[1];return e.drawImage(i.pipCache.pip,u+r*o,u+r*a)})},2*e)})}},{key:"pips",value:function(t,e,i,n,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=r.tileStyle,s=r.orientation,u=r.pips;if(this.pipVertices[a]&&this.pipVertices[a][s]&&this.pipVertices[a][s][u]){e!==this.pipCache.scale&&this.setPipCache(this.pipVertices[a][s],e);var c=2*e*r.scale,l=2*e*r.scale;t.globalAlpha=o,t.drawImage(this.pipCache.pips[u],i-c/2,n-l/2,c,l),t.globalAlpha=1}}},{key:"mine",value:function(t,e,i,n){arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.settings.mine;e!==this.mineCache.scale&&this.setMineCache(e),t.drawImage(this.mineCache.mine,i-e,n-e,2*e,2*e)}},{key:"setMineCache",value:function(t){var e=this;this.mineCache.scale=t,this.mineCache.mine=Object(n.quickCanvas)(function(i){e._mine(i,t,t,t,e.settings.mine.border),e._horns(i,t,t,t,e.settings.mine.border.horns,e.settings.mine.border.color),e._mine(i,t,t,t,e.settings.mine.body),e._horns(i,t,t,t,e.settings.mine.body.horns,e.settings.mine.body.color)},2*t)}},{key:"_mine",value:function(t,e,i,r,o){t.beginPath(),t.moveTo(i,r),t.arc(i,r,e*o.scale,0,2*Math.PI,!0),t.closePath(),t.fillStyle=Object(n.getColor)(o.color),t.fill()}},{key:"_horns",value:function(t,e,i,r,o,a){var s=this,u=e*o.scale,c=e*o.distance;t.beginPath(),this.horns.forEach(function(n){var o=O(n,2),a=o[0],l=o[1];return s.pip(t,e,i,r,a,l,u,c)}),t.closePath(),t.fillStyle=Object(n.getColor)(a),t.fill()}},{key:"explosion",value:function(t,e,i,r){var o=this,a=.667*e,s=.333*e;t.beginPath(),t.moveTo(i,r),t.moveTo(i+a*this.slicesX[0],r+a*this.slicesY[0]),Object(n.range)(this.settings.slices).filter(function(t){return t%2==1}).forEach(function(e){t.lineTo(i+s*o.slicesX[e],r+s*o.slicesY[e]),t.lineTo(i+a*o.slicesX[e+1],r+a*o.slicesY[e+1])}),t.closePath(),t.fillStyle="rgb(255,0,0)",t.fill()}}])&&P(e.prototype,i),r&&P(e,r),t}();function M(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var X=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,i,r;return e=t,(i=[{key:"fill",value:function(t,e,i,r,o){t.beginPath(),t.arc(i,r,e*o.scale,0,2*Math.PI,!1),t.fillStyle=Object(n.getColor)(o.color),t.fill()}},{key:"outline",value:function(t,e,i,r,o){t.beginPath(),t.arc(i,r,e*o.scale,0,2*Math.PI,!1),t.lineWidth=o.width,t.strokeStyle=Object(n.getColor)(o.color),t.stroke()}}])&&M(e.prototype,i),r&&M(e,r),t}();function z(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var C=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.settings=Object.assign({},e),this.squareX=[n.invSqrt2,n.invSqrt2,-n.invSqrt2,-n.invSqrt2],this.squareY=[n.invSqrt2,-n.invSqrt2,-n.invSqrt2,n.invSqrt2],this.diamondX=[1,0,-1,0,.5,-.5],this.diamondY=[0,-1,0,1,-.5,.5]}var e,i,r;return e=t,(i=[{key:"fill",value:function(t,e,i,r,o){e*=o.scale;var a=o.orientation===T?this.diamondX:this.squareX,s=o.orientation===T?this.diamondY:this.squareY;t.beginPath(),t.moveTo(i+e*a[0],r+e*s[0]),t.lineTo(i+e*a[1],r+e*s[1]),t.lineTo(i+e*a[2],r+e*s[2]),t.lineTo(i+e*a[3],r+e*s[3]),t.fillStyle=Object(n.getColor)(o.color),t.fill()}},{key:"outline",value:function(t,e,i,r,o){e*=o.scale;var a=o.orientation===T?this.diamondX:this.squareX,s=o.orientation===T?this.diamondY:this.squareY;t.beginPath(),t.moveTo(i+e*a[0],r+e*s[0]),t.lineTo(i+e*a[1],r+e*s[1]),t.lineTo(i+e*a[2],r+e*s[2]),t.lineTo(i+e*a[3],r+e*s[3]),t.closePath(),t.lineWidth=o.width,t.strokeStyle=Object(n.getColor)(o.color),t.stroke()}}])&&z(e.prototype,i),r&&z(e,r),t}();function _(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var W=function(){function t(e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.settings=Object.assign({},e),this.flatTopCornerX=[],this.flatTopCornerY=[],this.pointyTopCornerX=[],this.pointyTopCornerY=[];Object(n.range)(24).forEach(function(t){var e=Object(n.toFixed)(Math.cos(t/24*6*(2*Math.PI)/6)),r=Object(n.toFixed)(Math.sin(t/24*6*(2*Math.PI)/6));if(t%4==0){var o=t/4;i.flatTopCornerX[o]=e,i.flatTopCornerY[o]=r}if((t-2)%4==0){var a=(t-2)/4;i.pointyTopCornerX[a]=e,i.pointyTopCornerY[a]=r}})}var e,i,r;return e=t,(i=[{key:"outline",value:function(t,e,i,r,o){e*=o.scale;var a=o.orientation===T?this.pointyTopCornerX:this.flatTopCornerX,s=o.orientation===T?this.pointyTopCornerY:this.flatTopCornerY;t.beginPath(),t.moveTo(i+e*a[0],r+e*s[0]),t.lineTo(i+e*a[1],r+e*s[1]),t.lineTo(i+e*a[2],r+e*s[2]),t.lineTo(i+e*a[3],r+e*s[3]),t.lineTo(i+e*a[4],r+e*s[4]),t.lineTo(i+e*a[5],r+e*s[5]),t.closePath(),t.lineWidth=o.width,t.strokeStyle=Object(n.getColor)(o.color),t.stroke()}},{key:"fill",value:function(t,e,i,r,o){e*=o.scale;var a=o.orientation===T?this.pointyTopCornerX:this.flatTopCornerX,s=o.orientation===T?this.pointyTopCornerY:this.flatTopCornerY;t.beginPath(),t.moveTo(i+e*a[0],r+e*s[0]),t.lineTo(i+e*a[1],r+e*s[1]),t.lineTo(i+e*a[2],r+e*s[2]),t.lineTo(i+e*a[3],r+e*s[3]),t.lineTo(i+e*a[4],r+e*s[4]),t.lineTo(i+e*a[5],r+e*s[5]),t.fillStyle=Object(n.getColor)(o.color),t.fill()}}])&&_(e.prototype,i),r&&_(e,r),t}();var A={x:0,y:0,scale:10,orientation:w,tileStyle:y,drawStyle:"fill",width:1,color:{red:0,green:0,blue:0,alpha:.5}},E=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,A,e)};function q(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var R={adjustScaleMin:!0,scale:50,scaleMin:10,scaleMax:250},D=function(){function t(e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),["getOriginX","getOriginY","getScale","move","_checkMove","setOriginX","setOriginY","zoom","remap"].map(function(t){return i[t]=i[t].bind(i)}),this.settings=Object.assign({},R,e),Object.assign(this,Object(r.pick)(this.settings,["height","negativeTiles","radius","width","wrap"])),this.width&&this.height||delete this.wrap,this.checkScale(this.settings.canvasHeight,this.settings.canvasWidth),this.setOriginX(this.settings.canvasWidth,this.settings.centerX),this.setOriginY(this.settings.canvasHeight,this.settings.centerY)}var e,i,o;return e=t,(i=[{key:"getOriginX",value:function(){return this.originX}},{key:"getOriginY",value:function(){return this.originY}},{key:"getScale",value:function(){return this.scale}},{key:"checkScale",value:function(t,e){var i=this.height?this.calculateVerticalScale(t,this.height):0,n=this.width?this.calculateHorizontalScale(e,this.width):0;this.scaleMax=this.settings.scaleMax,this.scaleMin=this.settings.adjustScaleMin?Math.max(this.settings.scaleMin,i,n):this.settings.scaleMin,this.scale=this.scaleMin>this.settings.scale?this.scaleMin:this.settings.scale}},{key:"setOriginX",value:function(t,e){this.originX=e?e-t/2:this.negativeTiles?parseInt(t/2):this.width?this.width*this.horizontalDistance()/-2+t/2+this.horizontalDistance()/2:this.tileWidth()/2}},{key:"setOriginY",value:function(t,e){var i=this.height*this.verticalDistance();this.originY=e?e+t/2:this.negativeTiles?parseInt(t/2):this.height?i-(i-t)/2-this.verticalDistance()/2:t-this.tileHeight()/2}},{key:"move",value:function(t){Object(n.has)(t,"height")||(t.height=t.target.offsetHeight),Object(n.has)(t,"width")||(t.width=t.target.offsetWidth);var e=this.originX+t.deltaX,i=this.originY+t.deltaY;return this.originX=e,this.originY=i,this._checkMove(t),this.originX===e&&this.originY===i}},{key:"_checkMove",value:function(t){this.negativeTiles?this._checkMoveNegativeTiles(t):this._checkMovePositiveTiles(t)}},{key:"_checkMovePositiveTiles",value:function(t){var e=t.width,i=t.height,n=this.horizontalDistance(),r=this.verticalDistance(),o=this.tileWidth()/2,a=i-this.tileHeight()/2;if(!this.wrap){if(this.originX=this.originX>o?o:this.originX,this.originY=this.originY<a?a:this.originY,this.width){var s=o-(this.width*n+this.horizontalOverhang()-e);this.originX=this.originX<s?s:this.originX}if(this.height){var u=this.height*r+this.verticalOverhang()-this.tileHeight()/2;this.originY=this.originY>u?u:this.originY}}}},{key:"_checkMoveNegativeTiles",value:function(t){var e=this.horizontalDistance(),i=this.verticalDistance();if(!this.wrap){if(this.width){var n=t.width,r=(this.width*e+this.horizontalOverhang())/2;this.originX=this.originX>r?r:n-this.originX>r?n-r:this.originX}if(this.height){var o=t.height,a=(this.height*i+this.verticalOverhang())/2;this.originY=this.originY>a?a:o-this.originY>a?o-a:this.originY}}}},{key:"zoom",value:function(t){var e=this.scale,i=e*t.scaleStep;i=Math.max(i,this.scaleMin),e!==(i=Math.min(i,this.scaleMax))&&(this.scale=i,this.move({deltaX:(t.offsetX-this.originX)/e*(e-i),deltaY:(t.offsetY-this.originY)/e*(e-i),width:t.target.offsetWidth,height:t.target.offsetHeight}))}},{key:"remap",value:function(t){Object.assign(this,Object(r.pick)(t,["height","width","negativeTiles"])),this.checkScale(t.canvasHeight,t.canvasWidth),this.setOriginX(t.canvasWidth,t.centerX),this.setOriginY(t.canvasHeight,t.centerY)}}])&&q(e.prototype,i),o&&q(e,o),t}();function H(t){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function B(t,e){return!e||"object"!==H(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function I(t){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function L(t,e){return(L=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var N=function(t){function e(t,i){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),B(this,I(e).call(this,t,i))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&L(t,e)}(e,p),e}();function Q(t){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function F(t,e,i){return(F=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&J(r,i.prototype),r}).apply(null,arguments)}function V(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function U(t){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function J(t,e){return(J=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function K(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var Z=function(t){var e=t.tilePoint,i=t.mapPoint,n=t.pixelPoint;return{tile:e instanceof N?e:new N(e),mapTile:i instanceof N?i:i?new N(i):i,pixelPoint:n}},$=function(t){function e(t){var i,n,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=this,r=U(e).call(this,t),i=!r||"object"!==Q(r)&&"function"!=typeof r?K(n):r,["tileHeight","tileWidth","maxWidth","minWidth","horizontalOverhang","verticalOverhang","horizontalDistance","verticalDistance","calculateHorizontalScale","calculateVerticalScale","tileToPixel","pixelToTile","teleport","inBounds","enforceBoundries","boundingBox"].map(function(t){return i[t]=i[t].bind(K(K(i)))}),i}var i,o,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&J(t,e)}(e,D),i=e,(o=[{key:"tileHeight",value:function(){return this.minWidth()}},{key:"tileWidth",value:function(){return this.minWidth()}},{key:"maxWidth",value:function(){return 2*this.scale}},{key:"minWidth",value:function(){return this.maxWidth()*n.invSqrt2}},{key:"horizontalOverhang",value:function(){return 0}},{key:"verticalOverhang",value:function(){return 0}},{key:"horizontalDistance",value:function(){return this.minWidth()}},{key:"verticalDistance",value:function(){return this.minWidth()}},{key:"calculateHorizontalScale",value:function(t,e){return t/e/n.invSqrt2/2}},{key:"calculateVerticalScale",value:function(t,e){return t/e/n.invSqrt2/2}},{key:"tileToPixel",value:function(t){var e=(t=t instanceof N?t:F(N,Array.prototype.slice.call(arguments))).getX()*this.minWidth()+this.originX,i=this.originY-t.getY()*this.minWidth();return new p(e,i)}},{key:"pixelToTile",value:function(t){var e=(t=t instanceof p?t:F(p,Array.prototype.slice.call(arguments))).getX()-this.originX,i=this.originY-t.getY(),n=e/this.minWidth(),r=i/this.minWidth();return new N(n,r)}},{key:"teleport",value:function(t){var e=t.x,i=t.y;return this.wrap?(e%=this.width,i%=this.height,e=e<0?this.width+e:e,i=i<0?this.height+i:i,new p(e,i)):new p(e,i)}},{key:"inBounds",value:function(t){var e=t.x,i=t.y;return this.negativeTiles?(!this.width||Math.abs(e)<=Math.floor(this.width/2))&&(!this.height||Math.abs(i)<=Math.floor(this.height/2)):(!this.width||e>=0&&e<this.width)&&(!this.height||i>=0&&i<this.height)}},{key:"enforceBoundries",value:function(t){var e=t.tilePoint,i=t.pixelPoint;return this.wrap?{tilePoint:e,mapPoint:this.teleport(e),pixelPoint:i}:this.inBounds(e)?{tilePoint:e,mapPoint:e,pixelPoint:i}:{tilePoint:e,mapPoint:null,pixelPoint:i}}},{key:"boundingBox",value:function(t,e,i,o){var a=this,s=this.pixelToTile(t),u=this.pixelToTile(o),c=this.pixelToTile(e),l=Object(n.rangeInclusive)(s.getX(),c.getX()),h=Object(n.rangeInclusive)(u.getY(),s.getY());return r.chain(l).map(function(t){return h.map(function(e){return{x:t,y:e}})}).flatten().map(function(t){return{tilePoint:t,pixelPoint:a.tileToPixel(t)}}).map(this.enforceBoundries).map(Z).value()}}])&&V(i.prototype,o),a&&V(i,a),e}();function G(t){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function tt(t,e,i){return(tt=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&nt(r,i.prototype),r}).apply(null,arguments)}function et(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function it(t){return(it=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function nt(t,e){return(nt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function rt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var ot=function(t){var e=t.tilePoint,i=t.mapPoint,n=t.pixelPoint;return{tile:e instanceof N?e:new N(e),mapTile:i instanceof N?i:i?new N(i):i,pixelPoint:n}},at=function(t){function e(t){var i,n,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=this,r=it(e).call(this,t),i=!r||"object"!==G(r)&&"function"!=typeof r?rt(n):r,["tileHeight","tileWidth","maxWidth","minWidth","horizontalOverhang","verticalOverhang","horizontalDistance","verticalDistance","calculateHorizontalScale","calculateVerticalScale","tileToPixel","pixelToTile","teleport","inBounds","enforceBoundries","boundingBox"].map(function(t){return i[t]=i[t].bind(rt(rt(i)))}),i}var i,o,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&nt(t,e)}(e,D),i=e,(o=[{key:"tileHeight",value:function(){return this.maxWidth()}},{key:"tileWidth",value:function(){return this.maxWidth()}},{key:"maxWidth",value:function(){return 2*this.scale}},{key:"minWidth",value:function(){return this.maxWidth()*n.invSqrt2}},{key:"horizontalOverhang",value:function(){return.5*this.maxWidth()}},{key:"verticalOverhang",value:function(){return.5*this.maxWidth()}},{key:"horizontalDistance",value:function(){return this.maxWidth()/2}},{key:"verticalDistance",value:function(){return this.maxWidth()/2}},{key:"calculateHorizontalScale",value:function(t,e){return t/(e/2)/2}},{key:"calculateVerticalScale",value:function(t,e){return t/(e/2)/2}},{key:"tileToPixel",value:function(t){var e=(t=t instanceof N?t:tt(N,Array.prototype.slice.call(arguments))).getX(),i=t.getY(),r=(e<i?-1:1)*(Math.abs(i-e)/n.sqrt2)*this.minWidth()+this.originX,o=this.originY-(-e<i?1:-1)*(Math.abs(e+i)/n.sqrt2)*this.minWidth();return new p(r,o)}},{key:"pixelToTile",value:function(t){var e=(t=t instanceof p?t:tt(p,Array.prototype.slice.call(arguments))).getX()-this.originX,i=this.originY-t.getY(),r=(-e<i?1:-1)*(Math.abs(e+i)/n.sqrt2)/this.minWidth(),o=(e<i?1:-1)*(Math.abs(i-e)/n.sqrt2)/this.minWidth();return new N(r,o)}},{key:"teleport",value:function(t){var e=t.x,i=t.y;return this.wrap?(e%=this.width,i%=this.height,e=e<0?this.width+e:e,i=i<0?this.height+i:i,new p(e,i)):new p(e,i)}},{key:"inBounds",value:function(t){var e=t.x,i=t.y;return this.negativeTiles?(!this.width||Math.abs(e)<=Math.floor(this.width/2))&&(!this.height||Math.abs(i)<=Math.floor(this.height/2)):(!this.width||e>=0&&e<this.width)&&(!this.height||i>=0&&i<this.height)}},{key:"enforceBoundries",value:function(t){var e=t.tilePoint,i=t.pixelPoint;return this.wrap?{tilePoint:e,mapPoint:this.teleport(e),pixelPoint:i}:this.inBounds(e)?{tilePoint:e,mapPoint:e,pixelPoint:i}:{tilePoint:e,mapPoint:null,pixelPoint:i}}},{key:"boundingBox",value:function(t,e,i,o){var a=this,s=this.pixelToTile(t),u=this.pixelToTile(o),c=this.pixelToTile(e),l=this.pixelToTile(i),h=Object(n.rangeInclusive)(l.getX(),c.getX()),f=s.getY()-s.getX(),p=s.getY()+s.getX(),v=u.getY()-u.getX(),g=u.getY()+u.getX(),y=Math.floor(h.length/2),d=h.length%2?h[y]:(h[y-1]+h[y])/2,m=function(t){return{tilePoint:t,pixelPoint:a.tileToPixel(t)}};return r.chain(h).map(function(t){var e=t<d?f+t:p-t,i=t<d?g-t:v+t;i=Math.min(i,e),e=Math.max(i,e);var o=Object(n.rangeInclusive)(i-1,e+1);return r.chain(o).map(function(e){return{x:t,y:e}}).map(m).map(a.enforceBoundries).map(ot).value()}).flatten().value()}}])&&et(i.prototype,o),a&&et(i,a),e}();function st(t){return(st="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ut(t){return(ut=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ct(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function lt(t,e,i){return e&&ct(t.prototype,e),i&&ct(t,i),t}function ht(t,e){return(ht=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ft(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pt(t,e){return-t-e}var vt=function(t){function e(){var t,i,n,r,o,a,s,u,c,l;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),i=this,t=!(n=ut(e).call(this))||"object"!==st(n)&&"function"!=typeof n?ft(i):n,1===arguments.length){var h=arguments[0],f=h.q,p=h.r,v=h.s,g=void 0===v?-f-p:v,y=arguments[0],d=y.x,m=y.z,b=y.y,w=void 0===b?-d-m:b;t.x=isNaN(f)?d:f,t.y=isNaN(g)?w:g,t.z=isNaN(p)?m:p}else 2===arguments.length?(t.x=arguments[0],t.z=arguments[1],t.y=pt(t.x,t.z)):3===arguments.length&&(t.x=arguments[0],t.y=arguments[1],t.z=arguments[2]);return r=ft(ft(t)),o=Math.round(r.x),a=Math.round(r.y),s=Math.round(r.z),u=Math.abs(o-r.x),c=Math.abs(a-r.y),l=Math.abs(s-r.z),u>c&&u>l?o=-a-s:c>l?a=-o-s:s=-o-a,r.x=-0===o?0:o,r.y=-0===a?0:a,r.z=-0===s?0:s,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ht(t,e)}(e,p),lt(e,null,[{key:"qrToCube",value:function(t,e){return{x:t,y:pt(t,e),z:e}}},{key:"cubeToEvenR",value:function(t){var e=t.x,i=(t.y,t.z);return{col:e+(i+(1&i))/2,row:i}}},{key:"evenRToCube",value:function(t,i){var n=t-(i+(1&i))/2;return new e(n,-n-i,i)}},{key:"cubeToEvenQ",value:function(t){var e=t.x;t.y;return{col:e,row:t.z+(e+(1&e))/2}}},{key:"evenQToCube",value:function(t,i){var n=i-(t+(1&t))/2;return new e(t,-t-n,n)}}]),lt(e,[{key:"getX",value:function(){return this.x}},{key:"getY",value:function(){return this.y}},{key:"getZ",value:function(){return this.z}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setZ",value:function(t){return this.z=t,this}},{key:"moveX",value:function(t){return this.x+=t,this}},{key:"moveY",value:function(t){return this.y+=t,this}},{key:"moveZ",value:function(t){return this.z+=t,this}},{key:"getQ",value:function(){return this.x}},{key:"getR",value:function(){return this.z}},{key:"setQ",value:function(t){return this.x=t,this.y=pt(this.x,this.z),this}},{key:"setR",value:function(t){return this.z=t,this.y=pt(this.x,this.z),this}},{key:"moveQ",value:function(t){return this.x+=t,this.y=pt(this.x,this.z),this}},{key:"moveR",value:function(t){return this.z+=t,this.y=pt(this.x,this.z),this}},{key:"getPoint",value:function(){return{x:this.x,y:this.y,z:this.z}}},{key:"setHex",value:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}},{key:"moveHex",value:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}},{key:"subtractHex",value:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}},{key:"getAxial",value:function(){return{q:this.x,r:this.z}}},{key:"setAxial",value:function(t){return this.x=t.q,this.z=t.r,this.y=pt(this.x,this.y),this}},{key:"moveAxial",value:function(t){return this.x+=t.q,this.z+=t.r,this.y=pt(this.x,this.z),this}},{key:"distance",value:function(t){return Math.max(Math.abs(this.x-t.x),Math.abs(this.y-t.y),Math.abs(this.z-t.z))}}]),e}();function gt(t){return(gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function yt(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function dt(t,e,i){return(dt=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&wt(r,i.prototype),r}).apply(null,arguments)}function mt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function bt(t){return(bt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function wt(t,e){return(wt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Tt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var xt=function(t){var e=t.tilePoint,i=t.mapPoint,n=t.pixelPoint;return{tile:e instanceof vt?e:new vt(e),mapTile:i instanceof vt?i:i?new vt(i):i,pixelPoint:n}},kt=new vt({x:0,y:0,z:0}),Ot=function(t){function e(t){var i,n,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=this,r=bt(e).call(this,t),i=!r||"object"!==gt(r)&&"function"!=typeof r?Tt(n):r,["tileHeight","tileWidth","maxWidth","minWidth","horizontalOverhang","verticalOverhang","horizontalDistance","verticalDistance","calculateHorizontalScale","calculateVerticalScale","tileToPixel","pixelToTile","teleport","inBounds","enforceBoundries","boundingBox"].map(function(t){return i[t]=i[t].bind(Tt(Tt(i)))}),i.radius&&(i.mirrors=[new vt({x:2*i.radius+1,y:-i.radius-1,z:-i.radius}),new vt({x:i.radius+1,y:i.radius,z:-2*i.radius-1}),new vt({x:-i.radius,y:2*i.radius+1,z:-i.radius-1}),new vt({x:-2*i.radius-1,y:i.radius+1,z:i.radius}),new vt({x:-i.radius-1,y:-i.radius,z:2*i.radius+1}),new vt({x:i.radius,y:-2*i.radius-1,z:i.radius+1})]),i}var i,o,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&wt(t,e)}(e,D),i=e,(o=[{key:"tileHeight",value:function(){return this.minWidth()}},{key:"tileWidth",value:function(){return this.maxWidth()}},{key:"maxWidth",value:function(){return 2*this.scale}},{key:"minWidth",value:function(){return this.scale*n.sqrt3}},{key:"horizontalOverhang",value:function(){return.25*this.maxWidth()}},{key:"verticalOverhang",value:function(){return 0}},{key:"horizontalDistance",value:function(){return.75*this.maxWidth()}},{key:"verticalDistance",value:function(){return this.minWidth()}},{key:"calculateHorizontalScale",value:function(t,e){return t/(.75*e+.25)/2}},{key:"calculateVerticalScale",value:function(t,e){return t/e/n.sqrt3}},{key:"tileToPixel",value:function(t){t=t instanceof vt?t:dt(vt,Array.prototype.slice.call(arguments));var e=3*this.scale/2*t.getQ()+this.originX,i=this.scale*n.sqrt3*(t.getR()+t.getQ()/2)+this.originY;return new p(e,i)}},{key:"pixelToTile",value:function(t){var e=(t=t instanceof p?t:dt(p,Array.prototype.slice.call(arguments))).getX()-this.originX,i=t.getY()-this.originY,r=e*(2/3)/this.scale,o=(i*(n.sqrt3/3)-e/3)/this.scale;return new vt(r,o)}},{key:"teleport",value:function(t){if(!this.wrap)return t;if(t=t instanceof vt?t:new vt(t),this.radius){if(t.distance(kt)<=this.radius)return t;var e=this.mirrors.map(function(e){return t.distance(e)}),i=this.mirrors[e.indexOf(Math.min.apply(Math,yt(e)))];return this.teleport(t.subtractHex(i))}var n=vt.cubeToEvenQ(t),r=n.col,o=n.row;if(this.width%2){var a=Math.floor(r/this.width),s=a/2;o-=s=a%2==0?s:r%2?Math.ceil(s):Math.floor(s)}var u=Math.floor(this.width/2),c=Math.floor(this.height/2);return this.negativeTiles&&(r+=u,o+=c),r%=this.width,o%=this.height,r=r<0?r+this.width:r,o=o<0?o+this.height:o,this.negativeTiles&&(r-=u,o-=c),vt.evenQToCube(r,o)}},{key:"inBounds",value:function(t){var e=t.x,i=t.z,n=t.y,r=void 0===n?-e-i:n;return this.radius?this.negativeTiles?Math.max(Math.abs(e),Math.abs(r),Math.abs(i))<=Math.floor(this.radius):Math.max(Math.abs(e-this.radius),Math.abs(r+this.radius),Math.abs(i))<=this.radius:!this.width&&!this.height||(this.negativeTiles?(!this.width||Math.abs(e)<this.width/2)&&(!this.height||Math.abs(-r-Math.floor(e/2))<this.height/2):(!this.width||e>=0&&e<this.width)&&(!this.height||r<=-1*Math.floor(e/2)&&-r-Math.floor(e/2)<this.height))}},{key:"enforceBoundries",value:function(t){var e=t.tilePoint,i=t.pixelPoint;return this.wrap?{tilePoint:e,mapPoint:this.teleport(e),pixelPoint:i}:this.inBounds(e)?{tilePoint:e,mapPoint:e,pixelPoint:i}:{tilePoint:e,mapPoint:null,pixelPoint:i}}},{key:"boundingBox",value:function(t,e,i,o){var a=this,s=this.pixelToTile(t),u=(this.pixelToTile(i),this.pixelToTile(o)),c=this.pixelToTile(e),l=Object(n.rangeInclusive)(s.getQ()-1,c.getQ()+1),h=u.getR()-c.getR(),f=function(t){return{tilePoint:t,pixelPoint:a.tileToPixel(t)}};return r.chain(l).map(function(t,e){var i=s.getR()-Math.floor(e/2),o=i+h,u=Object(n.rangeInclusive)(i,o+1);return r.chain(u).map(function(e){return vt.qrToCube(t,e)}).map(f).map(a.enforceBoundries).map(xt).value()}).flatten().value()}}])&&mt(i.prototype,o),a&&mt(i,a),e}();function St(t){return(St="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Pt(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function jt(t,e,i){return(jt=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&Xt(r,i.prototype),r}).apply(null,arguments)}function Yt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Mt(t){return(Mt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Xt(t,e){return(Xt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function zt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var Ct,_t=function(t){var e=t.tilePoint,i=t.mapPoint,n=t.pixelPoint;return{tile:e instanceof vt?e:new vt(e),mapTile:i instanceof vt?i:i?new vt(i):i,pixelPoint:n}},Wt=new vt({x:0,y:0,z:0}),At=function(t){function e(t){var i,n,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=this,r=Mt(e).call(this,t),i=!r||"object"!==St(r)&&"function"!=typeof r?zt(n):r,["tileHeight","tileWidth","maxWidth","minWidth","horizontalOverhang","verticalOverhang","horizontalDistance","verticalDistance","calculateHorizontalScale","calculateVerticalScale","tileToPixel","pixelToTile","teleport","inBounds","enforceBoundries","boundingBox"].map(function(t){return i[t]=i[t].bind(zt(zt(i)))}),i.radius&&(i.mirrors=[new vt({x:2*i.radius+1,y:-i.radius-1,z:-i.radius}),new vt({x:i.radius+1,y:i.radius,z:-2*i.radius-1}),new vt({x:-i.radius,y:2*i.radius+1,z:-i.radius-1}),new vt({x:-2*i.radius-1,y:i.radius+1,z:i.radius}),new vt({x:-i.radius-1,y:-i.radius,z:2*i.radius+1}),new vt({x:i.radius,y:-2*i.radius-1,z:i.radius+1})]),i}var i,o,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Xt(t,e)}(e,D),i=e,(o=[{key:"tileHeight",value:function(){return this.maxWidth()}},{key:"tileWidth",value:function(){return this.minWidth()}},{key:"maxWidth",value:function(){return 2*this.scale}},{key:"minWidth",value:function(){return this.scale*n.sqrt3}},{key:"horizontalOverhang",value:function(){return 0}},{key:"verticalOverhang",value:function(){return.25*this.maxWidth()}},{key:"horizontalDistance",value:function(){return this.minWidth()}},{key:"verticalDistance",value:function(){return.75*this.maxWidth()}},{key:"calculateHorizontalScale",value:function(t,e){return t/e/n.sqrt3}},{key:"calculateVerticalScale",value:function(t,e){return t/(.75*e+.25)/2}},{key:"tileToPixel",value:function(t){t=t instanceof vt?t:jt(vt,Array.prototype.slice.call(arguments));var e=this.scale*n.sqrt3*(t.getQ()+t.getR()/2),i=3*this.scale/2*t.getR();return new p(e+this.originX,i+this.originY)}},{key:"pixelToTile",value:function(t){var e=(t=t instanceof p?t:jt(p,Array.prototype.slice.call(arguments))).getX()-this.originX,i=t.getY()-this.originY,r=(e*(n.sqrt3/3)-i/3)/this.scale,o=i*(2/3)/this.scale;return new vt(r,o)}},{key:"teleport",value:function(t){if(!this.wrap)return t;if(t=t instanceof vt?t:new vt(t),this.radius){if(t.distance(Wt)<=this.radius)return t;var e=this.mirrors.map(function(e){return t.distance(e)}),i=this.mirrors[e.indexOf(Math.min.apply(Math,Pt(e)))];return this.teleport(t.subtractHex(i))}var n=vt.cubeToEvenR(t),r=n.col,o=n.row;if(this.height%2){var a=Math.floor(o/this.height),s=a/2;r-=s=a%2==0?s:o%2?Math.ceil(s):Math.floor(s)}var u=Math.floor(this.width/2),c=Math.floor(this.height/2);return this.negativeTiles&&(r+=u,o+=c),r%=this.width,o%=this.height,r=r<0?r+this.width:r,o=o<0?o+this.height:o,this.negativeTiles&&(r-=u,o-=c),vt.evenRToCube(r,o)}},{key:"inBounds",value:function(t){return t=t instanceof vt?t:new vt(t),this.radius?this.negativeTiles?Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))<=Math.floor(this.radius):Math.max(Math.abs(t.x-this.radius),Math.abs(t.y+this.radius),Math.abs(t.z))<=this.radius:!this.width&&!this.height||(this.negativeTiles?(!this.width||Math.abs(t.x)<this.width/2)&&(!this.height||Math.abs(-t.y-Math.floor(t.x/2))<this.height/2):(!this.width||t.x>=0&&t.x<this.width)&&(!this.height||t.y<=-1*Math.floor(t.x/2)&&-t.y-Math.floor(t.x/2)<this.height))}},{key:"enforceBoundries",value:function(t){var e=t.tilePoint,i=t.pixelPoint;return this.wrap?{tilePoint:e,mapPoint:this.teleport(e),pixelPoint:i}:this.inBounds(e)?{tilePoint:e,mapPoint:e,pixelPoint:i}:{tilePoint:e,mapPoint:null,pixelPoint:i}}},{key:"boundingBox",value:function(t,e,i,o){var a=this,s=this.pixelToTile(t),u=this.pixelToTile(i),c=(this.pixelToTile(o),this.pixelToTile(e)),l=Object(n.rangeInclusive)(s.getR()-1,u.getR()+1),h=c.getQ()-s.getQ(),f=function(t){return{tilePoint:t,pixelPoint:a.tileToPixel(t)}};return r.chain(l).map(function(t,e){var i=s.getQ()-Math.floor(e/2),o=i+h,u=Object(n.rangeInclusive)(i,o+1);return r.chain(u).map(function(e){return vt.qrToCube(e,t)}).map(f).map(a.enforceBoundries).map(_t).value()}).flatten().value()}}])&&Yt(i.prototype,o),a&&Yt(i,a),e}();function Et(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function qt(t,e,i){return e&&Et(t.prototype,e),i&&Et(t,i),t}function Rt(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}i.d(e,"Tessellate",function(){return It});var Dt=(Rt(Ct={},y,new W),Rt(Ct,"circle",new X),Rt(Ct,d,new C),Ct),Ht=new Y,Bt={tile:y,board:y,orientation:w,negativeTiles:!0,tap:n.noop,pressStart:n.noop,press:n.noop,draw:n.noop};var It=function(){function t(e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),["checkSettings","tap","doubletap","pressStart","press","move","zoom","pixelToTile","tileToPixel","getLocationSets","draw","resize","remap"].map(function(t){i[t]=i[t].bind(i)}),this.checkSettings(e),this.sketch=new g({element:this.settings.element,draw:this.draw,resize:this.resize}),this.onTap=new l(Object.assign({element:this.settings.element,tap:this.tap,doubletap:this.doubletap,pressStart:this.pressStart,press:this.press,move:this.move,zoom:this.zoom},r.pick(this.settings,["desktopPress","moveThreshold","doubletapThreshold","pressThreshold","wheelFactor"])));var n=function(t,e){switch(t){case y:switch(e){case w:return Ot;case T:return At}case d:switch(e){case w:return $;case T:return at}}}(this.settings.board,this.settings.orientation);this.cartographer=new n(Object.assign(this.sketch.getSize(),r.pick(this.settings,["adjustScaleMin","centerX","centerY","height","negativeTiles","radius","scale","width","wrap"])))}return qt(t,null,[{key:"TILE_STYLES",get:function(){return m}},{key:"BOARD_STYLES",get:function(){return b}},{key:"ORIENTATION_STYLES",get:function(){return x}},{key:"DRAW_STYLES",get:function(){return k}},{key:"TILES",get:function(){return Dt}},{key:"Cell",get:function(){return E}},{key:"Shapes",get:function(){return Ht}},{key:"utils",get:function(){return n}},{key:"funky",get:function(){return r}}]),qt(t,[{key:"checkSettings",value:function(t){this.settings=Object.assign({},Bt,t),this.settings.element=this.settings.element instanceof HTMLElement?this.settings.element:document.querySelector(this.settings.element),this.settings.radius&&(this.settings.height=2*this.settings.radius+1,this.settings.width=2*this.settings.radius+1),this.settings.negativeTiles&&(this.settings.height&&this.settings.height%2==0&&this.settings.height++,this.settings.width&&this.settings.width%2==0&&this.settings.width++)}},{key:"tap",value:function(t){var e=new p(t.offsetX,t.offsetY),i=this.cartographer.pixelToTile(e),n=this.cartographer.teleport(i);this.interacted=!0,this.settings.tap({event:t,mapTile:n,point:e,tile:i})}},{key:"doubletap",value:function(t){console.log("DOUBLETAP",t);var e=new p(t.offsetX,t.offsetY),i=this.cartographer.pixelToTile(e),n=this.cartographer.teleport(i);this.interacted=!0;var r={event:t,map:map,mapTile:n,point:e,tile:i};console.log(r)}},{key:"pressStart",value:function(t){var e=new p(t.offsetX,t.offsetY),i=this.cartographer.pixelToTile(e),n=this.cartographer.teleport(i);this.interacted=!0,this.settings.pressStart({event:t,mapTile:n,point:e,tile:i})}},{key:"press",value:function(t){var e=new p(t.offsetX,t.offsetY),i=this.cartographer.pixelToTile(e),n=this.cartographer.teleport(i);this.interacted=!0,this.settings.press({event:t,mapTile:n,point:e,tile:i})}},{key:"move",value:function(t){return this.cartographer.move(t)}},{key:"zoom",value:function(t){this.cartographer.zoom(t)}},{key:"pixelToTile",value:function(t,e){return this.cartographer.pixelToTile(t,e)}},{key:"tileToPixel",value:function(t){return this.cartographer.tileToPixel(t)}},{key:"newLocation",value:function(t){var e=this;this.lastLocation=this.lastLocation||{};var i=n.extend({originX:this.cartographer.getOriginX(),originY:this.cartographer.getOriginY(),scaleOrig:this.cartographer.getScale()},t),o=r.reduce(i,function(t,i,n){return t||e.lastLocation[n]!==i},!1);return this.lastLocation=i,o}},{key:"getLocationSets",value:function(t){var e=t.upperLeftX,i=t.upperLeftY,n=t.lowerRightX,r=t.lowerRightY,o=new p(e,i),a=new p(n,0),s=new p(0,r),u=new p(n,r);return this.cartographer.boundingBox(o,a,s,u)}},{key:"draw",value:function(t){var e=t.canvas,i=e.height,n=e.width,r={upperLeftX:0,upperLeftY:0,lowerRightX:n,lowerRightY:i},o=this.interacted;this.interacted=!1;var a=this.newLocation(r);return this.locationSets=a?this.getLocationSets(r):this.locationSets,this.settings.draw({context:t,height:i,width:n,scale:this.cartographer.getScale(),lastNow:t.lastUTC,now:t.utc,interacted:o,moved:a,locationSets:this.locationSets})}},{key:"resize",value:function(t){var e=this.cartographer.getOriginX(),i=this.cartographer.getOriginY(),n=this.cartographer.getScale(),r=Object.assign({},t,{deltaX:t.deltaX/2,deltaY:t.deltaY/2});this.move(r),this.cartographer.checkScale(t.height,t.width);var o=t.width/2,a=t.height/2,s=this.cartographer.getScale(),u={deltaX:(o-e)/n*(n-s),deltaY:(a-i)/n*(n-s),height:t.height,width:t.width};this.move(u)}},{key:"remap",value:function(t){var e=t.height,i=t.width;this.cartographer.remap(Object.assign({height:e,width:i},this.sketch.getSize()))}}]),t}()}])); |