import{g as e}from"./index-B1MHyEgd.js";function t(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(i){if("default"!==i&&!(i in e)){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})}),Object.freeze(e)}var i,s={exports:{}};var o,r=i?s.exports:(i=1,o="undefined"==typeof window?s.exports:window,s.exports=(e=>(()=>{var t={944:t=>{t.exports=e}},i={};function s(e){var o=i[e];if(void 0!==o)return o.exports;var r=i[e]={exports:{}};return t[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};s.d(o,{default:()=>b});var r=s(944),n=s.n(r);let{addEvent:a,clamp:h,isNumber:l,relativeLength:d}=n();class p{constructor(e){this.init(e)}init(e,t){this.axis=e,this.options=e.options.resize||{},this.render(),t||this.addMouseEvents()}render(){let e=this.axis,t=e.chart,i=this.options,s=i.x||0,o=i.y,r=h(e.top+e.height+o,t.plotTop,t.plotTop+t.plotHeight),n={};t.styledMode||(n={cursor:i.cursor,stroke:i.lineColor,"stroke-width":i.lineWidth,dashstyle:i.lineDashStyle}),this.lastPos=r-o,this.controlLine||(this.controlLine=t.renderer.path().addClass("highcharts-axis-resizer")),this.controlLine.add(e.axisGroup);let a=t.styledMode?this.controlLine.strokeWidth():i.lineWidth;n.d=t.renderer.crispLine([["M",e.left+s,r],["L",e.left+e.width+s,r]],a),this.controlLine.attr(n)}addMouseEvents(){let e,t,i,s=this,o=s.controlLine.element,r=s.axis.chart.container,n=[];s.mouseMoveHandler=e=e=>s.onMouseMove(e),s.mouseUpHandler=t=e=>s.onMouseUp(e),s.mouseDownHandler=i=()=>s.onMouseDown(),n.push(a(r,"mousemove",e),a(r.ownerDocument,"mouseup",t),a(o,"mousedown",i),a(r,"touchmove",e),a(r.ownerDocument,"touchend",t),a(o,"touchstart",i)),s.eventsToUnbind=n}onMouseMove(e){if(!e.touches||0!==e.touches[0].pageX){let t=this.axis.chart.pointer;this.grabbed&&t&&(this.hasDragged=!0,this.updateAxes(t.normalize(e).chartY-(this.options.y||0)))}}onMouseUp(e){let t=this.axis.chart.pointer;this.hasDragged&&t&&this.updateAxes(t.normalize(e).chartY-(this.options.y||0)),this.grabbed=this.hasDragged=this.axis.chart.activeResizer=void 0}onMouseDown(){this.axis.chart.pointer?.reset(!1,0),this.grabbed=this.axis.chart.activeResizer=!0}updateAxes(e){let t=this.axis.chart,i=this.options.controlledAxis,s=0===i.next.length?[t.yAxis.indexOf(this.axis)+1]:i.next,o=[this.axis].concat(i.prev),r=[],n=t.plotTop,a=t.plotHeight,p=n+a,c=e=>100*e/a+"%",u=(e,t,i)=>Math.round(h(e,t,i)),f=!1,x=(e=h(e,n,p))-this.lastPos;if(x*x<1)return;let g=!0;for(let i of[o,s])for(let o of i){let h,v,y=l(o)?t.yAxis[o]:g?o:t.get(o),m=y&&y.options;if(!m||m.isInternal){g=!1;continue}v=y.top;let z=Math.round(d(m.minLength||NaN,a)),b=Math.round(d(m.maxLength||NaN,a));if(g||i!==s)(h=u(e-v,z,b))===b&&(f=!0),e=v+h,r.push({axis:y,options:{height:c(h)}});else{if(x=e-this.lastPos,h=u(y.len-x,z,b),(v=y.top+x)+h>p){let t=p-h-v;e+=t,v+=t}v<n&&(v=n)+h>p&&(h=a),h===z&&(f=!0),r.push({axis:y,options:{top:c(v-n),height:c(h)}})}g=!1}if(!f){for(let e of r)e.axis.update(e.options,!1);t.redraw(!1)}}destroy(){let e=this.axis;for(let t of(delete e.resizer,this.eventsToUnbind&&this.eventsToUnbind.forEach(e=>e()),this.controlLine.destroy(),Object.keys(this)))this[t]=null}}p.resizerOptions={minLength:"10%",maxLength:"100%",resize:{controlledAxis:{next:[],prev:[]},enabled:!1,cursor:"ns-resize",lineColor:"#cccccc",lineDashStyle:"Solid",lineWidth:4,x:0,y:0}};let{defaultOptions:c}=n(),{addEvent:u,merge:f,wrap:x}=n();function g(){let e=this.resizer,t=this.options.resize;if(t){let i=!1!==t.enabled;e?i?e.init(this,!0):e.destroy():i&&(this.resizer=new p(this))}}function v(e){!e.keepEvents&&this.resizer&&this.resizer.destroy()}function y(e){this.chart.activeResizer||e.apply(this,[].slice.call(arguments,1))}function m(e){this.chart.activeResizer||e.apply(this,[].slice.call(arguments,1))}let z=n();z.AxisResizer=p,function(e,t){e.keepProps.includes("resizer")||(f(!0,c.yAxis,p.resizerOptions),e.keepProps.push("resizer"),u(e,"afterRender",g),u(e,"destroy",v),x(t.prototype,"runPointActions",m),x(t.prototype,"drag",y))}(z.Axis,z.Pointer);let b=n();return o.default})())(o._Highcharts)),n=t({__proto__:null,default:e(r)},[r]);export{n as d};
//# sourceMappingURL=drag-panes-DDnXSwLH.js.map
