@stlite/desktop 0.78.2 → 0.79.0
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/build/assets/{FileDownload.esm-D2QqHv2c.js → FileDownload.esm-CUqgQU-j.js} +1 -1
- package/build/assets/{FormClearHelper-DliGOSkq.js → FormClearHelper-DmeZ2QuQ.js} +1 -1
- package/build/assets/{Hooks-Daeq69Zu.js → Hooks-CBIuRW4z.js} +1 -1
- package/build/assets/{InputInstructions-BQD8A2_u.js → InputInstructions-iKTPb-Lc.js} +1 -1
- package/build/assets/{ProgressBar-DuGylkeS.js → ProgressBar-Dfr9f8u1.js} +1 -1
- package/build/assets/{RenderInPortalIfExists-HKy5CC9C.js → RenderInPortalIfExists-CxeJAxCs.js} +1 -1
- package/build/assets/{Toolbar-B9grKd8p.js → Toolbar-CG7W1D-O.js} +1 -1
- package/build/assets/{base-input-DJ1o9wy-.js → base-input-DoV-1XUt.js} +1 -1
- package/build/assets/{createSuper-BCtrEkDw.js → createSuper-CvaFdVoD.js} +1 -1
- package/build/assets/{data-grid-overlay-editor-SiNLnLoA.js → data-grid-overlay-editor-CCUG7ReD.js} +1 -1
- package/build/assets/{downloader-y7WtJrbZ.js → downloader-B6rOwzu2.js} +1 -1
- package/build/assets/{es6-ChzZtMws.js → es6-CTcMcfqp.js} +2 -2
- package/build/assets/{getPrototypeOf-jxUzvEiF.js → getPrototypeOf-CFHg57KG.js} +1 -1
- package/build/assets/{iframeResizer.contentWindow-VeTSZzxi.js → iframeResizer.contentWindow-DLNn1A7T.js} +1 -1
- package/build/assets/{index-Di0b5deS.js → index-0aipcnh6.js} +1 -1
- package/build/assets/{index-NW5mgelH.js → index-6rnmC53g.js} +1 -1
- package/build/assets/{index-C-G07XIn.js → index-BHysWwrh.js} +1 -1
- package/build/assets/{index-lR3NBV82.js → index-BTHCcLIl.js} +1 -1
- package/build/assets/{index-B7GLWddS.js → index-BhkIHxDp.js} +1 -1
- package/build/assets/{index-JLaGWCy4.js → index-Bp04iQqW.js} +1 -1
- package/build/assets/{index-CSRB3KZi.js → index-BpeIvyJQ.js} +1 -1
- package/build/assets/{index-CFVMKjCp.js → index-BrRb8POj.js} +1 -1
- package/build/assets/{index-C9Os1Tio.js → index-ByOIN0Gm.js} +1 -1
- package/build/assets/{index-z2lXC7XI.js → index-BzTZZCvL.js} +4 -4
- package/build/assets/{index-Cxp-1GAt.js → index-C4j64dI5.js} +1 -1
- package/build/assets/{index-C5VxAqHf.js → index-CGhw9Sdf.js} +1 -1
- package/build/assets/{index-GTNwQsph.js → index-CIL1eIZN.js} +1 -1
- package/build/assets/{index-Dh5Ef2Om.js → index-CIs9EQe5.js} +1 -1
- package/build/assets/{index-CQ8B9Pyu.js → index-CSyyBx79.js} +1 -1
- package/build/assets/{index-DXHAdPWu.js → index-CW4i_Lge.js} +1 -1
- package/build/assets/{index-UrV00MOE.js → index-CWiqZgRl.js} +1 -1
- package/build/assets/{index-CxF9whAo.js → index-CoKgwXo8.js} +1 -1
- package/build/assets/{index-CvKkwQxq.js → index-Cua9_98i.js} +1 -1
- package/build/assets/{index-BYdd9282.js → index-D-lzdDJ5.js} +1 -1
- package/build/assets/{index-j3NobT-r.js → index-D9QNa8Xs.js} +1 -1
- package/build/assets/{index-Bia2Aiul.js → index-DHFNQm8n.js} +1 -1
- package/build/assets/{index-CnPYErGb.js → index-DURajqPC.js} +1 -1
- package/build/assets/{index-DYrQR0Ux.js → index-Df9nIm6O.js} +1 -1
- package/build/assets/{index-Dkd6yjmr.js → index-DjQcVgxO.js} +1 -1
- package/build/assets/{index-Bsw1C-zM.js → index-DqxtC9MD.js} +1 -1
- package/build/assets/{index-CGRaMNW7.js → index-DtrE1h0V.js} +1 -1
- package/build/assets/{index-ByZKQf5p.js → index-Dwt05210.js} +1 -1
- package/build/assets/{index-Do74AQgb.js → index-N6IvabtE.js} +1 -1
- package/build/assets/{index-BqYxHJ94.js → index-OR2HlVVN.js} +1 -1
- package/build/assets/{index-B2k4Ofkz.js → index-P_LN9wWJ.js} +1 -1
- package/build/assets/{index-Bh9EjD0o.js → index-RhMZ16-Y.js} +1 -1
- package/build/assets/{index-C_q5O89K.js → index-fudEipDa.js} +1 -1
- package/build/assets/{index-CS3mWYPw.js → index-hsTwnoRn.js} +1 -1
- package/build/assets/{index-BCDKFsnk.js → index-qMuFpOqI.js} +1 -1
- package/build/assets/{index-DMBd-bc-.js → index-steA8SlM.js} +5 -5
- package/build/assets/{index-CpzAXWaZ.js → index-xGO_nKX1.js} +1 -1
- package/build/assets/{input-Dhep7xP0.js → input-BrXgmYe9.js} +1 -1
- package/build/assets/{memory-BqTZFgXm.js → memory-Bf74T19z.js} +1 -1
- package/build/assets/{number-overlay-editor-BywJqzaW.js → number-overlay-editor-20er5Sp-.js} +1 -1
- package/build/assets/{sandbox-DmnKum9A.js → sandbox-CV8SMiuv.js} +1 -1
- package/build/assets/{slicedToArray-DkF8JK54.js → slicedToArray-tqzlNjPF.js} +1 -1
- package/build/assets/{textarea-CCmBHfjM.js → textarea-DMefjquC.js} +1 -1
- package/build/assets/{timepicker-DWOLsPBU.js → timepicker-D5Qmkk9Q.js} +1 -1
- package/build/assets/{uniqueId-C3qA3EXY.js → uniqueId-IQr2jcrE.js} +1 -1
- package/build/assets/{useBasicWidgetState-CDQNZkN8.js → useBasicWidgetState-Cqy4gnzY.js} +1 -1
- package/build/assets/{useOnInputChange-FEZNS9DP.js → useOnInputChange-BD_aeagL.js} +1 -1
- package/build/assets/{withFullScreenWrapper-dTVQmtO5.js → withFullScreenWrapper-DIS3bwns.js} +1 -1
- package/build/assets/worker-B1MO5Shr.js +216 -0
- package/build/electron/worker.js +109 -10
- package/build/index.html +1 -1
- package/package.json +4 -4
- package/wheels/streamlit-1.41.0-cp312-none-any.whl +0 -0
- package/build/assets/worker-CLbVOjel.js +0 -117
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b2 as R,bd as be,r as c,b3 as O,M as me,j as g,a_ as ge,b7 as ye,b0 as ve,aK as we,a2 as ne,a$ as Re}from"./index-
|
|
1
|
+
import{b2 as R,bd as be,r as c,b3 as O,M as me,j as g,a_ as ge,b7 as ye,b0 as ve,aK as we,a2 as ne,a$ as Re}from"./index-BzTZZCvL.js";import{a as Oe}from"./useBasicWidgetState-Cqy4gnzY.js";import"./FormClearHelper-DmeZ2QuQ.js";var ie={vertical:"vertical",horizontal:"horizontal"};function ae(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),o.push.apply(o,r)}return o}function C(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?ae(Object(o),!0).forEach(function(r){k(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ae(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function k(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var L=0,I=1,T=2;function B(e){return e.$isActive?T:e.$isHovered?I:L}function ke(e){var t=e.$theme.colors,o=e.$disabled,r=e.$checked,n=e.$isFocusVisible,s=e.$error;if(o)return t.tickFillDisabled;if(r)if(s)switch(B(e)){case L:return t.tickFillErrorSelected;case I:return t.tickFillErrorSelectedHover;case T:return t.tickFillErrorSelectedHoverActive}else switch(B(e)){case L:return t.tickFillSelected;case I:return t.tickFillSelectedHover;case T:return t.tickFillSelectedHoverActive}else return n?t.borderSelected:s?t.tickBorderError:t.tickBorder;return null}function je(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(B(e)){case L:return t.tickFillError;case I:return t.tickFillErrorHover;case T:return t.tickFillErrorHoverActive}else switch(B(e)){case L:return t.tickFill;case I:return t.tickFillHover;case T:return t.tickFillActive}}function $e(e){var t=e.$labelPlacement,o=t===void 0?"":t,r=e.$theme,n;switch(o){case"top":n="Bottom";break;case"bottom":n="Top";break;case"left":n=r.direction==="rtl"?"Left":"Right";break;default:case"right":n=r.direction==="rtl"?"Right":"Left";break}var s=r.sizing,i=s.scale300;return k({},"padding".concat(n),i)}function Se(e){var t=e.$disabled,o=e.$theme,r=o.colors;return t?r.contentSecondary:r.contentPrimary}var U=R("div",function(e){var t=e.$disabled,o=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:o==="horizontal"?"row":"column",alignItems:o==="horizontal"?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}});U.displayName="RadioGroupRoot",U.displayName="RadioGroupRoot";var q=R("label",function(e){var t,o=e.$disabled,r=e.$hasDescription,n=e.$labelPlacement,s=e.$theme,i=e.$align,a=s.sizing,u=i==="horizontal",f=s.direction==="rtl"?"Left":"Right";return t={flexDirection:n==="top"||n==="bottom"?"column":"row",display:"flex",alignItems:"center",cursor:o?"not-allowed":"pointer",marginTop:a.scale200},k(t,"margin".concat(f),u?a.scale200:null),k(t,"marginBottom",r&&!u?null:a.scale200),t});q.displayName="Root",q.displayName="Root";var G=R("div",function(e){var t=e.$theme,o=t.animation,r=t.sizing;return{backgroundColor:je(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?r.scale200:r.scale550,transitionDuration:o.timing200,transitionTimingFunction:o.easeOutCurve,width:e.$checked?r.scale200:r.scale550}});G.displayName="RadioMarkInner",G.displayName="RadioMarkInner";var W=R("div",function(e){var t=e.$theme,o=t.animation,r=t.sizing;return{alignItems:"center",backgroundColor:ke(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:r.scale700,justifyContent:"center",marginTop:r.scale0,marginRight:r.scale0,marginBottom:r.scale0,marginLeft:r.scale0,outline:"none",verticalAlign:"middle",width:r.scale700,flexShrink:0,transitionDuration:o.timing200,transitionTimingFunction:o.easeOutCurve}});W.displayName="RadioMarkOuter",W.displayName="RadioMarkOuter";var X=R("div",function(e){var t=e.$theme.typography;return C(C({verticalAlign:"middle"},$e(e)),{},{color:Se(e)},t.LabelMedium)});X.displayName="Label",X.displayName="Label";var K=R("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});K.displayName="Input",K.displayName="Input";var J=R("div",function(e){var t,o=e.$theme,r=e.$align,n=r==="horizontal",s=o.direction==="rtl"?"Right":"Left",i=o.direction==="rtl"?"Left":"Right";return C(C({},o.typography.ParagraphSmall),{},(t={color:o.colors.contentSecondary,cursor:"auto"},k(t,"margin".concat(s),r==="horizontal"?null:o.sizing.scale900),k(t,"margin".concat(i),n?o.sizing.scale200:null),k(t,"maxWidth","240px"),t))});J.displayName="Description",J.displayName="Description";function Q(e){"@babel/helpers - typeof";return Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(e)}function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},Y.apply(this,arguments)}function Me(e,t){return Ee(e)||xe(e,t)||Pe(e,t)||Fe()}function Fe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pe(e,t){if(e){if(typeof e=="string")return se(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if(o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set")return Array.from(e);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return se(e,t)}}function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function xe(e,t){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r=[],n=!0,s=!1,i,a;try{for(o=o.call(e);!(n=(i=o.next()).done)&&(r.push(i.value),!(t&&r.length===t));n=!0);}catch(u){s=!0,a=u}finally{try{!n&&o.return!=null&&o.return()}finally{if(s)throw a}}return r}}function Ee(e){if(Array.isArray(e))return e}function Le(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ie(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Te(e,t,o){return Ie(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Z(e,t)}function Z(e,t){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},Z(e,t)}function Be(e){var t=De();return function(){var o=D(e),r;if(t){var n=D(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return Ae(this,r)}}function Ae(e,t){if(t&&(Q(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return A(e)}function A(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function De(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function D(e){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},D(e)}function z(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var le=function(e){Ce(o,e);var t=Be(o);function o(){var r;Le(this,o);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),z(A(r),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),z(A(r),"handleFocus",function(a,u){be(a)&&r.setState({isFocusVisible:!0}),r.setState({focusedRadioIndex:u}),r.props.onFocus&&r.props.onFocus(a)}),z(A(r),"handleBlur",function(a,u){r.state.isFocusVisible!==!1&&r.setState({isFocusVisible:!1}),r.setState({focusedRadioIndex:-1}),r.props.onBlur&&r.props.onBlur(a)}),r}return Te(o,[{key:"render",value:function(){var r=this,n=this.props.overrides,s=n===void 0?{}:n,i=O(s.RadioGroupRoot,U),a=Me(i,2),u=a[0],f=a[1];return c.createElement(u,Y({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},f),c.Children.map(this.props.children,function(p,d){if(!c.isValidElement(p))return null;var h=r.props.value===p.props.value;return c.cloneElement(p,{align:r.props.align,autoFocus:r.props.autoFocus,checked:h,disabled:r.props.disabled||p.props.disabled,error:r.props.error,isFocused:r.state.focusedRadioIndex===d,isFocusVisible:r.state.isFocusVisible,tabIndex:d===0&&!r.props.value||h?"0":"-1",labelPlacement:r.props.labelPlacement,name:r.props.name,onBlur:function(l){return r.handleBlur(l,d)},onFocus:function(l){return r.handleFocus(l,d)},onChange:r.props.onChange,onMouseEnter:r.props.onMouseEnter,onMouseLeave:r.props.onMouseLeave})}))}}]),o}(c.Component);z(le,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});function ee(e){"@babel/helpers - typeof";return ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ee(e)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},w.apply(this,arguments)}function F(e,t){return _e(e)||He(e,t)||Ve(e,t)||ze()}function ze(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ve(e,t){if(e){if(typeof e=="string")return ce(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if(o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set")return Array.from(e);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return ce(e,t)}}function ce(e,t){(t==null||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function He(e,t){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r=[],n=!0,s=!1,i,a;try{for(o=o.call(e);!(n=(i=o.next()).done)&&(r.push(i.value),!(t&&r.length===t));n=!0);}catch(u){s=!0,a=u}finally{try{!n&&o.return!=null&&o.return()}finally{if(s)throw a}}return r}}function _e(e){if(Array.isArray(e))return e}function Ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ue(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qe(e,t,o){return Ue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ge(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&te(e,t)}function te(e,t){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},te(e,t)}function We(e){var t=Ke();return function(){var o=V(e),r;if(t){var n=V(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return Xe(this,r)}}function Xe(e,t){if(t&&(ee(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return P(e)}function P(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ke(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function V(e){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},V(e)}function x(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function Je(e){return e==="top"||e==="left"}function Qe(e){return e==="bottom"||e==="right"}var Ye=function(e){return e.stopPropagation()},ue=function(e){Ge(o,e);var t=We(o);function o(){var r;Ne(this,o);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),x(P(r),"state",{isActive:!1,isHovered:!1}),x(P(r),"onMouseEnter",function(a){r.setState({isHovered:!0}),r.props.onMouseEnter&&r.props.onMouseEnter(a)}),x(P(r),"onMouseLeave",function(a){r.setState({isHovered:!1}),r.props.onMouseLeave&&r.props.onMouseLeave(a)}),x(P(r),"onMouseDown",function(a){r.setState({isActive:!0}),r.props.onMouseDown&&r.props.onMouseDown(a)}),x(P(r),"onMouseUp",function(a){r.setState({isActive:!1}),r.props.onMouseUp&&r.props.onMouseUp(a)}),r}return qe(o,[{key:"componentDidMount",value:function(){var r;this.props.autoFocus&&(r=this.props.inputRef)!==null&&r!==void 0&&r.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var r=this.props.overrides,n=r===void 0?{}:r,s=O(n.Root,q),i=F(s,2),a=i[0],u=i[1],f=O(n.Label,X),p=F(f,2),d=p[0],h=p[1],l=O(n.Input,K),b=F(l,2),j=b[0],H=b[1],$=O(n.Description,J),E=F($,2),_=E[0],S=E[1],N=O(n.RadioMarkInner,G),m=F(N,2),y=m[0],v=m[1],pe=O(n.RadioMarkOuter,W),re=F(pe,2),de=re[0],fe=re[1],M={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},oe=c.createElement(d,w({},M,h),this.props.containsInteractiveElement?c.createElement("div",{onClick:function(he){return he.preventDefault()}},this.props.children):this.props.children);return c.createElement(c.Fragment,null,c.createElement(a,w({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},M,u),Je(this.props.labelPlacement)&&oe,c.createElement(de,w({},M,fe),c.createElement(y,w({},M,v))),c.createElement(j,w({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:Ye,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},M,H)),Qe(this.props.labelPlacement)&&oe),!!this.props.description&&c.createElement(_,w({},M,S),this.props.description))}}]),o}(c.Component);x(ue,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:c.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});function Ze({disabled:e,horizontal:t,width:o,value:r,onChange:n,options:s,captions:i,label:a,labelVisibility:u,help:f}){const[p,d]=c.useState(r??null);c.useEffect(()=>{r!==p&&d(r??null)},[r]);const h=c.useCallback(m=>{const y=parseInt(m.target.value,10);d(y),n(y)},[n]),l=me(),{colors:b,radii:j}=l,H={width:o},$=i.length>0,E=s.length>0,_=E?s:["No options to select."],S=e||!E,N=m=>m==""&&t&&$?" ":m;return g.jsxs("div",{className:"stRadio","data-testid":"stRadio",style:H,children:[g.jsx(ge,{label:a,disabled:S,labelVisibility:u,children:f&&g.jsx(ye,{children:g.jsx(ve,{content:f,placement:we.TOP_RIGHT})})}),g.jsx(le,{onChange:h,value:p!==null?p.toString():void 0,disabled:S,align:t?ie.horizontal:ie.vertical,"aria-label":a,"data-testid":"stRadioGroup",overrides:{RadioGroupRoot:{style:{gap:$?l.spacing.sm:l.spacing.none,minHeight:l.sizes.minElementHeight}}},children:_.map((m,y)=>g.jsxs(ue,{value:y.toString(),overrides:{Root:{style:({$isFocusVisible:v})=>({marginBottom:l.spacing.none,marginTop:l.spacing.none,marginRight:$?l.spacing.sm:l.spacing.lg,paddingLeft:l.spacing.none,alignItems:"start",paddingRight:l.spacing.threeXS,backgroundColor:v?b.darkenedBgMix25:"",borderTopLeftRadius:j.md,borderTopRightRadius:j.md,borderBottomLeftRadius:j.md,borderBottomRightRadius:j.md})},RadioMarkOuter:{style:({$checked:v})=>({width:l.sizes.checkbox,height:l.sizes.checkbox,marginTop:"0.35rem",marginRight:l.spacing.none,marginLeft:l.spacing.none,backgroundColor:v&&!S?b.primary:b.fadedText40})},RadioMarkInner:{style:({$checked:v})=>({height:v?"37.5%":`calc(${l.sizes.checkbox} - ${l.spacing.threeXS})`,width:v?"37.5%":`calc(${l.sizes.checkbox} - ${l.spacing.threeXS})`})},Label:{style:{color:S?b.fadedText40:b.bodyText,position:"relative",top:l.spacing.px}}},children:[g.jsx(ne,{source:m,allowHTML:!1,isLabel:!0,largerLabel:!0}),$&&g.jsx(ne,{source:N(i[y]),allowHTML:!1,isCaption:!0,isLabel:!0})]},y))})]})}const et=c.memo(Ze);function tt({disabled:e,element:t,widgetMgr:o,width:r,fragmentId:n}){const[s,i]=Oe({getStateFromWidgetMgr:rt,getDefaultStateFromProto:ot,getCurrStateFromProto:nt,updateWidgetMgrState:it,element:t,widgetMgr:o,fragmentId:n}),a=c.useCallback(b=>{i({value:b,fromUi:!0})},[i]),{horizontal:u,options:f,captions:p,label:d,labelVisibility:h,help:l}=t;return g.jsx(et,{label:d,onChange:a,options:f,captions:p,width:r,disabled:e,horizontal:u,labelVisibility:Re(h==null?void 0:h.value),value:s??null,help:l})}function rt(e,t){return e.getIntValue(t)}function ot(e){return e.default??null}function nt(e){return e.value??null}function it(e,t,o,r){t.setIntValue(e,o.value??null,{fromUi:o.fromUi},r)}const at=c.memo(tt);export{at as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as N,r as d,u as M,aD as U,aR as j,j as p}from"./index-
|
|
1
|
+
import{c as N,r as d,u as M,aD as U,aR as j,j as p}from"./index-BzTZZCvL.js";const x=N("iframe",{target:"evvcert0"})(({theme:r})=>({colorScheme:"normal",border:"none",padding:r.spacing.none,margin:r.spacing.none,width:"100%",aspectRatio:"16 / 9"}),""),V=528;function A({element:r,width:m,endpoints:f,elementMgr:l}){const n=d.useRef(null),{type:y,url:E,startTime:s,subtitles:g,endTime:o,loop:u,autoplay:T,muted:L}=r,c=M(E),v=U(g),P=d.useMemo(()=>{if(!r.id)return!0;const e=l.getElementState(r.id,"preventAutoplay");return e||l.setElementState(r.id,"preventAutoplay",!0),e??!1},[r.id,l]);d.useEffect(()=>{n.current&&(n.current.currentTime=s)},[s]),d.useEffect(()=>{const e=n.current,t=()=>{e&&(e.currentTime=r.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[r]),d.useEffect(()=>{const e=n.current;if(!e)return;let t=!1;const i=()=>{o>0&&e.currentTime>=o&&(u?(e.currentTime=s||0,e.play()):t||(t=!0,e.pause()))};return o>0&&e.addEventListener("timeupdate",i),()=>{e&&o>0&&e.removeEventListener("timeupdate",i)}},[o,u,s]),d.useEffect(()=>{const e=n.current;if(!e)return;const t=()=>{u&&(e.currentTime=s||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[u,s]);const R=e=>{const{startTime:t,endTime:i,loop:S,autoplay:b,muted:w}=r,a=new URL(e);if(t&&!isNaN(t)&&a.searchParams.append("start",t.toString()),i&&!isNaN(i)&&a.searchParams.append("end",i.toString()),S){a.searchParams.append("loop","1");const h=a.pathname.split("/").pop();h&&a.searchParams.append("playlist",h)}return b&&a.searchParams.append("autoplay","1"),w&&a.searchParams.append("mute","1"),a.toString()};return y===j.Type.YOUTUBE_IFRAME?p.jsx(x,{className:"stVideo","data-testid":"stVideo",title:c,src:R(c),allow:"autoplay; encrypted-media",allowFullScreen:!0}):p.jsx("video",{className:"stVideo","data-testid":"stVideo",ref:n,controls:!0,muted:L,autoPlay:T&&!P,src:f.buildMediaURL(c),style:{width:m,height:m===0?V:void 0},crossOrigin:void 0,children:v&&v.map((e,t)=>p.jsx("track",{kind:"captions",src:f.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0},t))})}export{A as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as N,r as k,b2 as Q,bs as dt,bd as ht,b3 as J,bt as ft,bu as pt,c as he,Q as gt,M as mt,a7 as vt,j as Y,R as Ne,bQ as bt,a_ as yt,a$ as wt,bc as Tt,b0 as xt,aK as kt,G as Ot,bR as Se}from"./index-z2lXC7XI.js";import{s as _e}from"./sprintf-C-r3gIuM.js";import{a as Rt}from"./useBasicWidgetState-CDQNZkN8.js";import"./FormClearHelper-DliGOSkq.js";var De={},Ee={},Ie={},fe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Direction=void 0,function(n){n.Right="to right",n.Left="to left",n.Down="to bottom",n.Up="to top"}(t.Direction||(t.Direction={}))})(fe),function(t){var n=N&&N.__spreadArray||function(o,c,l){if(l||arguments.length===2)for(var g=0,v=c.length,m;g<v;g++)(m||!(g in c))&&(m||(m=Array.prototype.slice.call(c,0,g)),m[g]=c[g]);return o.concat(m||Array.prototype.slice.call(c))};Object.defineProperty(t,"__esModule",{value:!0}),t.useThumbOverlap=t.assertUnreachable=t.voidFn=t.getTrackBackground=t.replaceAt=t.schd=t.translate=t.getClosestThumbIndex=t.translateThumbs=t.getPaddingAndBorder=t.getMargin=t.checkInitialOverlap=t.checkValuesAgainstBoundaries=t.checkBoundaries=t.isVertical=t.relativeValue=t.normalizeValue=t.isStepDivisible=t.isTouchEvent=t.getStepDecimals=void 0;var r=k,e=fe,a=function(o){var c=o.toString().split(".")[1];return c?c.length:0};t.getStepDecimals=a;function i(o){return o.touches&&o.touches.length||o.changedTouches&&o.changedTouches.length}t.isTouchEvent=i;function s(o,c,l){var g=(c-o)/l,v=8,m=Number(g.toFixed(v));return parseInt(m.toString(),10)===m}t.isStepDivisible=s;function u(o,c,l,g,v,m,T){var b=1e11;if(o=Math.round(o*b)/b,!m){var E=T[c-1],S=T[c+1];if(E&&E>o)return E;if(S&&S<o)return S}if(o>g)return g;if(o<l)return l;var _=Math.floor(o*b-l*b)%Math.floor(v*b),F=Math.floor(o*b-Math.abs(_)),U=_===0?o:F/b,j=Math.abs(_/b)<v/2?U:U+v,V=(0,t.getStepDecimals)(v);return parseFloat(j.toFixed(V))}t.normalizeValue=u;function d(o,c,l){return(o-c)/(l-c)}t.relativeValue=d;function y(o){return o===e.Direction.Up||o===e.Direction.Down}t.isVertical=y;function f(o,c,l){if(c>=l)throw new RangeError("min (".concat(c,") is equal/bigger than max (").concat(l,")"));if(o<c)throw new RangeError("value (".concat(o,") is smaller than min (").concat(c,")"));if(o>l)throw new RangeError("value (".concat(o,") is bigger than max (").concat(l,")"))}t.checkBoundaries=f;function h(o,c,l){return o<c?c:o>l?l:o}t.checkValuesAgainstBoundaries=h;function p(o){if(!(o.length<2)&&!o.slice(1).every(function(c,l){return o[l]<=c}))throw new RangeError("values={[".concat(o,"]} needs to be sorted when allowOverlap={false}"))}t.checkInitialOverlap=p;function R(o){var c=window.getComputedStyle(o);return{top:parseInt(c["margin-top"],10),bottom:parseInt(c["margin-bottom"],10),left:parseInt(c["margin-left"],10),right:parseInt(c["margin-right"],10)}}t.getMargin=R;function w(o){var c=window.getComputedStyle(o);return{top:parseInt(c["padding-top"],10)+parseInt(c["border-top-width"],10),bottom:parseInt(c["padding-bottom"],10)+parseInt(c["border-bottom-width"],10),left:parseInt(c["padding-left"],10)+parseInt(c["border-left-width"],10),right:parseInt(c["padding-right"],10)+parseInt(c["border-right-width"],10)}}t.getPaddingAndBorder=w;function M(o,c,l){var g=l?-1:1;o.forEach(function(v,m){return D(v,g*c[m].x,c[m].y)})}t.translateThumbs=M;function L(o,c,l,g){for(var v=0,m=$(o[0],c,l,g),T=1;T<o.length;T++){var b=$(o[T],c,l,g);b<m&&(m=b,v=T)}return v}t.getClosestThumbIndex=L;function D(o,c,l){o.style.transform="translate(".concat(c,"px, ").concat(l,"px)")}t.translate=D;var O=function(o){var c=[],l=null,g=function(){for(var v=[],m=0;m<arguments.length;m++)v[m]=arguments[m];c=v,!l&&(l=requestAnimationFrame(function(){l=null,o.apply(void 0,c)}))};return g};t.schd=O;function I(o,c,l){var g=o.slice(0);return g[c]=l,g}t.replaceAt=I;function q(o){var c=o.values,l=o.colors,g=o.min,v=o.max,m=o.direction,T=m===void 0?e.Direction.Right:m,b=o.rtl,E=b===void 0?!1:b;E&&T===e.Direction.Right?T=e.Direction.Left:E&&e.Direction.Left&&(T=e.Direction.Right);var S=c.slice(0).sort(function(F,U){return F-U}).map(function(F){return(F-g)/(v-g)*100}),_=S.reduce(function(F,U,j){return"".concat(F,", ").concat(l[j]," ").concat(U,"%, ").concat(l[j+1]," ").concat(U,"%")},"");return"linear-gradient(".concat(T,", ").concat(l[0]," 0%").concat(_,", ").concat(l[l.length-1]," 100%)")}t.getTrackBackground=q;function ee(){}t.voidFn=ee;function z(o){throw new Error("Didn't expect to get here")}t.assertUnreachable=z;var P=function(o,c,l,g,v){v===void 0&&(v=function(T){return T});var m=Math.ceil(n([o],Array.from(o.children),!0).reduce(function(T,b){var E=Math.ceil(b.getBoundingClientRect().width);if(b.innerText&&b.innerText.includes(l)&&b.childElementCount===0){var S=b.cloneNode(!0);S.innerHTML=v(c.toFixed(g)),S.style.visibility="hidden",document.body.appendChild(S),E=Math.ceil(S.getBoundingClientRect().width),document.body.removeChild(S)}return E>T?E:T},o.getBoundingClientRect().width));return m},Z=function(o,c,l,g,v,m,T){T===void 0&&(T=function(S){return S});var b=[],E=function(S){var _=P(l[S],g[S],v,m,T),F=c[S].x;c.forEach(function(U,j){var V=U.x,A=P(l[j],g[j],v,m,T);S!==j&&(F>=V&&F<=V+A||F+_>=V&&F+_<=V+A)&&(b.includes(j)||(b.push(S),b.push(j),b=n(n([],b,!0),[S,j],!1),E(j)))})};return E(o),Array.from(new Set(b.sort()))},G=function(o,c,l,g,v,m){g===void 0&&(g=.1),v===void 0&&(v=" - "),m===void 0&&(m=function(j){return j});var T=(0,t.getStepDecimals)(g),b=(0,r.useState)({}),E=b[0],S=b[1],_=(0,r.useState)(m(c[l].toFixed(T))),F=_[0],U=_[1];return(0,r.useEffect)(function(){if(o){var j=o.getThumbs();if(j.length<1)return;var V={},A=o.getOffsets(),re=Z(l,A,j,c,v,T,m),se=m(c[l].toFixed(T));if(re.length){var ae=re.reduce(function(te,le,ce,de){return te.length?n(n([],te,!0),[A[de[ce]].x],!1):[A[de[ce]].x]},[]);if(Math.min.apply(Math,ae)===A[l].x){var ie=[];re.forEach(function(te){ie.push(c[te].toFixed(T))}),se=Array.from(new Set(ie.sort(function(te,le){return parseFloat(te)-parseFloat(le)}))).map(m).join(v);var Re=Math.min.apply(Math,ae),ue=Math.max.apply(Math,ae),Me=j[re[ae.indexOf(ue)]].getBoundingClientRect().width;V.left="".concat(Math.abs(Re-(ue+Me))/2,"px"),V.transform="translate(-50%, 0)"}else V.visibility="hidden"}U(se),S(V)}},[o,c]),[F,E]};t.useThumbOverlap=G;function $(o,c,l,g){var v=o.getBoundingClientRect(),m=v.left,T=v.top,b=v.width,E=v.height;return y(g)?Math.abs(l-(T+E/2)):Math.abs(c-(m+b/2))}}(Ie);var Mt=N&&N.__extends||function(){var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i])},t(n,r)};return function(n,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(n,r);function e(){this.constructor=n}n.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}}(),St=N&&N.__createBinding||(Object.create?function(t,n,r,e){e===void 0&&(e=r);var a=Object.getOwnPropertyDescriptor(n,r);(!a||("get"in a?!n.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return n[r]}}),Object.defineProperty(t,e,a)}:function(t,n,r,e){e===void 0&&(e=r),t[e]=n[r]}),Dt=N&&N.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),Et=N&&N.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&St(n,t,r);return Dt(n,t),n},Ue=N&&N.__spreadArray||function(t,n,r){if(r||arguments.length===2)for(var e=0,a=n.length,i;e<a;e++)(i||!(e in n))&&(i||(i=Array.prototype.slice.call(n,0,e)),i[e]=n[e]);return t.concat(i||Array.prototype.slice.call(n))};Object.defineProperty(Ee,"__esModule",{value:!0});var pe=Et(k),x=Ie,B=fe,It=["ArrowRight","ArrowUp","k","PageUp"],Ct=["ArrowLeft","ArrowDown","j","PageDown"],Pt=function(t){Mt(n,t);function n(r){var e=t.call(this,r)||this;if(e.trackRef=pe.createRef(),e.thumbRefs=[],e.state={draggedTrackPos:[-1,-1],draggedThumbIndex:-1,thumbZIndexes:new Array(e.props.values.length).fill(0).map(function(a,i){return i}),isChanged:!1,markOffsets:[]},e.getOffsets=function(){var a=e.props,i=a.direction,s=a.values,u=a.min,d=a.max,y=e.trackRef.current,f=y.getBoundingClientRect(),h=(0,x.getPaddingAndBorder)(y);return e.getThumbs().map(function(p,R){var w={x:0,y:0},M=p.getBoundingClientRect(),L=(0,x.getMargin)(p);switch(i){case B.Direction.Right:return w.x=(L.left+h.left)*-1,w.y=((M.height-f.height)/2+h.top)*-1,w.x+=f.width*(0,x.relativeValue)(s[R],u,d)-M.width/2,w;case B.Direction.Left:return w.x=(L.right+h.right)*-1,w.y=((M.height-f.height)/2+h.top)*-1,w.x+=f.width-f.width*(0,x.relativeValue)(s[R],u,d)-M.width/2,w;case B.Direction.Up:return w.x=((M.width-f.width)/2+L.left+h.left)*-1,w.y=-h.left,w.y+=f.height-f.height*(0,x.relativeValue)(s[R],u,d)-M.height/2,w;case B.Direction.Down:return w.x=((M.width-f.width)/2+L.left+h.left)*-1,w.y=-h.left,w.y+=f.height*(0,x.relativeValue)(s[R],u,d)-M.height/2,w;default:return(0,x.assertUnreachable)(i)}})},e.getThumbs=function(){return e.trackRef&&e.trackRef.current?Array.from(e.trackRef.current.children).filter(function(a){return a.hasAttribute("aria-valuenow")}):(console.warn("No thumbs found in the track container. Did you forget to pass & spread the `props` param in renderTrack?"),[])},e.getTargetIndex=function(a){return e.getThumbs().findIndex(function(i){return i===a.target||i.contains(a.target)})},e.addTouchEvents=function(a){document.addEventListener("touchmove",e.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",e.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",e.schdOnEnd,{passive:!1})},e.addMouseEvents=function(a){document.addEventListener("mousemove",e.schdOnMouseMove),document.addEventListener("mouseup",e.schdOnEnd)},e.onMouseDownTrack=function(a){var i;if(a.button===0)if(a.persist(),a.preventDefault(),e.addMouseEvents(a.nativeEvent),e.props.values.length>1&&e.props.draggableTrack){if(e.thumbRefs.some(function(u){var d;return(d=u.current)===null||d===void 0?void 0:d.contains(a.target)}))return;e.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return e.onMove(a.clientX,a.clientY)})}else{var s=(0,x.getClosestThumbIndex)(e.thumbRefs.map(function(u){return u.current}),a.clientX,a.clientY,e.props.direction);(i=e.thumbRefs[s].current)===null||i===void 0||i.focus(),e.setState({draggedThumbIndex:s},function(){return e.onMove(a.clientX,a.clientY)})}},e.onResize=function(){(0,x.translateThumbs)(e.getThumbs(),e.getOffsets(),e.props.rtl),e.calculateMarkOffsets()},e.onTouchStartTrack=function(a){var i;if(a.persist(),e.addTouchEvents(a.nativeEvent),e.props.values.length>1&&e.props.draggableTrack){if(e.thumbRefs.some(function(u){var d;return(d=u.current)===null||d===void 0?void 0:d.contains(a.target)}))return;e.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return e.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var s=(0,x.getClosestThumbIndex)(e.thumbRefs.map(function(u){return u.current}),a.touches[0].clientX,a.touches[0].clientY,e.props.direction);(i=e.thumbRefs[s].current)===null||i===void 0||i.focus(),e.setState({draggedThumbIndex:s},function(){return e.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},e.onMouseOrTouchStart=function(a){if(!e.props.disabled){var i=(0,x.isTouchEvent)(a);if(!(!i&&a.button!==0)){var s=e.getTargetIndex(a);s!==-1&&(i?e.addTouchEvents(a):e.addMouseEvents(a),e.setState({draggedThumbIndex:s,thumbZIndexes:e.state.thumbZIndexes.map(function(u,d){return d===s?Math.max.apply(Math,e.state.thumbZIndexes):u<=e.state.thumbZIndexes[s]?u:u-1})}))}}},e.onMouseMove=function(a){a.preventDefault(),e.onMove(a.clientX,a.clientY)},e.onTouchMove=function(a){a.preventDefault(),e.onMove(a.touches[0].clientX,a.touches[0].clientY)},e.onKeyDown=function(a){var i=e.props,s=i.values,u=i.onChange,d=i.step,y=i.rtl,f=i.direction,h=e.state.isChanged,p=e.getTargetIndex(a.nativeEvent),R=y||f===B.Direction.Left||f===B.Direction.Down?-1:1;p!==-1&&(It.includes(a.key)?(a.preventDefault(),e.setState({draggedThumbIndex:p,isChanged:!0}),u((0,x.replaceAt)(s,p,e.normalizeValue(s[p]+R*(a.key==="PageUp"?d*10:d),p)))):Ct.includes(a.key)?(a.preventDefault(),e.setState({draggedThumbIndex:p,isChanged:!0}),u((0,x.replaceAt)(s,p,e.normalizeValue(s[p]-R*(a.key==="PageDown"?d*10:d),p)))):a.key==="Tab"?e.setState({draggedThumbIndex:-1},function(){h&&e.fireOnFinalChange()}):h&&e.fireOnFinalChange())},e.onKeyUp=function(a){var i=e.state.isChanged;e.setState({draggedThumbIndex:-1},function(){i&&e.fireOnFinalChange()})},e.onMove=function(a,i){var s=e.state,u=s.draggedThumbIndex,d=s.draggedTrackPos,y=e.props,f=y.direction,h=y.min,p=y.max,R=y.onChange,w=y.values,M=y.step,L=y.rtl;if(u===-1&&d[0]===-1&&d[1]===-1)return null;var D=e.trackRef.current;if(!D)return null;var O=D.getBoundingClientRect(),I=(0,x.isVertical)(f)?O.height:O.width;if(d[0]!==-1&&d[1]!==-1){var q=a-d[0],ee=i-d[1],z=0;switch(f){case B.Direction.Right:case B.Direction.Left:z=q/I*(p-h);break;case B.Direction.Down:case B.Direction.Up:z=ee/I*(p-h);break;default:(0,x.assertUnreachable)(f)}if(L&&(z*=-1),Math.abs(z)>=M/2){for(var P=0;P<e.thumbRefs.length;P++){if(w[P]===p&&Math.sign(z)===1||w[P]===h&&Math.sign(z)===-1)return;var Z=w[P]+z;Z>p?z=p-w[P]:Z<h&&(z=h-w[P])}for(var G=w.slice(0),P=0;P<e.thumbRefs.length;P++)G=(0,x.replaceAt)(G,P,e.normalizeValue(w[P]+z,P));e.setState({draggedTrackPos:[a,i]}),R(G)}}else{var $=0;switch(f){case B.Direction.Right:$=(a-O.left)/I*(p-h)+h;break;case B.Direction.Left:$=(I-(a-O.left))/I*(p-h)+h;break;case B.Direction.Down:$=(i-O.top)/I*(p-h)+h;break;case B.Direction.Up:$=(I-(i-O.top))/I*(p-h)+h;break;default:(0,x.assertUnreachable)(f)}L&&($=p+h-$),Math.abs(w[u]-$)>=M/2&&R((0,x.replaceAt)(w,u,e.normalizeValue($,u)))}},e.normalizeValue=function(a,i){var s=e.props,u=s.min,d=s.max,y=s.step,f=s.allowOverlap,h=s.values;return(0,x.normalizeValue)(a,i,u,d,y,f,h)},e.onEnd=function(a){if(a.preventDefault(),document.removeEventListener("mousemove",e.schdOnMouseMove),document.removeEventListener("touchmove",e.schdOnTouchMove),document.removeEventListener("mouseup",e.schdOnEnd),document.removeEventListener("touchend",e.schdOnEnd),document.removeEventListener("touchcancel",e.schdOnEnd),e.state.draggedThumbIndex===-1&&e.state.draggedTrackPos[0]===-1&&e.state.draggedTrackPos[1]===-1)return null;e.setState({draggedThumbIndex:-1,draggedTrackPos:[-1,-1]},function(){e.fireOnFinalChange()})},e.fireOnFinalChange=function(){e.setState({isChanged:!1});var a=e.props,i=a.onFinalChange,s=a.values;i&&i(s)},e.updateMarkRefs=function(a){if(!a.renderMark){e.numOfMarks=void 0,e.markRefs=void 0;return}e.numOfMarks=(a.max-a.min)/e.props.step,e.markRefs=[];for(var i=0;i<e.numOfMarks+1;i++)e.markRefs[i]=pe.createRef()},e.calculateMarkOffsets=function(){if(!(!e.props.renderMark||!e.trackRef||!e.numOfMarks||!e.markRefs||e.trackRef.current===null)){for(var a=window.getComputedStyle(e.trackRef.current),i=parseInt(a.width,10),s=parseInt(a.height,10),u=parseInt(a.paddingLeft,10),d=parseInt(a.paddingTop,10),y=[],f=0;f<e.numOfMarks+1;f++){var h=9999,p=9999;if(e.markRefs[f].current){var R=e.markRefs[f].current.getBoundingClientRect();h=R.height,p=R.width}e.props.direction===B.Direction.Left||e.props.direction===B.Direction.Right?y.push([Math.round(i/e.numOfMarks*f+u-p/2),-Math.round((h-s)/2)]):y.push([Math.round(s/e.numOfMarks*f+d-h/2),-Math.round((p-i)/2)])}e.setState({markOffsets:y})}},r.step===0)throw new Error('"step" property should be a positive number');return e.schdOnMouseMove=(0,x.schd)(e.onMouseMove),e.schdOnTouchMove=(0,x.schd)(e.onTouchMove),e.schdOnEnd=(0,x.schd)(e.onEnd),e.thumbRefs=r.values.map(function(){return pe.createRef()}),e.updateMarkRefs(r),e}return n.prototype.componentDidMount=function(){var r=this,e=this.props,a=e.values,i=e.min,s=e.step;this.resizeObserver=window.ResizeObserver?new window.ResizeObserver(this.onResize):{observe:function(){return window.addEventListener("resize",r.onResize)},unobserve:function(){return window.removeEventListener("resize",r.onResize)}},document.addEventListener("touchstart",this.onMouseOrTouchStart,{passive:!1}),document.addEventListener("mousedown",this.onMouseOrTouchStart,{passive:!1}),!this.props.allowOverlap&&(0,x.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(u){return(0,x.checkBoundaries)(u,r.props.min,r.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,x.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(u){(0,x.isStepDivisible)(i,u,s)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")})},n.prototype.componentDidUpdate=function(r,e){var a=this.props,i=a.max,s=a.min,u=a.step,d=a.values,y=a.rtl;(r.max!==i||r.min!==s||r.step!==u)&&this.updateMarkRefs(this.props),(0,x.translateThumbs)(this.getThumbs(),this.getOffsets(),y),(r.max!==i||r.min!==s||r.step!==u||e.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),d.forEach(function(f){(0,x.isStepDivisible)(s,f,u)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")}))},n.prototype.componentWillUnmount=function(){var r={passive:!1};document.removeEventListener("mousedown",this.onMouseOrTouchStart,r),document.removeEventListener("mousemove",this.schdOnMouseMove),document.removeEventListener("touchmove",this.schdOnTouchMove),document.removeEventListener("touchstart",this.onMouseOrTouchStart),document.removeEventListener("mouseup",this.schdOnEnd),document.removeEventListener("touchend",this.schdOnEnd),this.resizeObserver.unobserve(this.trackRef.current)},n.prototype.render=function(){var r=this,e=this.props,a=e.renderTrack,i=e.renderThumb,s=e.renderMark,u=s===void 0?function(){return null}:s,d=e.values,y=e.min,f=e.max,h=e.allowOverlap,p=e.disabled,R=this.state,w=R.draggedThumbIndex,M=R.thumbZIndexes,L=R.markOffsets;return a({props:{style:{transform:"scale(1)",cursor:w>-1?"grabbing":this.props.draggableTrack?(0,x.isVertical)(this.props.direction)?"ns-resize":"ew-resize":d.length===1&&!p?"pointer":"inherit"},onMouseDown:p?x.voidFn:this.onMouseDownTrack,onTouchStart:p?x.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:p,children:Ue(Ue([],L.map(function(D,O,I){return u({props:{style:r.props.direction===B.Direction.Left||r.props.direction===B.Direction.Right?{position:"absolute",left:"".concat(D[0],"px"),marginTop:"".concat(D[1],"px")}:{position:"absolute",top:"".concat(D[0],"px"),marginLeft:"".concat(D[1],"px")},key:"mark".concat(O),ref:r.markRefs[O]},index:O})}),!0),d.map(function(D,O){var I=r.state.draggedThumbIndex===O;return i({index:O,value:D,isDragged:I,props:{style:{position:"absolute",zIndex:M[O],cursor:p?"inherit":I?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:O,tabIndex:p?void 0:0,"aria-valuemax":h?f:d[O+1]||f,"aria-valuemin":h?y:d[O-1]||y,"aria-valuenow":D,draggable:!1,ref:r.thumbRefs[O],role:"slider",onKeyDown:p?x.voidFn:r.onKeyDown,onKeyUp:p?x.voidFn:r.onKeyUp}})}),!0)})},n.defaultProps={step:1,direction:B.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},n}(pe.Component);Ee.default=Pt,function(t){var n=N&&N.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.checkValuesAgainstBoundaries=t.relativeValue=t.useThumbOverlap=t.Direction=t.getTrackBackground=t.Range=void 0;var r=n(Ee);t.Range=r.default;var e=Ie;Object.defineProperty(t,"getTrackBackground",{enumerable:!0,get:function(){return e.getTrackBackground}}),Object.defineProperty(t,"useThumbOverlap",{enumerable:!0,get:function(){return e.useThumbOverlap}}),Object.defineProperty(t,"relativeValue",{enumerable:!0,get:function(){return e.relativeValue}}),Object.defineProperty(t,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return e.checkValuesAgainstBoundaries}});var a=fe;Object.defineProperty(t,"Direction",{enumerable:!0,get:function(){return a.Direction}})}(De);function He(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,e)}return r}function ge(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?He(Object(r),!0).forEach(function(e){jt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):He(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function jt(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var me=Q("div",{position:"relative",width:"100%"});me.displayName="Root",me.displayName="Root",me.displayName="StyledRoot";var ve=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$disabled,i=t.$isDragged,s=n.sizing,u="inherit";return a?u="not-allowed":i?u="grabbing":e.length===1&&(u="pointer"),{paddingTop:s.scale600,paddingBottom:s.scale600,paddingRight:s.scale600,paddingLeft:s.scale600,display:"flex",cursor:u,backgroundColor:n.colors.sliderTrackFill}});ve.displayName="Track",ve.displayName="Track",ve.displayName="StyledTrack";var be=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$min,i=t.$max,s=t.$disabled,u=n.colors,d=n.borders,y=n.direction,f=n.borders.useRoundedCorners?d.radius100:0;return{borderTopLeftRadius:f,borderTopRightRadius:f,borderBottomRightRadius:f,borderBottomLeftRadius:f,background:De.getTrackBackground({values:e,colors:e.length===1?[s?u.borderOpaque:u.primary,s?u.backgroundSecondary:u.borderOpaque]:[s?u.backgroundSecondary:u.borderOpaque,s?u.borderOpaque:u.primary,s?u.backgroundSecondary:u.borderOpaque],min:a||0,max:i||0,rtl:y==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:s?"not-allowed":"inherit"}});be.displayName="InnerTrack",be.displayName="InnerTrack",be.displayName="StyledInnerTrack";var ye=Q("div",function(t){return{width:"4px",height:"2px",backgroundColor:t.$theme.colors.backgroundPrimary,marginLeft:"16px"}});ye.displayName="Mark",ye.displayName="Mark",ye.displayName="StyledMark";var we=Q("div",function(t){return ge(ge({},t.$theme.typography.font200),{},{color:t.$theme.colors.contentPrimary})});we.displayName="Tick",we.displayName="Tick",we.displayName="StyledTick";var Te=Q("div",function(t){var n=t.$theme,r=n.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:r.scale600,paddingLeft:r.scale600,paddingBottom:r.scale400}});Te.displayName="TickBar",Te.displayName="TickBar",Te.displayName="StyledTickBar";var xe=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$thumbIndex,i=t.$disabled,s=e.length===2&&a===0,u=e.length===2&&a===1;return n.direction==="rtl"&&(u||s)&&(s=!s,u=!u),{height:"24px",width:"24px",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:i?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleFill,outline:"none",boxShadow:t.$isFocusVisible?"0 0 0 3px ".concat(n.colors.accent):"0 1px 4px rgba(0, 0, 0, 0.12)",cursor:i?"not-allowed":"inherit"}});xe.displayName="Thumb",xe.displayName="Thumb",xe.displayName="StyledThumb";var ke=Q("div",function(t){var n=t.$disabled,r=t.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:n?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleInnerFill}});ke.displayName="InnerThumb",ke.displayName="InnerThumb",ke.displayName="StyledInnerThumb";var Oe=Q("div",function(t){var n=t.$disabled,r=t.$theme;return ge(ge({position:"absolute",top:"-".concat(r.sizing.scale1400)},r.typography.font200),{},{backgroundColor:n?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleInnerFill,color:r.colors.contentInversePrimary,paddingLeft:r.sizing.scale600,paddingRight:r.sizing.scale600,paddingTop:r.sizing.scale500,paddingBottom:r.sizing.scale500,borderBottomLeftRadius:"48px",borderBottomRightRadius:"48px",borderTopLeftRadius:"48px",borderTopRightRadius:"48px",whiteSpace:"nowrap"})});Oe.displayName="ThumbValue",Oe.displayName="ThumbValue",Oe.displayName="StyledThumbValue";function Xe(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,e)}return r}function Bt(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Xe(Object(r),!0).forEach(function(e){Lt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Lt(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function X(){return X=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},X.apply(this,arguments)}function K(t,n){return zt(t)||Ft(t,n)||$t(t,n)||At()}function At(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{e as N,r as k,b2 as Q,bs as dt,bd as ht,b3 as J,bt as ft,bu as pt,c as he,Q as gt,M as mt,a7 as vt,j as Y,R as Ne,bQ as bt,a_ as yt,a$ as wt,bc as Tt,b0 as xt,aK as kt,G as Ot,bR as Se}from"./index-BzTZZCvL.js";import{s as _e}from"./sprintf-C-r3gIuM.js";import{a as Rt}from"./useBasicWidgetState-Cqy4gnzY.js";import"./FormClearHelper-DmeZ2QuQ.js";var De={},Ee={},Ie={},fe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Direction=void 0,function(n){n.Right="to right",n.Left="to left",n.Down="to bottom",n.Up="to top"}(t.Direction||(t.Direction={}))})(fe),function(t){var n=N&&N.__spreadArray||function(o,c,l){if(l||arguments.length===2)for(var g=0,v=c.length,m;g<v;g++)(m||!(g in c))&&(m||(m=Array.prototype.slice.call(c,0,g)),m[g]=c[g]);return o.concat(m||Array.prototype.slice.call(c))};Object.defineProperty(t,"__esModule",{value:!0}),t.useThumbOverlap=t.assertUnreachable=t.voidFn=t.getTrackBackground=t.replaceAt=t.schd=t.translate=t.getClosestThumbIndex=t.translateThumbs=t.getPaddingAndBorder=t.getMargin=t.checkInitialOverlap=t.checkValuesAgainstBoundaries=t.checkBoundaries=t.isVertical=t.relativeValue=t.normalizeValue=t.isStepDivisible=t.isTouchEvent=t.getStepDecimals=void 0;var r=k,e=fe,a=function(o){var c=o.toString().split(".")[1];return c?c.length:0};t.getStepDecimals=a;function i(o){return o.touches&&o.touches.length||o.changedTouches&&o.changedTouches.length}t.isTouchEvent=i;function s(o,c,l){var g=(c-o)/l,v=8,m=Number(g.toFixed(v));return parseInt(m.toString(),10)===m}t.isStepDivisible=s;function u(o,c,l,g,v,m,T){var b=1e11;if(o=Math.round(o*b)/b,!m){var E=T[c-1],S=T[c+1];if(E&&E>o)return E;if(S&&S<o)return S}if(o>g)return g;if(o<l)return l;var _=Math.floor(o*b-l*b)%Math.floor(v*b),F=Math.floor(o*b-Math.abs(_)),U=_===0?o:F/b,j=Math.abs(_/b)<v/2?U:U+v,V=(0,t.getStepDecimals)(v);return parseFloat(j.toFixed(V))}t.normalizeValue=u;function d(o,c,l){return(o-c)/(l-c)}t.relativeValue=d;function y(o){return o===e.Direction.Up||o===e.Direction.Down}t.isVertical=y;function f(o,c,l){if(c>=l)throw new RangeError("min (".concat(c,") is equal/bigger than max (").concat(l,")"));if(o<c)throw new RangeError("value (".concat(o,") is smaller than min (").concat(c,")"));if(o>l)throw new RangeError("value (".concat(o,") is bigger than max (").concat(l,")"))}t.checkBoundaries=f;function h(o,c,l){return o<c?c:o>l?l:o}t.checkValuesAgainstBoundaries=h;function p(o){if(!(o.length<2)&&!o.slice(1).every(function(c,l){return o[l]<=c}))throw new RangeError("values={[".concat(o,"]} needs to be sorted when allowOverlap={false}"))}t.checkInitialOverlap=p;function R(o){var c=window.getComputedStyle(o);return{top:parseInt(c["margin-top"],10),bottom:parseInt(c["margin-bottom"],10),left:parseInt(c["margin-left"],10),right:parseInt(c["margin-right"],10)}}t.getMargin=R;function w(o){var c=window.getComputedStyle(o);return{top:parseInt(c["padding-top"],10)+parseInt(c["border-top-width"],10),bottom:parseInt(c["padding-bottom"],10)+parseInt(c["border-bottom-width"],10),left:parseInt(c["padding-left"],10)+parseInt(c["border-left-width"],10),right:parseInt(c["padding-right"],10)+parseInt(c["border-right-width"],10)}}t.getPaddingAndBorder=w;function M(o,c,l){var g=l?-1:1;o.forEach(function(v,m){return D(v,g*c[m].x,c[m].y)})}t.translateThumbs=M;function L(o,c,l,g){for(var v=0,m=$(o[0],c,l,g),T=1;T<o.length;T++){var b=$(o[T],c,l,g);b<m&&(m=b,v=T)}return v}t.getClosestThumbIndex=L;function D(o,c,l){o.style.transform="translate(".concat(c,"px, ").concat(l,"px)")}t.translate=D;var O=function(o){var c=[],l=null,g=function(){for(var v=[],m=0;m<arguments.length;m++)v[m]=arguments[m];c=v,!l&&(l=requestAnimationFrame(function(){l=null,o.apply(void 0,c)}))};return g};t.schd=O;function I(o,c,l){var g=o.slice(0);return g[c]=l,g}t.replaceAt=I;function q(o){var c=o.values,l=o.colors,g=o.min,v=o.max,m=o.direction,T=m===void 0?e.Direction.Right:m,b=o.rtl,E=b===void 0?!1:b;E&&T===e.Direction.Right?T=e.Direction.Left:E&&e.Direction.Left&&(T=e.Direction.Right);var S=c.slice(0).sort(function(F,U){return F-U}).map(function(F){return(F-g)/(v-g)*100}),_=S.reduce(function(F,U,j){return"".concat(F,", ").concat(l[j]," ").concat(U,"%, ").concat(l[j+1]," ").concat(U,"%")},"");return"linear-gradient(".concat(T,", ").concat(l[0]," 0%").concat(_,", ").concat(l[l.length-1]," 100%)")}t.getTrackBackground=q;function ee(){}t.voidFn=ee;function z(o){throw new Error("Didn't expect to get here")}t.assertUnreachable=z;var P=function(o,c,l,g,v){v===void 0&&(v=function(T){return T});var m=Math.ceil(n([o],Array.from(o.children),!0).reduce(function(T,b){var E=Math.ceil(b.getBoundingClientRect().width);if(b.innerText&&b.innerText.includes(l)&&b.childElementCount===0){var S=b.cloneNode(!0);S.innerHTML=v(c.toFixed(g)),S.style.visibility="hidden",document.body.appendChild(S),E=Math.ceil(S.getBoundingClientRect().width),document.body.removeChild(S)}return E>T?E:T},o.getBoundingClientRect().width));return m},Z=function(o,c,l,g,v,m,T){T===void 0&&(T=function(S){return S});var b=[],E=function(S){var _=P(l[S],g[S],v,m,T),F=c[S].x;c.forEach(function(U,j){var V=U.x,A=P(l[j],g[j],v,m,T);S!==j&&(F>=V&&F<=V+A||F+_>=V&&F+_<=V+A)&&(b.includes(j)||(b.push(S),b.push(j),b=n(n([],b,!0),[S,j],!1),E(j)))})};return E(o),Array.from(new Set(b.sort()))},G=function(o,c,l,g,v,m){g===void 0&&(g=.1),v===void 0&&(v=" - "),m===void 0&&(m=function(j){return j});var T=(0,t.getStepDecimals)(g),b=(0,r.useState)({}),E=b[0],S=b[1],_=(0,r.useState)(m(c[l].toFixed(T))),F=_[0],U=_[1];return(0,r.useEffect)(function(){if(o){var j=o.getThumbs();if(j.length<1)return;var V={},A=o.getOffsets(),re=Z(l,A,j,c,v,T,m),se=m(c[l].toFixed(T));if(re.length){var ae=re.reduce(function(te,le,ce,de){return te.length?n(n([],te,!0),[A[de[ce]].x],!1):[A[de[ce]].x]},[]);if(Math.min.apply(Math,ae)===A[l].x){var ie=[];re.forEach(function(te){ie.push(c[te].toFixed(T))}),se=Array.from(new Set(ie.sort(function(te,le){return parseFloat(te)-parseFloat(le)}))).map(m).join(v);var Re=Math.min.apply(Math,ae),ue=Math.max.apply(Math,ae),Me=j[re[ae.indexOf(ue)]].getBoundingClientRect().width;V.left="".concat(Math.abs(Re-(ue+Me))/2,"px"),V.transform="translate(-50%, 0)"}else V.visibility="hidden"}U(se),S(V)}},[o,c]),[F,E]};t.useThumbOverlap=G;function $(o,c,l,g){var v=o.getBoundingClientRect(),m=v.left,T=v.top,b=v.width,E=v.height;return y(g)?Math.abs(l-(T+E/2)):Math.abs(c-(m+b/2))}}(Ie);var Mt=N&&N.__extends||function(){var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i])},t(n,r)};return function(n,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(n,r);function e(){this.constructor=n}n.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}}(),St=N&&N.__createBinding||(Object.create?function(t,n,r,e){e===void 0&&(e=r);var a=Object.getOwnPropertyDescriptor(n,r);(!a||("get"in a?!n.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return n[r]}}),Object.defineProperty(t,e,a)}:function(t,n,r,e){e===void 0&&(e=r),t[e]=n[r]}),Dt=N&&N.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),Et=N&&N.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&St(n,t,r);return Dt(n,t),n},Ue=N&&N.__spreadArray||function(t,n,r){if(r||arguments.length===2)for(var e=0,a=n.length,i;e<a;e++)(i||!(e in n))&&(i||(i=Array.prototype.slice.call(n,0,e)),i[e]=n[e]);return t.concat(i||Array.prototype.slice.call(n))};Object.defineProperty(Ee,"__esModule",{value:!0});var pe=Et(k),x=Ie,B=fe,It=["ArrowRight","ArrowUp","k","PageUp"],Ct=["ArrowLeft","ArrowDown","j","PageDown"],Pt=function(t){Mt(n,t);function n(r){var e=t.call(this,r)||this;if(e.trackRef=pe.createRef(),e.thumbRefs=[],e.state={draggedTrackPos:[-1,-1],draggedThumbIndex:-1,thumbZIndexes:new Array(e.props.values.length).fill(0).map(function(a,i){return i}),isChanged:!1,markOffsets:[]},e.getOffsets=function(){var a=e.props,i=a.direction,s=a.values,u=a.min,d=a.max,y=e.trackRef.current,f=y.getBoundingClientRect(),h=(0,x.getPaddingAndBorder)(y);return e.getThumbs().map(function(p,R){var w={x:0,y:0},M=p.getBoundingClientRect(),L=(0,x.getMargin)(p);switch(i){case B.Direction.Right:return w.x=(L.left+h.left)*-1,w.y=((M.height-f.height)/2+h.top)*-1,w.x+=f.width*(0,x.relativeValue)(s[R],u,d)-M.width/2,w;case B.Direction.Left:return w.x=(L.right+h.right)*-1,w.y=((M.height-f.height)/2+h.top)*-1,w.x+=f.width-f.width*(0,x.relativeValue)(s[R],u,d)-M.width/2,w;case B.Direction.Up:return w.x=((M.width-f.width)/2+L.left+h.left)*-1,w.y=-h.left,w.y+=f.height-f.height*(0,x.relativeValue)(s[R],u,d)-M.height/2,w;case B.Direction.Down:return w.x=((M.width-f.width)/2+L.left+h.left)*-1,w.y=-h.left,w.y+=f.height*(0,x.relativeValue)(s[R],u,d)-M.height/2,w;default:return(0,x.assertUnreachable)(i)}})},e.getThumbs=function(){return e.trackRef&&e.trackRef.current?Array.from(e.trackRef.current.children).filter(function(a){return a.hasAttribute("aria-valuenow")}):(console.warn("No thumbs found in the track container. Did you forget to pass & spread the `props` param in renderTrack?"),[])},e.getTargetIndex=function(a){return e.getThumbs().findIndex(function(i){return i===a.target||i.contains(a.target)})},e.addTouchEvents=function(a){document.addEventListener("touchmove",e.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",e.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",e.schdOnEnd,{passive:!1})},e.addMouseEvents=function(a){document.addEventListener("mousemove",e.schdOnMouseMove),document.addEventListener("mouseup",e.schdOnEnd)},e.onMouseDownTrack=function(a){var i;if(a.button===0)if(a.persist(),a.preventDefault(),e.addMouseEvents(a.nativeEvent),e.props.values.length>1&&e.props.draggableTrack){if(e.thumbRefs.some(function(u){var d;return(d=u.current)===null||d===void 0?void 0:d.contains(a.target)}))return;e.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return e.onMove(a.clientX,a.clientY)})}else{var s=(0,x.getClosestThumbIndex)(e.thumbRefs.map(function(u){return u.current}),a.clientX,a.clientY,e.props.direction);(i=e.thumbRefs[s].current)===null||i===void 0||i.focus(),e.setState({draggedThumbIndex:s},function(){return e.onMove(a.clientX,a.clientY)})}},e.onResize=function(){(0,x.translateThumbs)(e.getThumbs(),e.getOffsets(),e.props.rtl),e.calculateMarkOffsets()},e.onTouchStartTrack=function(a){var i;if(a.persist(),e.addTouchEvents(a.nativeEvent),e.props.values.length>1&&e.props.draggableTrack){if(e.thumbRefs.some(function(u){var d;return(d=u.current)===null||d===void 0?void 0:d.contains(a.target)}))return;e.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return e.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var s=(0,x.getClosestThumbIndex)(e.thumbRefs.map(function(u){return u.current}),a.touches[0].clientX,a.touches[0].clientY,e.props.direction);(i=e.thumbRefs[s].current)===null||i===void 0||i.focus(),e.setState({draggedThumbIndex:s},function(){return e.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},e.onMouseOrTouchStart=function(a){if(!e.props.disabled){var i=(0,x.isTouchEvent)(a);if(!(!i&&a.button!==0)){var s=e.getTargetIndex(a);s!==-1&&(i?e.addTouchEvents(a):e.addMouseEvents(a),e.setState({draggedThumbIndex:s,thumbZIndexes:e.state.thumbZIndexes.map(function(u,d){return d===s?Math.max.apply(Math,e.state.thumbZIndexes):u<=e.state.thumbZIndexes[s]?u:u-1})}))}}},e.onMouseMove=function(a){a.preventDefault(),e.onMove(a.clientX,a.clientY)},e.onTouchMove=function(a){a.preventDefault(),e.onMove(a.touches[0].clientX,a.touches[0].clientY)},e.onKeyDown=function(a){var i=e.props,s=i.values,u=i.onChange,d=i.step,y=i.rtl,f=i.direction,h=e.state.isChanged,p=e.getTargetIndex(a.nativeEvent),R=y||f===B.Direction.Left||f===B.Direction.Down?-1:1;p!==-1&&(It.includes(a.key)?(a.preventDefault(),e.setState({draggedThumbIndex:p,isChanged:!0}),u((0,x.replaceAt)(s,p,e.normalizeValue(s[p]+R*(a.key==="PageUp"?d*10:d),p)))):Ct.includes(a.key)?(a.preventDefault(),e.setState({draggedThumbIndex:p,isChanged:!0}),u((0,x.replaceAt)(s,p,e.normalizeValue(s[p]-R*(a.key==="PageDown"?d*10:d),p)))):a.key==="Tab"?e.setState({draggedThumbIndex:-1},function(){h&&e.fireOnFinalChange()}):h&&e.fireOnFinalChange())},e.onKeyUp=function(a){var i=e.state.isChanged;e.setState({draggedThumbIndex:-1},function(){i&&e.fireOnFinalChange()})},e.onMove=function(a,i){var s=e.state,u=s.draggedThumbIndex,d=s.draggedTrackPos,y=e.props,f=y.direction,h=y.min,p=y.max,R=y.onChange,w=y.values,M=y.step,L=y.rtl;if(u===-1&&d[0]===-1&&d[1]===-1)return null;var D=e.trackRef.current;if(!D)return null;var O=D.getBoundingClientRect(),I=(0,x.isVertical)(f)?O.height:O.width;if(d[0]!==-1&&d[1]!==-1){var q=a-d[0],ee=i-d[1],z=0;switch(f){case B.Direction.Right:case B.Direction.Left:z=q/I*(p-h);break;case B.Direction.Down:case B.Direction.Up:z=ee/I*(p-h);break;default:(0,x.assertUnreachable)(f)}if(L&&(z*=-1),Math.abs(z)>=M/2){for(var P=0;P<e.thumbRefs.length;P++){if(w[P]===p&&Math.sign(z)===1||w[P]===h&&Math.sign(z)===-1)return;var Z=w[P]+z;Z>p?z=p-w[P]:Z<h&&(z=h-w[P])}for(var G=w.slice(0),P=0;P<e.thumbRefs.length;P++)G=(0,x.replaceAt)(G,P,e.normalizeValue(w[P]+z,P));e.setState({draggedTrackPos:[a,i]}),R(G)}}else{var $=0;switch(f){case B.Direction.Right:$=(a-O.left)/I*(p-h)+h;break;case B.Direction.Left:$=(I-(a-O.left))/I*(p-h)+h;break;case B.Direction.Down:$=(i-O.top)/I*(p-h)+h;break;case B.Direction.Up:$=(I-(i-O.top))/I*(p-h)+h;break;default:(0,x.assertUnreachable)(f)}L&&($=p+h-$),Math.abs(w[u]-$)>=M/2&&R((0,x.replaceAt)(w,u,e.normalizeValue($,u)))}},e.normalizeValue=function(a,i){var s=e.props,u=s.min,d=s.max,y=s.step,f=s.allowOverlap,h=s.values;return(0,x.normalizeValue)(a,i,u,d,y,f,h)},e.onEnd=function(a){if(a.preventDefault(),document.removeEventListener("mousemove",e.schdOnMouseMove),document.removeEventListener("touchmove",e.schdOnTouchMove),document.removeEventListener("mouseup",e.schdOnEnd),document.removeEventListener("touchend",e.schdOnEnd),document.removeEventListener("touchcancel",e.schdOnEnd),e.state.draggedThumbIndex===-1&&e.state.draggedTrackPos[0]===-1&&e.state.draggedTrackPos[1]===-1)return null;e.setState({draggedThumbIndex:-1,draggedTrackPos:[-1,-1]},function(){e.fireOnFinalChange()})},e.fireOnFinalChange=function(){e.setState({isChanged:!1});var a=e.props,i=a.onFinalChange,s=a.values;i&&i(s)},e.updateMarkRefs=function(a){if(!a.renderMark){e.numOfMarks=void 0,e.markRefs=void 0;return}e.numOfMarks=(a.max-a.min)/e.props.step,e.markRefs=[];for(var i=0;i<e.numOfMarks+1;i++)e.markRefs[i]=pe.createRef()},e.calculateMarkOffsets=function(){if(!(!e.props.renderMark||!e.trackRef||!e.numOfMarks||!e.markRefs||e.trackRef.current===null)){for(var a=window.getComputedStyle(e.trackRef.current),i=parseInt(a.width,10),s=parseInt(a.height,10),u=parseInt(a.paddingLeft,10),d=parseInt(a.paddingTop,10),y=[],f=0;f<e.numOfMarks+1;f++){var h=9999,p=9999;if(e.markRefs[f].current){var R=e.markRefs[f].current.getBoundingClientRect();h=R.height,p=R.width}e.props.direction===B.Direction.Left||e.props.direction===B.Direction.Right?y.push([Math.round(i/e.numOfMarks*f+u-p/2),-Math.round((h-s)/2)]):y.push([Math.round(s/e.numOfMarks*f+d-h/2),-Math.round((p-i)/2)])}e.setState({markOffsets:y})}},r.step===0)throw new Error('"step" property should be a positive number');return e.schdOnMouseMove=(0,x.schd)(e.onMouseMove),e.schdOnTouchMove=(0,x.schd)(e.onTouchMove),e.schdOnEnd=(0,x.schd)(e.onEnd),e.thumbRefs=r.values.map(function(){return pe.createRef()}),e.updateMarkRefs(r),e}return n.prototype.componentDidMount=function(){var r=this,e=this.props,a=e.values,i=e.min,s=e.step;this.resizeObserver=window.ResizeObserver?new window.ResizeObserver(this.onResize):{observe:function(){return window.addEventListener("resize",r.onResize)},unobserve:function(){return window.removeEventListener("resize",r.onResize)}},document.addEventListener("touchstart",this.onMouseOrTouchStart,{passive:!1}),document.addEventListener("mousedown",this.onMouseOrTouchStart,{passive:!1}),!this.props.allowOverlap&&(0,x.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(u){return(0,x.checkBoundaries)(u,r.props.min,r.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,x.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(u){(0,x.isStepDivisible)(i,u,s)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")})},n.prototype.componentDidUpdate=function(r,e){var a=this.props,i=a.max,s=a.min,u=a.step,d=a.values,y=a.rtl;(r.max!==i||r.min!==s||r.step!==u)&&this.updateMarkRefs(this.props),(0,x.translateThumbs)(this.getThumbs(),this.getOffsets(),y),(r.max!==i||r.min!==s||r.step!==u||e.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),d.forEach(function(f){(0,x.isStepDivisible)(s,f,u)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")}))},n.prototype.componentWillUnmount=function(){var r={passive:!1};document.removeEventListener("mousedown",this.onMouseOrTouchStart,r),document.removeEventListener("mousemove",this.schdOnMouseMove),document.removeEventListener("touchmove",this.schdOnTouchMove),document.removeEventListener("touchstart",this.onMouseOrTouchStart),document.removeEventListener("mouseup",this.schdOnEnd),document.removeEventListener("touchend",this.schdOnEnd),this.resizeObserver.unobserve(this.trackRef.current)},n.prototype.render=function(){var r=this,e=this.props,a=e.renderTrack,i=e.renderThumb,s=e.renderMark,u=s===void 0?function(){return null}:s,d=e.values,y=e.min,f=e.max,h=e.allowOverlap,p=e.disabled,R=this.state,w=R.draggedThumbIndex,M=R.thumbZIndexes,L=R.markOffsets;return a({props:{style:{transform:"scale(1)",cursor:w>-1?"grabbing":this.props.draggableTrack?(0,x.isVertical)(this.props.direction)?"ns-resize":"ew-resize":d.length===1&&!p?"pointer":"inherit"},onMouseDown:p?x.voidFn:this.onMouseDownTrack,onTouchStart:p?x.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:p,children:Ue(Ue([],L.map(function(D,O,I){return u({props:{style:r.props.direction===B.Direction.Left||r.props.direction===B.Direction.Right?{position:"absolute",left:"".concat(D[0],"px"),marginTop:"".concat(D[1],"px")}:{position:"absolute",top:"".concat(D[0],"px"),marginLeft:"".concat(D[1],"px")},key:"mark".concat(O),ref:r.markRefs[O]},index:O})}),!0),d.map(function(D,O){var I=r.state.draggedThumbIndex===O;return i({index:O,value:D,isDragged:I,props:{style:{position:"absolute",zIndex:M[O],cursor:p?"inherit":I?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:O,tabIndex:p?void 0:0,"aria-valuemax":h?f:d[O+1]||f,"aria-valuemin":h?y:d[O-1]||y,"aria-valuenow":D,draggable:!1,ref:r.thumbRefs[O],role:"slider",onKeyDown:p?x.voidFn:r.onKeyDown,onKeyUp:p?x.voidFn:r.onKeyUp}})}),!0)})},n.defaultProps={step:1,direction:B.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},n}(pe.Component);Ee.default=Pt,function(t){var n=N&&N.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.checkValuesAgainstBoundaries=t.relativeValue=t.useThumbOverlap=t.Direction=t.getTrackBackground=t.Range=void 0;var r=n(Ee);t.Range=r.default;var e=Ie;Object.defineProperty(t,"getTrackBackground",{enumerable:!0,get:function(){return e.getTrackBackground}}),Object.defineProperty(t,"useThumbOverlap",{enumerable:!0,get:function(){return e.useThumbOverlap}}),Object.defineProperty(t,"relativeValue",{enumerable:!0,get:function(){return e.relativeValue}}),Object.defineProperty(t,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return e.checkValuesAgainstBoundaries}});var a=fe;Object.defineProperty(t,"Direction",{enumerable:!0,get:function(){return a.Direction}})}(De);function He(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,e)}return r}function ge(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?He(Object(r),!0).forEach(function(e){jt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):He(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function jt(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var me=Q("div",{position:"relative",width:"100%"});me.displayName="Root",me.displayName="Root",me.displayName="StyledRoot";var ve=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$disabled,i=t.$isDragged,s=n.sizing,u="inherit";return a?u="not-allowed":i?u="grabbing":e.length===1&&(u="pointer"),{paddingTop:s.scale600,paddingBottom:s.scale600,paddingRight:s.scale600,paddingLeft:s.scale600,display:"flex",cursor:u,backgroundColor:n.colors.sliderTrackFill}});ve.displayName="Track",ve.displayName="Track",ve.displayName="StyledTrack";var be=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$min,i=t.$max,s=t.$disabled,u=n.colors,d=n.borders,y=n.direction,f=n.borders.useRoundedCorners?d.radius100:0;return{borderTopLeftRadius:f,borderTopRightRadius:f,borderBottomRightRadius:f,borderBottomLeftRadius:f,background:De.getTrackBackground({values:e,colors:e.length===1?[s?u.borderOpaque:u.primary,s?u.backgroundSecondary:u.borderOpaque]:[s?u.backgroundSecondary:u.borderOpaque,s?u.borderOpaque:u.primary,s?u.backgroundSecondary:u.borderOpaque],min:a||0,max:i||0,rtl:y==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:s?"not-allowed":"inherit"}});be.displayName="InnerTrack",be.displayName="InnerTrack",be.displayName="StyledInnerTrack";var ye=Q("div",function(t){return{width:"4px",height:"2px",backgroundColor:t.$theme.colors.backgroundPrimary,marginLeft:"16px"}});ye.displayName="Mark",ye.displayName="Mark",ye.displayName="StyledMark";var we=Q("div",function(t){return ge(ge({},t.$theme.typography.font200),{},{color:t.$theme.colors.contentPrimary})});we.displayName="Tick",we.displayName="Tick",we.displayName="StyledTick";var Te=Q("div",function(t){var n=t.$theme,r=n.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:r.scale600,paddingLeft:r.scale600,paddingBottom:r.scale400}});Te.displayName="TickBar",Te.displayName="TickBar",Te.displayName="StyledTickBar";var xe=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$thumbIndex,i=t.$disabled,s=e.length===2&&a===0,u=e.length===2&&a===1;return n.direction==="rtl"&&(u||s)&&(s=!s,u=!u),{height:"24px",width:"24px",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:i?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleFill,outline:"none",boxShadow:t.$isFocusVisible?"0 0 0 3px ".concat(n.colors.accent):"0 1px 4px rgba(0, 0, 0, 0.12)",cursor:i?"not-allowed":"inherit"}});xe.displayName="Thumb",xe.displayName="Thumb",xe.displayName="StyledThumb";var ke=Q("div",function(t){var n=t.$disabled,r=t.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:n?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleInnerFill}});ke.displayName="InnerThumb",ke.displayName="InnerThumb",ke.displayName="StyledInnerThumb";var Oe=Q("div",function(t){var n=t.$disabled,r=t.$theme;return ge(ge({position:"absolute",top:"-".concat(r.sizing.scale1400)},r.typography.font200),{},{backgroundColor:n?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleInnerFill,color:r.colors.contentInversePrimary,paddingLeft:r.sizing.scale600,paddingRight:r.sizing.scale600,paddingTop:r.sizing.scale500,paddingBottom:r.sizing.scale500,borderBottomLeftRadius:"48px",borderBottomRightRadius:"48px",borderTopLeftRadius:"48px",borderTopRightRadius:"48px",whiteSpace:"nowrap"})});Oe.displayName="ThumbValue",Oe.displayName="ThumbValue",Oe.displayName="StyledThumbValue";function Xe(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,e)}return r}function Bt(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Xe(Object(r),!0).forEach(function(e){Lt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Lt(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function X(){return X=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},X.apply(this,arguments)}function K(t,n){return zt(t)||Ft(t,n)||$t(t,n)||At()}function At(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $t(t,n){if(t){if(typeof t=="string")return Ke(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ke(t,n)}}function Ke(t,n){(n==null||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}function Ft(t,n){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var e=[],a=!0,i=!1,s,u;try{for(r=r.call(t);!(a=(s=r.next()).done)&&(e.push(s.value),!(n&&e.length===n));a=!0);}catch(d){i=!0,u=d}finally{try{!a&&r.return!=null&&r.return()}finally{if(i)throw u}}return e}}function zt(t){if(Array.isArray(t))return t}var Vt=function(t){if(t.length>2||t.length===0)throw new Error("the value prop represents positions of thumbs, so its length can be only one or two");return t};function Nt(t){var n=t.overrides,r=n===void 0?{}:n,e=t.disabled,a=e===void 0?!1:e,i=t.marks,s=i===void 0?!1:i,u=t.onChange,d=u===void 0?function(){}:u,y=t.onFinalChange,f=y===void 0?function(){}:y,h=t.min,p=h===void 0?0:h,R=t.max,w=R===void 0?100:R,M=t.step,L=M===void 0?1:M,D=t.persistentThumb,O=D===void 0?!1:D,I=t.valueToLabel,q=I===void 0?function(C){return C}:I,ee=t.value,z=k.useContext(dt),P=k.useState(!1),Z=K(P,2),G=Z[0],$=Z[1],o=k.useState(!1),c=K(o,2),l=c[0],g=c[1],v=k.useState(!1),m=K(v,2),T=m[0],b=m[1],E=k.useState(-1),S=K(E,2),_=S[0],F=S[1],U=k.useCallback(function(C){ht(C)&&b(!0);var W=C.target.parentNode.firstChild===C.target?0:1;F(W)},[]),j=k.useCallback(function(C){T!==!1&&b(!1),F(-1)},[]),V=Vt(ee),A={$disabled:a,$step:L,$min:p,$max:w,$marks:s,$value:V,$isFocusVisible:T},re=J(r.Root,me),se=K(re,2),ae=se[0],ie=se[1],Re=J(r.Track,ve),ue=K(Re,2),Me=ue[0],te=ue[1],le=J(r.InnerTrack,be),ce=K(le,2),de=ce[0],Ye=ce[1],qe=J(r.Thumb,xe),Pe=K(qe,2),Ze=Pe[0],Ge=Pe[1],Qe=J(r.InnerThumb,ke),je=K(Qe,2),Je=je[0],et=je[1],tt=J(r.ThumbValue,Oe),Be=K(tt,2),nt=Be[0],rt=Be[1],at=J(r.Tick,we),Le=K(at,2),Ae=Le[0],$e=Le[1],it=J(r.TickBar,Te),Fe=K(it,2),ot=Fe[0],st=Fe[1],ut=J(r.Mark,ye),ze=K(ut,2),ct=ze[0],lt=ze[1];return k.createElement(ae,X({"data-baseweb":"slider"},A,ie,{onFocus:ft(ie,U),onBlur:pt(ie,j)}),k.createElement(De.Range,X({step:L,min:p,max:w,values:V,disabled:a,onChange:function(C){return d({value:C})},onFinalChange:function(C){return f({value:C})},rtl:z.direction==="rtl",renderTrack:function(C){var W=C.props,H=C.children,ne=C.isDragged;return k.createElement(Me,X({onMouseDown:W.onMouseDown,onTouchStart:W.onTouchStart,$isDragged:ne},A,te),k.createElement(de,X({$isDragged:ne,ref:W.ref},A,Ye),H))},renderThumb:function(C){var W=C.props,H=C.index,ne=C.isDragged,Ve=O||(!!H&&l||!H&&G||ne)&&!a;return k.createElement(Ze,X({},W,{onMouseEnter:function(){H===0?$(!0):g(!0)},onMouseLeave:function(){H===0?$(!1):g(!1)},$thumbIndex:H,$isDragged:ne,style:Bt({},W.style)},A,Ge,{$isFocusVisible:T&&_===H}),Ve&&k.createElement(nt,X({$thumbIndex:H,$isDragged:ne},A,rt),q(V[H])),Ve&&k.createElement(Je,X({$thumbIndex:H,$isDragged:ne},A,et)))}},s?{renderMark:function(C){var W=C.props,H=C.index;return k.createElement(ct,X({$markIndex:H},W,A,lt))}}:{})),k.createElement(ot,X({},A,st),k.createElement(Ae,X({},A,$e),q(p)),k.createElement(Ae,X({},A,$e),q(w))))}const _t=he("div",{target:"ew7r33m3"})(({disabled:t,theme:n})=>({alignItems:"center",backgroundColor:t?n.colors.gray:n.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",justifyContent:"center",height:n.sizes.sliderThumb,width:n.sizes.sliderThumb,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 0.2rem ${gt(n.colors.primary,.5)}`}}),""),Ut=he("div",{target:"ew7r33m2"})(({disabled:t,theme:n})=>({fontFamily:n.genericFonts.codeFont,fontSize:n.fontSizes.sm,color:t?n.colors.gray:n.colors.primary,top:"-1.6em",position:"absolute",whiteSpace:"nowrap",backgroundColor:n.colors.transparent,lineHeight:n.lineHeights.base,fontWeight:n.fontWeights.normal,pointerEvents:"none"}),""),Ht=he("div",{target:"ew7r33m1"})(({theme:t})=>({fontSize:t.fontSizes.sm,paddingBottom:t.spacing.none,paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingTop:"0.65em",justifyContent:"space-between",alignItems:"center",display:"flex"}),""),We=he("div",{target:"ew7r33m0"})(({disabled:t,theme:n})=>({lineHeight:n.lineHeights.base,fontWeight:n.fontWeights.normal,fontFamily:n.genericFonts.codeFont,color:t?n.colors.fadedText40:"inherit"}),""),Xt=200;function Kt({disabled:t,element:n,widgetMgr:r,width:e,fragmentId:a}){var $;const[i,s]=Rt({getStateFromWidgetMgr:Wt,getDefaultStateFromProto:Yt,getCurrStateFromProto:qt,updateWidgetMgrState:Zt,element:n,widgetMgr:r,fragmentId:a}),[u,d]=k.useState(i),y=k.useRef(null),[f]=k.useState([]),[h]=k.useState([]),{colors:p,fonts:R,fontSizes:w,spacing:M}=mt(),L={width:e},D=u.map(o=>Ce(o,n)),O=Ce(n.min,n),I=Ce(n.max,n),q=n.label;k.useEffect(()=>{d(i)},[i]);const ee=k.useCallback(vt(Xt,o=>{s({value:o,fromUi:!0})}),[]),z=k.useCallback(({value:o})=>{d(o),ee(o)},[ee]),P=k.useCallback(()=>Y.jsxs(Ht,{"data-testid":"stSliderTickBar",children:[Y.jsx(We,{disabled:t,"data-testid":"stSliderTickBarMin",children:O}),Y.jsx(We,{disabled:t,"data-testid":"stSliderTickBarMax",children:I})]}),[O,I,t]),Z=k.useCallback(Ne.forwardRef(function(o,c){const{$thumbIndex:l}=o,g=l||0;f[g]=c,h[g]||(h[g]=Ne.createRef());const v=bt(o,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),m=D[g];return Y.jsx(_t,{...v,disabled:o.$disabled===!0,ref:f[g],"aria-valuetext":m,"aria-label":q,children:Y.jsx(Ut,{"data-testid":"stSliderThumbValue",disabled:o.$disabled===!0,ref:h[g],children:m})})}),[]);k.useEffect(()=>{var m,T;h.map((b,E)=>{b.current&&(b.current.innerText=D[E])}),f.map((b,E)=>{b.current&&b.current.setAttribute("aria-valuetext",D[E])});const o=y.current??null,c=f[0].current,l=(m=f[1])==null?void 0:m.current,g=h[0].current,v=(T=h[1])==null?void 0:T.current;Jt(o,c,l,g,v)});const G=k.useCallback(({$disabled:o})=>({height:M.twoXS,...o?{background:p.darkenedBgMix25}:{}}),[p,M]);return Y.jsxs("div",{ref:y,className:"stSlider","data-testid":"stSlider",style:L,children:[Y.jsx(yt,{label:n.label,disabled:t,labelVisibility:wt(($=n.labelVisibility)==null?void 0:$.value),children:n.help&&Y.jsx(Tt,{children:Y.jsx(xt,{content:n.help,placement:kt.TOP_RIGHT})})}),Y.jsx(Nt,{min:n.min,max:n.max,step:n.step,value:Qt(u,n),onChange:z,disabled:t,overrides:{Thumb:Z,Tick:{style:{fontFamily:R.monospace}},Track:{style:{backgroundColor:"none !important",paddingBottom:M.none,paddingLeft:M.none,paddingRight:M.none,paddingTop:`calc(${w.sm} * 1.35)`}},InnerTrack:{style:G},TickBar:P}})]})}function Wt(t,n){return t.getDoubleArrayValue(n)}function Yt(t){return t.default}function qt(t){return t.value}function Zt(t,n,r,e){n.setDoubleArrayValue(t,r.value,{fromUi:r.fromUi},e)}function Gt(t){const{dataType:n}=t;return n===Se.DataType.DATETIME||n===Se.DataType.DATE||n===Se.DataType.TIME}function Ce(t,n){const{format:r,options:e}=n;return Gt(n)?Ot.utc(t/1e3).format(r):e.length>0?_e.sprintf(r,e[t]):_e.sprintf(r,t)}function Qt(t,n){const{min:r,max:e}=n;let a=t[0],i=t.length>1?t[1]:t[0];return a>i&&(a=i),a<r&&(a=r),a>e&&(a=e),i<r&&(i=r),i>e&&(i=e),t.length>1?[a,i]:[a]}function Jt(t,n,r,e,a){!t||!n||!e||(oe(t,n,e),r&&a&&(oe(t,r,a),en(t,n,r,e,a)))}function oe(t,n,r){const e=t.getBoundingClientRect(),a=n.getBoundingClientRect(),i=r.getBoundingClientRect(),s=a.left+a.width/2,u=s-i.width/2<e.left,d=s+i.width/2>e.right;r.style.left=u?"0":"",r.style.right=d?"0":""}function en(t,n,r,e,a){const i=t.getBoundingClientRect(),s=n.getBoundingClientRect(),u=r.getBoundingClientRect(),d=e.getBoundingClientRect(),y=a.getBoundingClientRect(),f=i.left+i.width/2,h=s.left+s.width/2,p=u.left+u.width/2,R=h-d.width/2>=i.left,w=p+y.width/2<=i.right,M=s.left-d.width>=i.left,L=u.right+y.width<=i.right,D=R?d.width/2:d.width,O=w?y.width/2:y.width,I=h+D;if(p-O-I>24){oe(t,n,e),oe(t,r,a);return}if(M&&L){e.style.left="",e.style.right=`${Math.round(s.width)}px`,a.style.left=`${Math.round(u.width)}px`,a.style.right="";return}h<f?(oe(t,n,e),a.style.left=`${Math.round(h+D+24-p)}px`,a.style.right=""):(oe(t,r,a),e.style.left="",e.style.right=`${-Math.round(p-O-24-h)}px`)}const tn=k.memo(Kt);export{tn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r,i as a,aV as l,R as d,a6 as c,bA as g,j as o,bB as h,a2 as p}from"./index-
|
|
1
|
+
import{c as r,i as a,aV as l,R as d,a6 as c,bA as g,j as o,bB as h,a2 as p}from"./index-BzTZZCvL.js";const m=r(l,{shouldForwardProp:a,target:"e1se5lgy2"})(({theme:e,usingCustomTheme:t})=>({fontSize:e.fontSizes.sm,width:e.sizes.spinnerSize,height:e.sizes.spinnerSize,borderWidth:e.sizes.spinnerThickness,radius:e.radii.md,justifyContents:"center",padding:e.spacing.none,margin:e.spacing.none,borderColor:e.colors.borderColor,borderTopColor:t?e.colors.primary:e.colors.blue70,flexGrow:0,flexShrink:0}),""),u=r("div",{target:"e1se5lgy1"})(({theme:e,width:t,cache:i})=>({width:t,...i?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null}),""),b=r("div",{target:"e1se5lgy0"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"center",width:"100%"}),"");function x({width:e,element:t}){const{activeTheme:i}=d.useContext(c),n=!g(i),{cache:s}=t;return o.jsx(u,{className:h({stSpinner:!0,stCacheSpinner:s}),"data-testid":"stSpinner",width:e,cache:s,children:o.jsxs(b,{children:[o.jsx(m,{usingCustomTheme:n}),o.jsx(p,{source:t.text,allowHTML:!1})]})})}export{x as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u,E as _,_ as q,bS as Mt,bT as k,bU as U,bV as Rt,R as We,bW as d,c as m,j as c,aY as P,aX as J,aG as Q,aF as Bt,bX as Lt,bY as Tt,av as Vt,$ as Ht,aS as Nt,as as Ge,B as M,aU as $t,aT as Kt,a_ as Xt,a$ as Wt,bc as Gt,b0 as Yt,aK as _t}from"./index-
|
|
1
|
+
import{r as u,E as _,_ as q,bS as Mt,bT as k,bU as U,bV as Rt,R as We,bW as d,c as m,j as c,aY as P,aX as J,aG as Q,aF as Bt,bX as Lt,bY as Tt,av as Vt,$ as Ht,aS as Nt,as as Ge,B as M,aU as $t,aT as Kt,a_ as Xt,a$ as Wt,bc as Gt,b0 as Yt,aK as _t}from"./index-BzTZZCvL.js";import{F as qt}from"./FormClearHelper-DmeZ2QuQ.js";import{P as Jt,S as Qt}from"./ProgressBar-Dfr9f8u1.js";import{u as Zt}from"./Hooks-CBIuRW4z.js";import{U as Z}from"./UploadFileInfo-C-jY39rj.js";var Ye=u.forwardRef(function(e,n){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement(_,q({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:n}),u.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),u.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}))});Ye.displayName="Clear";var _e=u.forwardRef(function(e,n){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement(_,q({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:n}),u.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),u.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});_e.displayName="CloudUpload";var qe=u.forwardRef(function(e,n){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement(_,q({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:n}),u.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});qe.displayName="Error";var Je=u.forwardRef(function(e,n){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement(_,q({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:n}),u.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),u.createElement("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"}))});Je.displayName="InsertDriveFile";var R=(e=>(e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b",e))(R||{});const Fe=Mt()?1024:1e3,ee=["gb","mb","kb","b"],te=(e,n,t=1)=>{if(n||(n="b"),t<0&&(t=0),e<0)throw new Error("Size must be greater than or equal to 0");const r=ee.indexOf(n),i=e/Fe;return r&&e>Fe/2?te(i,ee[r-1],t):`${e.toFixed(t)}${n.toUpperCase()}`},en=(e,n,t)=>{if(e<0)throw Error("Size must be 0 or greater");const r=ee.findIndex(s=>s===n),i=ee.findIndex(s=>s===t);if(r===-1||i===-1)throw Error("Unexpected byte unit provided");if(r===i)return e;const o=Math.abs(r-i),l=Fe**o;return r>i?e/l:e*l};var tn=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function T(e,n){var t=nn(e);if(typeof t.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(t,"path",{value:typeof n=="string"?n:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return t}function nn(e){var n=e.name,t=n&&n.lastIndexOf(".")!==-1;if(t&&!e.type){var r=n.split(".").pop().toLowerCase(),i=tn.get(r);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var rn=[".DS_Store","Thumbs.db"];function on(e){return k(this,void 0,void 0,function(){return U(this,function(n){return ne(e)&&an(e)?[2,un(e.dataTransfer,e.type)]:sn(e)?[2,ln(e)]:Array.isArray(e)&&e.every(function(t){return"getFile"in t&&typeof t.getFile=="function"})?[2,cn(e)]:[2,[]]})})}function an(e){return ne(e.dataTransfer)}function sn(e){return ne(e)&&ne(e.target)}function ne(e){return typeof e=="object"&&e!==null}function ln(e){return je(e.target.files).map(function(n){return T(n)})}function cn(e){return k(this,void 0,void 0,function(){var n;return U(this,function(t){switch(t.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return n=t.sent(),[2,n.map(function(r){return T(r)})]}})})}function un(e,n){return k(this,void 0,void 0,function(){var t,r;return U(this,function(i){switch(i.label){case 0:return e===null?[2,[]]:e.items?(t=je(e.items).filter(function(o){return o.kind==="file"}),n!=="drop"?[2,t]:[4,Promise.all(t.map(pn))]):[3,2];case 1:return r=i.sent(),[2,Qe(Ze(r))];case 2:return[2,Qe(je(e.files).map(function(o){return T(o)}))]}})})}function Qe(e){return e.filter(function(n){return rn.indexOf(n.name)===-1})}function je(e){if(e===null)return[];for(var n=[],t=0;t<e.length;t++){var r=e[t];n.push(r)}return n}function pn(e){if(typeof e.webkitGetAsEntry!="function")return et(e);var n=e.webkitGetAsEntry();return n&&n.isDirectory?tt(n):et(e)}function Ze(e){return e.reduce(function(n,t){return Rt(n,Array.isArray(t)?Ze(t):[t])},[])}function et(e){var n=e.getAsFile();if(!n)return Promise.reject(e+" is not a File");var t=T(n);return Promise.resolve(t)}function dn(e){return k(this,void 0,void 0,function(){return U(this,function(n){return[2,e.isDirectory?tt(e):fn(e)]})})}function tt(e){var n=e.createReader();return new Promise(function(t,r){var i=[];function o(){var l=this;n.readEntries(function(s){return k(l,void 0,void 0,function(){var f,h,w;return U(this,function(y){switch(y.label){case 0:if(s.length)return[3,5];y.label=1;case 1:return y.trys.push([1,3,,4]),[4,Promise.all(i)];case 2:return f=y.sent(),t(f),[3,4];case 3:return h=y.sent(),r(h),[3,4];case 4:return[3,6];case 5:w=Promise.all(s.map(dn)),i.push(w),o(),y.label=6;case 6:return[2]}})})},function(s){r(s)})}o()})}function fn(e){return k(this,void 0,void 0,function(){return U(this,function(n){return[2,new Promise(function(t,r){e.file(function(i){var o=T(i,e.fullPath);t(o)},function(i){r(i)})})]})})}var gn=function(e,n){if(e&&n){var t=Array.isArray(n)?n:n.split(","),r=e.name||"",i=(e.type||"").toLowerCase(),o=i.replace(/\/.*$/,"");return t.some(function(l){var s=l.trim().toLowerCase();return s.charAt(0)==="."?r.toLowerCase().endsWith(s):s.endsWith("/*")?o===s.replace(/\/.*$/,""):i===s})}return!0};function nt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,r)}return t}function rt(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?nt(Object(t),!0).forEach(function(r){it(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):nt(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function it(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ot(e,n){return yn(e)||vn(e,n)||hn(e,n)||mn()}function mn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hn(e,n){if(e){if(typeof e=="string")return at(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return at(e,n)}}function at(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function vn(e,n){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var r=[],i=!0,o=!1,l,s;try{for(t=t.call(e);!(i=(l=t.next()).done)&&(r.push(l.value),!(n&&r.length===n));i=!0);}catch(f){o=!0,s=f}finally{try{!i&&t.return!=null&&t.return()}finally{if(o)throw s}}return r}}function yn(e){if(Array.isArray(e))return e}var bn="file-invalid-type",xn="file-too-large",wn="file-too-small",Fn="too-many-files",jn=function(e){e=Array.isArray(e)&&e.length===1?e[0]:e;var n=Array.isArray(e)?"one of ".concat(e.join(", ")):e;return{code:bn,message:"File type must be ".concat(n)}},st=function(e){return{code:xn,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},lt=function(e){return{code:wn,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},Dn={code:Fn,message:"Too many files"};function ct(e,n){var t=e.type==="application/x-moz-file"||gn(e,n);return[t,t?null:jn(n)]}function ut(e,n,t){if(V(e.size))if(V(n)&&V(t)){if(e.size>t)return[!1,st(t)];if(e.size<n)return[!1,lt(n)]}else{if(V(n)&&e.size<n)return[!1,lt(n)];if(V(t)&&e.size>t)return[!1,st(t)]}return[!0,null]}function V(e){return e!=null}function Sn(e){var n=e.files,t=e.accept,r=e.minSize,i=e.maxSize,o=e.multiple,l=e.maxFiles;return!o&&n.length>1||o&&l>=1&&n.length>l?!1:n.every(function(s){var f=ct(s,t),h=ot(f,1),w=h[0],y=ut(s,r,i),z=ot(y,1),B=z[0];return w&&B})}function re(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function ie(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(n){return n==="Files"||n==="application/x-moz-file"}):!!e.target&&!!e.target.files}function pt(e){e.preventDefault()}function zn(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function An(e){return e.indexOf("Edge/")!==-1}function On(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return zn(e)||An(e)}function S(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),l=1;l<i;l++)o[l-1]=arguments[l];return n.some(function(s){return!re(r)&&s&&s.apply(void 0,[r].concat(o)),re(r)})}}function En(){return"showOpenFilePicker"in window}function Cn(e){return e=typeof e=="string"?e.split(","):e,[{description:"everything",accept:Array.isArray(e)?e.filter(function(n){return n==="audio/*"||n==="video/*"||n==="image/*"||n==="text/*"||/\w+\/[-+.\w]+/g.test(n)}).reduce(function(n,t){return rt(rt({},n),{},it({},t,[]))},{}):{}}]}function In(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function kn(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}var Un=["children"],Pn=["open"],Mn=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Rn=["refKey","onChange","onClick"];function Bn(e){return Vn(e)||Tn(e)||dt(e)||Ln()}function Ln(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Vn(e){if(Array.isArray(e))return Se(e)}function De(e,n){return $n(e)||Nn(e,n)||dt(e,n)||Hn()}function Hn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dt(e,n){if(e){if(typeof e=="string")return Se(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Se(e,n)}}function Se(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Nn(e,n){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var r=[],i=!0,o=!1,l,s;try{for(t=t.call(e);!(i=(l=t.next()).done)&&(r.push(l.value),!(n&&r.length===n));i=!0);}catch(f){o=!0,s=f}finally{try{!i&&t.return!=null&&t.return()}finally{if(o)throw s}}return r}}function $n(e){if(Array.isArray(e))return e}function ft(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,r)}return t}function g(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?ft(Object(t),!0).forEach(function(r){ze(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ft(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function ze(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function oe(e,n){if(e==null)return{};var t=Kn(e,n),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(n.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}function Kn(e,n){if(e==null)return{};var t={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(n.indexOf(i)>=0)&&(t[i]=e[i]);return t}var ae=u.forwardRef(function(e,n){var t=e.children,r=oe(e,Un),i=Xn(r),o=i.open,l=oe(i,Pn);return u.useImperativeHandle(n,function(){return{open:o}},[o]),We.createElement(u.Fragment,null,t(g(g({},l),{},{open:o})))});ae.displayName="Dropzone";var gt={disabled:!1,getFilesFromEvent:on,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0};ae.defaultProps=gt,ae.propTypes={children:d.func,accept:d.oneOfType([d.string,d.arrayOf(d.string)]),multiple:d.bool,preventDropOnDocument:d.bool,noClick:d.bool,noKeyboard:d.bool,noDrag:d.bool,noDragEventsBubbling:d.bool,minSize:d.number,maxSize:d.number,maxFiles:d.number,disabled:d.bool,getFilesFromEvent:d.func,onFileDialogCancel:d.func,onFileDialogOpen:d.func,useFsAccessApi:d.bool,onDragEnter:d.func,onDragLeave:d.func,onDragOver:d.func,onDrop:d.func,onDropAccepted:d.func,onDropRejected:d.func,validator:d.func};var Ae={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,draggedFiles:[],acceptedFiles:[],fileRejections:[]};function Xn(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=g(g({},gt),e),t=n.accept,r=n.disabled,i=n.getFilesFromEvent,o=n.maxSize,l=n.minSize,s=n.multiple,f=n.maxFiles,h=n.onDragEnter,w=n.onDragLeave,y=n.onDragOver,z=n.onDrop,B=n.onDropAccepted,se=n.onDropRejected,le=n.onFileDialogCancel,ce=n.onFileDialogOpen,Ee=n.useFsAccessApi,ue=n.preventDropOnDocument,Ce=n.noClick,pe=n.noKeyboard,Ie=n.noDrag,A=n.noDragEventsBubbling,de=n.validator,fe=u.useMemo(function(){return typeof ce=="function"?ce:mt},[ce]),H=u.useMemo(function(){return typeof le=="function"?le:mt},[le]),F=u.useRef(null),j=u.useRef(null),Ot=u.useReducer(Wn,Ae),ke=De(Ot,2),N=ke[0],x=ke[1],Et=N.isFocused,Ue=N.isFileDialogActive,Pe=N.draggedFiles,$=u.useRef(typeof window<"u"&&window.isSecureContext&&Ee&&En()),Me=function(){!$.current&&Ue&&setTimeout(function(){if(j.current){var a=j.current.files;a.length||(x({type:"closeDialog"}),H())}},300)};u.useEffect(function(){return window.addEventListener("focus",Me,!1),function(){window.removeEventListener("focus",Me,!1)}},[j,Ue,H,$]);var O=u.useRef([]),Re=function(a){F.current&&F.current.contains(a.target)||(a.preventDefault(),O.current=[])};u.useEffect(function(){return ue&&(document.addEventListener("dragover",pt,!1),document.addEventListener("drop",Re,!1)),function(){ue&&(document.removeEventListener("dragover",pt),document.removeEventListener("drop",Re))}},[F,ue]);var Be=u.useCallback(function(a){a.preventDefault(),a.persist(),G(a),O.current=[].concat(Bn(O.current),[a.target]),ie(a)&&Promise.resolve(i(a)).then(function(p){re(a)&&!A||(x({draggedFiles:p,isDragActive:!0,type:"setDraggedFiles"}),h&&h(a))})},[i,h,A]),Le=u.useCallback(function(a){a.preventDefault(),a.persist(),G(a);var p=ie(a);if(p&&a.dataTransfer)try{a.dataTransfer.dropEffect="copy"}catch{}return p&&y&&y(a),!1},[y,A]),Te=u.useCallback(function(a){a.preventDefault(),a.persist(),G(a);var p=O.current.filter(function(b){return F.current&&F.current.contains(b)}),v=p.indexOf(a.target);v!==-1&&p.splice(v,1),O.current=p,!(p.length>0)&&(x({isDragActive:!1,type:"setDraggedFiles",draggedFiles:[]}),ie(a)&&w&&w(a))},[F,w,A]),K=u.useCallback(function(a,p){var v=[],b=[];a.forEach(function(D){var L=ct(D,t),I=De(L,2),me=I[0],he=I[1],ve=ut(D,l,o),Y=De(ve,2),ye=Y[0],be=Y[1],xe=de?de(D):null;if(me&&ye&&!xe)v.push(D);else{var we=[he,be];xe&&(we=we.concat(xe)),b.push({file:D,errors:we.filter(function(Pt){return Pt})})}}),(!s&&v.length>1||s&&f>=1&&v.length>f)&&(v.forEach(function(D){b.push({file:D,errors:[Dn]})}),v.splice(0)),x({acceptedFiles:v,fileRejections:b,type:"setFiles"}),z&&z(v,b,p),b.length>0&&se&&se(b,p),v.length>0&&B&&B(v,p)},[x,s,t,l,o,f,z,B,se,de]),X=u.useCallback(function(a){a.preventDefault(),a.persist(),G(a),O.current=[],ie(a)&&Promise.resolve(i(a)).then(function(p){re(a)&&!A||K(p,a)}),x({type:"reset"})},[i,K,A]),E=u.useCallback(function(){if($.current){x({type:"openDialog"}),fe();var a={multiple:s,types:Cn(t)};window.showOpenFilePicker(a).then(function(p){return i(p)}).then(function(p){K(p,null),x({type:"closeDialog"})}).catch(function(p){In(p)?(H(p),x({type:"closeDialog"})):kn(p)&&($.current=!1,j.current&&(j.current.value=null,j.current.click()))});return}j.current&&(x({type:"openDialog"}),fe(),j.current.value=null,j.current.click())},[x,fe,H,Ee,K,t,s]),Ve=u.useCallback(function(a){!F.current||!F.current.isEqualNode(a.target)||(a.key===" "||a.key==="Enter"||a.keyCode===32||a.keyCode===13)&&(a.preventDefault(),E())},[F,E]),He=u.useCallback(function(){x({type:"focus"})},[]),Ne=u.useCallback(function(){x({type:"blur"})},[]),$e=u.useCallback(function(){Ce||(On()?setTimeout(E,0):E())},[Ce,E]),C=function(a){return r?null:a},ge=function(a){return pe?null:C(a)},W=function(a){return Ie?null:C(a)},G=function(a){A&&a.stopPropagation()},Ct=u.useMemo(function(){return function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=a.refKey,v=p===void 0?"ref":p,b=a.role,D=a.onKeyDown,L=a.onFocus,I=a.onBlur,me=a.onClick,he=a.onDragEnter,ve=a.onDragOver,Y=a.onDragLeave,ye=a.onDrop,be=oe(a,Mn);return g(g(ze({onKeyDown:ge(S(D,Ve)),onFocus:ge(S(L,He)),onBlur:ge(S(I,Ne)),onClick:C(S(me,$e)),onDragEnter:W(S(he,Be)),onDragOver:W(S(ve,Le)),onDragLeave:W(S(Y,Te)),onDrop:W(S(ye,X)),role:typeof b=="string"&&b!==""?b:"button"},v,F),!r&&!pe?{tabIndex:0}:{}),be)}},[F,Ve,He,Ne,$e,Be,Le,Te,X,pe,Ie,r]),It=u.useCallback(function(a){a.stopPropagation()},[]),kt=u.useMemo(function(){return function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=a.refKey,v=p===void 0?"ref":p,b=a.onChange,D=a.onClick,L=oe(a,Rn),I=ze({accept:t,multiple:s,type:"file",style:{display:"none"},onChange:C(S(b,X)),onClick:C(S(D,It)),tabIndex:-1},v,j);return g(g({},I),L)}},[j,t,s,X,r]),Ke=Pe.length,Xe=Ke>0&&Sn({files:Pe,accept:t,minSize:l,maxSize:o,multiple:s,maxFiles:f}),Ut=Ke>0&&!Xe;return g(g({},N),{},{isDragAccept:Xe,isDragReject:Ut,isFocused:Et&&!r,getRootProps:Ct,getInputProps:kt,rootRef:F,inputRef:j,open:C(E)})}function Wn(e,n){switch(n.type){case"focus":return g(g({},e),{},{isFocused:!0});case"blur":return g(g({},e),{},{isFocused:!1});case"openDialog":return g(g({},Ae),{},{isFileDialogActive:!0});case"closeDialog":return g(g({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":var t=n.isDragActive,r=n.draggedFiles;return g(g({},e),{},{draggedFiles:r,isDragActive:t});case"setFiles":return g(g({},e),{},{acceptedFiles:n.acceptedFiles,fileRejections:n.fileRejections});case"reset":return g({},Ae);default:return e}}function mt(){}const ht=m("section",{target:"e1b2p2ww15"})(({isDisabled:e,theme:n})=>({display:"flex",alignItems:"center",padding:n.spacing.lg,backgroundColor:n.colors.secondaryBg,borderRadius:n.radii.default,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${n.colors.primary}`},color:e?n.colors.gray:n.colors.bodyText}),""),vt=m("div",{target:"e1b2p2ww14"})({name:"9xni5b",styles:"margin-right:auto;align-items:center;display:flex"}),yt=m("span",{target:"e1b2p2ww13"})(({theme:e})=>({color:e.colors.darkenedBgMix100,marginRight:e.spacing.lg}),""),Gn=m("span",{target:"e1b2p2ww12"})(({theme:e})=>({marginBottom:e.spacing.twoXS}),""),Yn=m("div",{target:"e1b2p2ww11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),bt=m("div",{target:"e1b2p2ww10"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg}),""),_n=m("ul",{target:"e1b2p2ww9"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none}),""),xt=m("li",{target:"e1b2p2ww8"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none}),""),wt=m("div",{target:"e1b2p2ww7"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"}),""),Ft=m("div",{target:"e1b2p2ww6"})(({theme:e})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),""),jt=m("div",{target:"e1b2p2ww5"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS}),""),qn=m("span",{target:"e1b2p2ww4"})(({theme:e})=>({marginRight:e.spacing.twoXS}),""),Jn=m("div",{target:"e1b2p2ww3"})(({theme:e})=>({display:"flex",padding:e.spacing.twoXS,color:e.colors.darkenedBgMix100}),""),Dt=m("small",{target:"e1b2p2ww2"})(({theme:e})=>({color:e.colors.danger,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}),""),St=m("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),zt=e=>({[ht]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[vt]:{marginBottom:e.spacing.lg},[yt]:{display:"none"},[bt]:{paddingRight:e.spacing.lg},[jt]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[Ft]:{width:e.sizes.full},[wt]:{flexDirection:"column"},[Dt]:{height:"auto",whiteSpace:"initial"},[St]:{display:"none"},[xt]:{margin:e.spacing.none,padding:e.spacing.none}}),Qn=m("div",{target:"e1b2p2ww0"})(({theme:e})=>e.inSidebar?zt(e):{[`@media (max-width: ${e.breakpoints.sm})`]:zt(e)},""),Oe=m("small",{target:"e1bju1570"})(({kind:e,theme:n})=>{const{danger:t,fadedText60:r}=n.colors;return{color:e==="danger"?t:r,fontSize:n.fontSizes.sm,lineHeight:n.lineHeights.tight}},""),Zn=({multiple:e,acceptedExtensions:n,maxSizeBytes:t})=>c.jsxs(vt,{"data-testid":"stFileUploaderDropzoneInstructions",children:[c.jsx(yt,{children:c.jsx(P,{content:_e,size:"threeXL"})}),c.jsxs(Yn,{children:[c.jsxs(Gn,{children:["Drag and drop file",e?"s":""," here"]}),c.jsxs(Oe,{children:[`Limit ${te(t,R.Byte,0)} per file`,n.length?` \u2022 ${n.map(r=>r.replace(/^\./,"").toUpperCase()).join(", ")}`:null]})]})]}),er=({onDrop:e,multiple:n,acceptedExtensions:t,maxSizeBytes:r,disabled:i,label:o})=>c.jsx(ae,{onDrop:e,multiple:n,accept:t.length?t:void 0,maxSize:r,disabled:i,useFsAccessApi:!1,children:({getRootProps:l,getInputProps:s})=>c.jsxs(ht,{...l(),"data-testid":"stFileUploaderDropzone",isDisabled:i,"aria-label":o,children:[c.jsx("input",{"data-testid":"stFileUploaderDropzoneInput",...s()}),c.jsx(Zn,{multiple:n,acceptedExtensions:t,maxSizeBytes:r}),c.jsx(J,{kind:Q.SECONDARY,disabled:i,size:Bt.SMALL,children:"Browse files"})]})}),tr=m("div",{target:"e1nlpozb1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS}),""),nr=m("div",{target:"e1nlpozb0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40}),""),rr=({currentPage:e,totalPages:n,onNext:t,onPrevious:r})=>c.jsxs(tr,{"data-testid":"stFileUploaderPagination",children:[c.jsx(Oe,{children:`Showing page ${e} of ${n}`}),c.jsxs(nr,{children:[c.jsx(J,{onClick:r,kind:Q.MINIMAL,children:c.jsx(P,{content:Lt,size:"xl"})}),c.jsx(J,{onClick:t,kind:Q.MINIMAL,children:c.jsx(P,{content:Tt,size:"xl"})})]})]}),At=(e,n)=>Math.ceil(e.length/n),ir=e=>Vt(({pageSize:n,items:t,resetOnAdd:r,...i})=>{const[o,l]=u.useState(0),[s,f]=u.useState(At(t,n)),h=Zt(t);u.useEffect(()=>{h&&h.length!==t.length&&f(At(t,n)),h&&h.length<t.length?r&&l(0):o+1>=s&&l(s-1)},[t,o,n,h,r,s]);const w=()=>{l(Math.min(o+1,s-1))},y=()=>{l(Math.max(0,o-1))},z=t.slice(o*n,o*n+n);return c.jsxs(c.Fragment,{children:[c.jsx(e,{items:z,...i}),t.length>n?c.jsx(rr,{pageSize:n,totalPages:s,currentPage:o+1,onNext:w,onPrevious:y}):null]})},e),or=({fileInfo:e})=>e.status.type==="uploading"?c.jsx(Jt,{value:e.status.progress,size:Qt.SMALL}):e.status.type==="error"?c.jsxs(Dt,{children:[c.jsx(qn,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),c.jsx(St,{children:c.jsx(P,{content:qe,size:"lg"})})]}):e.status.type==="uploaded"?c.jsx(Oe,{children:te(e.size,R.Byte)}):null,ar=({fileInfo:e,onDelete:n})=>c.jsxs(jt,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[c.jsx(Jn,{children:c.jsx(P,{content:Je,size:"twoXL"})}),c.jsxs(wt,{className:"stFileUploaderFileData",children:[c.jsx(Ft,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,children:e.name}),c.jsx(or,{fileInfo:e})]}),c.jsx("div",{"data-testid":"stFileUploaderDeleteBtn",children:c.jsx(J,{onClick:()=>n(e.id),kind:Q.MINIMAL,children:c.jsx(P,{content:Ye,size:"lg"})})})]}),sr=({items:e,onDelete:n})=>c.jsx(_n,{children:e.map(t=>c.jsx(xt,{children:c.jsx(ar,{fileInfo:t,onDelete:n})},t.id))}),lr=ir(sr),cr=e=>c.jsx(bt,{children:c.jsx(lr,{...e})});class ur extends We.PureComponent{constructor(n){super(n),this.formClearHelper=new qt,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:r,widgetMgr:i,fragmentId:o}=this.props,l=i.getFileUploaderStateValue(r);Ht(t,l)||i.setFileUploaderStateValue(r,t,{fromUi:!0},o)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(t,r)=>{const{element:i}=this.props,{multipleFiles:o}=i;if(!o&&t.length===0&&r.length>1){const l=r.findIndex(s=>s.errors.length===1&&s.errors[0].code==="too-many-files");l>=0&&(t.push(r[l].file),r.splice(l,1))}if(this.props.uploadClient.fetchFileURLs(t).then(l=>{if(!o&&t.length>0){const s=this.state.files.find(f=>f.status.type!=="error");s&&(this.forceUpdatingStatus=!0,this.deleteFile(s.id),this.forceUpdatingStatus=!1)}Nt(l,t).forEach(([s,f])=>{this.uploadFile(s,f)})}).catch(l=>{this.addFiles(t.map(s=>new Z(s.name,s.size,this.nextLocalFileId(),{type:"error",errorMessage:l})))}),r.length>0){const l=r.map(s=>{const{file:f}=s;return new Z(f.name,f.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(s.errors[0].code,s.file)})});this.addFiles(l)}},this.uploadFile=(t,r)=>{const i=Ge.CancelToken.source(),o=new Z(r.name,r.size,this.nextLocalFileId(),{type:"uploading",cancelToken:i,progress:1});this.addFile(o),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,r,l=>this.onUploadProgress(l,o.id),i.token).then(()=>this.onUploadComplete(o.id,t)).catch(l=>{Ge.isCancel(l)||this.updateFile(o.id,o.setStatus({type:"error",errorMessage:l?l.toString():"Unknown error"}))})},this.onUploadComplete=(t,r)=>{const i=this.getFile(t);M(i)||i.status.type!=="uploading"||this.updateFile(i.id,i.setStatus({type:"uploaded",fileId:r.fileId,fileUrls:r}))},this.getErrorMessage=(t,r)=>{switch(t){case"file-too-large":return`File must be ${te(this.maxUploadSizeInBytes,R.Byte)} or smaller.`;case"file-invalid-type":return`${r.type} files are not allowed.`;case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=t=>{const r=this.getFile(t);M(r)||(r.status.type==="uploading"&&r.status.cancelToken.cancel(),r.status.type==="uploaded"&&r.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(r.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(r=>({files:[...r.files,t]}))},this.addFiles=t=>{this.setState(r=>({files:[...r.files,...t]}))},this.removeFile=t=>{this.setState(r=>({files:r.files.filter(i=>i.id!==t)}))},this.getFile=t=>this.state.files.find(r=>r.id===t),this.updateFile=(t,r)=>{this.setState(i=>({files:i.files.map(o=>o.id===t?r:o)}))},this.onUploadProgress=(t,r)=>{const i=this.getFile(r);if(M(i)||i.status.type!=="uploading")return;const o=Math.round(t.loaded*100/t.total);i.status.progress!==o&&this.updateFile(r,i.setStatus({type:"uploading",cancelToken:i.status.cancelToken,progress:o}))},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(M(t))return;const{widgetMgr:r,element:i,fragmentId:o}=this.props;r.setFileUploaderStateValue(i,t,{fromUi:!0},o)})},this.state=this.initialValue}get initialValue(){const n={files:[],newestServerFileId:0},{widgetMgr:t,element:r}=this.props,i=t.getFileUploaderStateValue(r);if(M(i))return n;const{uploadedFileInfo:o}=i;return M(o)||o.length===0?n:{files:o.map(l=>{const s=l.name,f=l.size,h=l.fileId,w=l.fileUrls;return new Z(s,f,this.nextLocalFileId(),{type:"uploaded",fileId:h,fileUrls:w})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const n=this.props.element.maxUploadSizeMb;return en(n,R.Megabyte,R.Byte)}get status(){const n=t=>t.status.type==="uploading";return this.state.files.some(n)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const n=this.createWidgetValue(),{element:t,widgetMgr:r,fragmentId:i}=this.props;r.getFileUploaderStateValue(t)===void 0&&r.setFileUploaderStateValue(t,n,{fromUi:!1},i)}createWidgetValue(){const n=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:r,size:i,status:o}=t,{fileId:l,fileUrls:s}=o;return new $t({fileId:l,fileUrls:s,name:r,size:i})});return new Kt({uploadedFileInfo:n})}render(){var s;const{files:n}=this.state,{element:t,disabled:r,widgetMgr:i}=this.props,o=t.type;this.formClearHelper.manageFormClearListener(i,t.formId,this.onFormCleared);const l=n.slice().reverse();return c.jsxs(Qn,{className:"stFileUploader","data-testid":"stFileUploader",children:[c.jsx(Xt,{label:t.label,disabled:r,labelVisibility:Wt((s=t.labelVisibility)==null?void 0:s.value),children:t.help&&c.jsx(Gt,{children:c.jsx(Yt,{content:t.help,placement:_t.TOP_RIGHT})})}),c.jsx(er,{onDrop:this.dropHandler,multiple:t.multipleFiles,acceptedExtensions:o,maxSizeBytes:this.maxUploadSizeInBytes,label:t.label,disabled:r}),l.length>0&&c.jsx(cr,{items:l,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}export{ur as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aG as i,j as t,aH as h,aX as u,aF as m,aI as p}from"./index-
|
|
1
|
+
import{aG as i,j as t,aH as h,aX as u,aF as m,aI as p}from"./index-BzTZZCvL.js";function f(l){const{disabled:d,element:e,widgetMgr:r,width:s,fragmentId:n}=l,o={width:s};let a=i.SECONDARY;e.type==="primary"?a=i.PRIMARY:e.type==="tertiary"&&(a=i.TERTIARY);const c=e.help?s:!0;return t.jsx("div",{className:"stButton","data-testid":"stButton",style:o,children:t.jsx(h,{help:e.help,children:t.jsx(u,{kind:a,size:m.SMALL,disabled:d,fluidWidth:e.useContainerWidth?c:!1,onClick:()=>r.setTriggerValue(e,{fromUi:!0},n),children:t.jsx(p,{icon:e.icon,label:e.label})})})})}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,u as v,j as T}from"./index-
|
|
1
|
+
import{r as s,u as v,j as T}from"./index-BzTZZCvL.js";function y({element:t,width:c,endpoints:m,elementMgr:d}){const n=s.useRef(null),{startTime:u,endTime:a,loop:i,autoplay:l}=t,f=s.useMemo(()=>{if(!t.id)return!0;const e=d.getElementState(t.id,"preventAutoplay");return e||d.setElementState(t.id,"preventAutoplay",!0),e??!1},[t.id,d]);s.useEffect(()=>{n.current&&(n.current.currentTime=u)},[u]),s.useEffect(()=>{const e=n.current,r=()=>{e&&(e.currentTime=t.startTime)};return e&&e.addEventListener("loadedmetadata",r),()=>{e&&e.removeEventListener("loadedmetadata",r)}},[t]),s.useEffect(()=>{const e=n.current;if(!e)return;let r=!1;const o=()=>{a>0&&e.currentTime>=a&&(i?(e.currentTime=u||0,e.play()):r||(r=!0,e.pause()))};return a>0&&e.addEventListener("timeupdate",o),()=>{e&&a>0&&e.removeEventListener("timeupdate",o)}},[a,i,u]),s.useEffect(()=>{const e=n.current;if(!e)return;const r=()=>{i&&(e.currentTime=u||0,e.play())};return e.addEventListener("ended",r),()=>{e&&e.removeEventListener("ended",r)}},[i,u]);const p=v(t.url),E=m.buildMediaURL(p);return T.jsx("audio",{className:"stAudio","data-testid":"stAudio",ref:n,controls:!0,autoPlay:l&&!f,src:E,style:{width:c}})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,aL as r,j as t,a2 as o}from"./index-
|
|
1
|
+
import{c as a,aL as r,j as t,a2 as o}from"./index-BzTZZCvL.js";import{P as i}from"./ProgressBar-Dfr9f8u1.js";const l=a("div",{target:"e18r7x300"})(({theme:e})=>({paddingBottom:e.spacing.sm,lineHeight:"normal",color:r(e)}),"");function d({element:e,width:s}){return t.jsxs("div",{className:"stProgress","data-testid":"stProgress",children:[t.jsx(l,{children:t.jsx(o,{source:e.text,allowHTML:!1,isLabel:!0})}),t.jsx(i,{value:e.value,width:s})]})}export{d as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b2 as w,r as p,bd as ne,be as x,bf as R,M as ae,a5 as le,j as F,bg as ce,bh as se,Q as de,bi as ue,a$ as ge,a2 as be,b7 as pe,b0 as he,aK as me}from"./index-
|
|
1
|
+
import{b2 as w,r as p,bd as ne,be as x,bf as R,M as ae,a5 as le,j as F,bg as ce,bh as se,Q as de,bi as ue,a$ as ge,a2 as be,b7 as pe,b0 as he,aK as me}from"./index-BzTZZCvL.js";import{a as fe}from"./useBasicWidgetState-Cqy4gnzY.js";import"./FormClearHelper-DmeZ2QuQ.js";var T=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),ve=Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"});function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),r.push.apply(r,o)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?X(Object(r),!0).forEach(function(o){q(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function q(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ye(e){var t=e.$disabled,r=e.$checked,o=e.$error,c=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.colors;return t?l.tickFillDisabled:r||c?"transparent":o?l.borderNegative:a?l.borderSelected:l.tickBorder}function ke(e){var t=e.$labelPlacement,r=t===void 0?"":t,o=e.$theme,c=o.sizing,n=c.scale300,a;switch(r){case"top":a="Bottom";break;case"bottom":a="Top";break;case"left":a="Right";break;default:case"right":a="Left";break}return o.direction==="rtl"&&a==="Left"?a="Right":o.direction==="rtl"&&a==="Right"&&(a="Left"),q({},"padding".concat(a),n)}function $e(e){var t=e.$disabled,r=e.$checked,o=e.$isIndeterminate,c=e.$error,n=e.$isHovered,a=e.$isActive,l=e.$theme,i=l.colors;return t?r||o?i.tickFillDisabled:i.tickFill:c&&(o||r)?a?i.tickFillErrorSelectedHoverActive:n?i.tickFillErrorSelectedHover:i.tickFillErrorSelected:c?a?i.tickFillErrorHoverActive:n?i.tickFillErrorHover:i.tickFillError:o||r?a?i.tickFillSelectedHoverActive:n?i.tickFillSelectedHover:i.tickFillSelected:a?i.tickFillActive:n?i.tickFillHover:i.tickFill}function we(e){var t=e.$disabled,r=e.$theme,o=r.colors;return t?o.contentSecondary:o.contentPrimary}var C=w("label",function(e){var t=e.$disabled,r=e.$labelPlacement;return{flexDirection:r==="top"||r==="bottom"?"column":"row",display:"flex",alignItems:r==="top"||r==="bottom"?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}});C.displayName="Root",C.displayName="Root";var M=w("span",function(e){var t=e.$checked,r=e.$disabled,o=e.$error,c=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.sizing,i=n.animation,s=r?n.colors.tickMarkFillDisabled:o?n.colors.tickMarkFillError:n.colors.tickMarkFill,k=encodeURIComponent(`
|
|
2
2
|
<svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path d="M14 0.5H0V3.5H14V0.5Z" fill="`.concat(s,`"/>
|
|
4
4
|
</svg>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b2 as q,r as f,b3 as H,b4 as J,M as Q,b5 as l,j as d,a_ as Y,a$ as Z,b6 as ee,b7 as te,b0 as re,aK as ne,aX as oe,aG as _,aF as U,al as ie,a2 as ae}from"./index-
|
|
1
|
+
import{b2 as q,r as f,b3 as H,b4 as J,M as Q,b5 as l,j as d,a_ as Y,a$ as Z,b6 as ee,b7 as te,b0 as re,aK as ne,aX as oe,aG as _,aF as U,al as ie,a2 as ae}from"./index-BzTZZCvL.js";import{a as ce}from"./useBasicWidgetState-Cqy4gnzY.js";import"./FormClearHelper-DmeZ2QuQ.js";var le={primary:"primary",secondary:"secondary",tertiary:"tertiary"},A={default:"default",pill:"pill",round:"round",circle:"circle",square:"square"},ue={mini:"mini",default:"default",compact:"compact",large:"large"},R=Object.freeze({radio:"radio",checkbox:"checkbox"}),T=q("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==A.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});T.displayName="StyledRoot",T.displayName="StyledRoot";function G(e){"@babel/helpers - typeof";return G=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(e)}function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},z.apply(this,arguments)}function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function se(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?V(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fe(e,t){return be(e)||ye(e,t)||de(e,t)||pe()}function pe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function de(e,t){if(e){if(typeof e=="string")return X(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X(e,t)}}function X(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ye(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,u;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(s){i=!0,u=s}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw u}}return n}}function be(e){if(Array.isArray(e))return e}function me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ge(e,t,r){return he(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Se(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&B(e,t)}function B(e,t){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},B(e,t)}function ve(e){var t=Ee();return function(){var r=P(e),n;if(t){var o=P(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Oe(this,n)}}function Oe(e,t){if(t&&(G(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F(e)}function F(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ee(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},P(e)}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function we(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var W=function(e){Se(r,e);var t=ve(r);function r(){var n;me(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),N(F(n),"childRefs",{}),n}return ge(r,[{key:"render",value:function(){var n=this,o=this.props,i=o.overrides,a=i===void 0?{}:i,u=o.mode,s=u===void 0?R.checkbox:u,m=o.children,y=o.selected,g=o.disabled,p=o.onClick,b=o.kind,S=o.shape,x=o.size,w=H(a.Root,T),k=fe(w,2),j=k[0],E=k[1],L=this.props["aria-label"]||this.props.ariaLabel,v=s===R.radio,$=f.Children.count(m);return f.createElement(J.Consumer,null,function(K){return f.createElement(j,z({"aria-label":L||K.buttongroup.ariaLabel,"data-baseweb":"button-group",role:v?"radiogroup":"group",$shape:S,$length:m.length},E),f.Children.map(m,function(h,C){if(!f.isValidElement(h))return null;var D=h.props.isSelected?h.props.isSelected:we(y,C);return v&&(n.childRefs[C]=f.createRef()),f.cloneElement(h,{disabled:g||h.props.disabled,isSelected:D,ref:v?n.childRefs[C]:void 0,tabIndex:!v||D||v&&(!y||y===-1)&&C===0?0:-1,onKeyDown:function(c){if(v){var O=Number(y)?Number(y):0;if(c.key==="ArrowUp"||c.key==="ArrowLeft"){c.preventDefault&&c.preventDefault();var I=O-1<0?$-1:O-1;p&&p(c,I),n.childRefs[I].current&&n.childRefs[I].current.focus()}if(c.key==="ArrowDown"||c.key==="ArrowRight"){c.preventDefault&&c.preventDefault();var M=O+1>$-1?0:O+1;p&&p(c,M),n.childRefs[M].current&&n.childRefs[M].current.focus()}}},kind:b,onClick:function(c){g||(h.props.onClick&&h.props.onClick(c),p&&p(c,C))},shape:S,size:x,overrides:se({BaseButton:{style:function(c){var O=c.$theme;return m.length===1?{}:S!==A.default?{marginLeft:O.sizing.scale100,marginRight:O.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":D,role:v?"radio":"checkbox"}}},h.props.overrides)})}))})}}]),r}(f.Component);N(W,"defaultProps",{disabled:!1,onClick:function(){},shape:A.default,size:ue.default,kind:le.secondary});function je(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Le(e,t,r){return e==l.ClickMode.MULTI_SELECT?je(t,r??[]):r!=null&&r.includes(t)?[]:[t]}function Ce(e){return e.length===0?-1:e[0]}function ke(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Re(e,t,r){const n=r===l.Style.PILLS?_.PILLS:r===l.Style.BORDERLESS?_.BORDERLESS_ICON:_.SEGMENTED_CONTROL,o=r===l.Style.BORDERLESS?U.XSMALL:U.MEDIUM,i=r===l.Style.BORDERLESS?"lg":"base";return{element:d.jsxs(d.Fragment,{children:[t&&d.jsx(ie,{size:i,iconValue:t}),e&&d.jsx(ae,{source:e,allowHTML:!1})]}),kind:n,size:o}}function Pe(e,t,r,n){return r.indexOf(n)>-1?!0:t!==l.ClickMode.SINGLE_SELECT||e!==l.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function xe(e,t){return e&&(t=`${t}Active`),t}function De(e,t){const r={flexWrap:"wrap",maxWidth:"fit-content"};switch(e){case l.Style.BORDERLESS:return{...r,columnGap:t.threeXS,rowGap:t.threeXS};case l.Style.PILLS:return{...r,columnGap:t.twoXS,rowGap:t.twoXS};case l.Style.SEGMENTED_CONTROL:return{...r,columnGap:t.none,rowGap:t.twoXS,"::after":{content:"''",flex:1e4}};default:return r}}function Ie(e,t,r,n,o,i){const a=Pe(r,n,o,t);let u=e.content,s=e.contentIcon;return a&&(u=e.selectedContent?e.selectedContent:u,s=e.selectedContentIcon?e.selectedContentIcon:s),f.forwardRef(function(m,y){const{element:g,kind:p,size:b}=Re(u??"",s??void 0,i),S=xe(!!(a&&!e.selectedContent&&!e.selectedContentIcon),p);return d.jsx(oe,{...m,size:b,kind:S,children:g})})}function Me(e,t){return e.getIntArrayValue(t)}function _e(e){return e.default??null}function Ae(e){return e.value??null}function Te(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o}=e,{clickMode:i,options:a,selectionVisualization:u,style:s,label:m,labelVisibility:y,help:g}=r,p=Q(),[b,S]=ce({getStateFromWidgetMgr:Me,getDefaultStateFromProto:_e,getCurrStateFromProto:Ae,updateWidgetMgrState:ke,element:r,widgetMgr:o,fragmentId:n}),x=(j,E)=>{const L=Le(i,E,b);S({value:L,fromUi:!0})};let w;i===l.ClickMode.SINGLE_SELECT?w=R.radio:i===l.ClickMode.MULTI_SELECT&&(w=R.checkbox);const k=f.useMemo(()=>a.map((j,E)=>{const L=Ie(j,E,u,i,b,s);return d.jsx(L,{},`${j.content}-${E}`)}),[i,a,u,s,b]);return d.jsxs("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[d.jsx(Y,{label:m,disabled:t,labelVisibility:Z((y==null?void 0:y.value)??ee.LabelVisibilityOptions.COLLAPSED),children:g&&d.jsx(te,{children:d.jsx(re,{content:g,placement:ne.TOP})})}),d.jsx(W,{disabled:t,mode:w,onClick:x,selected:i===l.ClickMode.MULTI_SELECT?b:Ce(b),overrides:{Root:{style:f.useCallback(()=>De(s,p.spacing),[s,p.spacing])}},children:k})]})}const Ge=f.memo(Te);export{Ge as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{k as i,c as r,r as l,j as t}from"./index-
|
|
1
|
+
import{k as i,c as r,r as l,j as t}from"./index-BzTZZCvL.js";import{R as m,P as p}from"./RenderInPortalIfExists-CxeJAxCs.js";const c="/assets/balloon-0.Czj7AKwE.png",g="/assets/balloon-1.CNvFFrND.png",d="/assets/balloon-2.DTvC6B1t.png",x="/assets/balloon-3.CgSk4tbL.png",f="/assets/balloon-4.mbtFrzxf.png",b="/assets/balloon-5.CSwkUfRA.png",n=300,h=121,s=20,u=80,C=1e3,N=i`
|
|
2
2
|
from {
|
|
3
3
|
transform: translateY(calc(100vh + ${n}px));
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as y,E,_ as R,c as C,Q as G,j as u,b1 as X,aK as k,aX as q,aG as Q,aY as O,b9 as z,e as J,g as K,a7 as Y,M as Z,ba as ee,bb as te,R as re,O as ie,$ as se,B as P,as as _,aU as ne,aT as ae,a_ as oe,a$ as le,bc as de,b0 as ce}from"./index-z2lXC7XI.js";import{F as he}from"./FormClearHelper-DliGOSkq.js";import{U as V}from"./UploadFileInfo-C-jY39rj.js";import{P as ue,S as pe}from"./ProgressBar-DuGylkeS.js";var L=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});L.displayName="Video";var D=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});D.displayName="X";var $=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),y.createElement("rect",{width:24,height:24,fill:"none"}),y.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});$.displayName="SwitchCamera";function ge(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const W=C("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),T=C("div",{target:"etz5kuj8"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),fe=C("p",{target:"etz5kuj7"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"}),""),me=C("img",{target:"etz5kuj6"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),ve=C("a",{target:"etz5kuj5"})(({theme:i})=>({color:i.colors.primary,display:"block",textDecoration:"none"}),""),Se=C("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),ye=C("div",{target:"etz5kuj3"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),we=C("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),be=C("button",{target:"etz5kuj0"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40},fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,margin:i.spacing.none,lineHeight:i.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${G(i.colors.primary,.5)}`},...ge("medium",i)}),"");function H({disabled:i,onClick:l,children:t,progress:s}){return u.jsxs(be,{disabled:i||!1,onClick:l||(()=>{}),progress:s||null,"data-testid":"stCameraInputButton",children:[t,s&&u.jsx(we,{children:u.jsx(ue,{value:s,size:pe.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})})]})}var F=(i=>(i.USER="user",i.ENVIRONMENT="environment",i))(F||{});const Me=({switchFacingMode:i})=>u.jsx(ye,{"data-testid":"stCameraInputSwitchButton",children:u.jsx(X,{content:"Switch camera",placement:k.TOP_RIGHT,children:u.jsx(q,{kind:Q.MINIMAL,onClick:i,children:u.jsx(O,{content:$,size:"twoXL",color:z.white})})})});var A={exports:{}};(function(i,l){(function(t,s){i.exports=s(y)})(J,function(t){return function(s){var n={};function a(o){if(n[o])return n[o].exports;var p=n[o]={i:o,l:!1,exports:{}};return s[o].call(p.exports,p,p.exports,a),p.l=!0,p.exports}return a.m=s,a.c=n,a.d=function(o,p,S){a.o(o,p)||Object.defineProperty(o,p,{enumerable:!0,get:S})},a.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},a.t=function(o,p){if(p&1&&(o=a(o)),p&8||p&4&&typeof o=="object"&&o&&o.__esModule)return o;var S=Object.create(null);if(a.r(S),Object.defineProperty(S,"default",{enumerable:!0,value:o}),p&2&&typeof o!="string")for(var x in o)a.d(S,x,(function(U){return o[U]}).bind(null,x));return S},a.n=function(o){var p=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(p,"a",p),p},a.o=function(o,p){return Object.prototype.hasOwnProperty.call(o,p)},a.p="",a(a.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(s,n,a){a.r(n);var o=a("react"),p=function(){var g=function(h,e){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,d){r.__proto__=d}||function(r,d){for(var c in d)d.hasOwnProperty(c)&&(r[c]=d[c])},g(h,e)};return function(h,e){g(h,e);function r(){this.constructor=h}h.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),S=function(){return S=Object.assign||function(g){for(var h,e=1,r=arguments.length;e<r;e++){h=arguments[e];for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(g[d]=h[d])}return g},S.apply(this,arguments)},x=function(g,h){var e={};for(var r in g)Object.prototype.hasOwnProperty.call(g,r)&&h.indexOf(r)<0&&(e[r]=g[r]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,r=Object.getOwnPropertySymbols(g);d<r.length;d++)h.indexOf(r[d])<0&&Object.prototype.propertyIsEnumerable.call(g,r[d])&&(e[r[d]]=g[r[d]]);return e};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(g){var h=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return h?new Promise(function(e,r){h.call(navigator,g,e,r)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var j=function(g){p(h,g);function h(e){var r=g.call(this,e)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return h.prototype.componentDidMount=function(){var e=this,r=e.state,d=e.props;if(this.unmounted=!1,!U()){d.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},h.prototype.componentDidUpdate=function(e){var r=this.props;if(!U()){r.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(e.audioConstraints)!==JSON.stringify(r.audioConstraints),c=JSON.stringify(e.videoConstraints)!==JSON.stringify(r.videoConstraints),w=e.minScreenshotWidth!==r.minScreenshotWidth,v=e.minScreenshotHeight!==r.minScreenshotHeight;(c||w||v)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},h.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},h.stopMediaStream=function(e){e&&(e.getVideoTracks&&e.getAudioTracks?(e.getVideoTracks().map(function(r){e.removeTrack(r),r.stop()}),e.getAudioTracks().map(function(r){e.removeTrack(r),r.stop()})):e.stop())},h.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(h.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},h.prototype.getScreenshot=function(e){var r=this,d=r.state,c=r.props;if(!d.hasUserMedia)return null;var w=this.getCanvas(e);return w&&w.toDataURL(c.screenshotFormat,c.screenshotQuality)},h.prototype.getCanvas=function(e){var r=this,d=r.state,c=r.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var w=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var f=w/v;w=c.minScreenshotWidth||this.video.clientWidth,v=w/f,c.minScreenshotHeight&&v<c.minScreenshotHeight&&(v=c.minScreenshotHeight,w=v*f)}this.canvas=document.createElement("canvas"),this.canvas.width=(e==null?void 0:e.width)||w,this.canvas.height=(e==null?void 0:e.height)||v,this.ctx=this.canvas.getContext("2d")}var M=this,b=M.ctx,m=M.canvas;return b&&m&&(m.width=(e==null?void 0:e.width)||m.width,m.height=(e==null?void 0:e.height)||m.height,c.mirrored&&(b.translate(m.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,(e==null?void 0:e.width)||m.width,(e==null?void 0:e.height)||m.height),c.mirrored&&(b.scale(-1,1),b.translate(-m.width,0))),m},h.prototype.requestUserMedia=function(){var e=this,r=this.props,d=function(v,f){var M={video:typeof f<"u"?f:!0};r.audio&&(M.audio=typeof v<"u"?v:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(M).then(function(m){e.unmounted||b!==e.requestUserMediaId?h.stopMediaStream(m):e.handleUserMedia(null,m)}).catch(function(m){e.handleUserMedia(m)})};if("mediaDevices"in navigator)d(r.audioConstraints,r.videoConstraints);else{var c=function(v){return{optional:[{sourceId:v}]}},w=function(v){var f=v.deviceId;return typeof f=="string"?f:Array.isArray(f)&&f.length>0?f[0]:typeof f=="object"&&f.ideal?f.ideal:null};MediaStreamTrack.getSources(function(v){var f=null,M=null;v.forEach(function(I){I.kind==="audio"?f=I.id:I.kind==="video"&&(M=I.id)});var b=w(r.audioConstraints);b&&(f=b);var m=w(r.videoConstraints);m&&(M=m),d(c(f),c(M))})}},h.prototype.handleUserMedia=function(e,r){var d=this.props;if(e||!r){this.setState({hasUserMedia:!1}),d.onUserMediaError(e);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}d.onUserMedia(r)},h.prototype.render=function(){var e=this,r=this,d=r.state,c=r.props,w=c.audio;c.forceScreenshotSourceSize,c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var v=c.mirrored,f=c.style,M=f===void 0?{}:f,b=c.children,m=x(c,["audio","forceScreenshotSourceSize","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),I=v?S(S({},M),{transform:(M.transform||"")+" scaleX(-1)"}):M,N={getScreenshot:this.getScreenshot.bind(this)};return o.createElement(o.Fragment,null,o.createElement("video",S({autoPlay:!0,src:d.src,muted:!w,playsInline:!0,ref:function(B){e.video=B},style:I},m)),b&&b(N))},h.defaultProps={audio:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},h}(o.Component);n.default=j},react:function(s,n){s.exports=t}}).default})})(A);var Ue=A.exports;const xe=K(Ue),Ce=({width:i})=>u.jsxs(T,{width:i,children:[u.jsx(O,{size:"threeXL",color:z.gray60,content:L}),u.jsxs(fe,{children:["This app would like to use your camera.",u.jsx(ve,{href:te,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),je=({handleCapture:i,width:l,disabled:t,clearPhotoInProgress:s,setClearPhotoInProgress:n,facingMode:a,setFacingMode:o,testOverride:p})=>{const[S,x]=y.useState(p||"pending"),U=y.useRef(null),[j,g]=y.useState(l),h=y.useCallback(Y(1e3,g),[]);y.useEffect(()=>{h(l)},[l,h]);function e(){if(U.current!==null){const d=U.current.getScreenshot();i(d)}}const r=Z();return u.jsxs(W,{"data-testid":"stCameraInputWebcamComponent",children:[S!=="success"&&!t&&!s?u.jsx(Ce,{width:j}):ee&&u.jsx(Me,{switchFacingMode:o}),u.jsx(T,{"data-testid":"stCameraInputWebcamStyledBox",hidden:S!=="success"&&!t&&!s,width:j,children:!t&&u.jsx(xe,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:j,height:j*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{x("error")},onUserMedia:()=>{x("success"),n(!1)},videoConstraints:{width:{ideal:j},facingMode:a}})}),u.jsx(H,{onClick:e,disabled:S!=="success"||t||s,children:"Take Photo"})]})},Ie=150;class Pe extends re.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new he,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=t=>{this.setState({clearPhotoInProgress:t})},this.setFacingMode=()=>{this.setState(t=>({facingMode:t.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=t=>{if(t===null)return Promise.resolve();this.setState({imgSrc:t,shutter:!0,minShutterEffectPassed:!1});const s=n=>new Promise(a=>setTimeout(a,n));return Fe(t,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(n=>this.props.uploadClient.fetchFileURLs([n]).then(a=>({file:n,fileUrls:a[0]}))).then(({file:n,fileUrls:a})=>this.uploadFile(a,n)).then(()=>s(Ie)).then(()=>{this.setState((n,a)=>({imgSrc:t,shutter:n.shutter,minShutterEffectPassed:!0}))}).catch(n=>{ie(n)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(t=>this.deleteFile(t.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:s,widgetMgr:n,fragmentId:a}=this.props,o=n.getFileUploaderStateValue(s);se(t,o)||n.setFileUploaderStateValue(s,t,{fromUi:!0},a)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(P(t))return;this.setState({imgSrc:null});const{widgetMgr:s,element:n,fragmentId:a}=this.props;s.setFileUploaderStateValue(n,t,{fromUi:!0},a)})},this.deleteFile=t=>{const s=this.getFile(t);P(s)||(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(s.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(s=>({files:[...s.files,t]}))},this.removeFile=t=>{this.setState(s=>({files:s.files.filter(n=>n.id!==t)}))},this.getFile=t=>this.state.files.find(s=>s.id===t),this.updateFile=(t,s)=>{this.setState(n=>({files:n.files.map(a=>a.id===t?s:a)}))},this.onUploadComplete=(t,s)=>{this.setState(()=>({shutter:!1}));const n=this.getFile(t);P(n)||n.status.type!=="uploading"||this.updateFile(n.id,n.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},this.onUploadProgress=(t,s)=>{const n=this.getFile(s);if(P(n)||n.status.type!=="uploading")return;const a=Math.round(t.loaded*100/t.total);n.status.progress!==a&&this.updateFile(s,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:a}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(t,s)=>{const n=_.CancelToken.source(),a=new V(s.name,s.size,this.nextLocalFileId(),{type:"uploading",cancelToken:n,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,s,o=>this.onUploadProgress(o,a.id),n.token).then(()=>this.onUploadComplete(a.id,t)).catch(o=>{_.isCancel(o)||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:o?o.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:t,element:s}=this.props,n=t.getFileUploaderStateValue(s);if(P(n))return l;const{uploadedFileInfo:a}=n;return P(a)||a.length===0?l:{files:a.map(o=>{const p=o.name,S=o.size,x=o.fileId,U=o.fileUrls;return new V(p,S,this.nextLocalFileId(),{type:"uploaded",fileId:x,fileUrls:U})}),imgSrc:a.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=t=>t.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:n}=this.props;s.getFileUploaderStateValue(t)===void 0&&s.setFileUploaderStateValue(t,l,{fromUi:!1},n)}createWidgetValue(){const l=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:s,size:n,status:a}=t;return new ne({fileId:a.fileId,fileUrls:a.fileUrls,name:s,size:n})});return new ae({uploadedFileInfo:l})}render(){var a;const{element:l,widgetMgr:t,disabled:s,width:n}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),u.jsxs(W,{className:"stCameraInput","data-testid":"stCameraInput",children:[u.jsx(oe,{label:l.label,disabled:s,labelVisibility:le((a=l.labelVisibility)==null?void 0:a.value),children:l.help&&u.jsx(de,{children:u.jsx(ce,{content:l.help,placement:k.TOP_RIGHT})})}),this.state.imgSrc?u.jsxs(u.Fragment,{children:[u.jsx(T,{width:n,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&u.jsx(me,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:n,height:n*9/16})}),u.jsx(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||s,children:this.getProgress()?"Uploading...":u.jsxs(Se,{children:[u.jsx(O,{content:D,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):u.jsx(je,{handleCapture:this.handleCapture,width:n,disabled:s,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Fe(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}export{Pe as default};
|
|
1
|
+
import{r as y,E,_ as R,c as C,Q as G,j as u,b1 as X,aK as k,aX as q,aG as Q,aY as O,b9 as z,e as J,g as K,a7 as Y,M as Z,ba as ee,bb as te,R as re,O as ie,$ as se,B as P,as as _,aU as ne,aT as ae,a_ as oe,a$ as le,bc as de,b0 as ce}from"./index-BzTZZCvL.js";import{F as he}from"./FormClearHelper-DmeZ2QuQ.js";import{U as V}from"./UploadFileInfo-C-jY39rj.js";import{P as ue,S as pe}from"./ProgressBar-Dfr9f8u1.js";var L=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});L.displayName="Video";var D=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});D.displayName="X";var $=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),y.createElement("rect",{width:24,height:24,fill:"none"}),y.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});$.displayName="SwitchCamera";function ge(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const W=C("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),T=C("div",{target:"etz5kuj8"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),fe=C("p",{target:"etz5kuj7"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"}),""),me=C("img",{target:"etz5kuj6"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),ve=C("a",{target:"etz5kuj5"})(({theme:i})=>({color:i.colors.primary,display:"block",textDecoration:"none"}),""),Se=C("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),ye=C("div",{target:"etz5kuj3"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),we=C("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),be=C("button",{target:"etz5kuj0"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40},fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,margin:i.spacing.none,lineHeight:i.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${G(i.colors.primary,.5)}`},...ge("medium",i)}),"");function H({disabled:i,onClick:l,children:t,progress:s}){return u.jsxs(be,{disabled:i||!1,onClick:l||(()=>{}),progress:s||null,"data-testid":"stCameraInputButton",children:[t,s&&u.jsx(we,{children:u.jsx(ue,{value:s,size:pe.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})})]})}var F=(i=>(i.USER="user",i.ENVIRONMENT="environment",i))(F||{});const Me=({switchFacingMode:i})=>u.jsx(ye,{"data-testid":"stCameraInputSwitchButton",children:u.jsx(X,{content:"Switch camera",placement:k.TOP_RIGHT,children:u.jsx(q,{kind:Q.MINIMAL,onClick:i,children:u.jsx(O,{content:$,size:"twoXL",color:z.white})})})});var A={exports:{}};(function(i,l){(function(t,s){i.exports=s(y)})(J,function(t){return function(s){var n={};function a(o){if(n[o])return n[o].exports;var p=n[o]={i:o,l:!1,exports:{}};return s[o].call(p.exports,p,p.exports,a),p.l=!0,p.exports}return a.m=s,a.c=n,a.d=function(o,p,S){a.o(o,p)||Object.defineProperty(o,p,{enumerable:!0,get:S})},a.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},a.t=function(o,p){if(p&1&&(o=a(o)),p&8||p&4&&typeof o=="object"&&o&&o.__esModule)return o;var S=Object.create(null);if(a.r(S),Object.defineProperty(S,"default",{enumerable:!0,value:o}),p&2&&typeof o!="string")for(var x in o)a.d(S,x,(function(U){return o[U]}).bind(null,x));return S},a.n=function(o){var p=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(p,"a",p),p},a.o=function(o,p){return Object.prototype.hasOwnProperty.call(o,p)},a.p="",a(a.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(s,n,a){a.r(n);var o=a("react"),p=function(){var g=function(h,e){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,d){r.__proto__=d}||function(r,d){for(var c in d)d.hasOwnProperty(c)&&(r[c]=d[c])},g(h,e)};return function(h,e){g(h,e);function r(){this.constructor=h}h.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),S=function(){return S=Object.assign||function(g){for(var h,e=1,r=arguments.length;e<r;e++){h=arguments[e];for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(g[d]=h[d])}return g},S.apply(this,arguments)},x=function(g,h){var e={};for(var r in g)Object.prototype.hasOwnProperty.call(g,r)&&h.indexOf(r)<0&&(e[r]=g[r]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,r=Object.getOwnPropertySymbols(g);d<r.length;d++)h.indexOf(r[d])<0&&Object.prototype.propertyIsEnumerable.call(g,r[d])&&(e[r[d]]=g[r[d]]);return e};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(g){var h=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return h?new Promise(function(e,r){h.call(navigator,g,e,r)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var j=function(g){p(h,g);function h(e){var r=g.call(this,e)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return h.prototype.componentDidMount=function(){var e=this,r=e.state,d=e.props;if(this.unmounted=!1,!U()){d.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},h.prototype.componentDidUpdate=function(e){var r=this.props;if(!U()){r.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(e.audioConstraints)!==JSON.stringify(r.audioConstraints),c=JSON.stringify(e.videoConstraints)!==JSON.stringify(r.videoConstraints),w=e.minScreenshotWidth!==r.minScreenshotWidth,v=e.minScreenshotHeight!==r.minScreenshotHeight;(c||w||v)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},h.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},h.stopMediaStream=function(e){e&&(e.getVideoTracks&&e.getAudioTracks?(e.getVideoTracks().map(function(r){e.removeTrack(r),r.stop()}),e.getAudioTracks().map(function(r){e.removeTrack(r),r.stop()})):e.stop())},h.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(h.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},h.prototype.getScreenshot=function(e){var r=this,d=r.state,c=r.props;if(!d.hasUserMedia)return null;var w=this.getCanvas(e);return w&&w.toDataURL(c.screenshotFormat,c.screenshotQuality)},h.prototype.getCanvas=function(e){var r=this,d=r.state,c=r.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var w=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var f=w/v;w=c.minScreenshotWidth||this.video.clientWidth,v=w/f,c.minScreenshotHeight&&v<c.minScreenshotHeight&&(v=c.minScreenshotHeight,w=v*f)}this.canvas=document.createElement("canvas"),this.canvas.width=(e==null?void 0:e.width)||w,this.canvas.height=(e==null?void 0:e.height)||v,this.ctx=this.canvas.getContext("2d")}var M=this,b=M.ctx,m=M.canvas;return b&&m&&(m.width=(e==null?void 0:e.width)||m.width,m.height=(e==null?void 0:e.height)||m.height,c.mirrored&&(b.translate(m.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,(e==null?void 0:e.width)||m.width,(e==null?void 0:e.height)||m.height),c.mirrored&&(b.scale(-1,1),b.translate(-m.width,0))),m},h.prototype.requestUserMedia=function(){var e=this,r=this.props,d=function(v,f){var M={video:typeof f<"u"?f:!0};r.audio&&(M.audio=typeof v<"u"?v:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(M).then(function(m){e.unmounted||b!==e.requestUserMediaId?h.stopMediaStream(m):e.handleUserMedia(null,m)}).catch(function(m){e.handleUserMedia(m)})};if("mediaDevices"in navigator)d(r.audioConstraints,r.videoConstraints);else{var c=function(v){return{optional:[{sourceId:v}]}},w=function(v){var f=v.deviceId;return typeof f=="string"?f:Array.isArray(f)&&f.length>0?f[0]:typeof f=="object"&&f.ideal?f.ideal:null};MediaStreamTrack.getSources(function(v){var f=null,M=null;v.forEach(function(I){I.kind==="audio"?f=I.id:I.kind==="video"&&(M=I.id)});var b=w(r.audioConstraints);b&&(f=b);var m=w(r.videoConstraints);m&&(M=m),d(c(f),c(M))})}},h.prototype.handleUserMedia=function(e,r){var d=this.props;if(e||!r){this.setState({hasUserMedia:!1}),d.onUserMediaError(e);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}d.onUserMedia(r)},h.prototype.render=function(){var e=this,r=this,d=r.state,c=r.props,w=c.audio;c.forceScreenshotSourceSize,c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var v=c.mirrored,f=c.style,M=f===void 0?{}:f,b=c.children,m=x(c,["audio","forceScreenshotSourceSize","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),I=v?S(S({},M),{transform:(M.transform||"")+" scaleX(-1)"}):M,N={getScreenshot:this.getScreenshot.bind(this)};return o.createElement(o.Fragment,null,o.createElement("video",S({autoPlay:!0,src:d.src,muted:!w,playsInline:!0,ref:function(B){e.video=B},style:I},m)),b&&b(N))},h.defaultProps={audio:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},h}(o.Component);n.default=j},react:function(s,n){s.exports=t}}).default})})(A);var Ue=A.exports;const xe=K(Ue),Ce=({width:i})=>u.jsxs(T,{width:i,children:[u.jsx(O,{size:"threeXL",color:z.gray60,content:L}),u.jsxs(fe,{children:["This app would like to use your camera.",u.jsx(ve,{href:te,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),je=({handleCapture:i,width:l,disabled:t,clearPhotoInProgress:s,setClearPhotoInProgress:n,facingMode:a,setFacingMode:o,testOverride:p})=>{const[S,x]=y.useState(p||"pending"),U=y.useRef(null),[j,g]=y.useState(l),h=y.useCallback(Y(1e3,g),[]);y.useEffect(()=>{h(l)},[l,h]);function e(){if(U.current!==null){const d=U.current.getScreenshot();i(d)}}const r=Z();return u.jsxs(W,{"data-testid":"stCameraInputWebcamComponent",children:[S!=="success"&&!t&&!s?u.jsx(Ce,{width:j}):ee&&u.jsx(Me,{switchFacingMode:o}),u.jsx(T,{"data-testid":"stCameraInputWebcamStyledBox",hidden:S!=="success"&&!t&&!s,width:j,children:!t&&u.jsx(xe,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:j,height:j*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{x("error")},onUserMedia:()=>{x("success"),n(!1)},videoConstraints:{width:{ideal:j},facingMode:a}})}),u.jsx(H,{onClick:e,disabled:S!=="success"||t||s,children:"Take Photo"})]})},Ie=150;class Pe extends re.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new he,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=t=>{this.setState({clearPhotoInProgress:t})},this.setFacingMode=()=>{this.setState(t=>({facingMode:t.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=t=>{if(t===null)return Promise.resolve();this.setState({imgSrc:t,shutter:!0,minShutterEffectPassed:!1});const s=n=>new Promise(a=>setTimeout(a,n));return Fe(t,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(n=>this.props.uploadClient.fetchFileURLs([n]).then(a=>({file:n,fileUrls:a[0]}))).then(({file:n,fileUrls:a})=>this.uploadFile(a,n)).then(()=>s(Ie)).then(()=>{this.setState((n,a)=>({imgSrc:t,shutter:n.shutter,minShutterEffectPassed:!0}))}).catch(n=>{ie(n)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(t=>this.deleteFile(t.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:s,widgetMgr:n,fragmentId:a}=this.props,o=n.getFileUploaderStateValue(s);se(t,o)||n.setFileUploaderStateValue(s,t,{fromUi:!0},a)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(P(t))return;this.setState({imgSrc:null});const{widgetMgr:s,element:n,fragmentId:a}=this.props;s.setFileUploaderStateValue(n,t,{fromUi:!0},a)})},this.deleteFile=t=>{const s=this.getFile(t);P(s)||(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(s.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(s=>({files:[...s.files,t]}))},this.removeFile=t=>{this.setState(s=>({files:s.files.filter(n=>n.id!==t)}))},this.getFile=t=>this.state.files.find(s=>s.id===t),this.updateFile=(t,s)=>{this.setState(n=>({files:n.files.map(a=>a.id===t?s:a)}))},this.onUploadComplete=(t,s)=>{this.setState(()=>({shutter:!1}));const n=this.getFile(t);P(n)||n.status.type!=="uploading"||this.updateFile(n.id,n.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},this.onUploadProgress=(t,s)=>{const n=this.getFile(s);if(P(n)||n.status.type!=="uploading")return;const a=Math.round(t.loaded*100/t.total);n.status.progress!==a&&this.updateFile(s,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:a}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(t,s)=>{const n=_.CancelToken.source(),a=new V(s.name,s.size,this.nextLocalFileId(),{type:"uploading",cancelToken:n,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,s,o=>this.onUploadProgress(o,a.id),n.token).then(()=>this.onUploadComplete(a.id,t)).catch(o=>{_.isCancel(o)||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:o?o.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:t,element:s}=this.props,n=t.getFileUploaderStateValue(s);if(P(n))return l;const{uploadedFileInfo:a}=n;return P(a)||a.length===0?l:{files:a.map(o=>{const p=o.name,S=o.size,x=o.fileId,U=o.fileUrls;return new V(p,S,this.nextLocalFileId(),{type:"uploaded",fileId:x,fileUrls:U})}),imgSrc:a.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=t=>t.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:n}=this.props;s.getFileUploaderStateValue(t)===void 0&&s.setFileUploaderStateValue(t,l,{fromUi:!1},n)}createWidgetValue(){const l=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:s,size:n,status:a}=t;return new ne({fileId:a.fileId,fileUrls:a.fileUrls,name:s,size:n})});return new ae({uploadedFileInfo:l})}render(){var a;const{element:l,widgetMgr:t,disabled:s,width:n}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),u.jsxs(W,{className:"stCameraInput","data-testid":"stCameraInput",children:[u.jsx(oe,{label:l.label,disabled:s,labelVisibility:le((a=l.labelVisibility)==null?void 0:a.value),children:l.help&&u.jsx(de,{children:u.jsx(ce,{content:l.help,placement:k.TOP_RIGHT})})}),this.state.imgSrc?u.jsxs(u.Fragment,{children:[u.jsx(T,{width:n,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&u.jsx(me,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:n,height:n*9/16})}),u.jsx(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||s,children:this.getProgress()?"Uploading...":u.jsxs(Se,{children:[u.jsx(O,{content:D,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):u.jsx(je,{handleCapture:this.handleCapture,width:n,disabled:s,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Fe(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}export{Pe as default};
|