text: // https://github.com/johnwalley/d3-simple-slider v1.5.5 Copyright 2020 John Walley
  !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-array"),require("d3-axis"),require("d3-dispatch"),require("d3-drag"),require("d3-ease"),require("d3-scale"),require("d3-selection"),require("d3-transition")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-axis","d3-dispatch","d3-drag","d3-ease","d3-scale","d3-selection","d3-transition"],e):e((t=t||self).d3=t.d3||{},t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3)}(this,(function(t,e,a,r,n,l,i,u){"use strict";function s(t){return"translate("+t+",0)"}function c(t){return"translate(0,"+t+")"}function o(t,o){o=void 0!==o?o:null;var d=[0],f=[0],m=[0,10],p=100,g=100,h=!0,v="M-5.5,-5.5v10l6,5.5l6,-5.5v-10z",k=null,x=null,y=null,w=null,A=null,b=null,D=null,M=r.dispatch("onchange","start","end","drag"),q=null,z=null,L=null,F=1===t||4===t?-1:1,V=4===t||2===t?-1:1,O=4===t||2===t?"y":"x",P=4===t||2===t?"x":"y",R=1===t||3===t?s:c,T=1===t||3===t?c:s,j=null;switch(t){case 1:j=a.axisTop;break;case 2:j=a.axisRight;break;case 3:j=a.axisBottom;break;case 4:j=a.axisLeft}var B=null,H=null;function Q(a){q=a.selection?a.selection():a,o=o?o.range([e.min(o.range()),e.min(o.range())+(1===t||3===t?p:g)]):(o=m[0]instanceof Date?i.scaleTime():i.scaleLinear()).domain(m).range(1===t||3===t?[0,p]:[g,0]).clamp(!0),z=i.scaleLinear().range(o.range()).domain(o.range()).clamp(!0),d=d.map((function(t){return i.scaleLinear().range(m).domain(m).clamp(!0)(t)})),w=w||o.tickFormat(),b=b||w||o.tickFormat(),q.selectAll(".axis").data([null]).enter().append("g").attr("transform",T(7*F)).attr("class","axis");var r=q.selectAll(".slider").data([null]),l=r.enter().append("g").attr("class","slider").attr("cursor",1===t||3===t?"ew-resize":"ns-resize").call(n.drag().on("start",(function(){u.select(this).classed("active",!0);var a=z(3===t||1===t?u.event.x:u.event.y);L=d[0]===m[0]&&d[1]===m[0]?1:d[0]===m[1]&&d[1]===m[1]?0:e.scan(d.map((function(t){return Math.abs(t-_(o.invert(a)))})));var n=d.map((function(t,e){return e===L?_(o.invert(a)):t}));C(n),M.call("start",r,1===n.length?n[0]:n),E(n,!0)})).on("drag",(function(){var e=c(z(3===t||1===t?u.event.x:u.event.y));C(e),M.call("drag",r,1===e.length?e[0]:e),E(e,!0)})).on("end",(function(){u.select(this).classed("active",!1);var e=c(z(3===t||1===t?u.event.x:u.event.y));C(e),M.call("end",r,1===e.length?e[0]:e),E(e,!0),L=null})));l.append("line").attr("class","track").attr(O+"1",o.range()[0]-8*V).attr("stroke","#bbb").attr("stroke-width",6).attr("stroke-linecap","round"),l.append("line").attr("class","track-inset").attr(O+"1",o.range()[0]-8*V).attr("stroke","#eee").attr("stroke-width",4).attr("stroke-linecap","round"),D&&l.append("line").attr("class","track-fill").attr(O+"1",1===d.length?o.range()[0]-8*V:o(d[0])).attr("stroke",D).attr("stroke-width",4).attr("stroke-linecap","round"),l.append("line").attr("class","track-overlay").attr(O+"1",o.range()[0]-8*V).attr("stroke","transparent").attr("stroke-width",40).attr("stroke-linecap","round").merge(r.select(".track-overlay"));var s=l.selectAll(".parameter-value").data(d).enter().append("g").attr("class","parameter-value").attr("transform",(function(t){return R(o(t))})).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle");function c(t){var e=_(o.invert(t));return d.map((function(t,a){return 2===d.length?a===L?0===L?Math.min(e,_(d[1])):Math.max(e,_(d[0])):t:a===L?e:t}))}s.append("path").attr("transform","rotate("+90*(t+1)+")").attr("d",v).attr("class","handle").attr("aria-label","handle").attr("aria-valuemax",m[1]).attr("aria-valuemin",m[0]).attr("aria-valuenow",d).attr("aria-orientation",4===t||2===t?"vertical":"horizontal").attr("focusable","true").attr("tabindex",0).attr("fill","white").attr("stroke","#777").on("keydown",(function(t,e){var a=k||(m[1]-m[0])/100;function r(t){return d.map((function(a,r){return 2===d.length?r===e?0===e?Math.min(t,_(d[1])):Math.max(t,_(d[0])):a:r===e?t:a}))}switch(u.event.key){case"ArrowLeft":case"ArrowDown":Q.value(r(+d[e]-a)),u.event.preventDefault();break;case"PageDown":Q.value(r(+d[e]-2*a)),u.event.preventDefault();break;case"ArrowRight":case"ArrowUp":Q.value(r(+d[e]+a)),u.event.preventDefault();break;case"PageUp":Q.value(r(+d[e]+2*a)),u.event.preventDefault();break;case"Home":Q.value(r(m[0])),u.event.preventDefault();break;case"End":Q.value(r(m[1])),u.event.preventDefault()}})),h&&1===d.length&&s.append("text").attr("font-size",10).attr(P,27*F).attr("dy",1===t?"0em":3===t?".71em":".32em").text(w(d[0])),a.select(".track").attr(O+"2",o.range()[1]+8*V),a.select(".track-inset").attr(O+"2",o.range()[1]+8*V),D&&a.select(".track-fill").attr(O+"2",1===d.length?o(d[0]):o(d[1])),a.select(".track-overlay").attr(O+"2",o.range()[1]+8*V),a.select(".axis").call(j(o).tickFormat(w).ticks(A).tickValues(x)),q.select(".axis").select(".domain").remove(),a.select(".axis").attr("transform",T(7*F)),a.selectAll(".axis text").attr("fill","#aaa").attr(P,20*F).attr("dy",1===t?"0em":3===t?".71em":".32em").attr("text-anchor",2===t?"start":4===t?"end":"middle"),a.selectAll(".axis line").attr("stroke","#aaa"),a.selectAll(".parameter-value").attr("transform",(function(t){return R(o(t))})),U(),H=q.select(".parameter-value text"),B=q.select(".track-fill")}function U(){if(q&&h&&1===d.length){var t=[];q.selectAll(".axis .tick").each((function(e){t.push(Math.abs(e-d[0]))}));var a=e.scan(t);q.selectAll(".axis .tick text").attr("opacity",(function(t,e){return e===a?0:1}))}}function _(t){if(k){var a=(t-m[0])%k,r=t-a;return 2*a>k&&(r+=k),t instanceof Date?new Date(r):r}if(y){var n=e.scan(y.map((function(e){return Math.abs(t-e)})));return y[n]}return t}function E(t,e){(d[0]!==t[0]||d.length>1&&d[1]!==t[1])&&(d=t,e&&M.call("onchange",Q,1===t.length?t[0]:t),U())}function C(t,e){q&&((e=void 0!==e&&e)?(q.selectAll(".parameter-value").data(t).transition().ease(l.easeQuadOut).duration(200).attr("transform",(function(t){return R(o(t))})).select(".handle").attr("aria-valuenow",(function(t){return t})),D&&B.transition().ease(l.easeQuadOut).duration(200).attr(O+"1",1===d.length?o.range()[0]-8*F:o(t[0])).attr(O+"2",1===d.length?o(t[0]):o(t[1]))):(q.selectAll(".parameter-value").data(t).attr("transform",(function(t){return R(o(t))})).select(".handle").attr("aria-valuenow",(function(t){return t})),D&&B.attr(O+"1",1===d.length?o.range()[0]-8*F:o(t[0])).attr(O+"2",1===d.length?o(t[0]):o(t[1]))),h&&H.text(b(t[0])))}return o&&(m=[e.min(o.domain()),e.max(o.domain())],1===t||3===t?p=e.max(o.range())-e.min(o.range()):g=e.max(o.range())-e.min(o.range()),o=o.clamp(!0)),Q.min=function(t){return arguments.length?(m[0]=t,Q):m[0]},Q.max=function(t){return arguments.length?(m[1]=t,Q):m[1]},Q.domain=function(t){return arguments.length?(m=t,Q):m},Q.width=function(t){return arguments.length?(p=t,Q):p},Q.height=function(t){return arguments.length?(g=t,Q):g},Q.tickFormat=function(t){return arguments.length?(w=t,Q):w},Q.displayFormat=function(t){return arguments.length?(b=t,Q):b},Q.ticks=function(t){return arguments.length?(A=t,Q):A},Q.value=function(t){if(!arguments.length)return 1===d.length?d[0]:d;var e=Array.isArray(t)?t:[t];e.sort((function(t,e){return t-e}));var a=e.map(o).map(z),r=a.map(o.invert).map(_);return C(r,!0),E(r,!0),Q},Q.silentValue=function(t){if(!arguments.length)return 1===d.length?d[0]:d;var e=Array.isArray(t)?t:[t];e.sort((function(t,e){return t-e}));var a=e.map(o).map(z),r=a.map(o.invert).map(_);return C(r,!1),E(r,!1),Q},Q.default=function(t){if(!arguments.length)return 1===f.length?f[0]:f;var e=Array.isArray(t)?t:[t];return e.sort((function(t,e){return t-e})),f=e,d=e,Q},Q.step=function(t){return arguments.length?(k=t,Q):k},Q.tickValues=function(t){return arguments.length?(x=t,Q):x},Q.marks=function(t){return arguments.length?(y=t,Q):y},Q.handle=function(t){return arguments.length?(v=t,Q):v},Q.displayValue=function(t){return arguments.length?(h=t,Q):h},Q.fill=function(t){return arguments.length?(D=t,Q):D},Q.on=function(){var t=M.on.apply(M,arguments);return t===M?Q:t},Q}t.sliderBottom=function(t){return o(3,t)},t.sliderHorizontal=function(t){return o(3,t)},t.sliderLeft=function(t){return o(4,t)},t.sliderRight=function(t){return o(2,t)},t.sliderTop=function(t){return o(1,t)},t.sliderVertical=function(t){return o(4,t)},Object.defineProperty(t,"__esModule",{value:!0})}));
  