@wistia/vhs 2.74.0 → 2.74.1-beta.7e6b4a65.8314659
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.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/vhs v2.74.
|
|
3
|
+
* @license @wistia/vhs v2.74.1-beta.7e6b4a65.8314659
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2021-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -1606,7 +1606,7 @@ var DM=Object.create;var jl=Object.defineProperty;var SM=Object.getOwnPropertyDe
|
|
|
1606
1606
|
`,TX=_u(yS)`
|
|
1607
1607
|
cursor: pointer;
|
|
1608
1608
|
text-decoration: underline;
|
|
1609
|
-
`,AX=e=>{let t="error";return e>1&&(t+="s"),`${e} ${t} found on page`},RX=e=>{document.getElementById(`fieldset-${e}`)?.scrollIntoView({behavior:"smooth"})},FX=({errors:e={},statusError:t})=>bS(PX,{children:[(0,Wu.isNonEmptyString)(t)?ju(yS,{children:t}):null,Object.keys(e).map(r=>ju("li",{children:ju(TX,{"data-testid":`form-global-error-${r}`,onClick:()
|
|
1609
|
+
`,AX=e=>{let t="error";return e>1&&(t+="s"),`${e} ${t} found on page`},RX=e=>{document.getElementById(`fieldset-${e}`)?.scrollIntoView({behavior:"smooth"})},FX=({errors:e={},statusError:t})=>bS(PX,{children:[(0,Wu.isNonEmptyString)(t)?ju(yS,{children:t}):null,Object.keys(e).map(r=>ju("li",{children:ju(TX,{"data-testid":`form-global-error-${r}`,onClick:n=>{n.preventDefault(),RX(r)},children:e[r]})},r))]}),Up=DX((e,t)=>{let r=mi(),{status:n,errors:o}=r,a=Object.keys(o).length;(0,Wu.isNotNil)(n)&&n.length>0&&(a+=1);let s=(0,Wu.isNotNil)(n)&&!n.success||a;return Sn(s)?bS(SX,{ref:t,children:[ju(EX,{children:AX(a)}),ju(FX,{errors:o,statusError:n})]}):null});Up.displayName="FormGlobalError_VHS";i();i();import{useContext as BX}from"react";var Uu=()=>BX(If);i();i();import{useEffect as OX}from"react";i();i();import{useCallback as _h,useEffect as CS,useRef as Uh}from"react";var Kh=(e,t=0)=>{let r=Uh(!1),n=Uh(),o=Uh(e),a=_h(()=>r.current,[]),s=_h(()=>{r.current=!1,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{r.current=!0,o.current()},t)},[t]),u=_h(()=>{r.current=null,n.current&&clearTimeout(n.current)},[]);return CS(()=>{o.current=e},[e]),CS(()=>(s(),u),[t]),[a,u,s]};var qh=(e,t=0,r=[])=>{let[n,o,a]=Kh(e,t);return OX(a,r),[n,o]};import{jsx as DS,jsxs as IX}from"react/jsx-runtime";var wS=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),MX=(e,t)=>{let r={};return Object.keys(e).forEach(n=>{e[n]===null?(0,Ft.isNotUndefined)(t)&&(0,Ft.isNotUndefined)(t.fields)&&(0,Ft.isNotUndefined)(t.fields[n])&&t.fields[n]._type==="boolean"?r[n]=!1:r[n]=void 0:r[n]=e[n]}),r},SS=({children:e,className:t,formId:r,initialValues:n,onSubmit:o,scrollToFormErrorsOnSubmit:a=!0,shareFormContext:s,style:u,submitOnChange:l=!1,validate:c,validateOnBlur:p=!1,validateOnChange:d=!1,validationSchema:h,globalErrorRef:g,showGlobalError:v=!0,innerRef:m})=>{let[b,y]=Kp(),[x,w]=Kp(),[S,E]=Kp(0),D=Uu(),P=(H,I)=>{let k={};Object.keys(H).forEach(V=>{let z=H[V],ee=(0,Ft.isNotUndefined)(h)&&(0,Ft.isNotUndefined)(h.fields[V])&&h.fields[V]._type==="string";if(z==null){k[V]=null;return}if(typeof z=="number"){k[V]=z;return}z===!1&&(k[V]=!1),ee&&!z&&(k[V]=null),z&&(k[V]=ee?z.trim():z)}),o(k,I)},A=a&&((0,Ft.isUndefined)(b)||!b)&&((0,Ft.isUndefined)(x)||!x)&&(0,Ft.isNotUndefined)(g.current?.scrollIntoView);xS(()=>{if(((0,Ft.isUndefined)(b)||!b)&&(0,Ft.isNotUndefined)(x)&&x&&document.activeElement&&document.activeElement.blur(),A){let H=S>1?`there are ${S} errors`:"there's an error!";D({variant:"error",message:`Uh oh, ${H}`}),g.current.scrollIntoView({behavior:"smooth"})}},[S,g,b,x,A,D]);let F=MX(n,h),M=750;return DS(Ww,{enableReinitialize:!0,initialValues:F,innerRef:(0,Ft.isNotNil)(m)?m:()=>{},onSubmit:P,validate:(0,Ft.isNotNil)(c)?c:()=>{},validateOnBlur:p,validateOnChange:d,validationSchema:h,children:H=>{let[I,k]=Kp(H.values);if(xS(()=>{(0,Ft.isNotUndefined)(s)&&s(H),y(H.isSubmitting),w(H.isValid),E(Object.keys(H.errors).length),l&&wS(H.values,I)&&k(H.values)},[H,I]),l){let[,]=qh(()=>{wS(n,I)&&H.submitForm()},M,[I])}return IX(gh,{className:t,"data-testid":r,noValidate:!0,style:u,children:[v?DS(Up,{ref:g}):null,e]})}})};SS.displayName="Form_VHS";i();i();i();i();import{jsx as kX}from"react/jsx-runtime";var qp=({type:e="submit",isSubmitting:t=!1,children:r,disabled:n=!1,...o})=>kX(nt,{disabled:t||n,type:e,...o,children:r});qp.displayName="FormConnectorButton_VHS";import{jsx as ES}from"react/jsx-runtime";var NX=e=>e.preventDefault(),PS=({buttons:e,align:t="left",...r})=>{let{isSubmitting:n}=mi();return ES(Fo,{align:t,...r,children:e.map(({name:o,type:a,...s})=>ES(qp,{isSubmitting:n,type:a,...s,onMouseDown:NX,children:o},o))})};PS.displayName="FormButtons_VHS";i();i();import{forwardRef as ene}from"react";import OA from"styled-components";i();var TS={checkbox:{component:"FormConnectorCheckboxGroup",inputType:null},custom:{component:"FormConnectorCustomField",inputType:null},email:{component:"FormConnectorInput",inputType:"email"},hidden:{component:"FormConnectorHidden",inputType:"hidden"},multiline:{component:"FormConnectorInput",inputType:null},number:{component:"FormConnectorInput",inputType:"number"},password:{component:"FormConnectorInput",inputType:"password"},phone:{component:"FormConnectorInput",inputType:"tel"},radio:{component:"FormConnectorRadioGroup",inputType:null},search:{component:"FormConnectorInput",inputType:"search"},select:{component:"FormConnectorSelect",inputType:null},text:{component:"FormConnectorInput",inputType:"text"},time:{component:"FormConnectorInput",inputType:"time"},timePosition:{component:"FormConnectorInput",inputType:"text"},url:{component:"FormConnectorInput",inputType:"url"},richTextEditor:{component:"FormConnectorRichTextEditor",inputType:null}};i();i();var Xp=K(Q());import{jsx as VX}from"react/jsx-runtime";var Yp=({direction:e="column",disabled:t=!1,field:{name:r,value:n},form:{errors:o,setFieldValue:a},label:s,labelDescription:u,labelProps:l={},onChangeCustom:c,options:p=[]})=>{let d=(m,b)=>{a(b,m.target.checked)},h=(m,b)=>{let y=n;if((0,Xp.isArray)(y))if(m.target.checked)y.push(b);else{let x=y.indexOf(b);x>-1&&y.splice(x,1)}a(b,y)},g=Array.isArray(n)&&p.length>1?h:d,v=Array.isArray(p)?p:[p];return VX(Hp,{direction:e,disabled:t,error:(0,Xp.isNotNil)(o)?o[r]:void 0,label:s,labelDescription:u,labelProps:l,name:r,onChange:(m,b)=>{g(m,b),c&&c(m.target.checked)},options:v,value:n})};Yp.displayName="FormConnectorCheckboxGroup_VHS";i();i();var RS=K(Q());import{jsx as AS}from"react/jsx-runtime";var Jp=({customComponent:e,field:t,form:r,label:n="",labelDescription:o,labelProps:a={},...s})=>{let{name:u}=t,{errors:l}=r;return AS(Zt,{error:(0,RS.isNotUndefined)(l)?l[u]:void 0,label:n,labelDescription:o,labelProps:a,name:u,children:AS(e,{field:t,form:r,...s})})};Jp.displayName="FormConnectorCustomField_VHS";i();i();var kS=K(Q());i();i();var Ku=K(Q());import{forwardRef as oY,useEffect as iY,useRef as aY}from"react";import sY from"styled-components";i();import LX,{css as bi}from"styled-components";var FS=bi`
|
|
1610
1610
|
border-color: ${({theme:e})=>e.color.brandBlue500};
|
|
1611
1611
|
outline: none;
|
|
1612
1612
|
`,$X=bi`
|
|
@@ -2726,7 +2726,7 @@ var DM=Object.create;var jl=Object.defineProperty;var SM=Object.getOwnPropertyDe
|
|
|
2726
2726
|
visibility: hidden;
|
|
2727
2727
|
width: calc(100% + 40px);
|
|
2728
2728
|
}
|
|
2729
|
-
`,rM=({align:e="left",buttonVariant:t="secondary",earliestDate:r,latestDate:n,format:o=Zse,fullWidth:a=!1,footerText:s,onChange:u,presets:l=[],range:c={end:new Date,start:new Date},shouldPreventFuture:p=!1,...d})=>{let[h,g]=Gl(c),[v,m]=Gl(!1),[b,y]=Gl(!0),[x,w]=Gl("end"),[S,E]=Gl([]),D=kn();return eM(()=>{g(c)},[c]),eM(()=>{let A=()=>{m(!1),g(c)};return v&&window.addEventListener("click",A),()=>{window.removeEventListener("click",A)}},[v,c,g]),Ki(tue,{"data-testid":"rangeselector-test-identifer",onClick:A=>A.stopPropagation(),children:[Mt(rue,{...d,"data-testid":"trigger",fullWidth:a,icon:Mt(Se,{size:"sm",type:"caret-down"}),iconPosition:"end",inputButtonOverride:t==="input",onClick:()=>m(!v),textAlign:"left",variant:t==="input"?"tertiary":t,children:o(c)}),v?Ki(iue,{align:e,hasPresets:!!l.length,children:[Ki(aue,{children:[!!l.length&&Mt(qd,{"data-testid":"presets",style:{marginBottom:0,borderRight:`1px solid ${D.color.grey400}`,padding:"12px"},variant:"unbulleted",children:l.map(({label:A,value:F,tooltipText:M})=>Mt(Bi,{children:Mt(nue,{"data-testid":A?.replaceAll(" ","_"),isActive:Qse(h,F),onClick:()=>{g(F)},children:Ki(lue,{"data-title":`${A}___`,children:[A," ",M!==void 0?Mt(Jse,{tooltipText:M}):null]})})},A))}),Mt(sue,{children:Ki(eue,{children:[Mt(K1,{earliestDate:r,latestDate:n,onChange:A=>{g(A)},onErrorChange:E,onSelectedRangePartChange:w,range:h,shouldPreventFuture:p,width:"100%"}),Mt(G1,{earliestDate:r,latestDate:n,onChange:A=>{g(A)},onIsValidChange:y,range:h,rangePartToShow:x,shouldPreventFuture:p})]})})]}),Mt(oue,{}),Ki(uue,{children:[Mt("div",{children:s}),Ki(Fo,{align:"right",children:[Mt(nt,{onClick:()=>{g(c),m(!1)},style:{marginLeft:0},variant:"secondary",children:"Cancel"}),Mt(nt,{"data-testid":"apply-button",disabled:!!S.length||!b,onMouseUp:()=>{u&&u(h),m(!1)},children:"Apply"})]})]})]}):null]})};rM.displayName="RangeSelector_VHS";i();i();import i5,{css as cue}from"styled-components";i();i();import Gs from"react";function e5(e){return e&&e.stopPropagation&&e.stopPropagation(),e&&e.preventDefault&&e.preventDefault(),!1}function t5(e){return e==null?[]:Array.isArray(e)?e.slice():[e]}function q1(e){return e!==null&&e.length===1?e[0]:e.slice()}function X1(e){Object.keys(e).forEach(t=>{typeof document<"u"&&document.addEventListener(t,e[t],!1)})}function qi(e,t){return r5(function(r,n){let o=r;return o<=n.min&&(o=n.min),o>=n.max&&(o=n.max),o}(e,t),t)}function r5(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 n5=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 d=l[0]-o.startPosition[0],h=l[1]-o.startPosition[1];o.isScrolling=Math.abs(h)>Math.abs(d)}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]),X1(o.getMouseEventMap())})}e5(u)}},o.onSliderClick=u=>{if(!o.props.disabled&&o.props.onSliderClick&&!o.hasMoved){let l=o.getMousePosition(u),c=qi(o.calcValue(o.calcOffsetFromPosition(l[0])),o.props);o.props.onSliderClick(c)}},o.createOnKeyDown=u=>l=>{o.props.disabled||(o.start(u),X1(o.getKeyDownEventMap()),e5(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]),X1(o.getMouseEventMap()),e5(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]),X1(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},d={index:l,value:q1(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(d)),o.props.renderThumb(p,d)},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)},d={index:u,value:q1(o.state.value)};return o.props.renderTrack(p,d)};let a=t5(n.value);a.length||(a=t5(n.defaultValue)),o.pendingResizeTimeouts=[];let s=[];for(let u=0;u<a.length;u+=1)a[u]=qi(a[u],n),s.push(u);return o.resizeObserver=null,o.resizeElementRef=Gs.createRef(),o.state={index:-1,upperBound:0,sliderLength:0,value:a,zIndices:s},o}Yl(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=t5(n.value);return a.length?o.pending?null:{value:a.map(s=>qi(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 q1(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 qi(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()],d=u-p,h=Math.abs(l-c);this.state.upperBound===d&&this.state.sliderLength===h&&this.state.thumbSize===p||this.setState({upperBound:d,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=qi(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=qi(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=qi(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:d}=this.props;if(!l){if(a>0){let h=o[a-1];n<h+d&&(n=h+d)}if(a<s-1){let h=o[a+1];n>h-d&&(n=h-d)}}o[a]=n,l&&s>1&&(n>u?(this.pushSucceeding(o,d,a),function(h,g,v,m){for(let b=0;b<h;b+=1){let y=m-b*v;g[h-1-b]>y&&(g[h-1-b]=y)}}(s,o,d,c)):n<u&&(this.pushPreceding(o,d,a),function(h,g,v,m){for(let b=0;b<h;b+=1){let y=m+b*v;g[b]<y&&(g[b]=y)}}(s,o,d,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]=r5(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]=r5(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](q1(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 Gs.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}(Gs.Component);n5.displayName="ReactSlider",n5.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=>Gs.createElement("div",e),renderTrack:e=>Gs.createElement("div",e),renderMark:e=>Gs.createElement("span",e)};var o5=n5;var yt=K(Q());import{jsx as Hl}from"react/jsx-runtime";var nM="4px",fue=cue`
|
|
2729
|
+
`,rM=({align:e="left",buttonVariant:t="secondary",earliestDate:r,latestDate:n,format:o=Zse,fullWidth:a=!1,footerText:s,onChange:u,presets:l=[],range:c={end:new Date,start:new Date},shouldPreventFuture:p=!1,...d})=>{let[h,g]=Gl(c),[v,m]=Gl(!1),[b,y]=Gl(!0),[x,w]=Gl("end"),[S,E]=Gl([]),D=kn();return eM(()=>{g(c)},[c]),eM(()=>{let A=()=>{m(!1),g(c)};return v&&window.addEventListener("click",A),()=>{window.removeEventListener("click",A)}},[v,c,g]),Ki(tue,{"data-testid":"rangeselector-test-identifier",onClick:A=>A.stopPropagation(),children:[Mt(rue,{...d,"data-testid":"trigger",fullWidth:a,icon:Mt(Se,{size:"sm",type:"caret-down"}),iconPosition:"end",inputButtonOverride:t==="input",onClick:()=>m(!v),textAlign:"left",variant:t==="input"?"tertiary":t,children:o(c)}),v?Ki(iue,{align:e,hasPresets:!!l.length,children:[Ki(aue,{children:[!!l.length&&Mt(qd,{"data-testid":"presets",style:{marginBottom:0,borderRight:`1px solid ${D.color.grey400}`,padding:"12px"},variant:"unbulleted",children:l.map(({label:A,value:F,tooltipText:M})=>Mt(Bi,{children:Mt(nue,{"data-testid":A?.replaceAll(" ","_"),isActive:Qse(h,F),onClick:()=>{g(F)},children:Ki(lue,{"data-title":`${A}___`,children:[A," ",M!==void 0?Mt(Jse,{tooltipText:M}):null]})})},A))}),Mt(sue,{children:Ki(eue,{children:[Mt(K1,{earliestDate:r,latestDate:n,onChange:A=>{g(A)},onErrorChange:E,onSelectedRangePartChange:w,range:h,shouldPreventFuture:p,width:"100%"}),Mt(G1,{earliestDate:r,latestDate:n,onChange:A=>{g(A)},onIsValidChange:y,range:h,rangePartToShow:x,shouldPreventFuture:p})]})})]}),Mt(oue,{}),Ki(uue,{children:[Mt("div",{children:s}),Ki(Fo,{align:"right",children:[Mt(nt,{onClick:()=>{g(c),m(!1)},style:{marginLeft:0},variant:"secondary",children:"Cancel"}),Mt(nt,{"data-testid":"apply-button",disabled:!!S.length||!b,onMouseUp:()=>{u&&u(h),m(!1)},children:"Apply"})]})]})]}):null]})};rM.displayName="RangeSelector_VHS";i();i();import i5,{css as cue}from"styled-components";i();i();import Gs from"react";function e5(e){return e&&e.stopPropagation&&e.stopPropagation(),e&&e.preventDefault&&e.preventDefault(),!1}function t5(e){return e==null?[]:Array.isArray(e)?e.slice():[e]}function q1(e){return e!==null&&e.length===1?e[0]:e.slice()}function X1(e){Object.keys(e).forEach(t=>{typeof document<"u"&&document.addEventListener(t,e[t],!1)})}function qi(e,t){return r5(function(r,n){let o=r;return o<=n.min&&(o=n.min),o>=n.max&&(o=n.max),o}(e,t),t)}function r5(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 n5=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 d=l[0]-o.startPosition[0],h=l[1]-o.startPosition[1];o.isScrolling=Math.abs(h)>Math.abs(d)}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]),X1(o.getMouseEventMap())})}e5(u)}},o.onSliderClick=u=>{if(!o.props.disabled&&o.props.onSliderClick&&!o.hasMoved){let l=o.getMousePosition(u),c=qi(o.calcValue(o.calcOffsetFromPosition(l[0])),o.props);o.props.onSliderClick(c)}},o.createOnKeyDown=u=>l=>{o.props.disabled||(o.start(u),X1(o.getKeyDownEventMap()),e5(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]),X1(o.getMouseEventMap()),e5(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]),X1(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},d={index:l,value:q1(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(d)),o.props.renderThumb(p,d)},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)},d={index:u,value:q1(o.state.value)};return o.props.renderTrack(p,d)};let a=t5(n.value);a.length||(a=t5(n.defaultValue)),o.pendingResizeTimeouts=[];let s=[];for(let u=0;u<a.length;u+=1)a[u]=qi(a[u],n),s.push(u);return o.resizeObserver=null,o.resizeElementRef=Gs.createRef(),o.state={index:-1,upperBound:0,sliderLength:0,value:a,zIndices:s},o}Yl(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=t5(n.value);return a.length?o.pending?null:{value:a.map(s=>qi(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 q1(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 qi(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()],d=u-p,h=Math.abs(l-c);this.state.upperBound===d&&this.state.sliderLength===h&&this.state.thumbSize===p||this.setState({upperBound:d,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=qi(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=qi(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=qi(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:d}=this.props;if(!l){if(a>0){let h=o[a-1];n<h+d&&(n=h+d)}if(a<s-1){let h=o[a+1];n>h-d&&(n=h-d)}}o[a]=n,l&&s>1&&(n>u?(this.pushSucceeding(o,d,a),function(h,g,v,m){for(let b=0;b<h;b+=1){let y=m-b*v;g[h-1-b]>y&&(g[h-1-b]=y)}}(s,o,d,c)):n<u&&(this.pushPreceding(o,d,a),function(h,g,v,m){for(let b=0;b<h;b+=1){let y=m+b*v;g[b]<y&&(g[b]=y)}}(s,o,d,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]=r5(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]=r5(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](q1(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 Gs.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}(Gs.Component);n5.displayName="ReactSlider",n5.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=>Gs.createElement("div",e),renderTrack:e=>Gs.createElement("div",e),renderMark:e=>Gs.createElement("span",e)};var o5=n5;var yt=K(Q());import{jsx as Hl}from"react/jsx-runtime";var nM="4px",fue=cue`
|
|
2730
2730
|
opacity: 0.5;
|
|
2731
2731
|
|
|
2732
2732
|
& * {
|