@wistia/vhs 2.32.0-beta.ebf6f76e.fd86589 → 2.32.0-beta.f2d8f1fc.6e408f5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +2 -2
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license VHS v2.32.0-beta.
|
|
3
|
+
* @license VHS v2.32.0-beta.f2d8f1fc.6e408f5
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2021-2024, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -2455,7 +2455,7 @@
|
|
|
2455
2455
|
white-space: nowrap;
|
|
2456
2456
|
|
|
2457
2457
|
&&::before {
|
|
2458
|
-
content: attr(title);
|
|
2458
|
+
content: attr(data-title);
|
|
2459
2459
|
display: block;
|
|
2460
2460
|
font-weight: bold;
|
|
2461
2461
|
height: 0;
|
|
@@ -2463,7 +2463,7 @@
|
|
|
2463
2463
|
visibility: hidden;
|
|
2464
2464
|
width: calc(100% + 40px);
|
|
2465
2465
|
}
|
|
2466
|
-
`,tf=({align:e="left",buttonVariant:t="secondary",earliestDate:r,latestDate:n,format:o=bj,footerText:a,onChange:s,presets:u=[],range:l={end:new Date,start:new Date},shouldPreventFuture:c=!1})=>{let[p,m]=(0,An.useState)(l),[h,g]=(0,An.useState)(!1),[v,f]=(0,An.useState)(!0),[b,C]=(0,An.useState)("end"),[x,D]=(0,An.useState)([]),E=vr();return(0,An.useEffect)(()=>{m(l)},[l]),(0,An.useEffect)(()=>{let w=()=>{g(!1),m(l)};return h&&window.addEventListener("click",w),()=>{window.removeEventListener("click",w)}},[h,l,m]),(0,_e.jsxs)(xj,{"data-testid":"rangeselector-test-identifer",onClick:w=>w.stopPropagation(),children:[(0,_e.jsx)(wj,{"data-testid":"trigger",icon:(0,_e.jsx)(De,{size:"sm",type:"caret-down"}),iconPosition:"end",inputButtonOverride:t==="input",onClick:()=>g(!h),variant:t==="input"?"tertiary":t,children:o(l)}),h?(0,_e.jsxs)(Sj,{align:e,hasPresets:!!u.length,children:[(0,_e.jsxs)(Tj,{children:[!!u.length&&(0,_e.jsx)(Zi,{"data-testid":"presets",style:{marginBottom:0,borderRight:`1px solid ${E.color.grey400}`,padding:"12px"},variant:"unbulleted",children:u.map(({label:w,value:T,tooltipText:F})=>(0,_e.jsx)(mo,{children:(0,_e.jsx)(Ej,{"data-testid":w?.replaceAll(" ","_"),isActive:yj(p,T),onClick:()=>{m(T)},children:(0,_e.jsxs)($j,{title:`${w}___`,children:[w," ",F!==void 0?(0,_e.jsx)(vj,{tooltipText:F}):null]})})},w))}),(0,_e.jsx)(Pj,{children:(0,_e.jsxs)(Cj,{children:[(0,_e.jsx)(Qi,{earliestDate:r,latestDate:n,onChange:w=>{m(w)},onErrorChange:D,onSelectedRangePartChange:C,range:p,shouldPreventFuture:c,width:"100%"}),(0,_e.jsx)(Yi,{earliestDate:r,latestDate:n,onChange:w=>{m(w)},onIsValidChange:f,range:p,rangePartToShow:b,shouldPreventFuture:c})]})})]}),(0,_e.jsx)(Dj,{}),(0,_e.jsxs)(Aj,{children:[(0,_e.jsx)("div",{children:a}),(0,_e.jsxs)(Gr,{align:"right",children:[(0,_e.jsx)(qe,{onClick:()=>{m(l),g(!1)},style:{marginLeft:0},variant:"secondary",children:"Cancel"}),(0,_e.jsx)(qe,{"data-testid":"apply-button",disabled:!!x.length||!v,onMouseUp:()=>{s&&s(p),g(!1)},children:"Apply"})]})]})]}):null]})};tf.displayName="RangeSelector_VHS";i();var ts=G(require("styled-components"));i();i();i();i();function Fu(e,t){return Fu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Fu(e,t)}function V3(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Fu(e,t)}var ma=G(require("react"),1);function z3(e){return e&&e.stopPropagation&&e.stopPropagation(),e&&e.preventDefault&&e.preventDefault(),!1}function _3(e){return e==null?[]:Array.isArray(e)?e.slice():[e]}function rf(e){return e!==null&&e.length===1?e[0]:e.slice()}function nf(e){Object.keys(e).forEach(t=>{typeof document<"u"&&document.addEventListener(t,e[t],!1)})}function da(e,t){return H3(function(r,n){let o=r;return o<=n.min&&(o=n.min),o>=n.max&&(o=n.max),o}(e,t),t)}function H3(e,t){let r=(e-t.min)%t.step,n=e-r;return 2*Math.abs(r)>=t.step&&(n+=r>0?t.step:-t.step),parseFloat(n.toFixed(5))}var G3=function(e){function t(n){var o;(o=e.call(this,n)||this).onKeyUp=()=>{o.onEnd()},o.onMouseUp=()=>{o.onEnd(o.getMouseEventMap())},o.onTouchEnd=u=>{u.preventDefault(),o.onEnd(o.getTouchEventMap())},o.onBlur=()=>{o.setState({index:-1},o.onEnd(o.getKeyDownEventMap()))},o.onMouseMove=u=>{o.setState({pending:!0});let l=o.getMousePosition(u),c=o.getDiffPosition(l[0]),p=o.getValueFromPosition(c);o.move(p)},o.onTouchMove=u=>{if(u.touches.length>1)return;o.setState({pending:!0});let l=o.getTouchPosition(u);if(o.isScrolling===void 0){let m=l[0]-o.startPosition[0],h=l[1]-o.startPosition[1];o.isScrolling=Math.abs(h)>Math.abs(m)}if(o.isScrolling)return void o.setState({index:-1});let c=o.getDiffPosition(l[0]),p=o.getValueFromPosition(c);o.move(p)},o.onKeyDown=u=>{if(!(u.ctrlKey||u.shiftKey||u.altKey||u.metaKey))switch(o.setState({pending:!0}),u.key){case"ArrowLeft":case"ArrowDown":case"Left":case"Down":u.preventDefault(),o.moveDownByStep();break;case"ArrowRight":case"ArrowUp":case"Right":case"Up":u.preventDefault(),o.moveUpByStep();break;case"Home":u.preventDefault(),o.move(o.props.min);break;case"End":u.preventDefault(),o.move(o.props.max);break;case"PageDown":u.preventDefault(),o.moveDownByStep(o.props.pageFn(o.props.step));break;case"PageUp":u.preventDefault(),o.moveUpByStep(o.props.pageFn(o.props.step))}},o.onSliderMouseDown=u=>{if(!o.props.disabled&&u.button!==2){if(o.setState({pending:!0}),!o.props.snapDragDisabled){let l=o.getMousePosition(u);o.forceValueFromPosition(l[0],c=>{o.start(c,l[0]),nf(o.getMouseEventMap())})}z3(u)}},o.onSliderClick=u=>{if(!o.props.disabled&&o.props.onSliderClick&&!o.hasMoved){let l=o.getMousePosition(u),c=da(o.calcValue(o.calcOffsetFromPosition(l[0])),o.props);o.props.onSliderClick(c)}},o.createOnKeyDown=u=>l=>{o.props.disabled||(o.start(u),nf(o.getKeyDownEventMap()),z3(l))},o.createOnMouseDown=u=>l=>{if(o.props.disabled||l.button===2)return;o.setState({pending:!0});let c=o.getMousePosition(l);o.start(u,c[0]),nf(o.getMouseEventMap()),z3(l)},o.createOnTouchStart=u=>l=>{if(o.props.disabled||l.touches.length>1)return;o.setState({pending:!0});let c=o.getTouchPosition(l);o.startPosition=c,o.isScrolling=void 0,o.start(u,c[0]),nf(o.getTouchEventMap()),function(p){p.stopPropagation&&p.stopPropagation()}(l)},o.handleResize=()=>{let u=window.setTimeout(()=>{o.pendingResizeTimeouts.shift(),o.resize()},0);o.pendingResizeTimeouts.push(u)},o.renderThumb=(u,l)=>{let c=o.props.thumbClassName+" "+o.props.thumbClassName+"-"+l+" "+(o.state.index===l?o.props.thumbActiveClassName:""),p={ref:h=>{o["thumb"+l]=h},key:o.props.thumbClassName+"-"+l,className:c,style:u,onMouseDown:o.createOnMouseDown(l),onTouchStart:o.createOnTouchStart(l),onFocus:o.createOnKeyDown(l),tabIndex:0,role:"slider","aria-orientation":o.props.orientation,"aria-valuenow":o.state.value[l],"aria-valuemin":o.props.min,"aria-valuemax":o.props.max,"aria-label":Array.isArray(o.props.ariaLabel)?o.props.ariaLabel[l]:o.props.ariaLabel,"aria-labelledby":Array.isArray(o.props.ariaLabelledby)?o.props.ariaLabelledby[l]:o.props.ariaLabelledby,"aria-disabled":o.props.disabled},m={index:l,value:rf(o.state.value),valueNow:o.state.value[l]};return o.props.ariaValuetext&&(p["aria-valuetext"]=typeof o.props.ariaValuetext=="string"?o.props.ariaValuetext:o.props.ariaValuetext(m)),o.props.renderThumb(p,m)},o.renderTrack=(u,l,c)=>{let p={key:o.props.trackClassName+"-"+u,className:o.props.trackClassName+" "+o.props.trackClassName+"-"+u,style:o.buildTrackStyle(l,o.state.upperBound-c)},m={index:u,value:rf(o.state.value)};return o.props.renderTrack(p,m)};let a=_3(n.value);a.length||(a=_3(n.defaultValue)),o.pendingResizeTimeouts=[];let s=[];for(let u=0;u<a.length;u+=1)a[u]=da(a[u],n),s.push(u);return o.resizeObserver=null,o.resizeElementRef=ma.default.createRef(),o.state={index:-1,upperBound:0,sliderLength:0,value:a,zIndices:s},o}V3(t,e);var r=t.prototype;return r.componentDidMount=function(){typeof window<"u"&&(this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.resizeElementRef.current),this.resize())},t.getDerivedStateFromProps=function(n,o){let a=_3(n.value);return a.length?o.pending?null:{value:a.map(s=>da(s,n))}:null},r.componentDidUpdate=function(){this.state.upperBound===0&&this.resize()},r.componentWillUnmount=function(){this.clearPendingResizeTimeouts(),this.resizeObserver&&this.resizeObserver.disconnect()},r.onEnd=function(n){n&&function(o){Object.keys(o).forEach(a=>{typeof document<"u"&&document.removeEventListener(a,o[a],!1)})}(n),this.hasMoved&&this.fireChangeEvent("onAfterChange"),this.setState({pending:!1}),this.hasMoved=!1},r.getValue=function(){return rf(this.state.value)},r.getClosestIndex=function(n){let o=Number.MAX_VALUE,a=-1,{value:s}=this.state,u=s.length;for(let l=0;l<u;l+=1){let c=this.calcOffset(s[l]),p=Math.abs(n-c);p<o&&(o=p,a=l)}return a},r.getMousePosition=function(n){return[n["page"+this.axisKey()],n["page"+this.orthogonalAxisKey()]]},r.getTouchPosition=function(n){let o=n.touches[0];return[o["page"+this.axisKey()],o["page"+this.orthogonalAxisKey()]]},r.getKeyDownEventMap=function(){return{keydown:this.onKeyDown,keyup:this.onKeyUp,focusout:this.onBlur}},r.getMouseEventMap=function(){return{mousemove:this.onMouseMove,mouseup:this.onMouseUp}},r.getTouchEventMap=function(){return{touchmove:this.onTouchMove,touchend:this.onTouchEnd}},r.getValueFromPosition=function(n){let o=n/(this.state.sliderLength-this.state.thumbSize)*(this.props.max-this.props.min);return da(this.state.startValue+o,this.props)},r.getDiffPosition=function(n){let o=n-this.state.startPosition;return this.props.invert&&(o*=-1),o},r.resize=function(){let{slider:n,thumb0:o}=this;if(!n||!o)return;let a=this.sizeKey(),s=n.getBoundingClientRect(),u=n[a],l=s[this.posMaxKey()],c=s[this.posMinKey()],p=o.getBoundingClientRect()[a.replace("client","").toLowerCase()],m=u-p,h=Math.abs(l-c);this.state.upperBound===m&&this.state.sliderLength===h&&this.state.thumbSize===p||this.setState({upperBound:m,sliderLength:h,thumbSize:p})},r.calcOffset=function(n){let o=this.props.max-this.props.min;return o===0?0:(n-this.props.min)/o*this.state.upperBound},r.calcValue=function(n){return n/this.state.upperBound*(this.props.max-this.props.min)+this.props.min},r.calcOffsetFromPosition=function(n){let{slider:o}=this,a=o.getBoundingClientRect(),s=a[this.posMaxKey()],u=a[this.posMinKey()],l=n-(window["page"+this.axisKey()+"Offset"]+(this.props.invert?s:u));return this.props.invert&&(l=this.state.sliderLength-l),l-=this.state.thumbSize/2,l},r.forceValueFromPosition=function(n,o){let a=this.calcOffsetFromPosition(n),s=this.getClosestIndex(a),u=da(this.calcValue(a),this.props),l=this.state.value.slice();l[s]=u;for(let c=0;c<l.length-1;c+=1)if(l[c+1]-l[c]<this.props.minDistance)return;this.fireChangeEvent("onBeforeChange"),this.hasMoved=!0,this.setState({value:l},()=>{o(s),this.fireChangeEvent("onChange")})},r.clearPendingResizeTimeouts=function(){do{let n=this.pendingResizeTimeouts.shift();clearTimeout(n)}while(this.pendingResizeTimeouts.length)},r.start=function(n,o){let a=this["thumb"+n];a&&a.focus();let{zIndices:s}=this.state;s.splice(s.indexOf(n),1),s.push(n),this.setState(u=>({startValue:u.value[n],startPosition:o!==void 0?o:u.startPosition,index:n,zIndices:s}))},r.moveUpByStep=function(n){n===void 0&&(n=this.props.step);let o=this.state.value[this.state.index],a=da(this.props.invert&&this.props.orientation==="horizontal"?o-n:o+n,this.props);this.move(Math.min(a,this.props.max))},r.moveDownByStep=function(n){n===void 0&&(n=this.props.step);let o=this.state.value[this.state.index],a=da(this.props.invert&&this.props.orientation==="horizontal"?o+n:o-n,this.props);this.move(Math.max(a,this.props.min))},r.move=function(n){let o=this.state.value.slice(),{index:a}=this.state,{length:s}=o,u=o[a];if(n===u)return;this.hasMoved||this.fireChangeEvent("onBeforeChange"),this.hasMoved=!0;let{pearling:l,max:c,min:p,minDistance:m}=this.props;if(!l){if(a>0){let h=o[a-1];n<h+m&&(n=h+m)}if(a<s-1){let h=o[a+1];n>h-m&&(n=h-m)}}o[a]=n,l&&s>1&&(n>u?(this.pushSucceeding(o,m,a),function(h,g,v,f){for(let b=0;b<h;b+=1){let C=f-b*v;g[h-1-b]>C&&(g[h-1-b]=C)}}(s,o,m,c)):n<u&&(this.pushPreceding(o,m,a),function(h,g,v,f){for(let b=0;b<h;b+=1){let C=f+b*v;g[b]<C&&(g[b]=C)}}(s,o,m,p))),this.setState({value:o},this.fireChangeEvent.bind(this,"onChange"))},r.pushSucceeding=function(n,o,a){let s,u;for(s=a,u=n[s]+o;n[s+1]!==null&&u>n[s+1];s+=1,u=n[s]+o)n[s+1]=H3(u,this.props)},r.pushPreceding=function(n,o,a){for(let s=a,u=n[s]-o;n[s-1]!==null&&u<n[s-1];s-=1,u=n[s]-o)n[s-1]=H3(u,this.props)},r.axisKey=function(){return this.props.orientation==="vertical"?"Y":"X"},r.orthogonalAxisKey=function(){return this.props.orientation==="vertical"?"X":"Y"},r.posMinKey=function(){return this.props.orientation==="vertical"?this.props.invert?"bottom":"top":this.props.invert?"right":"left"},r.posMaxKey=function(){return this.props.orientation==="vertical"?this.props.invert?"top":"bottom":this.props.invert?"left":"right"},r.sizeKey=function(){return this.props.orientation==="vertical"?"clientHeight":"clientWidth"},r.fireChangeEvent=function(n){this.props[n]&&this.props[n](rf(this.state.value),this.state.index)},r.buildThumbStyle=function(n,o){let a={position:"absolute",touchAction:"none",willChange:this.state.index>=0?this.posMinKey():void 0,zIndex:this.state.zIndices.indexOf(o)+1};return a[this.posMinKey()]=n+"px",a},r.buildTrackStyle=function(n,o){let a={position:"absolute",willChange:this.state.index>=0?this.posMinKey()+","+this.posMaxKey():void 0};return a[this.posMinKey()]=n,a[this.posMaxKey()]=o,a},r.buildMarkStyle=function(n){var o;return(o={position:"absolute"})[this.posMinKey()]=n,o},r.renderThumbs=function(n){let{length:o}=n,a=[];for(let u=0;u<o;u+=1)a[u]=this.buildThumbStyle(n[u],u);let s=[];for(let u=0;u<o;u+=1)s[u]=this.renderThumb(a[u],u);return s},r.renderTracks=function(n){let o=[],a=n.length-1;o.push(this.renderTrack(0,0,n[0]));for(let s=0;s<a;s+=1)o.push(this.renderTrack(s+1,n[s],n[s+1]));return o.push(this.renderTrack(a+1,n[a],this.state.upperBound)),o},r.renderMarks=function(){let{marks:n}=this.props,o=this.props.max-this.props.min+1;return typeof n=="boolean"?n=Array.from({length:o}).map((a,s)=>s):typeof n=="number"&&(n=Array.from({length:o}).map((a,s)=>s).filter(a=>a%n==0)),n.map(parseFloat).sort((a,s)=>a-s).map(a=>{let s=this.calcOffset(a),u={key:a,className:this.props.markClassName,style:this.buildMarkStyle(s)};return this.props.renderMark(u)})},r.render=function(){let n=[],{value:o}=this.state,a=o.length;for(let c=0;c<a;c+=1)n[c]=this.calcOffset(o[c],c);let s=this.props.withTracks?this.renderTracks(n):null,u=this.renderThumbs(n),l=this.props.marks?this.renderMarks():null;return ma.default.createElement("div",{ref:c=>{this.slider=c,this.resizeElementRef.current=c},style:{position:"relative"},className:this.props.className+(this.props.disabled?" disabled":""),onMouseDown:this.onSliderMouseDown,onClick:this.onSliderClick},s,u,l)},t}(ma.default.Component);G3.displayName="ReactSlider",G3.defaultProps={min:0,max:100,step:1,pageFn:e=>10*e,minDistance:0,defaultValue:0,orientation:"horizontal",className:"slider",thumbClassName:"thumb",thumbActiveClassName:"active",trackClassName:"track",markClassName:"mark",withTracks:!0,pearling:!1,disabled:!1,snapDragDisabled:!1,invert:!1,marks:[],renderThumb:e=>ma.default.createElement("div",e),renderTrack:e=>ma.default.createElement("div",e),renderMark:e=>ma.default.createElement("span",e)};var j3=G3;var es=require("react/jsx-runtime"),Tw="4px",Oj=ts.css`
|
|
2466
|
+
`,tf=({align:e="left",buttonVariant:t="secondary",earliestDate:r,latestDate:n,format:o=bj,footerText:a,onChange:s,presets:u=[],range:l={end:new Date,start:new Date},shouldPreventFuture:c=!1})=>{let[p,m]=(0,An.useState)(l),[h,g]=(0,An.useState)(!1),[v,f]=(0,An.useState)(!0),[b,C]=(0,An.useState)("end"),[x,D]=(0,An.useState)([]),E=vr();return(0,An.useEffect)(()=>{m(l)},[l]),(0,An.useEffect)(()=>{let w=()=>{g(!1),m(l)};return h&&window.addEventListener("click",w),()=>{window.removeEventListener("click",w)}},[h,l,m]),(0,_e.jsxs)(xj,{"data-testid":"rangeselector-test-identifer",onClick:w=>w.stopPropagation(),children:[(0,_e.jsx)(wj,{"data-testid":"trigger",icon:(0,_e.jsx)(De,{size:"sm",type:"caret-down"}),iconPosition:"end",inputButtonOverride:t==="input",onClick:()=>g(!h),variant:t==="input"?"tertiary":t,children:o(l)}),h?(0,_e.jsxs)(Sj,{align:e,hasPresets:!!u.length,children:[(0,_e.jsxs)(Tj,{children:[!!u.length&&(0,_e.jsx)(Zi,{"data-testid":"presets",style:{marginBottom:0,borderRight:`1px solid ${E.color.grey400}`,padding:"12px"},variant:"unbulleted",children:u.map(({label:w,value:T,tooltipText:F})=>(0,_e.jsx)(mo,{children:(0,_e.jsx)(Ej,{"data-testid":w?.replaceAll(" ","_"),isActive:yj(p,T),onClick:()=>{m(T)},children:(0,_e.jsxs)($j,{"data-title":`${w}___`,children:[w," ",F!==void 0?(0,_e.jsx)(vj,{tooltipText:F}):null]})})},w))}),(0,_e.jsx)(Pj,{children:(0,_e.jsxs)(Cj,{children:[(0,_e.jsx)(Qi,{earliestDate:r,latestDate:n,onChange:w=>{m(w)},onErrorChange:D,onSelectedRangePartChange:C,range:p,shouldPreventFuture:c,width:"100%"}),(0,_e.jsx)(Yi,{earliestDate:r,latestDate:n,onChange:w=>{m(w)},onIsValidChange:f,range:p,rangePartToShow:b,shouldPreventFuture:c})]})})]}),(0,_e.jsx)(Dj,{}),(0,_e.jsxs)(Aj,{children:[(0,_e.jsx)("div",{children:a}),(0,_e.jsxs)(Gr,{align:"right",children:[(0,_e.jsx)(qe,{onClick:()=>{m(l),g(!1)},style:{marginLeft:0},variant:"secondary",children:"Cancel"}),(0,_e.jsx)(qe,{"data-testid":"apply-button",disabled:!!x.length||!v,onMouseUp:()=>{s&&s(p),g(!1)},children:"Apply"})]})]})]}):null]})};tf.displayName="RangeSelector_VHS";i();var ts=G(require("styled-components"));i();i();i();i();function Fu(e,t){return Fu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Fu(e,t)}function V3(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Fu(e,t)}var ma=G(require("react"),1);function z3(e){return e&&e.stopPropagation&&e.stopPropagation(),e&&e.preventDefault&&e.preventDefault(),!1}function _3(e){return e==null?[]:Array.isArray(e)?e.slice():[e]}function rf(e){return e!==null&&e.length===1?e[0]:e.slice()}function nf(e){Object.keys(e).forEach(t=>{typeof document<"u"&&document.addEventListener(t,e[t],!1)})}function da(e,t){return H3(function(r,n){let o=r;return o<=n.min&&(o=n.min),o>=n.max&&(o=n.max),o}(e,t),t)}function H3(e,t){let r=(e-t.min)%t.step,n=e-r;return 2*Math.abs(r)>=t.step&&(n+=r>0?t.step:-t.step),parseFloat(n.toFixed(5))}var G3=function(e){function t(n){var o;(o=e.call(this,n)||this).onKeyUp=()=>{o.onEnd()},o.onMouseUp=()=>{o.onEnd(o.getMouseEventMap())},o.onTouchEnd=u=>{u.preventDefault(),o.onEnd(o.getTouchEventMap())},o.onBlur=()=>{o.setState({index:-1},o.onEnd(o.getKeyDownEventMap()))},o.onMouseMove=u=>{o.setState({pending:!0});let l=o.getMousePosition(u),c=o.getDiffPosition(l[0]),p=o.getValueFromPosition(c);o.move(p)},o.onTouchMove=u=>{if(u.touches.length>1)return;o.setState({pending:!0});let l=o.getTouchPosition(u);if(o.isScrolling===void 0){let m=l[0]-o.startPosition[0],h=l[1]-o.startPosition[1];o.isScrolling=Math.abs(h)>Math.abs(m)}if(o.isScrolling)return void o.setState({index:-1});let c=o.getDiffPosition(l[0]),p=o.getValueFromPosition(c);o.move(p)},o.onKeyDown=u=>{if(!(u.ctrlKey||u.shiftKey||u.altKey||u.metaKey))switch(o.setState({pending:!0}),u.key){case"ArrowLeft":case"ArrowDown":case"Left":case"Down":u.preventDefault(),o.moveDownByStep();break;case"ArrowRight":case"ArrowUp":case"Right":case"Up":u.preventDefault(),o.moveUpByStep();break;case"Home":u.preventDefault(),o.move(o.props.min);break;case"End":u.preventDefault(),o.move(o.props.max);break;case"PageDown":u.preventDefault(),o.moveDownByStep(o.props.pageFn(o.props.step));break;case"PageUp":u.preventDefault(),o.moveUpByStep(o.props.pageFn(o.props.step))}},o.onSliderMouseDown=u=>{if(!o.props.disabled&&u.button!==2){if(o.setState({pending:!0}),!o.props.snapDragDisabled){let l=o.getMousePosition(u);o.forceValueFromPosition(l[0],c=>{o.start(c,l[0]),nf(o.getMouseEventMap())})}z3(u)}},o.onSliderClick=u=>{if(!o.props.disabled&&o.props.onSliderClick&&!o.hasMoved){let l=o.getMousePosition(u),c=da(o.calcValue(o.calcOffsetFromPosition(l[0])),o.props);o.props.onSliderClick(c)}},o.createOnKeyDown=u=>l=>{o.props.disabled||(o.start(u),nf(o.getKeyDownEventMap()),z3(l))},o.createOnMouseDown=u=>l=>{if(o.props.disabled||l.button===2)return;o.setState({pending:!0});let c=o.getMousePosition(l);o.start(u,c[0]),nf(o.getMouseEventMap()),z3(l)},o.createOnTouchStart=u=>l=>{if(o.props.disabled||l.touches.length>1)return;o.setState({pending:!0});let c=o.getTouchPosition(l);o.startPosition=c,o.isScrolling=void 0,o.start(u,c[0]),nf(o.getTouchEventMap()),function(p){p.stopPropagation&&p.stopPropagation()}(l)},o.handleResize=()=>{let u=window.setTimeout(()=>{o.pendingResizeTimeouts.shift(),o.resize()},0);o.pendingResizeTimeouts.push(u)},o.renderThumb=(u,l)=>{let c=o.props.thumbClassName+" "+o.props.thumbClassName+"-"+l+" "+(o.state.index===l?o.props.thumbActiveClassName:""),p={ref:h=>{o["thumb"+l]=h},key:o.props.thumbClassName+"-"+l,className:c,style:u,onMouseDown:o.createOnMouseDown(l),onTouchStart:o.createOnTouchStart(l),onFocus:o.createOnKeyDown(l),tabIndex:0,role:"slider","aria-orientation":o.props.orientation,"aria-valuenow":o.state.value[l],"aria-valuemin":o.props.min,"aria-valuemax":o.props.max,"aria-label":Array.isArray(o.props.ariaLabel)?o.props.ariaLabel[l]:o.props.ariaLabel,"aria-labelledby":Array.isArray(o.props.ariaLabelledby)?o.props.ariaLabelledby[l]:o.props.ariaLabelledby,"aria-disabled":o.props.disabled},m={index:l,value:rf(o.state.value),valueNow:o.state.value[l]};return o.props.ariaValuetext&&(p["aria-valuetext"]=typeof o.props.ariaValuetext=="string"?o.props.ariaValuetext:o.props.ariaValuetext(m)),o.props.renderThumb(p,m)},o.renderTrack=(u,l,c)=>{let p={key:o.props.trackClassName+"-"+u,className:o.props.trackClassName+" "+o.props.trackClassName+"-"+u,style:o.buildTrackStyle(l,o.state.upperBound-c)},m={index:u,value:rf(o.state.value)};return o.props.renderTrack(p,m)};let a=_3(n.value);a.length||(a=_3(n.defaultValue)),o.pendingResizeTimeouts=[];let s=[];for(let u=0;u<a.length;u+=1)a[u]=da(a[u],n),s.push(u);return o.resizeObserver=null,o.resizeElementRef=ma.default.createRef(),o.state={index:-1,upperBound:0,sliderLength:0,value:a,zIndices:s},o}V3(t,e);var r=t.prototype;return r.componentDidMount=function(){typeof window<"u"&&(this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.resizeElementRef.current),this.resize())},t.getDerivedStateFromProps=function(n,o){let a=_3(n.value);return a.length?o.pending?null:{value:a.map(s=>da(s,n))}:null},r.componentDidUpdate=function(){this.state.upperBound===0&&this.resize()},r.componentWillUnmount=function(){this.clearPendingResizeTimeouts(),this.resizeObserver&&this.resizeObserver.disconnect()},r.onEnd=function(n){n&&function(o){Object.keys(o).forEach(a=>{typeof document<"u"&&document.removeEventListener(a,o[a],!1)})}(n),this.hasMoved&&this.fireChangeEvent("onAfterChange"),this.setState({pending:!1}),this.hasMoved=!1},r.getValue=function(){return rf(this.state.value)},r.getClosestIndex=function(n){let o=Number.MAX_VALUE,a=-1,{value:s}=this.state,u=s.length;for(let l=0;l<u;l+=1){let c=this.calcOffset(s[l]),p=Math.abs(n-c);p<o&&(o=p,a=l)}return a},r.getMousePosition=function(n){return[n["page"+this.axisKey()],n["page"+this.orthogonalAxisKey()]]},r.getTouchPosition=function(n){let o=n.touches[0];return[o["page"+this.axisKey()],o["page"+this.orthogonalAxisKey()]]},r.getKeyDownEventMap=function(){return{keydown:this.onKeyDown,keyup:this.onKeyUp,focusout:this.onBlur}},r.getMouseEventMap=function(){return{mousemove:this.onMouseMove,mouseup:this.onMouseUp}},r.getTouchEventMap=function(){return{touchmove:this.onTouchMove,touchend:this.onTouchEnd}},r.getValueFromPosition=function(n){let o=n/(this.state.sliderLength-this.state.thumbSize)*(this.props.max-this.props.min);return da(this.state.startValue+o,this.props)},r.getDiffPosition=function(n){let o=n-this.state.startPosition;return this.props.invert&&(o*=-1),o},r.resize=function(){let{slider:n,thumb0:o}=this;if(!n||!o)return;let a=this.sizeKey(),s=n.getBoundingClientRect(),u=n[a],l=s[this.posMaxKey()],c=s[this.posMinKey()],p=o.getBoundingClientRect()[a.replace("client","").toLowerCase()],m=u-p,h=Math.abs(l-c);this.state.upperBound===m&&this.state.sliderLength===h&&this.state.thumbSize===p||this.setState({upperBound:m,sliderLength:h,thumbSize:p})},r.calcOffset=function(n){let o=this.props.max-this.props.min;return o===0?0:(n-this.props.min)/o*this.state.upperBound},r.calcValue=function(n){return n/this.state.upperBound*(this.props.max-this.props.min)+this.props.min},r.calcOffsetFromPosition=function(n){let{slider:o}=this,a=o.getBoundingClientRect(),s=a[this.posMaxKey()],u=a[this.posMinKey()],l=n-(window["page"+this.axisKey()+"Offset"]+(this.props.invert?s:u));return this.props.invert&&(l=this.state.sliderLength-l),l-=this.state.thumbSize/2,l},r.forceValueFromPosition=function(n,o){let a=this.calcOffsetFromPosition(n),s=this.getClosestIndex(a),u=da(this.calcValue(a),this.props),l=this.state.value.slice();l[s]=u;for(let c=0;c<l.length-1;c+=1)if(l[c+1]-l[c]<this.props.minDistance)return;this.fireChangeEvent("onBeforeChange"),this.hasMoved=!0,this.setState({value:l},()=>{o(s),this.fireChangeEvent("onChange")})},r.clearPendingResizeTimeouts=function(){do{let n=this.pendingResizeTimeouts.shift();clearTimeout(n)}while(this.pendingResizeTimeouts.length)},r.start=function(n,o){let a=this["thumb"+n];a&&a.focus();let{zIndices:s}=this.state;s.splice(s.indexOf(n),1),s.push(n),this.setState(u=>({startValue:u.value[n],startPosition:o!==void 0?o:u.startPosition,index:n,zIndices:s}))},r.moveUpByStep=function(n){n===void 0&&(n=this.props.step);let o=this.state.value[this.state.index],a=da(this.props.invert&&this.props.orientation==="horizontal"?o-n:o+n,this.props);this.move(Math.min(a,this.props.max))},r.moveDownByStep=function(n){n===void 0&&(n=this.props.step);let o=this.state.value[this.state.index],a=da(this.props.invert&&this.props.orientation==="horizontal"?o+n:o-n,this.props);this.move(Math.max(a,this.props.min))},r.move=function(n){let o=this.state.value.slice(),{index:a}=this.state,{length:s}=o,u=o[a];if(n===u)return;this.hasMoved||this.fireChangeEvent("onBeforeChange"),this.hasMoved=!0;let{pearling:l,max:c,min:p,minDistance:m}=this.props;if(!l){if(a>0){let h=o[a-1];n<h+m&&(n=h+m)}if(a<s-1){let h=o[a+1];n>h-m&&(n=h-m)}}o[a]=n,l&&s>1&&(n>u?(this.pushSucceeding(o,m,a),function(h,g,v,f){for(let b=0;b<h;b+=1){let C=f-b*v;g[h-1-b]>C&&(g[h-1-b]=C)}}(s,o,m,c)):n<u&&(this.pushPreceding(o,m,a),function(h,g,v,f){for(let b=0;b<h;b+=1){let C=f+b*v;g[b]<C&&(g[b]=C)}}(s,o,m,p))),this.setState({value:o},this.fireChangeEvent.bind(this,"onChange"))},r.pushSucceeding=function(n,o,a){let s,u;for(s=a,u=n[s]+o;n[s+1]!==null&&u>n[s+1];s+=1,u=n[s]+o)n[s+1]=H3(u,this.props)},r.pushPreceding=function(n,o,a){for(let s=a,u=n[s]-o;n[s-1]!==null&&u<n[s-1];s-=1,u=n[s]-o)n[s-1]=H3(u,this.props)},r.axisKey=function(){return this.props.orientation==="vertical"?"Y":"X"},r.orthogonalAxisKey=function(){return this.props.orientation==="vertical"?"X":"Y"},r.posMinKey=function(){return this.props.orientation==="vertical"?this.props.invert?"bottom":"top":this.props.invert?"right":"left"},r.posMaxKey=function(){return this.props.orientation==="vertical"?this.props.invert?"top":"bottom":this.props.invert?"left":"right"},r.sizeKey=function(){return this.props.orientation==="vertical"?"clientHeight":"clientWidth"},r.fireChangeEvent=function(n){this.props[n]&&this.props[n](rf(this.state.value),this.state.index)},r.buildThumbStyle=function(n,o){let a={position:"absolute",touchAction:"none",willChange:this.state.index>=0?this.posMinKey():void 0,zIndex:this.state.zIndices.indexOf(o)+1};return a[this.posMinKey()]=n+"px",a},r.buildTrackStyle=function(n,o){let a={position:"absolute",willChange:this.state.index>=0?this.posMinKey()+","+this.posMaxKey():void 0};return a[this.posMinKey()]=n,a[this.posMaxKey()]=o,a},r.buildMarkStyle=function(n){var o;return(o={position:"absolute"})[this.posMinKey()]=n,o},r.renderThumbs=function(n){let{length:o}=n,a=[];for(let u=0;u<o;u+=1)a[u]=this.buildThumbStyle(n[u],u);let s=[];for(let u=0;u<o;u+=1)s[u]=this.renderThumb(a[u],u);return s},r.renderTracks=function(n){let o=[],a=n.length-1;o.push(this.renderTrack(0,0,n[0]));for(let s=0;s<a;s+=1)o.push(this.renderTrack(s+1,n[s],n[s+1]));return o.push(this.renderTrack(a+1,n[a],this.state.upperBound)),o},r.renderMarks=function(){let{marks:n}=this.props,o=this.props.max-this.props.min+1;return typeof n=="boolean"?n=Array.from({length:o}).map((a,s)=>s):typeof n=="number"&&(n=Array.from({length:o}).map((a,s)=>s).filter(a=>a%n==0)),n.map(parseFloat).sort((a,s)=>a-s).map(a=>{let s=this.calcOffset(a),u={key:a,className:this.props.markClassName,style:this.buildMarkStyle(s)};return this.props.renderMark(u)})},r.render=function(){let n=[],{value:o}=this.state,a=o.length;for(let c=0;c<a;c+=1)n[c]=this.calcOffset(o[c],c);let s=this.props.withTracks?this.renderTracks(n):null,u=this.renderThumbs(n),l=this.props.marks?this.renderMarks():null;return ma.default.createElement("div",{ref:c=>{this.slider=c,this.resizeElementRef.current=c},style:{position:"relative"},className:this.props.className+(this.props.disabled?" disabled":""),onMouseDown:this.onSliderMouseDown,onClick:this.onSliderClick},s,u,l)},t}(ma.default.Component);G3.displayName="ReactSlider",G3.defaultProps={min:0,max:100,step:1,pageFn:e=>10*e,minDistance:0,defaultValue:0,orientation:"horizontal",className:"slider",thumbClassName:"thumb",thumbActiveClassName:"active",trackClassName:"track",markClassName:"mark",withTracks:!0,pearling:!1,disabled:!1,snapDragDisabled:!1,invert:!1,marks:[],renderThumb:e=>ma.default.createElement("div",e),renderTrack:e=>ma.default.createElement("div",e),renderMark:e=>ma.default.createElement("span",e)};var j3=G3;var es=require("react/jsx-runtime"),Tw="4px",Oj=ts.css`
|
|
2467
2467
|
opacity: 0.5;
|
|
2468
2468
|
|
|
2469
2469
|
& * {
|