// https://d3js.org/d3-zoom/ Version 1.7.1. Copyright 2017 Mike Bostock. !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-dispatch"),require("d3-drag"),require("d3-interpolate"),require("d3-selection"),require("d3-transition")):"function"==typeof define&&define.amd?define(["exports","d3-dispatch","d3-drag","d3-interpolate","d3-selection","d3-transition"],n):n(t.d3=t.d3||{},t.d3,t.d3,t.d3,t.d3,t.d3)}(this,function(t,n,e,o,i,r){"use strict";function u(t,n,e){this.target=t,this.type=n,this.transform=e}function h(t,n,e){this.k=t,this.x=n,this.y=e}function s(t){return t.__zoom||y}function c(){i.event.stopImmediatePropagation()}function a(){return!i.event.button}function f(){var t,n,e=this;return e instanceof SVGElement?(t=(e=e.ownerSVGElement||e).width.baseVal.value,n=e.height.baseVal.value):(t=e.clientWidth,n=e.clientHeight),[[0,0],[t,n]]}function l(){return this.__zoom||y}function m(){return-i.event.deltaY*(i.event.deltaMode?120:1)/500}function p(){return"ontouchstart"in this}function d(t,n,e){var o=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],r=t.invertY(n[0][1])-e[0][1],u=t.invertY(n[1][1])-e[1][1];return t.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),u>r?(r+u)/2:Math.min(0,r)||Math.max(0,u))}var v=function(t){return function(){return t}};h.prototype={constructor:h,scale:function(t){return 1===t?this:new h(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new h(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var y=new h(1,0,0);s.prototype=h.prototype;var z=function(){i.event.preventDefault(),i.event.stopImmediatePropagation()};t.zoom=function(){function t(t){t.property("__zoom",l).on("wheel.zoom",M).on("mousedown.zoom",T).on("dblclick.zoom",b).filter(j).on("touchstart.zoom",Y).on("touchmove.zoom",X).on("touchend.zoom touchcancel.zoom",q).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function s(t,n){return(n=Math.max(B[0],Math.min(B[1],n)))===t.k?t:new h(n,t.x,t.y)}function _(t,n,e){var o=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return o===t.x&&i===t.y?t:new h(t.k,o,i)}function g(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function k(t,n,e){t.on("start.zoom",function(){x(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).end()}).tween("zoom",function(){var t=this,o=arguments,i=x(t,o),r=I.apply(t,o),u=e||g(r),s=Math.max(r[1][0]-r[0][0],r[1][1]-r[0][1]),c=t.__zoom,a="function"==typeof n?n.apply(t,o):n,f=K(c.invert(u).concat(s/c.k),a.invert(u).concat(s/a.k));return function(t){if(1===t)t=a;else{var n=f(t),e=s/n[2];t=new h(e,u[0]-n[0]*e,u[1]-n[1]*e)}i.zoom(null,t)}})}function x(t,n){for(var e,o=0,i=O.length;oC}t.zoom("mouse",P(_(t.that.__zoom,t.mouse[0]=i.mouse(t.that),t.mouse[1]),t.extent,G))},!0).on("mouseup.zoom",function(){n.on("mousemove.zoom mouseup.zoom",null),e.dragEnable(i.event.view,t.moved),z(),t.end()},!0),o=i.mouse(this),u=i.event.clientX,h=i.event.clientY;e.dragDisable(i.event.view),c(),t.mouse=[o,this.__zoom.invert(o)],r.interrupt(this),t.start()}}function b(){if(V.apply(this,arguments)){var n=this.__zoom,e=i.mouse(this),o=n.invert(e),r=n.k*(i.event.shiftKey?.5:2),u=P(_(s(n,r),e,o),I.apply(this,arguments),G);z(),H>0?i.select(this).transition().duration(H).call(k,u,e):i.select(this).call(t.transform,u)}}function Y(){if(V.apply(this,arguments)){var t,n,e,o,u=x(this,arguments),h=i.event.changedTouches,s=h.length;for(c(),n=0;n