@wistia/vhs 2.3.0-beta.783f2bfd.2d133ff → 2.3.0-beta.b8b257f7.762afdc

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 CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license VHS v2.3.0-beta.783f2bfd.2d133ff
3
+ * @license VHS v2.3.0-beta.b8b257f7.762afdc
4
4
  *
5
5
  * Copyright (c) 2021-2023, Wistia, Inc. and its affiliates.
6
6
  *
@@ -2283,8 +2283,7 @@
2283
2283
  background-color: white;
2284
2284
  border: 1px solid ${e.theme.color.grey300};
2285
2285
  border-radius: 4px;
2286
- color: ${e.theme.color.grey900}
2287
- font-size: 14px;
2286
+ color: #37373c;
2288
2287
  height: 36px;
2289
2288
 
2290
2289
  &:hover, &:focus {
@@ -2339,7 +2338,7 @@
2339
2338
  justify-content: space-between;
2340
2339
  padding: ${({theme:e})=>e.spacing.space05};
2341
2340
  width: 100%;
2342
- `,wl=({align:e="left",buttonVariant:t="secondary",earliestDate:r,latestDate:n,format:o=IN,footerText:a,onChange:s,presets:u=[],range:l={end:new Date,start:new Date},shouldPreventFuture:c=!1})=>{let[d,h]=(0,Vr.useState)(l),[m,v]=(0,Vr.useState)(!1),[C,p]=(0,Vr.useState)(!0),[b,y]=(0,Vr.useState)("end"),[x,A]=(0,Vr.useState)([]),S=Ut();return(0,Vr.useEffect)(()=>{h(l)},[l]),(0,Vr.useEffect)(()=>{let E=()=>{v(!1),h(l)};return m&&window.addEventListener("click",E),()=>{window.removeEventListener("click",E)}},[m,l,h]),(0,ze.jsxs)($N,{"data-testid":"rangeselector-test-identifer",onClick:E=>E.stopPropagation(),children:[(0,ze.jsx)(ZN,{"data-testid":"trigger",icon:(0,ze.jsx)($e,{size:"sm",type:"caret-down"}),iconPosition:"end",onClick:()=>v(!m),variant:t,children:o(l)}),m?(0,ze.jsxs)(VN,{align:e,hasPresets:!!u.length,children:[(0,ze.jsxs)(jN,{children:[!!u.length&&(0,ze.jsx)(Oa,{"data-testid":"presets",style:{marginBottom:0,borderRight:`1px solid ${S.color.grey400}`,padding:"12px"},variant:"unbulleted",children:u.map(({label:E,value:P})=>(0,ze.jsx)(wn,{children:(0,ze.jsx)(HN,{"data-testid":E?.replaceAll(" ","_"),isActive:kN(d,P),onClick:()=>{h(P)},children:(0,ze.jsx)("span",{children:E})})},E))}),(0,ze.jsx)(WN,{children:(0,ze.jsxs)(NN,{children:[(0,ze.jsx)(Va,{earliestDate:r,latestDate:n,onChange:E=>{h(E)},onErrorChange:A,onSelectedRangePartChange:y,range:d,shouldPreventFuture:c,width:"100%"}),(0,ze.jsx)(Za,{earliestDate:r,latestDate:n,onChange:E=>{h(E)},onIsValidChange:p,range:d,rangePartToShow:b,shouldPreventFuture:c})]})})]}),(0,ze.jsx)(zN,{}),(0,ze.jsxs)(UN,{children:[(0,ze.jsx)("div",{children:a}),(0,ze.jsxs)(fr,{align:"right",children:[(0,ze.jsx)(je,{onClick:()=>{h(l),v(!1)},style:{marginLeft:0},variant:"secondary",children:"Cancel"}),(0,ze.jsx)(je,{"data-testid":"apply-button",disabled:!!x.length||!C,onMouseUp:()=>{s&&s(d),v(!1)},children:"Apply"})]})]})]}):null]})};wl.displayName="RangeSelector_VHS";i();var Wa=z(require("styled-components"));i();i();var go=z(require("react"),1);function sd(e){return e&&e.stopPropagation&&e.stopPropagation(),e&&e.preventDefault&&e.preventDefault(),!1}function ud(e){return e==null?[]:Array.isArray(e)?e.slice():[e]}function Sl(e){return e!==null&&e.length===1?e[0]:e.slice()}function Tl(e){Object.keys(e).forEach(t=>{typeof document<"u"&&document.addEventListener(t,e[t],!1)})}function ho(e,t){return ld(function(r,n){let o=r;return o<=n.min&&(o=n.min),o>=n.max&&(o=n.max),o}(e,t),t)}function ld(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 cd=function(e){function t(n){var o;(o=e.call(this,n)||this).onKeyUp=()=>{o.onEnd()},o.onMouseUp=()=>{o.onEnd(o.getMouseEventMap())},o.onTouchEnd=()=>{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]),d=o.getValueFromPosition(c);o.move(d)},o.onTouchMove=u=>{if(u.touches.length>1)return;o.setState({pending:!0});let l=o.getTouchPosition(u);if(o.isScrolling===void 0){let h=l[0]-o.startPosition[0],m=l[1]-o.startPosition[1];o.isScrolling=Math.abs(m)>Math.abs(h)}if(o.isScrolling)return void o.setState({index:-1});let c=o.getDiffPosition(l[0]),d=o.getValueFromPosition(c);o.move(d)},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]),Tl(o.getMouseEventMap())})}sd(u)}},o.onSliderClick=u=>{if(!o.props.disabled&&o.props.onSliderClick&&!o.hasMoved){let l=o.getMousePosition(u),c=ho(o.calcValue(o.calcOffsetFromPosition(l[0])),o.props);o.props.onSliderClick(c)}},o.createOnKeyDown=u=>l=>{o.props.disabled||(o.start(u),Tl(o.getKeyDownEventMap()),sd(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]),Tl(o.getMouseEventMap()),sd(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]),Tl(o.getTouchEventMap()),function(d){d.stopPropagation&&d.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:""),d={ref:m=>{o["thumb"+l]=m},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},h={index:l,value:Sl(o.state.value),valueNow:o.state.value[l]};return o.props.ariaValuetext&&(d["aria-valuetext"]=typeof o.props.ariaValuetext=="string"?o.props.ariaValuetext:o.props.ariaValuetext(h)),o.props.renderThumb(d,h)},o.renderTrack=(u,l,c)=>{let d={key:o.props.trackClassName+"-"+u,className:o.props.trackClassName+" "+o.props.trackClassName+"-"+u,style:o.buildTrackStyle(l,o.state.upperBound-c)},h={index:u,value:Sl(o.state.value)};return o.props.renderTrack(d,h)};let a=ud(n.value);a.length||(a=ud(n.defaultValue)),o.pendingResizeTimeouts=[];let s=[];for(let u=0;u<a.length;u+=1)a[u]=ho(a[u],n),s.push(u);return o.resizeObserver=null,o.resizeElementRef=go.default.createRef(),o.state={index:-1,upperBound:0,sliderLength:0,value:a,zIndices:s},o}Wt(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=ud(n.value);return a.length?o.pending?null:{value:a.map(s=>ho(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 Sl(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]),d=Math.abs(n-c);d<o&&(o=d,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 ho(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()],d=o.getBoundingClientRect()[a.replace("client","").toLowerCase()],h=u-d,m=Math.abs(l-c);this.state.upperBound===h&&this.state.sliderLength===m&&this.state.thumbSize===d||this.setState({upperBound:h,sliderLength:m,thumbSize:d})},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=ho(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=ho(this.state.value[this.state.index]+n,this.props);this.move(Math.min(o,this.props.max))},r.moveDownByStep=function(n){n===void 0&&(n=this.props.step);let o=ho(this.state.value[this.state.index]-n,this.props);this.move(Math.max(o,this.props.min))},r.move=function(n){let{index:o,value:a}=this.state,{length:s}=a,u=a[o];if(n===u)return;this.hasMoved||this.fireChangeEvent("onBeforeChange"),this.hasMoved=!0;let{pearling:l,max:c,min:d,minDistance:h}=this.props;if(!l){if(o>0){let m=a[o-1];n<m+h&&(n=m+h)}if(o<s-1){let m=a[o+1];n>m-h&&(n=m-h)}}a[o]=n,l&&s>1&&(n>u?(this.pushSucceeding(a,h,o),function(m,v,C,p){for(let b=0;b<m;b+=1){let y=p-b*C;v[m-1-b]>y&&(v[m-1-b]=y)}}(s,a,h,c)):n<u&&(this.pushPreceding(a,h,o),function(m,v,C,p){for(let b=0;b<m;b+=1){let y=p+b*C;v[b]<y&&(v[b]=y)}}(s,a,h,d))),this.setState({value:a},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]=ld(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]=ld(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](Sl(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 go.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}(go.default.Component);cd.displayName="ReactSlider",cd.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=>go.default.createElement("div",e),renderTrack:e=>go.default.createElement("div",e),renderMark:e=>go.default.createElement("span",e)};var fd=cd;var ja=require("react/jsx-runtime"),gC="4px",_N=Wa.css`
2341
+ `,wl=({align:e="left",buttonVariant:t="quaternary",earliestDate:r,latestDate:n,format:o=IN,footerText:a,onChange:s,presets:u=[],range:l={end:new Date,start:new Date},shouldPreventFuture:c=!1})=>{let[d,h]=(0,Vr.useState)(l),[m,v]=(0,Vr.useState)(!1),[C,p]=(0,Vr.useState)(!0),[b,y]=(0,Vr.useState)("end"),[x,A]=(0,Vr.useState)([]),S=Ut();return(0,Vr.useEffect)(()=>{h(l)},[l]),(0,Vr.useEffect)(()=>{let E=()=>{v(!1),h(l)};return m&&window.addEventListener("click",E),()=>{window.removeEventListener("click",E)}},[m,l,h]),(0,ze.jsxs)($N,{"data-testid":"rangeselector-test-identifer",onClick:E=>E.stopPropagation(),children:[(0,ze.jsx)(ZN,{"data-testid":"trigger",icon:(0,ze.jsx)($e,{size:"sm",type:"caret-down"}),iconPosition:"end",onClick:()=>v(!m),variant:t,children:o(l)}),m?(0,ze.jsxs)(VN,{align:e,hasPresets:!!u.length,children:[(0,ze.jsxs)(jN,{children:[!!u.length&&(0,ze.jsx)(Oa,{"data-testid":"presets",style:{marginBottom:0,borderRight:`1px solid ${S.color.grey400}`,padding:"12px"},variant:"unbulleted",children:u.map(({label:E,value:P})=>(0,ze.jsx)(wn,{children:(0,ze.jsx)(HN,{"data-testid":E?.replaceAll(" ","_"),isActive:kN(d,P),onClick:()=>{h(P)},children:(0,ze.jsx)("span",{children:E})})},E))}),(0,ze.jsx)(WN,{children:(0,ze.jsxs)(NN,{children:[(0,ze.jsx)(Va,{earliestDate:r,latestDate:n,onChange:E=>{h(E)},onErrorChange:A,onSelectedRangePartChange:y,range:d,shouldPreventFuture:c,width:"100%"}),(0,ze.jsx)(Za,{earliestDate:r,latestDate:n,onChange:E=>{h(E)},onIsValidChange:p,range:d,rangePartToShow:b,shouldPreventFuture:c})]})})]}),(0,ze.jsx)(zN,{}),(0,ze.jsxs)(UN,{children:[(0,ze.jsx)("div",{children:a}),(0,ze.jsxs)(fr,{align:"right",children:[(0,ze.jsx)(je,{onClick:()=>{h(l),v(!1)},style:{marginLeft:0},variant:"secondary",children:"Cancel"}),(0,ze.jsx)(je,{"data-testid":"apply-button",disabled:!!x.length||!C,onMouseUp:()=>{s&&s(d),v(!1)},children:"Apply"})]})]})]}):null]})};wl.displayName="RangeSelector_VHS";i();var Wa=z(require("styled-components"));i();i();var go=z(require("react"),1);function sd(e){return e&&e.stopPropagation&&e.stopPropagation(),e&&e.preventDefault&&e.preventDefault(),!1}function ud(e){return e==null?[]:Array.isArray(e)?e.slice():[e]}function Sl(e){return e!==null&&e.length===1?e[0]:e.slice()}function Tl(e){Object.keys(e).forEach(t=>{typeof document<"u"&&document.addEventListener(t,e[t],!1)})}function ho(e,t){return ld(function(r,n){let o=r;return o<=n.min&&(o=n.min),o>=n.max&&(o=n.max),o}(e,t),t)}function ld(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 cd=function(e){function t(n){var o;(o=e.call(this,n)||this).onKeyUp=()=>{o.onEnd()},o.onMouseUp=()=>{o.onEnd(o.getMouseEventMap())},o.onTouchEnd=()=>{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]),d=o.getValueFromPosition(c);o.move(d)},o.onTouchMove=u=>{if(u.touches.length>1)return;o.setState({pending:!0});let l=o.getTouchPosition(u);if(o.isScrolling===void 0){let h=l[0]-o.startPosition[0],m=l[1]-o.startPosition[1];o.isScrolling=Math.abs(m)>Math.abs(h)}if(o.isScrolling)return void o.setState({index:-1});let c=o.getDiffPosition(l[0]),d=o.getValueFromPosition(c);o.move(d)},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]),Tl(o.getMouseEventMap())})}sd(u)}},o.onSliderClick=u=>{if(!o.props.disabled&&o.props.onSliderClick&&!o.hasMoved){let l=o.getMousePosition(u),c=ho(o.calcValue(o.calcOffsetFromPosition(l[0])),o.props);o.props.onSliderClick(c)}},o.createOnKeyDown=u=>l=>{o.props.disabled||(o.start(u),Tl(o.getKeyDownEventMap()),sd(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]),Tl(o.getMouseEventMap()),sd(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]),Tl(o.getTouchEventMap()),function(d){d.stopPropagation&&d.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:""),d={ref:m=>{o["thumb"+l]=m},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},h={index:l,value:Sl(o.state.value),valueNow:o.state.value[l]};return o.props.ariaValuetext&&(d["aria-valuetext"]=typeof o.props.ariaValuetext=="string"?o.props.ariaValuetext:o.props.ariaValuetext(h)),o.props.renderThumb(d,h)},o.renderTrack=(u,l,c)=>{let d={key:o.props.trackClassName+"-"+u,className:o.props.trackClassName+" "+o.props.trackClassName+"-"+u,style:o.buildTrackStyle(l,o.state.upperBound-c)},h={index:u,value:Sl(o.state.value)};return o.props.renderTrack(d,h)};let a=ud(n.value);a.length||(a=ud(n.defaultValue)),o.pendingResizeTimeouts=[];let s=[];for(let u=0;u<a.length;u+=1)a[u]=ho(a[u],n),s.push(u);return o.resizeObserver=null,o.resizeElementRef=go.default.createRef(),o.state={index:-1,upperBound:0,sliderLength:0,value:a,zIndices:s},o}Wt(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=ud(n.value);return a.length?o.pending?null:{value:a.map(s=>ho(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 Sl(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]),d=Math.abs(n-c);d<o&&(o=d,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 ho(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()],d=o.getBoundingClientRect()[a.replace("client","").toLowerCase()],h=u-d,m=Math.abs(l-c);this.state.upperBound===h&&this.state.sliderLength===m&&this.state.thumbSize===d||this.setState({upperBound:h,sliderLength:m,thumbSize:d})},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=ho(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=ho(this.state.value[this.state.index]+n,this.props);this.move(Math.min(o,this.props.max))},r.moveDownByStep=function(n){n===void 0&&(n=this.props.step);let o=ho(this.state.value[this.state.index]-n,this.props);this.move(Math.max(o,this.props.min))},r.move=function(n){let{index:o,value:a}=this.state,{length:s}=a,u=a[o];if(n===u)return;this.hasMoved||this.fireChangeEvent("onBeforeChange"),this.hasMoved=!0;let{pearling:l,max:c,min:d,minDistance:h}=this.props;if(!l){if(o>0){let m=a[o-1];n<m+h&&(n=m+h)}if(o<s-1){let m=a[o+1];n>m-h&&(n=m-h)}}a[o]=n,l&&s>1&&(n>u?(this.pushSucceeding(a,h,o),function(m,v,C,p){for(let b=0;b<m;b+=1){let y=p-b*C;v[m-1-b]>y&&(v[m-1-b]=y)}}(s,a,h,c)):n<u&&(this.pushPreceding(a,h,o),function(m,v,C,p){for(let b=0;b<m;b+=1){let y=p+b*C;v[b]<y&&(v[b]=y)}}(s,a,h,d))),this.setState({value:a},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]=ld(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]=ld(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](Sl(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 go.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}(go.default.Component);cd.displayName="ReactSlider",cd.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=>go.default.createElement("div",e),renderTrack:e=>go.default.createElement("div",e),renderMark:e=>go.default.createElement("span",e)};var fd=cd;var ja=require("react/jsx-runtime"),gC="4px",_N=Wa.css`
2343
2342
  opacity: 0.5;
2344
2343
 
2345
2344
  & * {