streamlit 1.52.0__py3-none-any.whl → 1.52.1__py3-none-any.whl
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.
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +284 -284
- streamlit/static/static/js/{ErrorOutline.esm.ZJDbmVTx.js → ErrorOutline.esm.sMJdFExW.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Dx0vI3vH.js → FileDownload.esm.CV-WYqBn.js} +1 -1
- streamlit/static/static/js/{FileHelper.B7Ero7qQ.js → FileHelper.5nCh9KDY.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.CG2XN1_g.js → FormClearHelper.-9RbsnV0.js} +1 -1
- streamlit/static/static/js/{InputInstructions.Cj5-1zf6.js → InputInstructions.2R3tBtW9.js} +1 -1
- streamlit/static/static/js/{Particles.BfWfv0Aw.js → Particles.DDHoXFxh.js} +1 -1
- streamlit/static/static/js/{ProgressBar.CGQ8OgfO.js → ProgressBar.BxmfHxKu.js} +1 -1
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.DTKLpwhl.js → StreamlitSyntaxHighlighter.BFWV0oqR.js} +1 -1
- streamlit/static/static/js/{Toolbar.B2qFUmd9.js → Toolbar.DMgU0Vgw.js} +1 -1
- streamlit/static/static/js/{base-input.o9tL8MDP.js → base-input.BXTqYbyG.js} +1 -1
- streamlit/static/static/js/{checkbox.0BeV1IBL.js → checkbox.5xWaqPqm.js} +1 -1
- streamlit/static/static/js/{createSuper.RBO59fEm.js → createSuper.OIgV8wc-.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CiTkUy0t.js → data-grid-overlay-editor.B4RIu9cw.js} +1 -1
- streamlit/static/static/js/{downloader.DwNZg3Mw.js → downloader.DwCJck8O.js} +1 -1
- streamlit/static/static/js/{embed.XT9xNd3F.js → embed.HKcgTiLB.js} +1 -1
- streamlit/static/static/js/{es6.x9KsYQg-.js → es6.4AP97RGk.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.ZVXpMPi0.js → iframeResizer.contentWindow.BZAsvL9q.js} +1 -1
- streamlit/static/static/js/{index.BxjzhVUb.js → index.-3selq_5.js} +1 -1
- streamlit/static/static/js/{index.AnXMIBz3.js → index.1ylynMAS.js} +1 -1
- streamlit/static/static/js/{index.hbeqcRTn.js → index.6UunrySF.js} +1 -1
- streamlit/static/static/js/{index.BfEKaEmw.js → index.B0TPxAZ1.js} +1 -1
- streamlit/static/static/js/{index.BQr-XwGV.js → index.BHWBaOWH.js} +1 -1
- streamlit/static/static/js/{index.CF5MxTbK.js → index.BJas6XzW.js} +1 -1
- streamlit/static/static/js/{index.B527JZdO.js → index.BKIlG7Ng.js} +1 -1
- streamlit/static/static/js/{index.5VPOamri.js → index.BMU6zZRk.js} +1 -1
- streamlit/static/static/js/{index.DO5utP74.js → index.BNMLO-0p.js} +1 -1
- streamlit/static/static/js/{index.DS7lf09n.js → index.BPmBNTel.js} +1 -1
- streamlit/static/static/js/{index.q5hIQwAY.js → index.BVuohWM1.js} +1 -1
- streamlit/static/static/js/{index.uSX757_v.js → index.B_AvdOKC.js} +1 -1
- streamlit/static/static/js/{index.RJZuWCGA.js → index.BjQIH-3U.js} +1 -1
- streamlit/static/static/js/{index.CyroQtI4.js → index.BrqtKtSu.js} +1 -1
- streamlit/static/static/js/{index.C_rK-Swb.js → index.Buc7XrOl.js} +5 -5
- streamlit/static/static/js/{index.DBalctjj.js → index.CIC9pLsG.js} +1 -1
- streamlit/static/static/js/{index.BTtmaLDB.js → index.CP2YZ73v.js} +1 -1
- streamlit/static/static/js/{index.DpNTZz82.js → index.CSbah0y4.js} +1 -1
- streamlit/static/static/js/{index.BWB_91TA.js → index.CbiYVMT1.js} +1 -1
- streamlit/static/static/js/{index.BHgV-yW4.js → index.CbxllBj8.js} +1 -1
- streamlit/static/static/js/{index.D6HmkoDm.js → index.Cd1D2eGF.js} +1 -1
- streamlit/static/static/js/{index.CuvXOyER.js → index.Ckcqwai8.js} +1 -1
- streamlit/static/static/js/{index.DMxc2XFp.js → index.CqTPbV5Y.js} +5 -5
- streamlit/static/static/js/{index.x_QRaLMd.js → index.CxXo5UKy.js} +1 -1
- streamlit/static/static/js/{index.rORSX6IW.js → index.CxbL5FgL.js} +1 -1
- streamlit/static/static/js/{index.CLmq_z9K.js → index.D52dMvK5.js} +1 -1
- streamlit/static/static/js/{index.Bjy4NRu9.js → index.DBUdji-9.js} +1 -1
- streamlit/static/static/js/{index.BuCx76ZV.js → index.DMU3coc2.js} +1 -1
- streamlit/static/static/js/{index.DsgAU5lc.js → index.DN4sfQLP.js} +1 -1
- streamlit/static/static/js/{index.KfXqjDYy.js → index.DRDE9rnx.js} +1 -1
- streamlit/static/static/js/{index.CyUHWoCC.js → index.DY9Ac89e.js} +1 -1
- streamlit/static/static/js/{index.BfXjTO8b.js → index.DYKCsDvl.js} +1 -1
- streamlit/static/static/js/{index.DXxnU5ej.js → index.Da9gznCC.js} +1 -1
- streamlit/static/static/js/{index.CjozwSzS.js → index.DfIRibXG.js} +1 -1
- streamlit/static/static/js/{index.CTgm_-jO.js → index.Dg5zbEp2.js} +1 -1
- streamlit/static/static/js/{index.Dr9HIhQw.js → index.Di9I2cid.js} +1 -1
- streamlit/static/static/js/{index.Bu5JWpT_.js → index.DkpEv0uV.js} +1 -1
- streamlit/static/static/js/{index.PaidgjCs.js → index.DwJ9Vhsl.js} +1 -1
- streamlit/static/static/js/{index.DWexTVLY.js → index.L7erTnMm.js} +1 -1
- streamlit/static/static/js/{index.CkGVt6-G.js → index.NaDyAN1s.js} +1 -1
- streamlit/static/static/js/{index.DlltaH7J.js → index.RNTPpVde.js} +1 -1
- streamlit/static/static/js/{index.DB_w_CZQ.js → index.VFDFuf_7.js} +1 -1
- streamlit/static/static/js/{index.By55VdPY.js → index.W-bl3NDo.js} +1 -1
- streamlit/static/static/js/{index.CNH4rdSz.js → index.XYozEjwK.js} +1 -1
- streamlit/static/static/js/{index.DAqCNvsO.js → index.oyLQ4pue.js} +1 -1
- streamlit/static/static/js/{index.DK0RFJUG.js → index.q4fLUQtC.js} +1 -1
- streamlit/static/static/js/{index.DcU3uDvB.js → index.q9puCQgK.js} +1 -1
- streamlit/static/static/js/{index.B1fRb5wF.js → index.xZBTXGNC.js} +1 -1
- streamlit/static/static/js/{input.D5oh9-aB.js → input.CcvrgErO.js} +1 -1
- streamlit/static/static/js/{main.q9oGOg0H.js → main.eVHOp4Th.js} +1 -1
- streamlit/static/static/js/{memory.5kCSFUJS.js → memory.Ck_sLv5Y.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.Cn_LsK8N.js → number-overlay-editor.DgcLMWOy.js} +1 -1
- streamlit/static/static/js/{pandasStylerUtils.BqhXt51_.js → pandasStylerUtils.DqP0h70z.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DD9NK1Z8.js → possibleConstructorReturn.C_51n46K.js} +1 -1
- streamlit/static/static/js/{sandbox.DACSyz29.js → sandbox.Q-g3QIZJ.js} +1 -1
- streamlit/static/static/js/{styled-components.C3R090At.js → styled-components.e0V96rJw.js} +1 -1
- streamlit/static/static/js/{throttle.B0GR3Iyz.js → throttle.D3b5WILl.js} +1 -1
- streamlit/static/static/js/{timepicker.BdhzPxrv.js → timepicker.Bpn70xGc.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.Db2pdqM2.js → toConsumableArray.DIN_ys1J.js} +1 -1
- streamlit/static/static/js/uniqueId.B27POWT6.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.Bfp6TnSw.js → useBasicWidgetState.DA3_qaXD.js} +1 -1
- streamlit/static/static/js/{useIntlLocale.hRV75Xgj.js → useIntlLocale.BSq6SANa.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.QepX7n8Y.js → useTextInputAutoExpand.ytEW5QmA.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.DHx8TzX6.js → useUpdateUiValue.DOxWBNiI.js} +1 -1
- streamlit/static/static/js/{useWaveformController.WxVzpzEX.js → useWaveformController.BCmk6WLk.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.DcKeRSWJ.js → withCalculatedWidth.ChdrMItN.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.CrHddARq.js → withFullScreenWrapper.7j_lzlaF.js} +1 -1
- {streamlit-1.52.0.dist-info → streamlit-1.52.1.dist-info}/METADATA +1 -1
- {streamlit-1.52.0.dist-info → streamlit-1.52.1.dist-info}/RECORD +92 -92
- streamlit/static/static/js/uniqueId.CtqIr-Yh.js +0 -1
- {streamlit-1.52.0.data → streamlit-1.52.1.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.52.0.dist-info → streamlit-1.52.1.dist-info}/WHEEL +0 -0
- {streamlit-1.52.0.dist-info → streamlit-1.52.1.dist-info}/entry_points.txt +0 -0
- {streamlit-1.52.0.dist-info → streamlit-1.52.1.dist-info}/top_level.txt +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x as d,r as c,g as m,V as g,W as y,j as t,X as f,k as h}from"./index.
|
|
1
|
+
import{x as d,r as c,g as m,V as g,W as y,j as t,X as f,k as h}from"./index.CqTPbV5Y.js";import{l as b}from"./index.8HslT92O.js";import{R as u}from"./main.eVHOp4Th.js";const S=d("div",{target:"ec2buac0"})(({theme:o})=>({overflowY:"auto",".react-json-view .copy-icon svg":{fontSize:"1em !important",marginRight:`${o.spacing.threeXS} !important`,verticalAlign:"middle !important"}}));function C({element:o}){const e=m(),{copyToClipboard:n}=g(),i=c.useCallback(a=>{n(JSON.stringify(a.src))},[n]);let s;try{s=JSON.parse(o.body)}catch(a){const r=y(a);try{s=b.parse(o.body)}catch{const l=parseInt(r.message.replace(/[^0-9]/g,""),10);return r.message+=`
|
|
2
2
|
${o.body.substring(0,l+1)} ← here`,t(f,{name:"Json Parse Error",message:r.message})}}const p=h(e)?"rjv-default":"monokai";return t(S,{className:"stJson","data-testid":"stJson",children:t(u,{src:s,collapsed:o.maxExpandDepth??!o.expanded,displayDataTypes:!1,displayObjectSize:!1,name:!1,theme:p,enableClipboard:i,style:{fontFamily:e.genericFonts.codeFont,fontSize:e.fontSizes.codeFontSize,fontWeight:e.fontWeights.code,backgroundColor:e.colors.bgColor,whiteSpace:"pre-wrap"}})})}const v=c.memo(C);export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,L as M,F as T,B as m,u as U,l as I,j as u,b as A,c as j,D as F,a as N,G as Y}from"./index.
|
|
1
|
+
import{r as o,L as M,F as T,B as m,u as U,l as I,j as u,b as A,c as j,D as F,a as N,G as Y}from"./index.CqTPbV5Y.js";import{c as R}from"./createDownloadLinkElement.ZaXNnPK4.js";function z(S){const{disabled:a,element:r,widgetMgr:B,endpoints:t,fragmentId:g}=S,{help:v,label:x,icon:L,ignoreRerun:h,type:p,url:k,deferredFileId:n}=r,b=r.shortcut?r.shortcut:void 0,[C,f]=o.useState(!1),[i,s]=o.useState(null),{enforceDownloadInNewTab:d=!1}=o.useContext(M),{requestDeferredFile:D}=o.useContext(T);let w=m.SECONDARY;p==="primary"?w=m.PRIMARY:p==="tertiary"&&(w=m.TERTIARY);const c=o.useMemo(()=>t.buildDownloadUrl(k),[t,k]);o.useEffect(()=>{!!n?.length||t.checkSourceUrlResponse(c,"Download Button")},[c,t,n]);const E=o.useCallback(async()=>{if(!D||!n){s("Deferred download not properly configured");return}f(!0),s(null);try{const e=await D(n);if(e.errorMsg){s(e.errorMsg),f(!1);return}const l=t.buildDownloadUrl(e.url);t.checkSourceUrlResponse(l,"Download Button"),R({filename:"",url:l,enforceDownloadInNewTab:d}).click()}catch(e){const l=e instanceof Error?e.message:"Download failed";s(l)}finally{f(!1)}},[D,n,t,d]),y=o.useCallback(()=>{if(a)return;h||B.setTriggerValue(r,{fromUi:!0},g),!!n?.length?E():R({filename:"",url:c,enforceDownloadInNewTab:d}).click()},[a,h,B,r,g,n,E,c,d]);return U({shortcut:b,disabled:a,onActivate:y}),o.useEffect(()=>{if(i){const e=setTimeout(()=>s(null),5e3);return()=>clearTimeout(e)}},[i]),I("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:[u(N,{help:v,containerWidth:!0,children:u(A,{kind:w,size:j.SMALL,disabled:a||C,onClick:y,containerWidth:!0,children:u(F,{icon:C?"spinner":L,label:x,shortcut:b})})}),i&&u(Y,{"data-testid":"stDownloadButtonError",children:i})]})}const K=o.memo(z);export{K as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cH as Rt,cI as _t,cJ as Ot,cK as _e,cL as Mt,cM as Ft,cN as Pt,cO as Bt,cP as Ht,cQ as At,c7 as fe,cR as Tt,cS as $t,al as Ee,ag as Oe,aB as s,r as C,bP as g,bA as _,x as ge,g as Nt,l as qe,j as A,o as Dt,T as jt,P as Lt,ac as zt,cT as Gt,m as Wt}from"./index.DMxc2XFp.js";import{u as Ut}from"./useBasicWidgetState.Bfp6TnSw.js";import{t as It,d as Vt}from"./throttle.B0GR3Iyz.js";import"./FormClearHelper.CG2XN1_g.js";function xt(r){return typeof r=="function"?r:Rt}function qt(r,e){var t=_e(r)?_t:Ot;return t(r,xt(e))}function $(r,e){var t=_e(r)?Mt:Ft;return t(r,Pt(e))}const Xt=Object.freeze(Object.defineProperty({__proto__:null,default:$},Symbol.toStringTag,{value:"Module"}));function Yt(r,e){return r&&Bt(r,xt(e))}const Kt=Object.freeze(Object.defineProperty({__proto__:null,default:Yt},Symbol.toStringTag,{value:"Module"}));var Zt="[object String]";function Jt(r){return typeof r=="string"||!_e(r)&&Ht(r)&&At(r)==Zt}const Qt=Object.freeze(Object.defineProperty({__proto__:null,default:Jt},Symbol.toStringTag,{value:"Module"}));function Xe(r){return r===void 0}var R={},j={};const er=fe(Qt),Me=fe(Kt),tr=fe(Tt),rr=fe(Xt);var Ye;function nr(){if(Ye)return j;Ye=1,Object.defineProperty(j,"__esModule",{value:!0}),j.flattenNames=void 0;var r=er,e=h(r),t=Me,n=h(t),a=tr,i=h(a),o=rr,l=h(o);function h(p){return p&&p.__esModule?p:{default:p}}var c=j.flattenNames=function p(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d=[];return(0,l.default)(u,function(f){Array.isArray(f)?p(f).map(function(v){return d.push(v)}):(0,i.default)(f)?(0,n.default)(f,function(v,b){v===!0&&d.push(b),d.push(b+"-"+v)}):(0,e.default)(f)&&d.push(f)}),d};return j.default=c,j}var L={};const ar=fe($t);var Ke;function ir(){if(Ke)return L;Ke=1,Object.defineProperty(L,"__esModule",{value:!0}),L.mergeClasses=void 0;var r=Me,e=i(r),t=ar,n=i(t),a=Object.assign||function(l){for(var h=1;h<arguments.length;h++){var c=arguments[h];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(l[p]=c[p])}return l};function i(l){return l&&l.__esModule?l:{default:l}}var o=L.mergeClasses=function(h){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],p=h.default&&(0,n.default)(h.default)||{};return c.map(function(u){var d=h[u];return d&&(0,e.default)(d,function(f,v){p[v]||(p[v]={}),p[v]=a({},p[v],d[v])}),u}),p};return L.default=o,L}var z={},Ze;function or(){if(Ze)return z;Ze=1,Object.defineProperty(z,"__esModule",{value:!0}),z.autoprefix=void 0;var r=Me,e=n(r),t=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(o[c]=h[c])}return o};function n(o){return o&&o.__esModule?o:{default:o}}var a={borderRadius:function(l){return{msBorderRadius:l,MozBorderRadius:l,OBorderRadius:l,WebkitBorderRadius:l,borderRadius:l}},boxShadow:function(l){return{msBoxShadow:l,MozBoxShadow:l,OBoxShadow:l,WebkitBoxShadow:l,boxShadow:l}},userSelect:function(l){return{WebkitTouchCallout:l,KhtmlUserSelect:l,MozUserSelect:l,msUserSelect:l,WebkitUserSelect:l,userSelect:l}},flex:function(l){return{WebkitBoxFlex:l,MozBoxFlex:l,WebkitFlex:l,msFlex:l,flex:l}},flexBasis:function(l){return{WebkitFlexBasis:l,flexBasis:l}},justifyContent:function(l){return{WebkitJustifyContent:l,justifyContent:l}},transition:function(l){return{msTransition:l,MozTransition:l,OTransition:l,WebkitTransition:l,transition:l}},transform:function(l){return{msTransform:l,MozTransform:l,OTransform:l,WebkitTransform:l,transform:l}},absolute:function(l){var h=l&&l.split(" ");return{position:"absolute",top:h&&h[0],right:h&&h[1],bottom:h&&h[2],left:h&&h[3]}},extend:function(l,h){var c=h[l];return c||{extend:l}}},i=z.autoprefix=function(l){var h={};return(0,e.default)(l,function(c,p){var u={};(0,e.default)(c,function(d,f){var v=a[f];v?u=t({},u,v(d)):u[f]=d}),h[p]=u}),h};return z.default=i,z}var G={},Je;function lr(){if(Je)return G;Je=1,Object.defineProperty(G,"__esModule",{value:!0}),G.hover=void 0;var r=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var u in p)Object.prototype.hasOwnProperty.call(p,u)&&(h[u]=p[u])}return h},e=Ee(),t=n(e);function n(h){return h&&h.__esModule?h:{default:h}}function a(h,c){if(!(h instanceof c))throw new TypeError("Cannot call a class as a function")}function i(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:h}function o(h,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)}var l=G.hover=function(c){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(u){o(d,u);function d(){var f,v,b,m;a(this,d);for(var E=arguments.length,M=Array(E),k=0;k<E;k++)M[k]=arguments[k];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(M))),b),b.state={hover:!1},b.handleMouseOver=function(){return b.setState({hover:!0})},b.handleMouseOut=function(){return b.setState({hover:!1})},b.render=function(){return t.default.createElement(p,{onMouseOver:b.handleMouseOver,onMouseOut:b.handleMouseOut},t.default.createElement(c,r({},b.props,b.state)))},v),i(b,m)}return d}(t.default.Component)};return G.default=l,G}var W={},Qe;function sr(){if(Qe)return W;Qe=1,Object.defineProperty(W,"__esModule",{value:!0}),W.active=void 0;var r=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var u in p)Object.prototype.hasOwnProperty.call(p,u)&&(h[u]=p[u])}return h},e=Ee(),t=n(e);function n(h){return h&&h.__esModule?h:{default:h}}function a(h,c){if(!(h instanceof c))throw new TypeError("Cannot call a class as a function")}function i(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:h}function o(h,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)}var l=W.active=function(c){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(u){o(d,u);function d(){var f,v,b,m;a(this,d);for(var E=arguments.length,M=Array(E),k=0;k<E;k++)M[k]=arguments[k];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(M))),b),b.state={active:!1},b.handleMouseDown=function(){return b.setState({active:!0})},b.handleMouseUp=function(){return b.setState({active:!1})},b.render=function(){return t.default.createElement(p,{onMouseDown:b.handleMouseDown,onMouseUp:b.handleMouseUp},t.default.createElement(c,r({},b.props,b.state)))},v),i(b,m)}return d}(t.default.Component)};return W.default=l,W}var xe={},et;function hr(){if(et)return xe;et=1,Object.defineProperty(xe,"__esModule",{value:!0});var r=function(t,n){var a={},i=function(l){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a[l]=h};return t===0&&i("first-child"),t===n-1&&i("last-child"),(t===0||t%2===0)&&i("even"),Math.abs(t%2)===1&&i("odd"),i("nth-child",t),a};return xe.default=r,xe}var tt;function cr(){if(tt)return R;tt=1,Object.defineProperty(R,"__esModule",{value:!0}),R.ReactCSS=R.loop=R.handleActive=R.handleHover=R.hover=void 0;var r=nr(),e=d(r),t=ir(),n=d(t),a=or(),i=d(a),o=lr(),l=d(o),h=sr(),c=d(h),p=hr(),u=d(p);function d(v){return v&&v.__esModule?v:{default:v}}R.hover=l.default,R.handleHover=l.default,R.handleActive=c.default,R.loop=u.default;var f=R.ReactCSS=function(b){for(var m=arguments.length,E=Array(m>1?m-1:0),M=1;M<m;M++)E[M-1]=arguments[M];var k=(0,e.default)(E),T=(0,n.default)(b,k);return(0,i.default)(T)};return R.default=f,R}var Fe=cr();const y=Oe(Fe);var pr=function(e,t,n,a,i){var o=i.clientWidth,l=i.clientHeight,h=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,c=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,p=h-(i.getBoundingClientRect().left+window.pageXOffset),u=c-(i.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var d=void 0;if(u<0?d=0:u>l?d=1:d=Math.round(u*100/l)/100,t.a!==d)return{h:t.h,s:t.s,l:t.l,a:d,source:"rgb"}}else{var f=void 0;if(p<0?f=0:p>o?f=1:f=Math.round(p*100/o)/100,a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}return null},Ce={},ur=function(e,t,n,a){if(typeof document>"u"&&!a)return null;var i=a?new a:document.createElement("canvas");i.width=n*2,i.height=n*2;var o=i.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,i.width,i.height),o.fillStyle=t,o.fillRect(0,0,n,n),o.translate(n,n),o.fillRect(0,0,n,n),i.toDataURL()):null},dr=function(e,t,n,a){var i=e+"-"+t+"-"+n+(a?"-server":"");if(Ce[i])return Ce[i];var o=ur(e,t,n,a);return Ce[i]=o,o},rt=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},le=function(e){var t=e.white,n=e.grey,a=e.size,i=e.renderers,o=e.borderRadius,l=e.boxShadow,h=e.children,c=y({default:{grid:{borderRadius:o,boxShadow:l,absolute:"0px 0px 0px 0px",background:"url("+dr(t,n,a,i.canvas)+") center left"}}});return C.isValidElement(h)?s.cloneElement(h,rt({},h.props,{style:rt({},h.props.style,c.grid)})):s.createElement("div",{style:c.grid})};le.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var fr=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},gr=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function br(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function nt(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function vr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Pe=function(r){vr(e,r);function e(){var t,n,a,i;br(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(n=(a=nt(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),a),a.handleChange=function(c){var p=pr(c,a.props.hsl,a.props.direction,a.props.a,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},a.unbindEventListeners=function(){window.removeEventListener("mousemove",a.handleChange),window.removeEventListener("mouseup",a.handleMouseUp)},n),nt(a,i)}return gr(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var n=this,a=this.props.rgb,i=y({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+a.r+","+a.g+","+a.b+`, 0) 0%,
|
|
1
|
+
import{cH as Rt,cI as _t,cJ as Ot,cK as _e,cL as Mt,cM as Ft,cN as Pt,cO as Bt,cP as Ht,cQ as At,c7 as fe,cR as Tt,cS as $t,al as Ee,ag as Oe,aB as s,r as C,bP as g,bA as _,x as ge,g as Nt,l as qe,j as A,o as Dt,T as jt,P as Lt,ac as zt,cT as Gt,m as Wt}from"./index.CqTPbV5Y.js";import{u as Ut}from"./useBasicWidgetState.DA3_qaXD.js";import{t as It,d as Vt}from"./throttle.D3b5WILl.js";import"./FormClearHelper.-9RbsnV0.js";function xt(r){return typeof r=="function"?r:Rt}function qt(r,e){var t=_e(r)?_t:Ot;return t(r,xt(e))}function $(r,e){var t=_e(r)?Mt:Ft;return t(r,Pt(e))}const Xt=Object.freeze(Object.defineProperty({__proto__:null,default:$},Symbol.toStringTag,{value:"Module"}));function Yt(r,e){return r&&Bt(r,xt(e))}const Kt=Object.freeze(Object.defineProperty({__proto__:null,default:Yt},Symbol.toStringTag,{value:"Module"}));var Zt="[object String]";function Jt(r){return typeof r=="string"||!_e(r)&&Ht(r)&&At(r)==Zt}const Qt=Object.freeze(Object.defineProperty({__proto__:null,default:Jt},Symbol.toStringTag,{value:"Module"}));function Xe(r){return r===void 0}var R={},j={};const er=fe(Qt),Me=fe(Kt),tr=fe(Tt),rr=fe(Xt);var Ye;function nr(){if(Ye)return j;Ye=1,Object.defineProperty(j,"__esModule",{value:!0}),j.flattenNames=void 0;var r=er,e=h(r),t=Me,n=h(t),a=tr,i=h(a),o=rr,l=h(o);function h(p){return p&&p.__esModule?p:{default:p}}var c=j.flattenNames=function p(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d=[];return(0,l.default)(u,function(f){Array.isArray(f)?p(f).map(function(v){return d.push(v)}):(0,i.default)(f)?(0,n.default)(f,function(v,b){v===!0&&d.push(b),d.push(b+"-"+v)}):(0,e.default)(f)&&d.push(f)}),d};return j.default=c,j}var L={};const ar=fe($t);var Ke;function ir(){if(Ke)return L;Ke=1,Object.defineProperty(L,"__esModule",{value:!0}),L.mergeClasses=void 0;var r=Me,e=i(r),t=ar,n=i(t),a=Object.assign||function(l){for(var h=1;h<arguments.length;h++){var c=arguments[h];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(l[p]=c[p])}return l};function i(l){return l&&l.__esModule?l:{default:l}}var o=L.mergeClasses=function(h){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],p=h.default&&(0,n.default)(h.default)||{};return c.map(function(u){var d=h[u];return d&&(0,e.default)(d,function(f,v){p[v]||(p[v]={}),p[v]=a({},p[v],d[v])}),u}),p};return L.default=o,L}var z={},Ze;function or(){if(Ze)return z;Ze=1,Object.defineProperty(z,"__esModule",{value:!0}),z.autoprefix=void 0;var r=Me,e=n(r),t=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(o[c]=h[c])}return o};function n(o){return o&&o.__esModule?o:{default:o}}var a={borderRadius:function(l){return{msBorderRadius:l,MozBorderRadius:l,OBorderRadius:l,WebkitBorderRadius:l,borderRadius:l}},boxShadow:function(l){return{msBoxShadow:l,MozBoxShadow:l,OBoxShadow:l,WebkitBoxShadow:l,boxShadow:l}},userSelect:function(l){return{WebkitTouchCallout:l,KhtmlUserSelect:l,MozUserSelect:l,msUserSelect:l,WebkitUserSelect:l,userSelect:l}},flex:function(l){return{WebkitBoxFlex:l,MozBoxFlex:l,WebkitFlex:l,msFlex:l,flex:l}},flexBasis:function(l){return{WebkitFlexBasis:l,flexBasis:l}},justifyContent:function(l){return{WebkitJustifyContent:l,justifyContent:l}},transition:function(l){return{msTransition:l,MozTransition:l,OTransition:l,WebkitTransition:l,transition:l}},transform:function(l){return{msTransform:l,MozTransform:l,OTransform:l,WebkitTransform:l,transform:l}},absolute:function(l){var h=l&&l.split(" ");return{position:"absolute",top:h&&h[0],right:h&&h[1],bottom:h&&h[2],left:h&&h[3]}},extend:function(l,h){var c=h[l];return c||{extend:l}}},i=z.autoprefix=function(l){var h={};return(0,e.default)(l,function(c,p){var u={};(0,e.default)(c,function(d,f){var v=a[f];v?u=t({},u,v(d)):u[f]=d}),h[p]=u}),h};return z.default=i,z}var G={},Je;function lr(){if(Je)return G;Je=1,Object.defineProperty(G,"__esModule",{value:!0}),G.hover=void 0;var r=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var u in p)Object.prototype.hasOwnProperty.call(p,u)&&(h[u]=p[u])}return h},e=Ee(),t=n(e);function n(h){return h&&h.__esModule?h:{default:h}}function a(h,c){if(!(h instanceof c))throw new TypeError("Cannot call a class as a function")}function i(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:h}function o(h,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)}var l=G.hover=function(c){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(u){o(d,u);function d(){var f,v,b,m;a(this,d);for(var E=arguments.length,M=Array(E),k=0;k<E;k++)M[k]=arguments[k];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(M))),b),b.state={hover:!1},b.handleMouseOver=function(){return b.setState({hover:!0})},b.handleMouseOut=function(){return b.setState({hover:!1})},b.render=function(){return t.default.createElement(p,{onMouseOver:b.handleMouseOver,onMouseOut:b.handleMouseOut},t.default.createElement(c,r({},b.props,b.state)))},v),i(b,m)}return d}(t.default.Component)};return G.default=l,G}var W={},Qe;function sr(){if(Qe)return W;Qe=1,Object.defineProperty(W,"__esModule",{value:!0}),W.active=void 0;var r=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var u in p)Object.prototype.hasOwnProperty.call(p,u)&&(h[u]=p[u])}return h},e=Ee(),t=n(e);function n(h){return h&&h.__esModule?h:{default:h}}function a(h,c){if(!(h instanceof c))throw new TypeError("Cannot call a class as a function")}function i(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:h}function o(h,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)}var l=W.active=function(c){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(u){o(d,u);function d(){var f,v,b,m;a(this,d);for(var E=arguments.length,M=Array(E),k=0;k<E;k++)M[k]=arguments[k];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(M))),b),b.state={active:!1},b.handleMouseDown=function(){return b.setState({active:!0})},b.handleMouseUp=function(){return b.setState({active:!1})},b.render=function(){return t.default.createElement(p,{onMouseDown:b.handleMouseDown,onMouseUp:b.handleMouseUp},t.default.createElement(c,r({},b.props,b.state)))},v),i(b,m)}return d}(t.default.Component)};return W.default=l,W}var xe={},et;function hr(){if(et)return xe;et=1,Object.defineProperty(xe,"__esModule",{value:!0});var r=function(t,n){var a={},i=function(l){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a[l]=h};return t===0&&i("first-child"),t===n-1&&i("last-child"),(t===0||t%2===0)&&i("even"),Math.abs(t%2)===1&&i("odd"),i("nth-child",t),a};return xe.default=r,xe}var tt;function cr(){if(tt)return R;tt=1,Object.defineProperty(R,"__esModule",{value:!0}),R.ReactCSS=R.loop=R.handleActive=R.handleHover=R.hover=void 0;var r=nr(),e=d(r),t=ir(),n=d(t),a=or(),i=d(a),o=lr(),l=d(o),h=sr(),c=d(h),p=hr(),u=d(p);function d(v){return v&&v.__esModule?v:{default:v}}R.hover=l.default,R.handleHover=l.default,R.handleActive=c.default,R.loop=u.default;var f=R.ReactCSS=function(b){for(var m=arguments.length,E=Array(m>1?m-1:0),M=1;M<m;M++)E[M-1]=arguments[M];var k=(0,e.default)(E),T=(0,n.default)(b,k);return(0,i.default)(T)};return R.default=f,R}var Fe=cr();const y=Oe(Fe);var pr=function(e,t,n,a,i){var o=i.clientWidth,l=i.clientHeight,h=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,c=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,p=h-(i.getBoundingClientRect().left+window.pageXOffset),u=c-(i.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var d=void 0;if(u<0?d=0:u>l?d=1:d=Math.round(u*100/l)/100,t.a!==d)return{h:t.h,s:t.s,l:t.l,a:d,source:"rgb"}}else{var f=void 0;if(p<0?f=0:p>o?f=1:f=Math.round(p*100/o)/100,a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}return null},Ce={},ur=function(e,t,n,a){if(typeof document>"u"&&!a)return null;var i=a?new a:document.createElement("canvas");i.width=n*2,i.height=n*2;var o=i.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,i.width,i.height),o.fillStyle=t,o.fillRect(0,0,n,n),o.translate(n,n),o.fillRect(0,0,n,n),i.toDataURL()):null},dr=function(e,t,n,a){var i=e+"-"+t+"-"+n+(a?"-server":"");if(Ce[i])return Ce[i];var o=ur(e,t,n,a);return Ce[i]=o,o},rt=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},le=function(e){var t=e.white,n=e.grey,a=e.size,i=e.renderers,o=e.borderRadius,l=e.boxShadow,h=e.children,c=y({default:{grid:{borderRadius:o,boxShadow:l,absolute:"0px 0px 0px 0px",background:"url("+dr(t,n,a,i.canvas)+") center left"}}});return C.isValidElement(h)?s.cloneElement(h,rt({},h.props,{style:rt({},h.props.style,c.grid)})):s.createElement("div",{style:c.grid})};le.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var fr=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},gr=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function br(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function nt(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function vr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Pe=function(r){vr(e,r);function e(){var t,n,a,i;br(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(n=(a=nt(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),a),a.handleChange=function(c){var p=pr(c,a.props.hsl,a.props.direction,a.props.a,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},a.unbindEventListeners=function(){window.removeEventListener("mousemove",a.handleChange),window.removeEventListener("mouseup",a.handleMouseUp)},n),nt(a,i)}return gr(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var n=this,a=this.props.rgb,i=y({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+a.r+","+a.g+","+a.b+`, 0) 0%,
|
|
2
2
|
rgba(`+a.r+","+a.g+","+a.b+", 1) 100%)",boxShadow:this.props.shadow,borderRadius:this.props.radius},container:{position:"relative",height:"100%",margin:"0 3px"},pointer:{position:"absolute",left:a.a*100+"%"},slider:{width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",marginTop:"1px",transform:"translateX(-2px)"}},vertical:{gradient:{background:"linear-gradient(to bottom, rgba("+a.r+","+a.g+","+a.b+`, 0) 0%,
|
|
3
3
|
rgba(`+a.r+","+a.g+","+a.b+", 1) 100%)"},pointer:{left:0,top:a.a*100+"%"}},overwrite:fr({},this.props.style)},{vertical:this.props.direction==="vertical",overwrite:!0});return s.createElement("div",{style:i.alpha},s.createElement("div",{style:i.checkboard},s.createElement(le,{renderers:this.props.renderers})),s.createElement("div",{style:i.gradient}),s.createElement("div",{style:i.container,ref:function(l){return n.container=l},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},s.createElement("div",{style:i.pointer},this.props.pointer?s.createElement(this.props.pointer,this.props):s.createElement("div",{style:i.slider}))))}}]),e}(C.PureComponent||C.Component),xr=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function mr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function wr(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function Er(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Sr=1,mt=38,Cr=40,kr=[mt,Cr],Rr=function(e){return kr.indexOf(e)>-1},_r=function(e){return Number(String(e).replace(/%/g,""))},Or=1,w=function(r){Er(e,r);function e(t){yr(this,e);var n=wr(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.handleBlur=function(){n.state.blurValue&&n.setState({value:n.state.blurValue,blurValue:null})},n.handleChange=function(a){n.setUpdatedValue(a.target.value,a)},n.handleKeyDown=function(a){var i=_r(a.target.value);if(!isNaN(i)&&Rr(a.keyCode)){var o=n.getArrowOffset(),l=a.keyCode===mt?i+o:i-o;n.setUpdatedValue(l,a)}},n.handleDrag=function(a){if(n.props.dragLabel){var i=Math.round(n.props.value+a.movementX);i>=0&&i<=n.props.dragMax&&n.props.onChange&&n.props.onChange(n.getValueObjectWithLabel(i),a)}},n.handleMouseDown=function(a){n.props.dragLabel&&(a.preventDefault(),n.handleDrag(a),window.addEventListener("mousemove",n.handleDrag),window.addEventListener("mouseup",n.handleMouseUp))},n.handleMouseUp=function(){n.unbindEventListeners()},n.unbindEventListeners=function(){window.removeEventListener("mousemove",n.handleDrag),window.removeEventListener("mouseup",n.handleMouseUp)},n.state={value:String(t.value).toUpperCase(),blurValue:String(t.value).toUpperCase()},n.inputId="rc-editable-input-"+Or++,n}return xr(e,[{key:"componentDidUpdate",value:function(n,a){this.props.value!==this.state.value&&(n.value!==this.props.value||a.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(n){return mr({},this.props.label,n)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||Sr}},{key:"setUpdatedValue",value:function(n,a){var i=this.props.label?this.getValueObjectWithLabel(n):n;this.props.onChange&&this.props.onChange(i,a),this.setState({value:n})}},{key:"render",value:function(){var n=this,a=y({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return s.createElement("div",{style:a.wrap},s.createElement("input",{id:this.inputId,style:a.input,ref:function(o){return n.input=o},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?s.createElement("label",{htmlFor:this.inputId,style:a.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(C.PureComponent||C.Component),Mr=function(e,t,n,a){var i=a.clientWidth,o=a.clientHeight,l=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,h=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=l-(a.getBoundingClientRect().left+window.pageXOffset),p=h-(a.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(p<0)u=359;else if(p>o)u=0;else{var d=-(p*100/o)+100;u=360*d/100}if(n.h!==u)return{h:u,s:n.s,l:n.l,a:n.a,source:"hsl"}}else{var f=void 0;if(c<0)f=0;else if(c>i)f=359;else{var v=c*100/i;f=360*v/100}if(n.h!==f)return{h:f,s:n.s,l:n.l,a:n.a,source:"hsl"}}return null},Fr=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function Pr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function at(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function Br(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var se=function(r){Br(e,r);function e(){var t,n,a,i;Pr(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(n=(a=at(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),a),a.handleChange=function(c){var p=Mr(c,a.props.direction,a.props.hsl,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},n),at(a,i)}return Fr(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var n=this,a=this.props.direction,i=a===void 0?"horizontal":a,o=y({default:{hue:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius,boxShadow:this.props.shadow},container:{padding:"0 2px",position:"relative",height:"100%",borderRadius:this.props.radius},pointer:{position:"absolute",left:this.props.hsl.h*100/360+"%"},slider:{marginTop:"1px",width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",transform:"translateX(-2px)"}},vertical:{pointer:{left:"0px",top:-(this.props.hsl.h*100/360)+100+"%"}}},{vertical:i==="vertical"});return s.createElement("div",{style:o.hue},s.createElement("div",{className:"hue-"+i,style:o.container,ref:function(h){return n.container=h},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},s.createElement("style",null,`
|
|
4
4
|
.hue-horizontal {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,E as L,_ as D,L as Te,e as de,n as P,W as ie,bU as Le,bN as De,bM as Be,x as d,j as n,Z as Ve,l as F,B as We,ax as ze,b as Me,m as Ne,T as qe,P as Oe,ac as He}from"./index.DMxc2XFp.js";import{u as $e}from"./useWaveformController.WxVzpzEX.js";import{T as je,a as ce}from"./Toolbar.B2qFUmd9.js";import{u as _e,F as Xe}from"./FormClearHelper.CG2XN1_g.js";import{c as Ge}from"./createDownloadLinkElement.ZaXNnPK4.js";import{E as Ke}from"./urls.BwSlolu9.js";import{F as Ze,D as Je}from"./FileDownload.esm.Dx0vI3vH.js";var ue=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),t.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});ue.displayName="Mic";var fe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});fe.displayName="Pause";var pe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});pe.displayName="PlayArrow";var me=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),t.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});me.displayName="Refresh";var ge=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});ge.displayName="StopCircle";const Qe=(e,r)=>{const{enforceDownloadInNewTab:o=!1}=t.useContext(Te);return t.useCallback(()=>{if(!e)return;const l=Ge({enforceDownloadInNewTab:o,url:e,filename:r});l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)},[e,o,r])},H=({widgetMgr:e,id:r,formId:o,key:c,defaultValue:l})=>{t.useEffect(()=>{const s=e.getElementState(r,c);de(s)&&P(l)&&e.setElementState(r,c,l)},[e,r,c,l]);const[S,u]=t.useState(e.getElementState(r,c)??l),h=t.useCallback(s=>{e.setElementState(r,c,s),u(s)},[e,r,c]),y=t.useMemo(()=>({formId:o||""}),[o]),b=t.useCallback(()=>h(l),[l,h]);return _e({element:y,widgetMgr:e,onFormCleared:b}),[S,h]},Ye=async({files:e,uploadClient:r,widgetMgr:o,widgetInfo:c,fragmentId:l,signal:S})=>{let u=[];try{u=await r.fetchFileURLs(e)}catch(s){return{successfulUploads:[],failedUploads:e.map(i=>({file:i,error:ie(s)}))}}const h=Le(e,u),y=[],b=[];return await Promise.all(h.map(async([s,i])=>{if(!s||!i?.uploadUrl||!i.fileId)return{file:s,fileUrl:i,error:new Error("No upload URL found")};try{await r.uploadFile({id:i.fileId,formId:c.formId||""},i.uploadUrl,s,void 0,S),y.push({fileUrl:i,file:s})}catch(N){const f=ie(N);b.push({file:s,error:f})}})),o.setFileUploaderStateValue(c,new De({uploadedFileInfo:y.map(({file:s,fileUrl:i})=>new Be({fileId:i.fileId,fileUrls:i,name:s.webkitRelativePath||s.name,size:s.size}))}),{fromUi:!0},l),{successfulUploads:y,failedUploads:b}},et=d("div",{target:"e3q8yfp0"})(),se=d("div",{target:"e3q8yfp1"})(({theme:e,disabled:r})=>({height:e.sizes.largestElementHeight,width:"100%",background:e.colors.secondaryBg,borderRadius:e.radii.default,marginBottom:e.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:e.spacing.xs,paddingRight:e.spacing.sm,border:e.colors.widgetBorderColor?`${e.sizes.borderWidth} solid ${e.colors.widgetBorderColor}`:void 0,cursor:r?"not-allowed":"auto",overflow:"hidden"})),tt=d("div",{target:"e3q8yfp2"})({flex:1}),rt=d("div",{target:"e3q8yfp3"})(({show:e,theme:r})=>({display:e?"block":"none",position:"relative",height:r.sizes.largestElementHeight,"& > div":{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center"}})),ot=d("span",{target:"e3q8yfp4"})(({theme:e,isPlayingOrRecording:r,disabled:o})=>({margin:e.spacing.sm,fontFamily:e.fonts.monospace,color:o?e.colors.fadedText40:r?e.colors.bodyText:e.colors.fadedText60,backgroundColor:e.colors.secondaryBg,fontSize:e.fontSizes.sm})),he=d("div",{target:"e3q8yfp5"})({width:"100%",textAlign:"center",overflow:"hidden"}),ye=d("span",{target:"e3q8yfp6"})(({theme:e})=>({color:e.colors.bodyText})),nt=d("a",{target:"e3q8yfp7"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none"})),at=d("div",{target:"e3q8yfp8"})(({theme:e})=>({flex:1,height:e.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),lt=d("div",{target:"e3q8yfp9"})(({theme:e})=>{const r="0.625em";return{opacity:.2,width:"100%",height:r,backgroundSize:r,backgroundImage:`radial-gradient(${e.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),it=d("span",{target:"e3q8yfp10"})(({theme:e})=>({"& > button":{color:e.colors.primary,padding:e.spacing.threeXS},"& > button:hover, & > button:focus":{color:e.colors.redColor}})),ct=d("span",{target:"e3q8yfp11"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),be=d("span",{target:"e3q8yfp12"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),$=d("div",{target:"e3q8yfp13"})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:e.spacing.xs,gap:e.spacing.twoXS,marginRight:e.spacing.twoXS})),st=d("div",{target:"e3q8yfp14"})(({theme:e})=>({marginLeft:e.spacing.sm})),T=({onClick:e,disabled:r,ariaLabel:o,iconContent:c})=>n(Me,{kind:We.BORDERLESS_ICON,onClick:e,disabled:r,"aria-label":o,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:n(ze,{content:c,size:"lg",color:"inherit"})}),dt=({disabled:e,stopRecording:r})=>n(it,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Stop recording",iconContent:ge})}),ut=({disabled:e,isPlaying:r,onClickPlayPause:o})=>n(be,{children:r?n(T,{onClick:o,disabled:e,ariaLabel:"Pause",iconContent:fe}):n(T,{onClick:o,disabled:e,ariaLabel:"Play",iconContent:pe})}),ft=({disabled:e,startRecording:r})=>n(ct,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Record",iconContent:ue})}),pt=({onClick:e})=>n(be,{children:n(T,{disabled:!1,onClick:e,ariaLabel:"Reset",iconContent:me})}),mt=({disabled:e,isRecording:r,isPlaying:o,isUploading:c,isError:l,recordingUrlExists:S,startRecording:u,stopRecording:h,onClickPlayPause:y,onClear:b})=>l?n($,{children:n(pt,{onClick:b})}):c?n($,{children:n(Ve,{size:"base",iconValue:"spinner"})}):F($,{children:[r?n(dt,{disabled:e,stopRecording:h}):n(ft,{disabled:e,startRecording:u}),S&&n(ut,{disabled:e,isPlaying:o,onClickPlayPause:y})]}),gt=t.memo(mt),ht=()=>n(he,{children:n(ye,{children:"An error has occurred, please try again."})}),yt=t.memo(ht),R="00:00",k=e=>{const r=Math.floor(e/1e3),o=Math.floor(r/60),c=Math.floor(o/60),l=r%60,S=o%60,u=l.toString().padStart(2,"0"),h=S.toString().padStart(2,"0"),y=c.toString().padStart(2,"0");return o<60?`${h}:${u}`:`${y}:${h}:${u}`},bt=()=>F(he,{children:[n(ye,{children:"This app would like to use your microphone."})," ",n(nt,{href:Ke,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),vt=t.memo(bt),St=()=>n(at,{children:n(lt,{})}),wt=t.memo(St),Ct=({element:e,uploadClient:r,widgetMgr:o,fragmentId:c,disabled:l})=>{const S=t.useRef(null),[u,h]=t.useState(!1),[y,b]=t.useState(!1),[s,i]=t.useState(!1),[N,f]=t.useState(R),[B,V]=H({widgetMgr:o,id:e.id,key:"deleteFileUrl",defaultValue:null}),[g,W]=H({widgetMgr:o,id:e.id,key:"recordingUrl",defaultValue:null}),[q,A]=H({widgetMgr:o,id:e.id,formId:e.formId,key:"recordingTime",defaultValue:R}),U=t.useRef(null),w=t.useRef(null),p=t.useRef(null),j=e.id,C=e.formId,ve=t.useCallback(async a=>{U.current&&U.current.abort();const v=new AbortController;U.current=v;try{if(b(!0),P(C)&&o.setFormsWithUploadsInProgress(new Set([C])),v.signal.aborted)return;let m;try{m=URL.createObjectURL(a),w.current&&w.current!==m&&URL.revokeObjectURL(w.current),w.current=m}catch{i(!0),b(!1),P(C)&&o.setFormsWithUploadsInProgress(new Set);return}if(v.signal.aborted){URL.revokeObjectURL(m),w.current=null;return}W(m);const Ie=new Date().toISOString().slice(0,16).replace(/:/g,"-"),Pe=new File([a],`${Ie}_audio.wav`,{type:a.type});try{const{successfulUploads:Fe,failedUploads:xe}=await Ye({files:[Pe],uploadClient:r,widgetMgr:o,widgetInfo:{id:j,formId:C},fragmentId:c,signal:v.signal});if(v.signal.aborted)return;if(xe.length>0){i(!0);return}i(!1);const le=Fe[0];le?.fileUrl?.deleteUrl&&V(le.fileUrl.deleteUrl)}catch{v.signal.aborted||i(!0)}finally{P(C)&&o.setFormsWithUploadsInProgress(new Set),v.signal.aborted||b(!1)}}catch{v.signal.aborted||(i(!0),b(!1)),P(C)&&o.setFormsWithUploadsInProgress(new Set)}},[r,o,j,C,c,V,W]),z=t.useRef(null),_=$e({containerRef:S,sampleRate:e.sampleRate??void 0,waveformPadding:4,events:{onPermissionDenied:()=>{h(!0)},onError:()=>{i(!0)},onRecordStart:()=>{A(R),f(R)},onRecordReady:()=>{const a=k(z.current?.playback.getDurationMs()??0);A(a),f(a)},onApprove:ve,onCancel:()=>{A(R),f(R)},onProgressMs:a=>{A(k(a))},onPlaybackPause:()=>{f(k(z.current?.playback.getCurrentTimeMs()??0))},onPlaybackFinish:()=>{f(k(z.current?.playback.getDurationMs()??0))}}});z.current=_;const{state:M,isPlaybackPlaying:I,start:X,stop:G,approve:K,cancel:Z,playback:{play:J,pause:Q,load:Y,getCurrentTimeMs:x,getDurationMs:ee}}=_,E=t.useCallback(async({updateWidgetManager:a,deleteFile:v})=>{const m=g;if(m&&w.current===m&&(URL.revokeObjectURL(m),w.current=null),p.current&&(cancelAnimationFrame(p.current),p.current=null),W(null),V(null),f(R),A(R),Z(),a&&o.setFileUploaderStateValue(e,{},{fromUi:!0},c),v&&B)try{await r.deleteFile(B)}catch{}P(m)&&URL.revokeObjectURL(m)},[B,g,r,Z,e,o,c,A,V,W]);t.useEffect(()=>{const a=()=>{I&&(f(k(x())),p.current=requestAnimationFrame(a))};return I?p.current=requestAnimationFrame(a):p.current&&(cancelAnimationFrame(p.current),p.current=null),()=>{p.current&&(cancelAnimationFrame(p.current),p.current=null)}},[I,x]),t.useEffect(()=>{if(!g)return;let a=!1;return f(q),(async()=>{try{if(await Y(g),a)return;const m=ee();m>0&&f(k(m))}catch{a||i(!0)}})(),()=>{a=!0}},[g,q,Y,ee]),t.useEffect(()=>{if(de(C))return;const a=new Xe;return a.manageFormClearListener(o,C,()=>{E({updateWidgetManager:!0,deleteFile:!1})}),()=>a.disconnect()},[C,E,o]),t.useEffect(()=>()=>{U.current&&(U.current.abort(),U.current=null),p.current&&(cancelAnimationFrame(p.current),p.current=null),w.current&&(URL.revokeObjectURL(w.current),w.current=null)},[]);const Se=t.useCallback(async()=>{try{if(I){const a=x();Q(),f(k(a))}else M==="idle"&&g&&(x()<=100&&f(R),await J())}catch{i(!0)}},[I,x,Q,J,g,M]),te=t.useCallback(async()=>{g&&await E({updateWidgetManager:!1,deleteFile:!0});try{f(R),await X()}catch{}},[E,g,X]),re=t.useCallback(async()=>{try{const{blob:a}=await G();await K(a)}catch{i(!0)}},[K,G]),oe=Qe(g,"recording.wav"),we=t.useCallback(()=>{te()},[te]),Ce=t.useCallback(()=>{re()},[re]),Re=t.useCallback(()=>{E({updateWidgetManager:!1,deleteFile:!0}),i(!1)},[E]),Ee=t.useCallback(()=>{oe()},[oe]),ke=t.useCallback(()=>{E({updateWidgetManager:!0,deleteFile:!0})},[E]),O=M==="recording",ne=I,Ae=O?q:N,ae=M==="idle"&&!u&&!g,Ue=u||ae||s;return F(et,{className:"stAudioInput","data-testid":"stAudioInput",children:[n(He,{label:e.label,disabled:l,labelVisibility:Ne(e.labelVisibility?.value),children:e.help&&n(st,{children:n(qe,{content:e.help,placement:Oe.TOP})})}),F(se,{disabled:l,children:[F(je,{isFullScreen:!1,disableFullscreenMode:!0,target:se,children:[g&&n(ce,{label:"Download as WAV",icon:Ze,onClick:Ee}),B&&n(ce,{label:"Clear recording",icon:Je,onClick:ke})]}),n(gt,{isRecording:O,isPlaying:ne,isUploading:y,isError:s,recordingUrlExists:!!g,startRecording:we,stopRecording:Ce,onClickPlayPause:()=>void Se(),onClear:Re,disabled:l||u}),F(tt,{children:[s&&n(yt,{}),ae&&n(wt,{}),u&&n(vt,{}),n(rt,{"data-testid":"stAudioInputWaveSurfer",ref:S,show:!Ue})]}),n(ot,{isPlayingOrRecording:O||ne,disabled:l,"data-testid":"stAudioInputWaveformTimeCode",children:Ae})]})]})},Ft=t.memo(Ct);export{Ft as default};
|
|
1
|
+
import{r as t,E as L,_ as D,L as Te,e as de,n as P,W as ie,bU as Le,bN as De,bM as Be,x as d,j as n,Z as Ve,l as F,B as We,ax as ze,b as Me,m as Ne,T as qe,P as Oe,ac as He}from"./index.CqTPbV5Y.js";import{u as $e}from"./useWaveformController.BCmk6WLk.js";import{T as je,a as ce}from"./Toolbar.DMgU0Vgw.js";import{u as _e,F as Xe}from"./FormClearHelper.-9RbsnV0.js";import{c as Ge}from"./createDownloadLinkElement.ZaXNnPK4.js";import{E as Ke}from"./urls.BwSlolu9.js";import{F as Ze,D as Je}from"./FileDownload.esm.CV-WYqBn.js";var ue=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),t.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});ue.displayName="Mic";var fe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});fe.displayName="Pause";var pe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});pe.displayName="PlayArrow";var me=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),t.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});me.displayName="Refresh";var ge=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});ge.displayName="StopCircle";const Qe=(e,r)=>{const{enforceDownloadInNewTab:o=!1}=t.useContext(Te);return t.useCallback(()=>{if(!e)return;const l=Ge({enforceDownloadInNewTab:o,url:e,filename:r});l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)},[e,o,r])},H=({widgetMgr:e,id:r,formId:o,key:c,defaultValue:l})=>{t.useEffect(()=>{const s=e.getElementState(r,c);de(s)&&P(l)&&e.setElementState(r,c,l)},[e,r,c,l]);const[S,u]=t.useState(e.getElementState(r,c)??l),h=t.useCallback(s=>{e.setElementState(r,c,s),u(s)},[e,r,c]),y=t.useMemo(()=>({formId:o||""}),[o]),b=t.useCallback(()=>h(l),[l,h]);return _e({element:y,widgetMgr:e,onFormCleared:b}),[S,h]},Ye=async({files:e,uploadClient:r,widgetMgr:o,widgetInfo:c,fragmentId:l,signal:S})=>{let u=[];try{u=await r.fetchFileURLs(e)}catch(s){return{successfulUploads:[],failedUploads:e.map(i=>({file:i,error:ie(s)}))}}const h=Le(e,u),y=[],b=[];return await Promise.all(h.map(async([s,i])=>{if(!s||!i?.uploadUrl||!i.fileId)return{file:s,fileUrl:i,error:new Error("No upload URL found")};try{await r.uploadFile({id:i.fileId,formId:c.formId||""},i.uploadUrl,s,void 0,S),y.push({fileUrl:i,file:s})}catch(N){const f=ie(N);b.push({file:s,error:f})}})),o.setFileUploaderStateValue(c,new De({uploadedFileInfo:y.map(({file:s,fileUrl:i})=>new Be({fileId:i.fileId,fileUrls:i,name:s.webkitRelativePath||s.name,size:s.size}))}),{fromUi:!0},l),{successfulUploads:y,failedUploads:b}},et=d("div",{target:"e3q8yfp0"})(),se=d("div",{target:"e3q8yfp1"})(({theme:e,disabled:r})=>({height:e.sizes.largestElementHeight,width:"100%",background:e.colors.secondaryBg,borderRadius:e.radii.default,marginBottom:e.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:e.spacing.xs,paddingRight:e.spacing.sm,border:e.colors.widgetBorderColor?`${e.sizes.borderWidth} solid ${e.colors.widgetBorderColor}`:void 0,cursor:r?"not-allowed":"auto",overflow:"hidden"})),tt=d("div",{target:"e3q8yfp2"})({flex:1}),rt=d("div",{target:"e3q8yfp3"})(({show:e,theme:r})=>({display:e?"block":"none",position:"relative",height:r.sizes.largestElementHeight,"& > div":{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center"}})),ot=d("span",{target:"e3q8yfp4"})(({theme:e,isPlayingOrRecording:r,disabled:o})=>({margin:e.spacing.sm,fontFamily:e.fonts.monospace,color:o?e.colors.fadedText40:r?e.colors.bodyText:e.colors.fadedText60,backgroundColor:e.colors.secondaryBg,fontSize:e.fontSizes.sm})),he=d("div",{target:"e3q8yfp5"})({width:"100%",textAlign:"center",overflow:"hidden"}),ye=d("span",{target:"e3q8yfp6"})(({theme:e})=>({color:e.colors.bodyText})),nt=d("a",{target:"e3q8yfp7"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none"})),at=d("div",{target:"e3q8yfp8"})(({theme:e})=>({flex:1,height:e.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),lt=d("div",{target:"e3q8yfp9"})(({theme:e})=>{const r="0.625em";return{opacity:.2,width:"100%",height:r,backgroundSize:r,backgroundImage:`radial-gradient(${e.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),it=d("span",{target:"e3q8yfp10"})(({theme:e})=>({"& > button":{color:e.colors.primary,padding:e.spacing.threeXS},"& > button:hover, & > button:focus":{color:e.colors.redColor}})),ct=d("span",{target:"e3q8yfp11"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),be=d("span",{target:"e3q8yfp12"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),$=d("div",{target:"e3q8yfp13"})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:e.spacing.xs,gap:e.spacing.twoXS,marginRight:e.spacing.twoXS})),st=d("div",{target:"e3q8yfp14"})(({theme:e})=>({marginLeft:e.spacing.sm})),T=({onClick:e,disabled:r,ariaLabel:o,iconContent:c})=>n(Me,{kind:We.BORDERLESS_ICON,onClick:e,disabled:r,"aria-label":o,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:n(ze,{content:c,size:"lg",color:"inherit"})}),dt=({disabled:e,stopRecording:r})=>n(it,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Stop recording",iconContent:ge})}),ut=({disabled:e,isPlaying:r,onClickPlayPause:o})=>n(be,{children:r?n(T,{onClick:o,disabled:e,ariaLabel:"Pause",iconContent:fe}):n(T,{onClick:o,disabled:e,ariaLabel:"Play",iconContent:pe})}),ft=({disabled:e,startRecording:r})=>n(ct,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Record",iconContent:ue})}),pt=({onClick:e})=>n(be,{children:n(T,{disabled:!1,onClick:e,ariaLabel:"Reset",iconContent:me})}),mt=({disabled:e,isRecording:r,isPlaying:o,isUploading:c,isError:l,recordingUrlExists:S,startRecording:u,stopRecording:h,onClickPlayPause:y,onClear:b})=>l?n($,{children:n(pt,{onClick:b})}):c?n($,{children:n(Ve,{size:"base",iconValue:"spinner"})}):F($,{children:[r?n(dt,{disabled:e,stopRecording:h}):n(ft,{disabled:e,startRecording:u}),S&&n(ut,{disabled:e,isPlaying:o,onClickPlayPause:y})]}),gt=t.memo(mt),ht=()=>n(he,{children:n(ye,{children:"An error has occurred, please try again."})}),yt=t.memo(ht),R="00:00",k=e=>{const r=Math.floor(e/1e3),o=Math.floor(r/60),c=Math.floor(o/60),l=r%60,S=o%60,u=l.toString().padStart(2,"0"),h=S.toString().padStart(2,"0"),y=c.toString().padStart(2,"0");return o<60?`${h}:${u}`:`${y}:${h}:${u}`},bt=()=>F(he,{children:[n(ye,{children:"This app would like to use your microphone."})," ",n(nt,{href:Ke,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),vt=t.memo(bt),St=()=>n(at,{children:n(lt,{})}),wt=t.memo(St),Ct=({element:e,uploadClient:r,widgetMgr:o,fragmentId:c,disabled:l})=>{const S=t.useRef(null),[u,h]=t.useState(!1),[y,b]=t.useState(!1),[s,i]=t.useState(!1),[N,f]=t.useState(R),[B,V]=H({widgetMgr:o,id:e.id,key:"deleteFileUrl",defaultValue:null}),[g,W]=H({widgetMgr:o,id:e.id,key:"recordingUrl",defaultValue:null}),[q,A]=H({widgetMgr:o,id:e.id,formId:e.formId,key:"recordingTime",defaultValue:R}),U=t.useRef(null),w=t.useRef(null),p=t.useRef(null),j=e.id,C=e.formId,ve=t.useCallback(async a=>{U.current&&U.current.abort();const v=new AbortController;U.current=v;try{if(b(!0),P(C)&&o.setFormsWithUploadsInProgress(new Set([C])),v.signal.aborted)return;let m;try{m=URL.createObjectURL(a),w.current&&w.current!==m&&URL.revokeObjectURL(w.current),w.current=m}catch{i(!0),b(!1),P(C)&&o.setFormsWithUploadsInProgress(new Set);return}if(v.signal.aborted){URL.revokeObjectURL(m),w.current=null;return}W(m);const Ie=new Date().toISOString().slice(0,16).replace(/:/g,"-"),Pe=new File([a],`${Ie}_audio.wav`,{type:a.type});try{const{successfulUploads:Fe,failedUploads:xe}=await Ye({files:[Pe],uploadClient:r,widgetMgr:o,widgetInfo:{id:j,formId:C},fragmentId:c,signal:v.signal});if(v.signal.aborted)return;if(xe.length>0){i(!0);return}i(!1);const le=Fe[0];le?.fileUrl?.deleteUrl&&V(le.fileUrl.deleteUrl)}catch{v.signal.aborted||i(!0)}finally{P(C)&&o.setFormsWithUploadsInProgress(new Set),v.signal.aborted||b(!1)}}catch{v.signal.aborted||(i(!0),b(!1)),P(C)&&o.setFormsWithUploadsInProgress(new Set)}},[r,o,j,C,c,V,W]),z=t.useRef(null),_=$e({containerRef:S,sampleRate:e.sampleRate??void 0,waveformPadding:4,events:{onPermissionDenied:()=>{h(!0)},onError:()=>{i(!0)},onRecordStart:()=>{A(R),f(R)},onRecordReady:()=>{const a=k(z.current?.playback.getDurationMs()??0);A(a),f(a)},onApprove:ve,onCancel:()=>{A(R),f(R)},onProgressMs:a=>{A(k(a))},onPlaybackPause:()=>{f(k(z.current?.playback.getCurrentTimeMs()??0))},onPlaybackFinish:()=>{f(k(z.current?.playback.getDurationMs()??0))}}});z.current=_;const{state:M,isPlaybackPlaying:I,start:X,stop:G,approve:K,cancel:Z,playback:{play:J,pause:Q,load:Y,getCurrentTimeMs:x,getDurationMs:ee}}=_,E=t.useCallback(async({updateWidgetManager:a,deleteFile:v})=>{const m=g;if(m&&w.current===m&&(URL.revokeObjectURL(m),w.current=null),p.current&&(cancelAnimationFrame(p.current),p.current=null),W(null),V(null),f(R),A(R),Z(),a&&o.setFileUploaderStateValue(e,{},{fromUi:!0},c),v&&B)try{await r.deleteFile(B)}catch{}P(m)&&URL.revokeObjectURL(m)},[B,g,r,Z,e,o,c,A,V,W]);t.useEffect(()=>{const a=()=>{I&&(f(k(x())),p.current=requestAnimationFrame(a))};return I?p.current=requestAnimationFrame(a):p.current&&(cancelAnimationFrame(p.current),p.current=null),()=>{p.current&&(cancelAnimationFrame(p.current),p.current=null)}},[I,x]),t.useEffect(()=>{if(!g)return;let a=!1;return f(q),(async()=>{try{if(await Y(g),a)return;const m=ee();m>0&&f(k(m))}catch{a||i(!0)}})(),()=>{a=!0}},[g,q,Y,ee]),t.useEffect(()=>{if(de(C))return;const a=new Xe;return a.manageFormClearListener(o,C,()=>{E({updateWidgetManager:!0,deleteFile:!1})}),()=>a.disconnect()},[C,E,o]),t.useEffect(()=>()=>{U.current&&(U.current.abort(),U.current=null),p.current&&(cancelAnimationFrame(p.current),p.current=null),w.current&&(URL.revokeObjectURL(w.current),w.current=null)},[]);const Se=t.useCallback(async()=>{try{if(I){const a=x();Q(),f(k(a))}else M==="idle"&&g&&(x()<=100&&f(R),await J())}catch{i(!0)}},[I,x,Q,J,g,M]),te=t.useCallback(async()=>{g&&await E({updateWidgetManager:!1,deleteFile:!0});try{f(R),await X()}catch{}},[E,g,X]),re=t.useCallback(async()=>{try{const{blob:a}=await G();await K(a)}catch{i(!0)}},[K,G]),oe=Qe(g,"recording.wav"),we=t.useCallback(()=>{te()},[te]),Ce=t.useCallback(()=>{re()},[re]),Re=t.useCallback(()=>{E({updateWidgetManager:!1,deleteFile:!0}),i(!1)},[E]),Ee=t.useCallback(()=>{oe()},[oe]),ke=t.useCallback(()=>{E({updateWidgetManager:!0,deleteFile:!0})},[E]),O=M==="recording",ne=I,Ae=O?q:N,ae=M==="idle"&&!u&&!g,Ue=u||ae||s;return F(et,{className:"stAudioInput","data-testid":"stAudioInput",children:[n(He,{label:e.label,disabled:l,labelVisibility:Ne(e.labelVisibility?.value),children:e.help&&n(st,{children:n(qe,{content:e.help,placement:Oe.TOP})})}),F(se,{disabled:l,children:[F(je,{isFullScreen:!1,disableFullscreenMode:!0,target:se,children:[g&&n(ce,{label:"Download as WAV",icon:Ze,onClick:Ee}),B&&n(ce,{label:"Clear recording",icon:Je,onClick:ke})]}),n(gt,{isRecording:O,isPlaying:ne,isUploading:y,isError:s,recordingUrlExists:!!g,startRecording:we,stopRecording:Ce,onClickPlayPause:()=>void Se(),onClear:Re,disabled:l||u}),F(tt,{children:[s&&n(yt,{}),ae&&n(wt,{}),u&&n(vt,{}),n(rt,{"data-testid":"stAudioInputWaveSurfer",ref:S,show:!Ue})]}),n(ot,{isPlayingOrRecording:O||ne,disabled:l,"data-testid":"stAudioInputWaveformTimeCode",children:Ae})]})]})},Ft=t.memo(Ct);export{Ft as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as y,E as O,_ as T,x as I,t as X,l as x,j as h,ay as Q,P as j,b as J,B as K,ax as W,bK as B,al as Y,ag as Z,bm as ee,g as te,bL as re,Q as ie,bn as oe,e as P,bM as ne,bN as ae,m as se,ab as le,T as de,ac as ce,a0 as ue}from"./index.DMxc2XFp.js";import{w as fe}from"./withCalculatedWidth.DcKeRSWJ.js";import{U as z}from"./UploadFileInfo.C-jY39rj.js";import{F as pe}from"./FormClearHelper.CG2XN1_g.js";import{P as he,S as ge}from"./ProgressBar.CGQ8OgfO.js";import{b as me}from"./urls.BwSlolu9.js";var k=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({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"}))});k.displayName="SwitchCamera";var $=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({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"}))});$.displayName="Video";var A=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({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"}))});A.displayName="X";function ve(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 N=I("div",{target:"etzmx8d0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),V=I("div",{target:"etzmx8d1"})(({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"})),Se=I("p",{target:"etzmx8d2"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"})),ye=I("img",{target:"etzmx8d3"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l})),be=I("a",{target:"etzmx8d4"})(({theme:i})=>({color:i.colors.link,textDecoration:i.linkUnderline?"underline":"none",display:"block"})),we=I("span",{target:"etzmx8d5"})({display:"flex",alignItems:"center"}),Ce=I("div",{target:"etzmx8d6"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Me=I("div",{target:"etzmx8d8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),Ue=I("button",{target:"etzmx8d9"})(({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,borderColor:i.colors.borderColor,backgroundColor:i.colors.lightenedBg05,cursor:"not-allowed"},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 ${X(i.colors.primary,.5)}`},...ve("medium",i)}));function Ie({disabled:i,onClick:l,children:t,progress:n}){return x(Ue,{disabled:i||!1,onClick:l||(()=>{}),progress:n||null,"data-testid":"stCameraInputButton",children:[t,n?h(Me,{children:h(he,{value:n,size:ge.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const H=y.memo(Ie);var R=function(i){return i.USER="user",i.ENVIRONMENT="environment",i}({});const Ee=({switchFacingMode:i})=>h(Ce,{"data-testid":"stCameraInputSwitchButton",children:h(Q,{content:"Switch camera",placement:j.TOP_RIGHT,children:h(J,{kind:K.MINIMAL,onClick:i,children:h(W,{content:k,size:"twoXL",color:B.white})})})}),xe=y.memo(Ee);var _={exports:{}},Fe=_.exports,L;function Pe(){return L||(L=1,function(i,l){(function(n,o){i.exports=o(Y())})(Fe,function(t){return function(n){var o={};function a(s){if(o[s])return o[s].exports;var f=o[s]={i:s,l:!1,exports:{}};return n[s].call(f.exports,f,f.exports,a),f.l=!0,f.exports}return a.m=n,a.c=o,a.d=function(s,f,g){a.o(s,f)||Object.defineProperty(s,f,{enumerable:!0,get:g})},a.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},a.t=function(s,f){if(f&1&&(s=a(s)),f&8||f&4&&typeof s=="object"&&s&&s.__esModule)return s;var g=Object.create(null);if(a.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:s}),f&2&&typeof s!="string")for(var U in s)a.d(g,U,(function(M){return s[M]}).bind(null,U));return g},a.n=function(s){var f=s&&s.__esModule?function(){return s.default}:function(){return s};return a.d(f,"a",f),f},a.o=function(s,f){return Object.prototype.hasOwnProperty.call(s,f)},a.p="",a(a.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(n,o,a){a.r(o);var s=a("react"),f=function(){var m=function(u,e){return m=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])},m(u,e)};return function(u,e){m(u,e);function r(){this.constructor=u}u.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),g=function(){return g=Object.assign||function(m){for(var u,e=1,r=arguments.length;e<r;e++){u=arguments[e];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(m[d]=u[d])}return m},g.apply(this,arguments)},U=function(m,u){var e={};for(var r in m)Object.prototype.hasOwnProperty.call(m,r)&&u.indexOf(r)<0&&(e[r]=m[r]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,r=Object.getOwnPropertySymbols(m);d<r.length;d++)u.indexOf(r[d])<0&&Object.prototype.propertyIsEnumerable.call(m,r[d])&&(e[r[d]]=m[r[d]]);return e};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(u){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return e?new Promise(function(r,d){e.call(navigator,u,r,d)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function M(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var E=function(m){f(u,m);function u(e){var r=m.call(this,e)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return u.prototype.componentDidMount=function(){var e=this,r=e.state,d=e.props;if(this.unmounted=!1,!M()){d.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(e){var r=this.props;if(!M()){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,S=e.minScreenshotHeight!==r.minScreenshotHeight;(c||w||S)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.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())},u.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(u.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},u.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)},u.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,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var v=w/S;w=c.minScreenshotWidth||this.video.clientWidth,S=w/v,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,w=S*v)}this.canvas=document.createElement("canvas"),this.canvas.width=e?.width||w,this.canvas.height=e?.height||S,this.ctx=this.canvas.getContext("2d")}var C=this,b=C.ctx,p=C.canvas;return b&&p&&(p.width=e?.width||p.width,p.height=e?.height||p.height,c.mirrored&&(b.translate(p.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,e?.width||p.width,e?.height||p.height),c.mirrored&&(b.scale(-1,1),b.translate(-p.width,0))),p},u.prototype.requestUserMedia=function(){var e=this,r=this.props,d=function(S,v){var C={video:typeof v<"u"?v:!0};r.audio&&(C.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(C).then(function(p){e.unmounted||b!==e.requestUserMediaId?u.stopMediaStream(p):e.handleUserMedia(null,p)}).catch(function(p){e.handleUserMedia(p)})};if("mediaDevices"in navigator)d(r.audioConstraints,r.videoConstraints);else{var c=function(S){return{optional:[{sourceId:S}]}},w=function(S){var v=S.deviceId;return typeof v=="string"?v:Array.isArray(v)&&v.length>0?v[0]:typeof v=="object"&&v.ideal?v.ideal:null};MediaStreamTrack.getSources(function(S){var v=null,C=null;S.forEach(function(F){F.kind==="audio"?v=F.id:F.kind==="video"&&(C=F.id)});var b=w(r.audioConstraints);b&&(v=b);var p=w(r.videoConstraints);p&&(C=p),d(c(v),c(C))})}},u.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)},u.prototype.render=function(){var e=this,r=this,d=r.state,c=r.props,w=c.audio;c.forceScreenshotSourceSize;var S=c.disablePictureInPicture;c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var v=c.mirrored,C=c.style,b=C===void 0?{}:C,p=c.children,F=U(c,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),D=v?g(g({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,G={getScreenshot:this.getScreenshot.bind(this)};return s.createElement(s.Fragment,null,s.createElement("video",g({autoPlay:!0,disablePictureInPicture:S,src:d.src,muted:!w,playsInline:!0,ref:function(q){e.video=q},style:D},F)),p&&p(G))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(s.Component);o.default=E},react:function(n,o){n.exports=t}}).default})}(_)),_.exports}var Re=Pe();const _e=Z(Re),Oe=({width:i})=>x(V,{width:i,children:[h(W,{size:"threeXL",color:B.gray60,content:$}),x(Se,{children:["This app would like to use your camera.",h(be,{href:me,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Te=({handleCapture:i,width:l,disabled:t,clearPhotoInProgress:n,setClearPhotoInProgress:o,facingMode:a,setFacingMode:s,testOverride:f})=>{const[g,U]=y.useState(f||"pending"),M=y.useRef(null),[E,m]=y.useState(l),u=y.useCallback(ee(1e3,m),[]);y.useEffect(()=>{u(l)},[l,u]);function e(){if(M.current!==null){const d=M.current.getScreenshot();i(d)}}const r=te();return x(N,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!t&&!n?h(Oe,{width:E}):re()&&h(xe,{switchFacingMode:s}),h(V,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!t&&!n,width:E,children:!t&&h(_e,{audio:!1,ref:M,screenshotFormat:"image/jpeg",screenshotQuality:1,width:E,height:E*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{U("error")},onUserMedia:()=>{U("success"),o(!1)},videoConstraints:{width:{ideal:E},facingMode:a}})}),h(H,{onClick:e,disabled:g!=="success"||t||n,children:"Take Photo"})]})},We=y.memo(Te),Ve=150,ze=ie.getLogger("CameraInput");class Le extends y.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new pe,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===R.USER?R.ENVIRONMENT:R.USER}))},this.handleCapture=t=>{if(t===null)return Promise.resolve();this.setState({imgSrc:t,shutter:!0,minShutterEffectPassed:!1});const n=o=>new Promise(a=>setTimeout(a,o));return je(t,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(o=>this.props.uploadClient.fetchFileURLs([o]).then(a=>({file:o,fileUrls:a[0]}))).then(({file:o,fileUrls:a})=>this.uploadFile(a,o)).then(()=>n(Ve)).then(()=>{this.setState((o,a)=>({imgSrc:t,shutter:o.shutter,minShutterEffectPassed:!0}))}).catch(o=>{ze.error(o)})},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:n,widgetMgr:o,fragmentId:a}=this.props,s=o.getFileUploaderStateValue(n);oe(t,s)||o.setFileUploaderStateValue(n,t,{fromUi:!0},a)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(P(t))return;this.setState({imgSrc:null});const{widgetMgr:n,element:o,fragmentId:a}=this.props;n.setFileUploaderStateValue(o,t,{fromUi:!0},a)})},this.deleteFile=t=>{const n=this.getFile(t);P(n)||(n.status.type==="uploading"&&n.status.abortController.abort(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(n.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(n=>({files:[...n.files,t]}))},this.removeFile=t=>{this.setState(n=>({files:n.files.filter(o=>o.id!==t)}))},this.getFile=t=>this.state.files.find(n=>n.id===t),this.updateFile=(t,n)=>{this.setState(o=>({files:o.files.map(a=>a.id===t?n:a)}))},this.onUploadComplete=(t,n)=>{this.setState(()=>({shutter:!1}));const o=this.getFile(t);P(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:n.fileId,fileUrls:n}))},this.onUploadProgress=(t,n)=>{const o=this.getFile(n);if(P(o)||o.status.type!=="uploading")return;const a=Math.round(t.loaded*100/t.total);o.status.progress!==a&&this.updateFile(n,o.setStatus({type:"uploading",abortController:o.status.abortController,progress:a}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(t,n)=>{const o=new AbortController,a=new z(n.name,n.size,this.nextLocalFileId(),{type:"uploading",abortController:o,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,n,s=>this.onUploadProgress(s,a.id),o.signal).then(()=>this.onUploadComplete(a.id,t)).catch(s=>{s instanceof DOMException&&s.name==="AbortError"||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:s?s.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:R.USER},{widgetMgr:t,element:n}=this.props,o=t.getFileUploaderStateValue(n);if(P(o))return l;const{uploadedFileInfo:a}=o;return P(a)||a.length===0?l:{files:a.map(s=>{const f=s.name,g=s.size,U=s.fileId,M=s.fileUrls;return new z(f,g,this.nextLocalFileId(),{type:"uploaded",fileId:U,fileUrls:M})}),imgSrc:a.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:R.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:n,fragmentId:o}=this.props;n.getFileUploaderStateValue(t)===void 0&&n.setFileUploaderStateValue(t,l,{fromUi:!1},o)}createWidgetValue(){const l=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:n,size:o,status:a}=t;return new ne({fileId:a.fileId,fileUrls:a.fileUrls,name:n,size:o})});return new ae({uploadedFileInfo:l})}render(){const{element:l,widgetMgr:t,disabled:n,width:o}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),x(N,{className:"stCameraInput","data-testid":"stCameraInput",children:[h(ce,{label:l.label,disabled:n,labelVisibility:se(l.labelVisibility?.value),children:l.help&&h(le,{children:h(de,{content:l.help,placement:j.TOP_RIGHT})})}),this.state.imgSrc?x(ue,{children:[h(V,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h(ye,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),h(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||n,children:this.getProgress()?"Uploading...":x(we,{children:[h(W,{content:A,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h(We,{handleCapture:this.handleCapture,width:o,disabled:n,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function je(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}const De=fe(Le);export{De as default};
|
|
1
|
+
import{r as y,E as O,_ as T,x as I,t as X,l as x,j as h,ay as Q,P as j,b as J,B as K,ax as W,bK as B,al as Y,ag as Z,bm as ee,g as te,bL as re,Q as ie,bn as oe,e as P,bM as ne,bN as ae,m as se,ab as le,T as de,ac as ce,a0 as ue}from"./index.CqTPbV5Y.js";import{w as fe}from"./withCalculatedWidth.ChdrMItN.js";import{U as z}from"./UploadFileInfo.C-jY39rj.js";import{F as pe}from"./FormClearHelper.-9RbsnV0.js";import{P as he,S as ge}from"./ProgressBar.BxmfHxKu.js";import{b as me}from"./urls.BwSlolu9.js";var k=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({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"}))});k.displayName="SwitchCamera";var $=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({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"}))});$.displayName="Video";var A=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({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"}))});A.displayName="X";function ve(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 N=I("div",{target:"etzmx8d0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),V=I("div",{target:"etzmx8d1"})(({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"})),Se=I("p",{target:"etzmx8d2"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"})),ye=I("img",{target:"etzmx8d3"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l})),be=I("a",{target:"etzmx8d4"})(({theme:i})=>({color:i.colors.link,textDecoration:i.linkUnderline?"underline":"none",display:"block"})),we=I("span",{target:"etzmx8d5"})({display:"flex",alignItems:"center"}),Ce=I("div",{target:"etzmx8d6"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Me=I("div",{target:"etzmx8d8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),Ue=I("button",{target:"etzmx8d9"})(({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,borderColor:i.colors.borderColor,backgroundColor:i.colors.lightenedBg05,cursor:"not-allowed"},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 ${X(i.colors.primary,.5)}`},...ve("medium",i)}));function Ie({disabled:i,onClick:l,children:t,progress:n}){return x(Ue,{disabled:i||!1,onClick:l||(()=>{}),progress:n||null,"data-testid":"stCameraInputButton",children:[t,n?h(Me,{children:h(he,{value:n,size:ge.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const H=y.memo(Ie);var R=function(i){return i.USER="user",i.ENVIRONMENT="environment",i}({});const Ee=({switchFacingMode:i})=>h(Ce,{"data-testid":"stCameraInputSwitchButton",children:h(Q,{content:"Switch camera",placement:j.TOP_RIGHT,children:h(J,{kind:K.MINIMAL,onClick:i,children:h(W,{content:k,size:"twoXL",color:B.white})})})}),xe=y.memo(Ee);var _={exports:{}},Fe=_.exports,L;function Pe(){return L||(L=1,function(i,l){(function(n,o){i.exports=o(Y())})(Fe,function(t){return function(n){var o={};function a(s){if(o[s])return o[s].exports;var f=o[s]={i:s,l:!1,exports:{}};return n[s].call(f.exports,f,f.exports,a),f.l=!0,f.exports}return a.m=n,a.c=o,a.d=function(s,f,g){a.o(s,f)||Object.defineProperty(s,f,{enumerable:!0,get:g})},a.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},a.t=function(s,f){if(f&1&&(s=a(s)),f&8||f&4&&typeof s=="object"&&s&&s.__esModule)return s;var g=Object.create(null);if(a.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:s}),f&2&&typeof s!="string")for(var U in s)a.d(g,U,(function(M){return s[M]}).bind(null,U));return g},a.n=function(s){var f=s&&s.__esModule?function(){return s.default}:function(){return s};return a.d(f,"a",f),f},a.o=function(s,f){return Object.prototype.hasOwnProperty.call(s,f)},a.p="",a(a.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(n,o,a){a.r(o);var s=a("react"),f=function(){var m=function(u,e){return m=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])},m(u,e)};return function(u,e){m(u,e);function r(){this.constructor=u}u.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),g=function(){return g=Object.assign||function(m){for(var u,e=1,r=arguments.length;e<r;e++){u=arguments[e];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(m[d]=u[d])}return m},g.apply(this,arguments)},U=function(m,u){var e={};for(var r in m)Object.prototype.hasOwnProperty.call(m,r)&&u.indexOf(r)<0&&(e[r]=m[r]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,r=Object.getOwnPropertySymbols(m);d<r.length;d++)u.indexOf(r[d])<0&&Object.prototype.propertyIsEnumerable.call(m,r[d])&&(e[r[d]]=m[r[d]]);return e};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(u){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return e?new Promise(function(r,d){e.call(navigator,u,r,d)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function M(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var E=function(m){f(u,m);function u(e){var r=m.call(this,e)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return u.prototype.componentDidMount=function(){var e=this,r=e.state,d=e.props;if(this.unmounted=!1,!M()){d.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(e){var r=this.props;if(!M()){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,S=e.minScreenshotHeight!==r.minScreenshotHeight;(c||w||S)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.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())},u.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(u.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},u.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)},u.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,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var v=w/S;w=c.minScreenshotWidth||this.video.clientWidth,S=w/v,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,w=S*v)}this.canvas=document.createElement("canvas"),this.canvas.width=e?.width||w,this.canvas.height=e?.height||S,this.ctx=this.canvas.getContext("2d")}var C=this,b=C.ctx,p=C.canvas;return b&&p&&(p.width=e?.width||p.width,p.height=e?.height||p.height,c.mirrored&&(b.translate(p.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,e?.width||p.width,e?.height||p.height),c.mirrored&&(b.scale(-1,1),b.translate(-p.width,0))),p},u.prototype.requestUserMedia=function(){var e=this,r=this.props,d=function(S,v){var C={video:typeof v<"u"?v:!0};r.audio&&(C.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(C).then(function(p){e.unmounted||b!==e.requestUserMediaId?u.stopMediaStream(p):e.handleUserMedia(null,p)}).catch(function(p){e.handleUserMedia(p)})};if("mediaDevices"in navigator)d(r.audioConstraints,r.videoConstraints);else{var c=function(S){return{optional:[{sourceId:S}]}},w=function(S){var v=S.deviceId;return typeof v=="string"?v:Array.isArray(v)&&v.length>0?v[0]:typeof v=="object"&&v.ideal?v.ideal:null};MediaStreamTrack.getSources(function(S){var v=null,C=null;S.forEach(function(F){F.kind==="audio"?v=F.id:F.kind==="video"&&(C=F.id)});var b=w(r.audioConstraints);b&&(v=b);var p=w(r.videoConstraints);p&&(C=p),d(c(v),c(C))})}},u.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)},u.prototype.render=function(){var e=this,r=this,d=r.state,c=r.props,w=c.audio;c.forceScreenshotSourceSize;var S=c.disablePictureInPicture;c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var v=c.mirrored,C=c.style,b=C===void 0?{}:C,p=c.children,F=U(c,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),D=v?g(g({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,G={getScreenshot:this.getScreenshot.bind(this)};return s.createElement(s.Fragment,null,s.createElement("video",g({autoPlay:!0,disablePictureInPicture:S,src:d.src,muted:!w,playsInline:!0,ref:function(q){e.video=q},style:D},F)),p&&p(G))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(s.Component);o.default=E},react:function(n,o){n.exports=t}}).default})}(_)),_.exports}var Re=Pe();const _e=Z(Re),Oe=({width:i})=>x(V,{width:i,children:[h(W,{size:"threeXL",color:B.gray60,content:$}),x(Se,{children:["This app would like to use your camera.",h(be,{href:me,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Te=({handleCapture:i,width:l,disabled:t,clearPhotoInProgress:n,setClearPhotoInProgress:o,facingMode:a,setFacingMode:s,testOverride:f})=>{const[g,U]=y.useState(f||"pending"),M=y.useRef(null),[E,m]=y.useState(l),u=y.useCallback(ee(1e3,m),[]);y.useEffect(()=>{u(l)},[l,u]);function e(){if(M.current!==null){const d=M.current.getScreenshot();i(d)}}const r=te();return x(N,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!t&&!n?h(Oe,{width:E}):re()&&h(xe,{switchFacingMode:s}),h(V,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!t&&!n,width:E,children:!t&&h(_e,{audio:!1,ref:M,screenshotFormat:"image/jpeg",screenshotQuality:1,width:E,height:E*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{U("error")},onUserMedia:()=>{U("success"),o(!1)},videoConstraints:{width:{ideal:E},facingMode:a}})}),h(H,{onClick:e,disabled:g!=="success"||t||n,children:"Take Photo"})]})},We=y.memo(Te),Ve=150,ze=ie.getLogger("CameraInput");class Le extends y.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new pe,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===R.USER?R.ENVIRONMENT:R.USER}))},this.handleCapture=t=>{if(t===null)return Promise.resolve();this.setState({imgSrc:t,shutter:!0,minShutterEffectPassed:!1});const n=o=>new Promise(a=>setTimeout(a,o));return je(t,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(o=>this.props.uploadClient.fetchFileURLs([o]).then(a=>({file:o,fileUrls:a[0]}))).then(({file:o,fileUrls:a})=>this.uploadFile(a,o)).then(()=>n(Ve)).then(()=>{this.setState((o,a)=>({imgSrc:t,shutter:o.shutter,minShutterEffectPassed:!0}))}).catch(o=>{ze.error(o)})},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:n,widgetMgr:o,fragmentId:a}=this.props,s=o.getFileUploaderStateValue(n);oe(t,s)||o.setFileUploaderStateValue(n,t,{fromUi:!0},a)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(P(t))return;this.setState({imgSrc:null});const{widgetMgr:n,element:o,fragmentId:a}=this.props;n.setFileUploaderStateValue(o,t,{fromUi:!0},a)})},this.deleteFile=t=>{const n=this.getFile(t);P(n)||(n.status.type==="uploading"&&n.status.abortController.abort(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(n.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(n=>({files:[...n.files,t]}))},this.removeFile=t=>{this.setState(n=>({files:n.files.filter(o=>o.id!==t)}))},this.getFile=t=>this.state.files.find(n=>n.id===t),this.updateFile=(t,n)=>{this.setState(o=>({files:o.files.map(a=>a.id===t?n:a)}))},this.onUploadComplete=(t,n)=>{this.setState(()=>({shutter:!1}));const o=this.getFile(t);P(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:n.fileId,fileUrls:n}))},this.onUploadProgress=(t,n)=>{const o=this.getFile(n);if(P(o)||o.status.type!=="uploading")return;const a=Math.round(t.loaded*100/t.total);o.status.progress!==a&&this.updateFile(n,o.setStatus({type:"uploading",abortController:o.status.abortController,progress:a}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(t,n)=>{const o=new AbortController,a=new z(n.name,n.size,this.nextLocalFileId(),{type:"uploading",abortController:o,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,n,s=>this.onUploadProgress(s,a.id),o.signal).then(()=>this.onUploadComplete(a.id,t)).catch(s=>{s instanceof DOMException&&s.name==="AbortError"||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:s?s.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:R.USER},{widgetMgr:t,element:n}=this.props,o=t.getFileUploaderStateValue(n);if(P(o))return l;const{uploadedFileInfo:a}=o;return P(a)||a.length===0?l:{files:a.map(s=>{const f=s.name,g=s.size,U=s.fileId,M=s.fileUrls;return new z(f,g,this.nextLocalFileId(),{type:"uploaded",fileId:U,fileUrls:M})}),imgSrc:a.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:R.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:n,fragmentId:o}=this.props;n.getFileUploaderStateValue(t)===void 0&&n.setFileUploaderStateValue(t,l,{fromUi:!1},o)}createWidgetValue(){const l=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:n,size:o,status:a}=t;return new ne({fileId:a.fileId,fileUrls:a.fileUrls,name:n,size:o})});return new ae({uploadedFileInfo:l})}render(){const{element:l,widgetMgr:t,disabled:n,width:o}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),x(N,{className:"stCameraInput","data-testid":"stCameraInput",children:[h(ce,{label:l.label,disabled:n,labelVisibility:se(l.labelVisibility?.value),children:l.help&&h(le,{children:h(de,{content:l.help,placement:j.TOP_RIGHT})})}),this.state.imgSrc?x(ue,{children:[h(V,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h(ye,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),h(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||n,children:this.getProgress()?"Uploading...":x(we,{children:[h(W,{content:A,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h(We,{handleCapture:this.handleCapture,width:o,disabled:n,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function je(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}const De=fe(Le);export{De as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as Ye,s as Ca,h as qa}from"./index.
|
|
1
|
+
import{w as Ye,s as Ca,h as qa}from"./index.D52dMvK5.js";import{bg as Ea,bh as Ia,bi as Ra}from"./index.CqTPbV5Y.js";function Oa(r,e){return Tr(r,{})||{type:"root",children:[]}}function Tr(r,e){const t=Fa(r,e);return t&&e.afterTransform&&e.afterTransform(r,t),t}function Fa(r,e){switch(r.nodeType){case 1:return Va(r,e);case 3:return Ha(r);case 8:return Pa(r);case 9:return Pt(r,e);case 10:return La();case 11:return Pt(r,e);default:return}}function Pt(r,e){return{type:"root",children:Br(r,e)}}function La(){return{type:"doctype"}}function Ha(r){return{type:"text",value:r.nodeValue||""}}function Pa(r){return{type:"comment",value:r.nodeValue||""}}function Va(r,e){const t=r.namespaceURI,a=t===Ye.svg?Ca:qa,n=t===Ye.html?r.tagName.toLowerCase():r.tagName,s=t===Ye.html&&n==="template"?r.content:r,o=r.getAttributeNames(),h={};let m=-1;for(;++m<o.length;)h[o[m]]=r.getAttribute(o[m])||"";return a(n,h,Br(s,e))}function Br(r,e){const t=r.childNodes,a=[];let n=-1;for(;++n<t.length;){const s=Tr(t[n],e);s!==void 0&&a.push(s)}return a}new DOMParser;function Ga(r,e){const t=Ua(r);return Oa(t)}function Ua(r){const e=document.createElement("template");return e.innerHTML=r,e.content}const Vt=function(r,e,t){const a=Ea(t);if(!r||!r.type||!r.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(e=r.children.indexOf(e),e<0)throw new Error("Expected child node or index");for(;++e<r.children.length;)if(a(r.children[e],e,r))return r.children[e]},W0=function(r){if(r==null)return Xa;if(typeof r=="string")return $a(r);if(typeof r=="object")return Ya(r);if(typeof r=="function")return vt(r);throw new Error("Expected function, string, or array as `test`")};function Ya(r){const e=[];let t=-1;for(;++t<r.length;)e[t]=W0(r[t]);return vt(a);function a(...n){let s=-1;for(;++s<e.length;)if(e[s].apply(this,n))return!0;return!1}}function $a(r){return vt(e);function e(t){return t.tagName===r}}function vt(r){return e;function e(t,a,n){return!!(Wa(t)&&r.call(this,t,typeof a=="number"?a:void 0,n||void 0))}}function Xa(r){return!!(r&&typeof r=="object"&&"type"in r&&r.type==="element"&&"tagName"in r&&typeof r.tagName=="string")}function Wa(r){return r!==null&&typeof r=="object"&&"type"in r&&"tagName"in r}const Gt=/\n/g,Ut=/[\t ]+/g,st=W0("br"),Yt=W0(t1),ja=W0("p"),$t=W0("tr"),Za=W0(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",e1,r1]),Nr=W0(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function Ka(r,e){const t=e||{},a="children"in r?r.children:[],n=Nr(r),s=qr(r,{whitespace:t.whitespace||"normal"}),o=[];(r.type==="text"||r.type==="comment")&&o.push(...Cr(r,{breakBefore:!0,breakAfter:!0}));let h=-1;for(;++h<a.length;)o.push(...Dr(a[h],r,{whitespace:s,breakBefore:h?void 0:n,breakAfter:h<a.length-1?st(a[h+1]):n}));const m=[];let p;for(h=-1;++h<o.length;){const g=o[h];typeof g=="number"?p!==void 0&&g>p&&(p=g):g&&(p!==void 0&&p>-1&&m.push(`
|
|
2
2
|
`.repeat(p)||" "),p=-1,m.push(g))}return m.join("")}function Dr(r,e,t){return r.type==="element"?Ja(r,e,t):r.type==="text"?t.whitespace==="normal"?Cr(r,t):Qa(r):[]}function Ja(r,e,t){const a=qr(r,t),n=r.children||[];let s=-1,o=[];if(Za(r))return o;let h,m;for(st(r)||$t(r)&&Vt(e,r,$t)?m=`
|
|
3
3
|
`:ja(r)?(h=2,m=2):Nr(r)&&(h=1,m=1);++s<n.length;)o=o.concat(Dr(n[s],r,{whitespace:a,breakBefore:s?void 0:h,breakAfter:s<n.length-1?st(n[s+1]):m}));return Yt(r)&&Vt(e,r,Yt)&&o.push(" "),h&&o.unshift(h),m&&o.push(m),o}function Cr(r,e){const t=String(r.value),a=[],n=[];let s=0;for(;s<=t.length;){Gt.lastIndex=s;const m=Gt.exec(t),p=m&&"index"in m?m.index:t.length;a.push(_a(t.slice(s,p).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),s===0?e.breakBefore:!0,p===t.length?e.breakAfter:!0)),s=p+1}let o=-1,h;for(;++o<a.length;)a[o].charCodeAt(a[o].length-1)===8203||o<a.length-1&&a[o+1].charCodeAt(0)===8203?(n.push(a[o]),h=void 0):a[o]?(typeof h=="number"&&n.push(h),n.push(a[o]),h=0):(o===0||o===a.length-1)&&n.push(0);return n}function Qa(r){return[String(r.value)]}function _a(r,e,t){const a=[];let n=0,s;for(;n<r.length;){Ut.lastIndex=n;const o=Ut.exec(r);s=o?o.index:r.length,!n&&!s&&o&&!e&&a.push(""),n!==s&&a.push(r.slice(n,s)),n=o?s+o[0].length:s}return n!==s&&!t&&a.push(""),a.join(" ")}function qr(r,e){if(r.type==="element"){const t=r.properties||{};switch(r.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return t.wrap?"pre-wrap":"pre";case"td":case"th":return t.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}function e1(r){return!!(r.properties||{}).hidden}function t1(r){return r.tagName==="td"||r.tagName==="th"}function r1(r){return r.tagName==="dialog"&&!(r.properties||{}).open}class u0{constructor(e,t,a){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=a}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new u0(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class f0{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new f0(t,u0.range(this,e))}}class M{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var a="KaTeX parse error: "+e,n,s,o=t&&t.loc;if(o&&o.start<=o.end){var h=o.lexer.input;n=o.start,s=o.end,n===h.length?a+=" at end of input: ":a+=" at position "+(n+1)+": ";var m=h.slice(n,s).replace(/[^]/g,"$&̲"),p;n>15?p="…"+h.slice(n-15,n):p=h.slice(0,n);var g;s+15<h.length?g=h.slice(s,s+15)+"…":g=h.slice(s),a+=p+m+g}var b=new Error(a);return b.name="ParseError",b.__proto__=M.prototype,b.position=n,n!=null&&s!=null&&(b.length=s-n),b.rawMessage=e,b}}M.prototype.__proto__=Error.prototype;var a1=function(e,t){return e.indexOf(t)!==-1},n1=function(e,t){return e===void 0?t:e},i1=/([A-Z])/g,s1=function(e){return e.replace(i1,"-$1").toLowerCase()},l1={"&":"&",">":">","<":"<",'"':""","'":"'"},o1=/[&><"']/g;function u1(r){return String(r).replace(o1,e=>l1[e])}var Er=function r(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?r(e.body[0]):e:e.type==="font"?r(e.body):e},h1=function(e){var t=Er(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},m1=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},c1=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},q={contains:a1,deflt:n1,escape:u1,hyphenate:s1,getBaseElem:Er,isCharacterBox:h1,protocolFromUrl:c1},Ae={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function d1(r){if(r.default)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class gt{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var t in Ae)if(Ae.hasOwnProperty(t)){var a=Ae[t];this[t]=e[t]!==void 0?a.processor?a.processor(e[t]):e[t]:d1(a)}}reportNonstrict(e,t,a){var n=this.strict;if(typeof n=="function"&&(n=n(e,t,a)),!(!n||n==="ignore")){if(n===!0||n==="error")throw new M("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),a);n==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+n+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,a){var n=this.strict;if(typeof n=="function")try{n=n(e,t,a)}catch{n="error"}return!n||n==="ignore"?!1:n===!0||n==="error"?!0:n==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+n+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var t=q.protocolFromUrl(e.url);if(t==null)return!1;e.protocol=t}var a=typeof this.trust=="function"?this.trust(e):this.trust;return!!a}}class F0{constructor(e,t,a){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=a}sup(){return y0[f1[this.id]]}sub(){return y0[p1[this.id]]}fracNum(){return y0[v1[this.id]]}fracDen(){return y0[g1[this.id]]}cramp(){return y0[b1[this.id]]}text(){return y0[y1[this.id]]}isTight(){return this.size>=2}}var bt=0,Be=1,te=2,B0=3,oe=4,d0=5,re=6,n0=7,y0=[new F0(bt,0,!1),new F0(Be,0,!0),new F0(te,1,!1),new F0(B0,1,!0),new F0(oe,2,!1),new F0(d0,2,!0),new F0(re,3,!1),new F0(n0,3,!0)],f1=[oe,d0,oe,d0,re,n0,re,n0],p1=[d0,d0,d0,d0,n0,n0,n0,n0],v1=[te,B0,oe,d0,re,n0,re,n0],g1=[B0,B0,d0,d0,n0,n0,n0,n0],b1=[Be,Be,B0,B0,d0,d0,n0,n0],y1=[bt,Be,te,B0,te,B0,te,B0],I={DISPLAY:y0[bt],TEXT:y0[te],SCRIPT:y0[oe],SCRIPTSCRIPT:y0[re]},lt=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function x1(r){for(var e=0;e<lt.length;e++)for(var t=lt[e],a=0;a<t.blocks.length;a++){var n=t.blocks[a];if(r>=n[0]&&r<=n[1])return t.name}return null}var Te=[];lt.forEach(r=>r.blocks.forEach(e=>Te.push(...e)));function Ir(r){for(var e=0;e<Te.length;e+=2)if(r>=Te[e]&&r<=Te[e+1])return!0;return!1}var ee=80,w1=function(e,t){return"M95,"+(622+e+t)+`
|
|
4
4
|
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{al as Ze,am as Q,r as _,bR as vt,an as mt,s as J,bd as bt,be as yt,x as oe,t as Ve,g as Tt,bS as kt,j as Z,l as Ie,m as Ot,ab as wt,T as Rt,P as St,ac as Mt,bT as _e}from"./index.DMxc2XFp.js";import{h as $t}from"./moment.C3j7ZXd7.js";import{s as Ne}from"./sprintf.D7DtBTRn.js";import{w as _t}from"./withCalculatedWidth.DcKeRSWJ.js";import{u as Et}from"./useBasicWidgetState.Bfp6TnSw.js";import"./FormClearHelper.CG2XN1_g.js";var ue={},H={},ce={},le={},Ue;function xe(){if(Ue)return le;Ue=1,Object.defineProperty(le,"__esModule",{value:!0}),le.Direction=void 0;var e;return function(r){r.Right="to right",r.Left="to left",r.Down="to bottom",r.Up="to top"}(e||(le.Direction=e={})),le}var He;function Ge(){return He||(He=1,function(e){var r=ce&&ce.__spreadArray||function(i,o,u){if(u||arguments.length===2)for(var h=0,m=o.length,g;h<m;h++)(g||!(h in o))&&(g||(g=Array.prototype.slice.call(o,0,h)),g[h]=o[h]);return i.concat(g||Array.prototype.slice.call(o))};Object.defineProperty(e,"__esModule",{value:!0}),e.isIOS=e.useThumbOverlap=e.assertUnreachable=e.voidFn=e.getTrackBackground=e.replaceAt=e.schd=e.translate=e.getClosestThumbIndex=e.translateThumbs=e.getPaddingAndBorder=e.getMargin=e.checkInitialOverlap=e.checkValuesAgainstBoundaries=e.checkBoundaries=e.isVertical=e.relativeValue=e.normalizeValue=e.isStepDivisible=e.isTouchEvent=e.getStepDecimals=void 0;var n=Ze(),s=xe(),v=function(i){var o=i.toString().split(".")[1];return o?o.length:0};e.getStepDecimals=v;function S(i){return i.touches&&i.touches.length||i.changedTouches&&i.changedTouches.length}e.isTouchEvent=S;function l(i,o,u){var h=(o-i)/u,m=8,g=Number(h.toFixed(m));return parseInt(g.toString(),10)===g}e.isStepDivisible=l;function p(i,o,u,h,m,g,T){var $=1e11;if(i=Math.round(i*$)/$,!g){var D=T[o-1],x=T[o+1];if(D&&D>i)return D;if(x&&x<i)return x}if(i>h)return h;if(i<u)return u;var U=Math.floor(i*$-u*$)%Math.floor(m*$),V=Math.floor(i*$-Math.abs(U)),W=U===0?i:V/$,A=Math.abs(U/$)<m/2?W:W+m,L=(0,e.getStepDecimals)(m);return parseFloat(A.toFixed(L))}e.normalizeValue=p;function F(i,o,u){return(i-o)/(u-o)}e.relativeValue=F;function j(i){return i===s.Direction.Up||i===s.Direction.Down}e.isVertical=j;function z(i,o,u){if(o>=u)throw new RangeError("min (".concat(o,") is equal/bigger than max (").concat(u,")"));if(i<o)throw new RangeError("value (".concat(i,") is smaller than min (").concat(o,")"));if(i>u)throw new RangeError("value (".concat(i,") is bigger than max (").concat(u,")"))}e.checkBoundaries=z;function E(i,o,u){return i<o?o:i>u?u:i}e.checkValuesAgainstBoundaries=E;function y(i){if(!(i.length<2)&&!i.slice(1).every(function(o,u){return i[u]<=o}))throw new RangeError("values={[".concat(i,"]} needs to be sorted when allowOverlap={false}"))}e.checkInitialOverlap=y;function d(i){var o=window.getComputedStyle(i);return{top:parseInt(o["margin-top"],10),bottom:parseInt(o["margin-bottom"],10),left:parseInt(o["margin-left"],10),right:parseInt(o["margin-right"],10)}}e.getMargin=d;function t(i){var o=window.getComputedStyle(i);return{top:parseInt(o["padding-top"],10)+parseInt(o["border-top-width"],10),bottom:parseInt(o["padding-bottom"],10)+parseInt(o["border-bottom-width"],10),left:parseInt(o["padding-left"],10)+parseInt(o["border-left-width"],10),right:parseInt(o["padding-right"],10)+parseInt(o["border-right-width"],10)}}e.getPaddingAndBorder=t;function a(i,o,u){var h=u?-1:1;i.forEach(function(m,g){return f(m,h*o[g].x,o[g].y)})}e.translateThumbs=a;function c(i,o,u,h){for(var m=0,g=B(i[0],o,u,h),T=1;T<i.length;T++){var $=B(i[T],o,u,h);$<g&&(g=$,m=T)}return m}e.getClosestThumbIndex=c;function f(i,o,u){i.style.transform="translate(".concat(o,"px, ").concat(u,"px)")}e.translate=f;var b=function(i){var o=[],u=null,h=function(){for(var m=[],g=0;g<arguments.length;g++)m[g]=arguments[g];o=m,!u&&(u=requestAnimationFrame(function(){u=null,i.apply(void 0,o)}))};return h};e.schd=b;function k(i,o,u){var h=i.slice(0);return h[o]=u,h}e.replaceAt=k;function I(i){var o=i.values,u=i.colors,h=i.min,m=i.max,g=i.direction,T=g===void 0?s.Direction.Right:g,$=i.rtl,D=$===void 0?!1:$;D&&T===s.Direction.Right?T=s.Direction.Left:D&&s.Direction.Left&&(T=s.Direction.Right);var x=o.slice(0).sort(function(V,W){return V-W}).map(function(V){return(V-h)/(m-h)*100}),U=x.reduce(function(V,W,A){return"".concat(V,", ").concat(u[A]," ").concat(W,"%, ").concat(u[A+1]," ").concat(W,"%")},"");return"linear-gradient(".concat(T,", ").concat(u[0]," 0%").concat(U,", ").concat(u[u.length-1]," 100%)")}e.getTrackBackground=I;function O(){}e.voidFn=O;function w(i){throw new Error("Didn't expect to get here")}e.assertUnreachable=w;var M=function(i,o,u,h,m){m===void 0&&(m=function(T){return T});var g=Math.ceil(r([i],Array.from(i.children),!0).reduce(function(T,$){var D=Math.ceil($.getBoundingClientRect().width);if($.innerText&&$.innerText.includes(u)&&$.childElementCount===0){var x=$.cloneNode(!0);x.innerHTML=m(o.toFixed(h)),x.style.visibility="hidden",document.body.appendChild(x),D=Math.ceil(x.getBoundingClientRect().width),document.body.removeChild(x)}return D>T?D:T},i.getBoundingClientRect().width));return g},P=function(i,o,u,h,m,g,T){T===void 0&&(T=function(x){return x});var $=[],D=function(x){var U=M(u[x],h[x],m,g,T),V=o[x].x;o.forEach(function(W,A){var L=W.x,G=M(u[A],h[A],m,g,T);x!==A&&(V>=L&&V<=L+G||V+U>=L&&V+U<=L+G)&&($.includes(A)||($.push(x),$.push(A),$=r(r([],$,!0),[x,A],!1),D(A)))})};return D(i),Array.from(new Set($.sort()))},R=function(i,o,u,h,m,g){h===void 0&&(h=.1),m===void 0&&(m=" - "),g===void 0&&(g=function(A){return A});var T=(0,e.getStepDecimals)(h),$=(0,n.useState)({}),D=$[0],x=$[1],U=(0,n.useState)(g(o[u].toFixed(T))),V=U[0],W=U[1];return(0,n.useEffect)(function(){if(i){var A=i.getThumbs();if(A.length<1)return;var L={},G=i.getOffsets(),ne=P(u,G,A,o,m,T,g),fe=g(o[u].toFixed(T));if(ne.length){var ee=ne.reduce(function(te,se,ve,me){return te.length?r(r([],te,!0),[G[me[ve]].x],!1):[G[me[ve]].x]},[]);if(Math.min.apply(Math,ee)===G[u].x){var he=[];ne.forEach(function(te){he.push(o[te].toFixed(T))}),fe=Array.from(new Set(he.sort(function(te,se){return parseFloat(te)-parseFloat(se)}))).map(g).join(m);var ge=Math.min.apply(Math,ee),pe=Math.max.apply(Math,ee),$e=A[ne[ee.indexOf(pe)]].getBoundingClientRect().width;L.left="".concat(Math.abs(ge-(pe+$e))/2,"px"),L.transform="translate(-50%, 0)"}else L.visibility="hidden"}W(fe),x(L)}},[i,o]),[V,D]};e.useThumbOverlap=R;function B(i,o,u,h){var m=i.getBoundingClientRect(),g=m.left,T=m.top,$=m.width,D=m.height;return j(h)?Math.abs(u-(T+D/2)):Math.abs(o-(g+$/2))}var C=function(){var i,o=((i=navigator.userAgentData)===null||i===void 0?void 0:i.platform)||navigator.platform;return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(o)||navigator.userAgent.includes("Mac")&&"ontouchend"in document};e.isIOS=C}(ce)),ce}var We;function It(){if(We)return H;We=1;var e=H&&H.__extends||function(){var E=function(y,d){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(t[c]=a[c])},E(y,d)};return function(y,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");E(y,d);function t(){this.constructor=y}y.prototype=d===null?Object.create(d):(t.prototype=d.prototype,new t)}}(),r=H&&H.__createBinding||(Object.create?function(E,y,d,t){t===void 0&&(t=d);var a=Object.getOwnPropertyDescriptor(y,d);(!a||("get"in a?!y.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return y[d]}}),Object.defineProperty(E,t,a)}:function(E,y,d,t){t===void 0&&(t=d),E[t]=y[d]}),n=H&&H.__setModuleDefault||(Object.create?function(E,y){Object.defineProperty(E,"default",{enumerable:!0,value:y})}:function(E,y){E.default=y}),s=H&&H.__importStar||function(E){if(E&&E.__esModule)return E;var y={};if(E!=null)for(var d in E)d!=="default"&&Object.prototype.hasOwnProperty.call(E,d)&&r(y,E,d);return n(y,E),y},v=H&&H.__spreadArray||function(E,y,d){if(d||arguments.length===2)for(var t=0,a=y.length,c;t<a;t++)(c||!(t in y))&&(c||(c=Array.prototype.slice.call(y,0,t)),c[t]=y[t]);return E.concat(c||Array.prototype.slice.call(y))};Object.defineProperty(H,"__esModule",{value:!0});var S=s(Ze()),l=Ge(),p=xe(),F=["ArrowRight","ArrowUp","k","PageUp"],j=["ArrowLeft","ArrowDown","j","PageDown"],z=function(E){e(y,E);function y(d){var t=E.call(this,d)||this;if(t.trackRef=S.createRef(),t.thumbRefs=[],t.state={draggedTrackPos:[-1,-1],draggedThumbIndex:-1,thumbZIndexes:new Array(t.props.values.length).fill(0).map(function(a,c){return c}),isChanged:!1,markOffsets:[]},t.getOffsets=function(){var a=t.props,c=a.direction,f=a.values,b=a.min,k=a.max,I=t.trackRef.current;if(!I)return console.warn("No track element found."),[];var O=I.getBoundingClientRect(),w=(0,l.getPaddingAndBorder)(I);return t.getThumbs().map(function(M,P){var R={x:0,y:0},B=M.getBoundingClientRect(),C=(0,l.getMargin)(M);switch(c){case p.Direction.Right:return R.x=(C.left+w.left)*-1,R.y=((B.height-O.height)/2+w.top)*-1,R.x+=O.width*(0,l.relativeValue)(f[P],b,k)-B.width/2,R;case p.Direction.Left:return R.x=(C.right+w.right)*-1,R.y=((B.height-O.height)/2+w.top)*-1,R.x+=O.width-O.width*(0,l.relativeValue)(f[P],b,k)-B.width/2,R;case p.Direction.Up:return R.x=((B.width-O.width)/2+C.left+w.left)*-1,R.y=-w.left,R.y+=O.height-O.height*(0,l.relativeValue)(f[P],b,k)-B.height/2,R;case p.Direction.Down:return R.x=((B.width-O.width)/2+C.left+w.left)*-1,R.y=-w.left,R.y+=O.height*(0,l.relativeValue)(f[P],b,k)-B.height/2,R;default:return(0,l.assertUnreachable)(c)}})},t.getThumbs=function(){return t.trackRef&&t.trackRef.current?Array.from(t.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?"),[])},t.getTargetIndex=function(a){return t.getThumbs().findIndex(function(c){return c===a.target||c.contains(a.target)})},t.addTouchEvents=function(a){document.addEventListener("touchmove",t.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",t.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",t.schdOnEnd,{passive:!1})},t.addMouseEvents=function(a){document.addEventListener("mousemove",t.schdOnMouseMove),document.addEventListener("mouseup",t.schdOnEnd)},t.onMouseDownTrack=function(a){var c;if(!(a.button!==0||(0,l.isIOS)()))if(a.persist(),a.preventDefault(),t.addMouseEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(b){var k;return(k=b.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return t.onMove(a.clientX,a.clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(b){return b.current}),a.clientX,a.clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.clientX,a.clientY)})}},t.onResize=function(){(0,l.translateThumbs)(t.getThumbs(),t.getOffsets(),t.props.rtl),t.calculateMarkOffsets()},t.onTouchStartTrack=function(a){var c;if(a.persist(),t.addTouchEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(b){var k;return(k=b.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(b){return b.current}),a.touches[0].clientX,a.touches[0].clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},t.onMouseOrTouchStart=function(a){if(!t.props.disabled){var c=(0,l.isTouchEvent)(a);if(!(!c&&a.button!==0)){var f=t.getTargetIndex(a);f!==-1&&(c?t.addTouchEvents(a):t.addMouseEvents(a),t.setState({draggedThumbIndex:f,thumbZIndexes:t.state.thumbZIndexes.map(function(b,k){return k===f?Math.max.apply(Math,t.state.thumbZIndexes):b<=t.state.thumbZIndexes[f]?b:b-1})}))}}},t.onMouseMove=function(a){a.preventDefault(),t.onMove(a.clientX,a.clientY)},t.onTouchMove=function(a){a.preventDefault(),t.onMove(a.touches[0].clientX,a.touches[0].clientY)},t.onKeyDown=function(a){var c=t.props,f=c.values,b=c.onChange,k=c.step,I=c.rtl,O=c.direction,w=t.state.isChanged,M=t.getTargetIndex(a.nativeEvent),P=I||O===p.Direction.Left||O===p.Direction.Down?-1:1;M!==-1&&(F.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),b((0,l.replaceAt)(f,M,t.normalizeValue(f[M]+P*(a.key==="PageUp"?k*10:k),M)))):j.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),b((0,l.replaceAt)(f,M,t.normalizeValue(f[M]-P*(a.key==="PageDown"?k*10:k),M)))):a.key==="Tab"?t.setState({draggedThumbIndex:-1},function(){w&&t.fireOnFinalChange()}):w&&t.fireOnFinalChange())},t.onKeyUp=function(a){var c=t.state.isChanged;t.setState({draggedThumbIndex:-1},function(){c&&t.fireOnFinalChange()})},t.onMove=function(a,c){var f=t.state,b=f.draggedThumbIndex,k=f.draggedTrackPos,I=t.props,O=I.direction,w=I.min,M=I.max,P=I.onChange,R=I.values,B=I.step,C=I.rtl;if(b===-1&&k[0]===-1&&k[1]===-1)return null;var i=t.trackRef.current;if(!i)return null;var o=i.getBoundingClientRect(),u=(0,l.isVertical)(O)?o.height:o.width;if(k[0]!==-1&&k[1]!==-1){var h=a-k[0],m=c-k[1],g=0;switch(O){case p.Direction.Right:case p.Direction.Left:g=h/u*(M-w);break;case p.Direction.Down:case p.Direction.Up:g=m/u*(M-w);break;default:(0,l.assertUnreachable)(O)}if(C&&(g*=-1),Math.abs(g)>=B/2){for(var T=0;T<t.thumbRefs.length;T++){if(R[T]===M&&Math.sign(g)===1||R[T]===w&&Math.sign(g)===-1)return;var $=R[T]+g;$>M?g=M-R[T]:$<w&&(g=w-R[T])}for(var D=R.slice(0),T=0;T<t.thumbRefs.length;T++)D=(0,l.replaceAt)(D,T,t.normalizeValue(R[T]+g,T));t.setState({draggedTrackPos:[a,c]}),P(D)}}else{var x=0;switch(O){case p.Direction.Right:x=(a-o.left)/u*(M-w)+w;break;case p.Direction.Left:x=(u-(a-o.left))/u*(M-w)+w;break;case p.Direction.Down:x=(c-o.top)/u*(M-w)+w;break;case p.Direction.Up:x=(u-(c-o.top))/u*(M-w)+w;break;default:(0,l.assertUnreachable)(O)}C&&(x=M+w-x),Math.abs(R[b]-x)>=B/2&&P((0,l.replaceAt)(R,b,t.normalizeValue(x,b)))}},t.normalizeValue=function(a,c){var f=t.props,b=f.min,k=f.max,I=f.step,O=f.allowOverlap,w=f.values;return(0,l.normalizeValue)(a,c,b,k,I,O,w)},t.onEnd=function(a){if(a.preventDefault(),document.removeEventListener("mousemove",t.schdOnMouseMove),document.removeEventListener("touchmove",t.schdOnTouchMove),document.removeEventListener("mouseup",t.schdOnEnd),document.removeEventListener("touchend",t.schdOnEnd),document.removeEventListener("touchcancel",t.schdOnEnd),t.state.draggedThumbIndex===-1&&t.state.draggedTrackPos[0]===-1&&t.state.draggedTrackPos[1]===-1)return null;t.setState({draggedThumbIndex:-1,draggedTrackPos:[-1,-1]},function(){t.fireOnFinalChange()})},t.fireOnFinalChange=function(){t.setState({isChanged:!1});var a=t.props,c=a.onFinalChange,f=a.values;c&&c(f)},t.updateMarkRefs=function(a){if(!a.renderMark){t.numOfMarks=void 0,t.markRefs=void 0;return}t.numOfMarks=(a.max-a.min)/t.props.step,t.markRefs=[];for(var c=0;c<t.numOfMarks+1;c++)t.markRefs[c]=S.createRef()},t.calculateMarkOffsets=function(){if(!(!t.props.renderMark||!t.trackRef||!t.numOfMarks||!t.markRefs||t.trackRef.current===null)){for(var a=window.getComputedStyle(t.trackRef.current),c=parseInt(a.width,10),f=parseInt(a.height,10),b=parseInt(a.paddingLeft,10),k=parseInt(a.paddingTop,10),I=[],O=0;O<t.numOfMarks+1;O++){var w=9999,M=9999;if(t.markRefs[O].current){var P=t.markRefs[O].current.getBoundingClientRect();w=P.height,M=P.width}t.props.direction===p.Direction.Left||t.props.direction===p.Direction.Right?I.push([Math.round(c/t.numOfMarks*O+b-M/2),-Math.round((w-f)/2)]):I.push([Math.round(f/t.numOfMarks*O+k-w/2),-Math.round((M-c)/2)])}t.setState({markOffsets:I})}},d.step===0)throw new Error('"step" property should be a positive number');return t.schdOnMouseMove=(0,l.schd)(t.onMouseMove),t.schdOnTouchMove=(0,l.schd)(t.onTouchMove),t.schdOnEnd=(0,l.schd)(t.onEnd),t.thumbRefs=d.values.map(function(){return S.createRef()}),t.updateMarkRefs(d),t}return y.prototype.componentDidMount=function(){var d=this,t=this.props,a=t.values,c=t.min,f=t.step;this.resizeObserver=window.ResizeObserver?new window.ResizeObserver(this.onResize):{observe:function(){return window.addEventListener("resize",d.onResize)},unobserve:function(){return window.removeEventListener("resize",d.onResize)}},document.addEventListener("touchstart",this.onMouseOrTouchStart,{passive:!1}),document.addEventListener("mousedown",this.onMouseOrTouchStart,{passive:!1}),!this.props.allowOverlap&&(0,l.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(b){return(0,l.checkBoundaries)(b,d.props.min,d.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(b){(0,l.isStepDivisible)(c,b,f)||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.")})},y.prototype.componentDidUpdate=function(d,t){var a=this.props,c=a.max,f=a.min,b=a.step,k=a.values,I=a.rtl;(d.max!==c||d.min!==f||d.step!==b)&&this.updateMarkRefs(this.props),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),I),(d.max!==c||d.min!==f||d.step!==b||t.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),k.forEach(function(O){(0,l.isStepDivisible)(f,O,b)||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.")}))},y.prototype.componentWillUnmount=function(){var d={passive:!1};document.removeEventListener("mousedown",this.onMouseOrTouchStart,d),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)},y.prototype.render=function(){var d=this,t=this.props,a=t.label,c=t.labelledBy,f=t.renderTrack,b=t.renderThumb,k=t.renderMark,I=k===void 0?function(){return null}:k,O=t.values,w=t.min,M=t.max,P=t.allowOverlap,R=t.disabled,B=this.state,C=B.draggedThumbIndex,i=B.thumbZIndexes,o=B.markOffsets;return f({props:{style:{transform:"scale(1)",cursor:C>-1?"grabbing":this.props.draggableTrack?(0,l.isVertical)(this.props.direction)?"ns-resize":"ew-resize":O.length===1&&!R?"pointer":"inherit"},onMouseDown:R?l.voidFn:this.onMouseDownTrack,onTouchStart:R?l.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:R,children:v(v([],o.map(function(u,h,m){return I({props:{style:d.props.direction===p.Direction.Left||d.props.direction===p.Direction.Right?{position:"absolute",left:"".concat(u[0],"px"),marginTop:"".concat(u[1],"px")}:{position:"absolute",top:"".concat(u[0],"px"),marginLeft:"".concat(u[1],"px")},key:"mark".concat(h),ref:d.markRefs[h]},index:h})}),!0),O.map(function(u,h){var m=d.state.draggedThumbIndex===h;return b({index:h,value:u,isDragged:m,props:{style:{position:"absolute",zIndex:i[h],cursor:R?"inherit":m?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:h,tabIndex:R?void 0:0,"aria-valuemax":P?M:O[h+1]||M,"aria-valuemin":P?w:O[h-1]||w,"aria-valuenow":u,draggable:!1,ref:d.thumbRefs[h],"aria-label":a,"aria-labelledby":c,role:"slider",onKeyDown:R?l.voidFn:d.onKeyDown,onKeyUp:R?l.voidFn:d.onKeyUp}})}),!0)})},y.defaultProps={label:"Accessibility label",labelledBy:null,step:1,direction:p.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},y}(S.Component);return H.default=z,H}var qe;function xt(){return qe||(qe=1,function(e){var r=ue&&ue.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.checkValuesAgainstBoundaries=e.relativeValue=e.useThumbOverlap=e.Direction=e.getTrackBackground=e.Range=void 0;var n=r(It());e.Range=n.default;var s=Ge();Object.defineProperty(e,"getTrackBackground",{enumerable:!0,get:function(){return s.getTrackBackground}}),Object.defineProperty(e,"useThumbOverlap",{enumerable:!0,get:function(){return s.useThumbOverlap}}),Object.defineProperty(e,"relativeValue",{enumerable:!0,get:function(){return s.relativeValue}}),Object.defineProperty(e,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return s.checkValuesAgainstBoundaries}});var v=xe();Object.defineProperty(e,"Direction",{enumerable:!0,get:function(){return v.Direction}})}(ue)),ue}var Je=xt();function Ke(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),n.push.apply(n,s)}return n}function be(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Ke(Object(n),!0).forEach(function(s){Ct(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Ct(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var ye=Q("div",{position:"relative",width:"100%"});ye.displayName="Root";ye.displayName="Root";ye.displayName="StyledRoot";var Te=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$disabled,S=e.$isDragged,l=r.sizing,p="inherit";return v?p="not-allowed":S?p="grabbing":s.length===1&&(p="pointer"),{paddingTop:l.scale600,paddingBottom:l.scale600,paddingRight:l.scale600,paddingLeft:l.scale600,display:"flex",cursor:p,backgroundColor:r.colors.sliderTrackFill}});Te.displayName="Track";Te.displayName="Track";Te.displayName="StyledTrack";var de=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$min,S=e.$max,l=e.$disabled,p=r.colors,F=r.borders,j=r.direction,z=r.borders.useRoundedCorners?F.radius100:0;return{borderTopLeftRadius:z,borderTopRightRadius:z,borderBottomRightRadius:z,borderBottomLeftRadius:z,background:Je.getTrackBackground({values:s,colors:s.length===1?[l?p.borderOpaque:p.primary,l?p.backgroundSecondary:p.borderOpaque]:[l?p.backgroundSecondary:p.borderOpaque,l?p.borderOpaque:p.primary,l?p.backgroundSecondary:p.borderOpaque],min:v||0,max:S||0,rtl:j==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:l?"not-allowed":"inherit"}});de.displayName="InnerTrack";de.displayName="InnerTrack";de.displayName="StyledInnerTrack";var ke=Q("div",function(e){return{width:"4px",height:"2px",backgroundColor:e.$theme.colors.backgroundPrimary,marginLeft:"16px"}});ke.displayName="Mark";ke.displayName="Mark";ke.displayName="StyledMark";var Oe=Q("div",function(e){return be(be({},e.$theme.typography.font200),{},{color:e.$theme.colors.contentPrimary})});Oe.displayName="Tick";Oe.displayName="Tick";Oe.displayName="StyledTick";var we=Q("div",function(e){var r=e.$theme,n=r.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:n.scale600,paddingLeft:n.scale600,paddingBottom:n.scale400}});we.displayName="TickBar";we.displayName="TickBar";we.displayName="StyledTickBar";var Re=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$thumbIndex,S=e.$disabled,l=s.length===2&&v===0,p=s.length===2&&v===1;return r.direction==="rtl"&&(p||l)&&(l=!l,p=!p),{height:"24px",width:"24px",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:S?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleFill,outline:"none",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(r.colors.accent):"0 1px 4px rgba(0, 0, 0, 0.12)",cursor:S?"not-allowed":"inherit"}});Re.displayName="Thumb";Re.displayName="Thumb";Re.displayName="StyledThumb";var Se=Q("div",function(e){var r=e.$disabled,n=e.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill}});Se.displayName="InnerThumb";Se.displayName="InnerThumb";Se.displayName="StyledInnerThumb";var Me=Q("div",function(e){var r=e.$disabled,n=e.$theme;return be(be({position:"absolute",top:"-".concat(n.sizing.scale1400)},n.typography.font200),{},{backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill,color:n.colors.contentInversePrimary,paddingLeft:n.sizing.scale600,paddingRight:n.sizing.scale600,paddingTop:n.sizing.scale500,paddingBottom:n.sizing.scale500,borderBottomLeftRadius:"48px",borderBottomRightRadius:"48px",borderTopLeftRadius:"48px",borderTopRightRadius:"48px",whiteSpace:"nowrap"})});Me.displayName="ThumbValue";Me.displayName="ThumbValue";Me.displayName="StyledThumbValue";function Xe(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),n.push.apply(n,s)}return n}function Dt(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Xe(Object(n),!0).forEach(function(s){Pt(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Pt(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function X(){return X=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},X.apply(this,arguments)}function K(e,r){return Ft(e)||Lt(e,r)||At(e,r)||Bt()}function Bt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{al as Ze,am as Q,r as _,bR as vt,an as mt,s as J,bd as bt,be as yt,x as oe,t as Ve,g as Tt,bS as kt,j as Z,l as Ie,m as Ot,ab as wt,T as Rt,P as St,ac as Mt,bT as _e}from"./index.CqTPbV5Y.js";import{h as $t}from"./moment.C3j7ZXd7.js";import{s as Ne}from"./sprintf.D7DtBTRn.js";import{w as _t}from"./withCalculatedWidth.ChdrMItN.js";import{u as Et}from"./useBasicWidgetState.DA3_qaXD.js";import"./FormClearHelper.-9RbsnV0.js";var ue={},H={},ce={},le={},Ue;function xe(){if(Ue)return le;Ue=1,Object.defineProperty(le,"__esModule",{value:!0}),le.Direction=void 0;var e;return function(r){r.Right="to right",r.Left="to left",r.Down="to bottom",r.Up="to top"}(e||(le.Direction=e={})),le}var He;function Ge(){return He||(He=1,function(e){var r=ce&&ce.__spreadArray||function(i,o,u){if(u||arguments.length===2)for(var h=0,m=o.length,g;h<m;h++)(g||!(h in o))&&(g||(g=Array.prototype.slice.call(o,0,h)),g[h]=o[h]);return i.concat(g||Array.prototype.slice.call(o))};Object.defineProperty(e,"__esModule",{value:!0}),e.isIOS=e.useThumbOverlap=e.assertUnreachable=e.voidFn=e.getTrackBackground=e.replaceAt=e.schd=e.translate=e.getClosestThumbIndex=e.translateThumbs=e.getPaddingAndBorder=e.getMargin=e.checkInitialOverlap=e.checkValuesAgainstBoundaries=e.checkBoundaries=e.isVertical=e.relativeValue=e.normalizeValue=e.isStepDivisible=e.isTouchEvent=e.getStepDecimals=void 0;var n=Ze(),s=xe(),v=function(i){var o=i.toString().split(".")[1];return o?o.length:0};e.getStepDecimals=v;function S(i){return i.touches&&i.touches.length||i.changedTouches&&i.changedTouches.length}e.isTouchEvent=S;function l(i,o,u){var h=(o-i)/u,m=8,g=Number(h.toFixed(m));return parseInt(g.toString(),10)===g}e.isStepDivisible=l;function p(i,o,u,h,m,g,T){var $=1e11;if(i=Math.round(i*$)/$,!g){var D=T[o-1],x=T[o+1];if(D&&D>i)return D;if(x&&x<i)return x}if(i>h)return h;if(i<u)return u;var U=Math.floor(i*$-u*$)%Math.floor(m*$),V=Math.floor(i*$-Math.abs(U)),W=U===0?i:V/$,A=Math.abs(U/$)<m/2?W:W+m,L=(0,e.getStepDecimals)(m);return parseFloat(A.toFixed(L))}e.normalizeValue=p;function F(i,o,u){return(i-o)/(u-o)}e.relativeValue=F;function j(i){return i===s.Direction.Up||i===s.Direction.Down}e.isVertical=j;function z(i,o,u){if(o>=u)throw new RangeError("min (".concat(o,") is equal/bigger than max (").concat(u,")"));if(i<o)throw new RangeError("value (".concat(i,") is smaller than min (").concat(o,")"));if(i>u)throw new RangeError("value (".concat(i,") is bigger than max (").concat(u,")"))}e.checkBoundaries=z;function E(i,o,u){return i<o?o:i>u?u:i}e.checkValuesAgainstBoundaries=E;function y(i){if(!(i.length<2)&&!i.slice(1).every(function(o,u){return i[u]<=o}))throw new RangeError("values={[".concat(i,"]} needs to be sorted when allowOverlap={false}"))}e.checkInitialOverlap=y;function d(i){var o=window.getComputedStyle(i);return{top:parseInt(o["margin-top"],10),bottom:parseInt(o["margin-bottom"],10),left:parseInt(o["margin-left"],10),right:parseInt(o["margin-right"],10)}}e.getMargin=d;function t(i){var o=window.getComputedStyle(i);return{top:parseInt(o["padding-top"],10)+parseInt(o["border-top-width"],10),bottom:parseInt(o["padding-bottom"],10)+parseInt(o["border-bottom-width"],10),left:parseInt(o["padding-left"],10)+parseInt(o["border-left-width"],10),right:parseInt(o["padding-right"],10)+parseInt(o["border-right-width"],10)}}e.getPaddingAndBorder=t;function a(i,o,u){var h=u?-1:1;i.forEach(function(m,g){return f(m,h*o[g].x,o[g].y)})}e.translateThumbs=a;function c(i,o,u,h){for(var m=0,g=B(i[0],o,u,h),T=1;T<i.length;T++){var $=B(i[T],o,u,h);$<g&&(g=$,m=T)}return m}e.getClosestThumbIndex=c;function f(i,o,u){i.style.transform="translate(".concat(o,"px, ").concat(u,"px)")}e.translate=f;var b=function(i){var o=[],u=null,h=function(){for(var m=[],g=0;g<arguments.length;g++)m[g]=arguments[g];o=m,!u&&(u=requestAnimationFrame(function(){u=null,i.apply(void 0,o)}))};return h};e.schd=b;function k(i,o,u){var h=i.slice(0);return h[o]=u,h}e.replaceAt=k;function I(i){var o=i.values,u=i.colors,h=i.min,m=i.max,g=i.direction,T=g===void 0?s.Direction.Right:g,$=i.rtl,D=$===void 0?!1:$;D&&T===s.Direction.Right?T=s.Direction.Left:D&&s.Direction.Left&&(T=s.Direction.Right);var x=o.slice(0).sort(function(V,W){return V-W}).map(function(V){return(V-h)/(m-h)*100}),U=x.reduce(function(V,W,A){return"".concat(V,", ").concat(u[A]," ").concat(W,"%, ").concat(u[A+1]," ").concat(W,"%")},"");return"linear-gradient(".concat(T,", ").concat(u[0]," 0%").concat(U,", ").concat(u[u.length-1]," 100%)")}e.getTrackBackground=I;function O(){}e.voidFn=O;function w(i){throw new Error("Didn't expect to get here")}e.assertUnreachable=w;var M=function(i,o,u,h,m){m===void 0&&(m=function(T){return T});var g=Math.ceil(r([i],Array.from(i.children),!0).reduce(function(T,$){var D=Math.ceil($.getBoundingClientRect().width);if($.innerText&&$.innerText.includes(u)&&$.childElementCount===0){var x=$.cloneNode(!0);x.innerHTML=m(o.toFixed(h)),x.style.visibility="hidden",document.body.appendChild(x),D=Math.ceil(x.getBoundingClientRect().width),document.body.removeChild(x)}return D>T?D:T},i.getBoundingClientRect().width));return g},P=function(i,o,u,h,m,g,T){T===void 0&&(T=function(x){return x});var $=[],D=function(x){var U=M(u[x],h[x],m,g,T),V=o[x].x;o.forEach(function(W,A){var L=W.x,G=M(u[A],h[A],m,g,T);x!==A&&(V>=L&&V<=L+G||V+U>=L&&V+U<=L+G)&&($.includes(A)||($.push(x),$.push(A),$=r(r([],$,!0),[x,A],!1),D(A)))})};return D(i),Array.from(new Set($.sort()))},R=function(i,o,u,h,m,g){h===void 0&&(h=.1),m===void 0&&(m=" - "),g===void 0&&(g=function(A){return A});var T=(0,e.getStepDecimals)(h),$=(0,n.useState)({}),D=$[0],x=$[1],U=(0,n.useState)(g(o[u].toFixed(T))),V=U[0],W=U[1];return(0,n.useEffect)(function(){if(i){var A=i.getThumbs();if(A.length<1)return;var L={},G=i.getOffsets(),ne=P(u,G,A,o,m,T,g),fe=g(o[u].toFixed(T));if(ne.length){var ee=ne.reduce(function(te,se,ve,me){return te.length?r(r([],te,!0),[G[me[ve]].x],!1):[G[me[ve]].x]},[]);if(Math.min.apply(Math,ee)===G[u].x){var he=[];ne.forEach(function(te){he.push(o[te].toFixed(T))}),fe=Array.from(new Set(he.sort(function(te,se){return parseFloat(te)-parseFloat(se)}))).map(g).join(m);var ge=Math.min.apply(Math,ee),pe=Math.max.apply(Math,ee),$e=A[ne[ee.indexOf(pe)]].getBoundingClientRect().width;L.left="".concat(Math.abs(ge-(pe+$e))/2,"px"),L.transform="translate(-50%, 0)"}else L.visibility="hidden"}W(fe),x(L)}},[i,o]),[V,D]};e.useThumbOverlap=R;function B(i,o,u,h){var m=i.getBoundingClientRect(),g=m.left,T=m.top,$=m.width,D=m.height;return j(h)?Math.abs(u-(T+D/2)):Math.abs(o-(g+$/2))}var C=function(){var i,o=((i=navigator.userAgentData)===null||i===void 0?void 0:i.platform)||navigator.platform;return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(o)||navigator.userAgent.includes("Mac")&&"ontouchend"in document};e.isIOS=C}(ce)),ce}var We;function It(){if(We)return H;We=1;var e=H&&H.__extends||function(){var E=function(y,d){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(t[c]=a[c])},E(y,d)};return function(y,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");E(y,d);function t(){this.constructor=y}y.prototype=d===null?Object.create(d):(t.prototype=d.prototype,new t)}}(),r=H&&H.__createBinding||(Object.create?function(E,y,d,t){t===void 0&&(t=d);var a=Object.getOwnPropertyDescriptor(y,d);(!a||("get"in a?!y.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return y[d]}}),Object.defineProperty(E,t,a)}:function(E,y,d,t){t===void 0&&(t=d),E[t]=y[d]}),n=H&&H.__setModuleDefault||(Object.create?function(E,y){Object.defineProperty(E,"default",{enumerable:!0,value:y})}:function(E,y){E.default=y}),s=H&&H.__importStar||function(E){if(E&&E.__esModule)return E;var y={};if(E!=null)for(var d in E)d!=="default"&&Object.prototype.hasOwnProperty.call(E,d)&&r(y,E,d);return n(y,E),y},v=H&&H.__spreadArray||function(E,y,d){if(d||arguments.length===2)for(var t=0,a=y.length,c;t<a;t++)(c||!(t in y))&&(c||(c=Array.prototype.slice.call(y,0,t)),c[t]=y[t]);return E.concat(c||Array.prototype.slice.call(y))};Object.defineProperty(H,"__esModule",{value:!0});var S=s(Ze()),l=Ge(),p=xe(),F=["ArrowRight","ArrowUp","k","PageUp"],j=["ArrowLeft","ArrowDown","j","PageDown"],z=function(E){e(y,E);function y(d){var t=E.call(this,d)||this;if(t.trackRef=S.createRef(),t.thumbRefs=[],t.state={draggedTrackPos:[-1,-1],draggedThumbIndex:-1,thumbZIndexes:new Array(t.props.values.length).fill(0).map(function(a,c){return c}),isChanged:!1,markOffsets:[]},t.getOffsets=function(){var a=t.props,c=a.direction,f=a.values,b=a.min,k=a.max,I=t.trackRef.current;if(!I)return console.warn("No track element found."),[];var O=I.getBoundingClientRect(),w=(0,l.getPaddingAndBorder)(I);return t.getThumbs().map(function(M,P){var R={x:0,y:0},B=M.getBoundingClientRect(),C=(0,l.getMargin)(M);switch(c){case p.Direction.Right:return R.x=(C.left+w.left)*-1,R.y=((B.height-O.height)/2+w.top)*-1,R.x+=O.width*(0,l.relativeValue)(f[P],b,k)-B.width/2,R;case p.Direction.Left:return R.x=(C.right+w.right)*-1,R.y=((B.height-O.height)/2+w.top)*-1,R.x+=O.width-O.width*(0,l.relativeValue)(f[P],b,k)-B.width/2,R;case p.Direction.Up:return R.x=((B.width-O.width)/2+C.left+w.left)*-1,R.y=-w.left,R.y+=O.height-O.height*(0,l.relativeValue)(f[P],b,k)-B.height/2,R;case p.Direction.Down:return R.x=((B.width-O.width)/2+C.left+w.left)*-1,R.y=-w.left,R.y+=O.height*(0,l.relativeValue)(f[P],b,k)-B.height/2,R;default:return(0,l.assertUnreachable)(c)}})},t.getThumbs=function(){return t.trackRef&&t.trackRef.current?Array.from(t.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?"),[])},t.getTargetIndex=function(a){return t.getThumbs().findIndex(function(c){return c===a.target||c.contains(a.target)})},t.addTouchEvents=function(a){document.addEventListener("touchmove",t.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",t.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",t.schdOnEnd,{passive:!1})},t.addMouseEvents=function(a){document.addEventListener("mousemove",t.schdOnMouseMove),document.addEventListener("mouseup",t.schdOnEnd)},t.onMouseDownTrack=function(a){var c;if(!(a.button!==0||(0,l.isIOS)()))if(a.persist(),a.preventDefault(),t.addMouseEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(b){var k;return(k=b.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return t.onMove(a.clientX,a.clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(b){return b.current}),a.clientX,a.clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.clientX,a.clientY)})}},t.onResize=function(){(0,l.translateThumbs)(t.getThumbs(),t.getOffsets(),t.props.rtl),t.calculateMarkOffsets()},t.onTouchStartTrack=function(a){var c;if(a.persist(),t.addTouchEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(b){var k;return(k=b.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(b){return b.current}),a.touches[0].clientX,a.touches[0].clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},t.onMouseOrTouchStart=function(a){if(!t.props.disabled){var c=(0,l.isTouchEvent)(a);if(!(!c&&a.button!==0)){var f=t.getTargetIndex(a);f!==-1&&(c?t.addTouchEvents(a):t.addMouseEvents(a),t.setState({draggedThumbIndex:f,thumbZIndexes:t.state.thumbZIndexes.map(function(b,k){return k===f?Math.max.apply(Math,t.state.thumbZIndexes):b<=t.state.thumbZIndexes[f]?b:b-1})}))}}},t.onMouseMove=function(a){a.preventDefault(),t.onMove(a.clientX,a.clientY)},t.onTouchMove=function(a){a.preventDefault(),t.onMove(a.touches[0].clientX,a.touches[0].clientY)},t.onKeyDown=function(a){var c=t.props,f=c.values,b=c.onChange,k=c.step,I=c.rtl,O=c.direction,w=t.state.isChanged,M=t.getTargetIndex(a.nativeEvent),P=I||O===p.Direction.Left||O===p.Direction.Down?-1:1;M!==-1&&(F.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),b((0,l.replaceAt)(f,M,t.normalizeValue(f[M]+P*(a.key==="PageUp"?k*10:k),M)))):j.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),b((0,l.replaceAt)(f,M,t.normalizeValue(f[M]-P*(a.key==="PageDown"?k*10:k),M)))):a.key==="Tab"?t.setState({draggedThumbIndex:-1},function(){w&&t.fireOnFinalChange()}):w&&t.fireOnFinalChange())},t.onKeyUp=function(a){var c=t.state.isChanged;t.setState({draggedThumbIndex:-1},function(){c&&t.fireOnFinalChange()})},t.onMove=function(a,c){var f=t.state,b=f.draggedThumbIndex,k=f.draggedTrackPos,I=t.props,O=I.direction,w=I.min,M=I.max,P=I.onChange,R=I.values,B=I.step,C=I.rtl;if(b===-1&&k[0]===-1&&k[1]===-1)return null;var i=t.trackRef.current;if(!i)return null;var o=i.getBoundingClientRect(),u=(0,l.isVertical)(O)?o.height:o.width;if(k[0]!==-1&&k[1]!==-1){var h=a-k[0],m=c-k[1],g=0;switch(O){case p.Direction.Right:case p.Direction.Left:g=h/u*(M-w);break;case p.Direction.Down:case p.Direction.Up:g=m/u*(M-w);break;default:(0,l.assertUnreachable)(O)}if(C&&(g*=-1),Math.abs(g)>=B/2){for(var T=0;T<t.thumbRefs.length;T++){if(R[T]===M&&Math.sign(g)===1||R[T]===w&&Math.sign(g)===-1)return;var $=R[T]+g;$>M?g=M-R[T]:$<w&&(g=w-R[T])}for(var D=R.slice(0),T=0;T<t.thumbRefs.length;T++)D=(0,l.replaceAt)(D,T,t.normalizeValue(R[T]+g,T));t.setState({draggedTrackPos:[a,c]}),P(D)}}else{var x=0;switch(O){case p.Direction.Right:x=(a-o.left)/u*(M-w)+w;break;case p.Direction.Left:x=(u-(a-o.left))/u*(M-w)+w;break;case p.Direction.Down:x=(c-o.top)/u*(M-w)+w;break;case p.Direction.Up:x=(u-(c-o.top))/u*(M-w)+w;break;default:(0,l.assertUnreachable)(O)}C&&(x=M+w-x),Math.abs(R[b]-x)>=B/2&&P((0,l.replaceAt)(R,b,t.normalizeValue(x,b)))}},t.normalizeValue=function(a,c){var f=t.props,b=f.min,k=f.max,I=f.step,O=f.allowOverlap,w=f.values;return(0,l.normalizeValue)(a,c,b,k,I,O,w)},t.onEnd=function(a){if(a.preventDefault(),document.removeEventListener("mousemove",t.schdOnMouseMove),document.removeEventListener("touchmove",t.schdOnTouchMove),document.removeEventListener("mouseup",t.schdOnEnd),document.removeEventListener("touchend",t.schdOnEnd),document.removeEventListener("touchcancel",t.schdOnEnd),t.state.draggedThumbIndex===-1&&t.state.draggedTrackPos[0]===-1&&t.state.draggedTrackPos[1]===-1)return null;t.setState({draggedThumbIndex:-1,draggedTrackPos:[-1,-1]},function(){t.fireOnFinalChange()})},t.fireOnFinalChange=function(){t.setState({isChanged:!1});var a=t.props,c=a.onFinalChange,f=a.values;c&&c(f)},t.updateMarkRefs=function(a){if(!a.renderMark){t.numOfMarks=void 0,t.markRefs=void 0;return}t.numOfMarks=(a.max-a.min)/t.props.step,t.markRefs=[];for(var c=0;c<t.numOfMarks+1;c++)t.markRefs[c]=S.createRef()},t.calculateMarkOffsets=function(){if(!(!t.props.renderMark||!t.trackRef||!t.numOfMarks||!t.markRefs||t.trackRef.current===null)){for(var a=window.getComputedStyle(t.trackRef.current),c=parseInt(a.width,10),f=parseInt(a.height,10),b=parseInt(a.paddingLeft,10),k=parseInt(a.paddingTop,10),I=[],O=0;O<t.numOfMarks+1;O++){var w=9999,M=9999;if(t.markRefs[O].current){var P=t.markRefs[O].current.getBoundingClientRect();w=P.height,M=P.width}t.props.direction===p.Direction.Left||t.props.direction===p.Direction.Right?I.push([Math.round(c/t.numOfMarks*O+b-M/2),-Math.round((w-f)/2)]):I.push([Math.round(f/t.numOfMarks*O+k-w/2),-Math.round((M-c)/2)])}t.setState({markOffsets:I})}},d.step===0)throw new Error('"step" property should be a positive number');return t.schdOnMouseMove=(0,l.schd)(t.onMouseMove),t.schdOnTouchMove=(0,l.schd)(t.onTouchMove),t.schdOnEnd=(0,l.schd)(t.onEnd),t.thumbRefs=d.values.map(function(){return S.createRef()}),t.updateMarkRefs(d),t}return y.prototype.componentDidMount=function(){var d=this,t=this.props,a=t.values,c=t.min,f=t.step;this.resizeObserver=window.ResizeObserver?new window.ResizeObserver(this.onResize):{observe:function(){return window.addEventListener("resize",d.onResize)},unobserve:function(){return window.removeEventListener("resize",d.onResize)}},document.addEventListener("touchstart",this.onMouseOrTouchStart,{passive:!1}),document.addEventListener("mousedown",this.onMouseOrTouchStart,{passive:!1}),!this.props.allowOverlap&&(0,l.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(b){return(0,l.checkBoundaries)(b,d.props.min,d.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(b){(0,l.isStepDivisible)(c,b,f)||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.")})},y.prototype.componentDidUpdate=function(d,t){var a=this.props,c=a.max,f=a.min,b=a.step,k=a.values,I=a.rtl;(d.max!==c||d.min!==f||d.step!==b)&&this.updateMarkRefs(this.props),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),I),(d.max!==c||d.min!==f||d.step!==b||t.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),k.forEach(function(O){(0,l.isStepDivisible)(f,O,b)||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.")}))},y.prototype.componentWillUnmount=function(){var d={passive:!1};document.removeEventListener("mousedown",this.onMouseOrTouchStart,d),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)},y.prototype.render=function(){var d=this,t=this.props,a=t.label,c=t.labelledBy,f=t.renderTrack,b=t.renderThumb,k=t.renderMark,I=k===void 0?function(){return null}:k,O=t.values,w=t.min,M=t.max,P=t.allowOverlap,R=t.disabled,B=this.state,C=B.draggedThumbIndex,i=B.thumbZIndexes,o=B.markOffsets;return f({props:{style:{transform:"scale(1)",cursor:C>-1?"grabbing":this.props.draggableTrack?(0,l.isVertical)(this.props.direction)?"ns-resize":"ew-resize":O.length===1&&!R?"pointer":"inherit"},onMouseDown:R?l.voidFn:this.onMouseDownTrack,onTouchStart:R?l.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:R,children:v(v([],o.map(function(u,h,m){return I({props:{style:d.props.direction===p.Direction.Left||d.props.direction===p.Direction.Right?{position:"absolute",left:"".concat(u[0],"px"),marginTop:"".concat(u[1],"px")}:{position:"absolute",top:"".concat(u[0],"px"),marginLeft:"".concat(u[1],"px")},key:"mark".concat(h),ref:d.markRefs[h]},index:h})}),!0),O.map(function(u,h){var m=d.state.draggedThumbIndex===h;return b({index:h,value:u,isDragged:m,props:{style:{position:"absolute",zIndex:i[h],cursor:R?"inherit":m?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:h,tabIndex:R?void 0:0,"aria-valuemax":P?M:O[h+1]||M,"aria-valuemin":P?w:O[h-1]||w,"aria-valuenow":u,draggable:!1,ref:d.thumbRefs[h],"aria-label":a,"aria-labelledby":c,role:"slider",onKeyDown:R?l.voidFn:d.onKeyDown,onKeyUp:R?l.voidFn:d.onKeyUp}})}),!0)})},y.defaultProps={label:"Accessibility label",labelledBy:null,step:1,direction:p.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},y}(S.Component);return H.default=z,H}var qe;function xt(){return qe||(qe=1,function(e){var r=ue&&ue.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.checkValuesAgainstBoundaries=e.relativeValue=e.useThumbOverlap=e.Direction=e.getTrackBackground=e.Range=void 0;var n=r(It());e.Range=n.default;var s=Ge();Object.defineProperty(e,"getTrackBackground",{enumerable:!0,get:function(){return s.getTrackBackground}}),Object.defineProperty(e,"useThumbOverlap",{enumerable:!0,get:function(){return s.useThumbOverlap}}),Object.defineProperty(e,"relativeValue",{enumerable:!0,get:function(){return s.relativeValue}}),Object.defineProperty(e,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return s.checkValuesAgainstBoundaries}});var v=xe();Object.defineProperty(e,"Direction",{enumerable:!0,get:function(){return v.Direction}})}(ue)),ue}var Je=xt();function Ke(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),n.push.apply(n,s)}return n}function be(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Ke(Object(n),!0).forEach(function(s){Ct(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Ct(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var ye=Q("div",{position:"relative",width:"100%"});ye.displayName="Root";ye.displayName="Root";ye.displayName="StyledRoot";var Te=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$disabled,S=e.$isDragged,l=r.sizing,p="inherit";return v?p="not-allowed":S?p="grabbing":s.length===1&&(p="pointer"),{paddingTop:l.scale600,paddingBottom:l.scale600,paddingRight:l.scale600,paddingLeft:l.scale600,display:"flex",cursor:p,backgroundColor:r.colors.sliderTrackFill}});Te.displayName="Track";Te.displayName="Track";Te.displayName="StyledTrack";var de=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$min,S=e.$max,l=e.$disabled,p=r.colors,F=r.borders,j=r.direction,z=r.borders.useRoundedCorners?F.radius100:0;return{borderTopLeftRadius:z,borderTopRightRadius:z,borderBottomRightRadius:z,borderBottomLeftRadius:z,background:Je.getTrackBackground({values:s,colors:s.length===1?[l?p.borderOpaque:p.primary,l?p.backgroundSecondary:p.borderOpaque]:[l?p.backgroundSecondary:p.borderOpaque,l?p.borderOpaque:p.primary,l?p.backgroundSecondary:p.borderOpaque],min:v||0,max:S||0,rtl:j==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:l?"not-allowed":"inherit"}});de.displayName="InnerTrack";de.displayName="InnerTrack";de.displayName="StyledInnerTrack";var ke=Q("div",function(e){return{width:"4px",height:"2px",backgroundColor:e.$theme.colors.backgroundPrimary,marginLeft:"16px"}});ke.displayName="Mark";ke.displayName="Mark";ke.displayName="StyledMark";var Oe=Q("div",function(e){return be(be({},e.$theme.typography.font200),{},{color:e.$theme.colors.contentPrimary})});Oe.displayName="Tick";Oe.displayName="Tick";Oe.displayName="StyledTick";var we=Q("div",function(e){var r=e.$theme,n=r.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:n.scale600,paddingLeft:n.scale600,paddingBottom:n.scale400}});we.displayName="TickBar";we.displayName="TickBar";we.displayName="StyledTickBar";var Re=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$thumbIndex,S=e.$disabled,l=s.length===2&&v===0,p=s.length===2&&v===1;return r.direction==="rtl"&&(p||l)&&(l=!l,p=!p),{height:"24px",width:"24px",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:S?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleFill,outline:"none",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(r.colors.accent):"0 1px 4px rgba(0, 0, 0, 0.12)",cursor:S?"not-allowed":"inherit"}});Re.displayName="Thumb";Re.displayName="Thumb";Re.displayName="StyledThumb";var Se=Q("div",function(e){var r=e.$disabled,n=e.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill}});Se.displayName="InnerThumb";Se.displayName="InnerThumb";Se.displayName="StyledInnerThumb";var Me=Q("div",function(e){var r=e.$disabled,n=e.$theme;return be(be({position:"absolute",top:"-".concat(n.sizing.scale1400)},n.typography.font200),{},{backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill,color:n.colors.contentInversePrimary,paddingLeft:n.sizing.scale600,paddingRight:n.sizing.scale600,paddingTop:n.sizing.scale500,paddingBottom:n.sizing.scale500,borderBottomLeftRadius:"48px",borderBottomRightRadius:"48px",borderTopLeftRadius:"48px",borderTopRightRadius:"48px",whiteSpace:"nowrap"})});Me.displayName="ThumbValue";Me.displayName="ThumbValue";Me.displayName="StyledThumbValue";function Xe(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),n.push.apply(n,s)}return n}function Dt(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Xe(Object(n),!0).forEach(function(s){Pt(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Pt(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function X(){return X=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},X.apply(this,arguments)}function K(e,r){return Ft(e)||Lt(e,r)||At(e,r)||Bt()}function Bt(){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 At(e,r){if(e){if(typeof e=="string")return Ye(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ye(e,r)}}function Ye(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,s=new Array(r);n<r;n++)s[n]=e[n];return s}function Lt(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s=[],v=!0,S=!1,l,p;try{for(n=n.call(e);!(v=(l=n.next()).done)&&(s.push(l.value),!(r&&s.length===r));v=!0);}catch(F){S=!0,p=F}finally{try{!v&&n.return!=null&&n.return()}finally{if(S)throw p}}return s}}function Ft(e){if(Array.isArray(e))return e}var jt=function(r){if(r.length>2||r.length===0)throw new Error("the value prop represents positions of thumbs, so its length can be only one or two");return r};function zt(e){var r=e.overrides,n=r===void 0?{}:r,s=e.disabled,v=s===void 0?!1:s,S=e.marks,l=S===void 0?!1:S,p=e.onChange,F=p===void 0?function(){}:p,j=e.onFinalChange,z=j===void 0?function(){}:j,E=e.min,y=E===void 0?0:E,d=e.max,t=d===void 0?100:d,a=e.step,c=a===void 0?1:a,f=e.persistentThumb,b=f===void 0?!1:f,k=e.valueToLabel,I=k===void 0?function(Y){return Y}:k,O=e.value,w=_.useContext(vt),M=_.useState(!1),P=K(M,2),R=P[0],B=P[1],C=_.useState(!1),i=K(C,2),o=i[0],u=i[1],h=_.useState(!1),m=K(h,2),g=m[0],T=m[1],$=_.useState(-1),D=K($,2),x=D[0],U=D[1],V=_.useCallback(function(Y){mt(Y)&&T(!0);var N=Y.target.parentNode.firstChild===Y.target?0:1;U(N)},[]),W=_.useCallback(function(Y){g!==!1&&T(!1),U(-1)},[]),A=jt(O),L={$disabled:v,$step:c,$min:y,$max:t,$marks:l,$value:A,$isFocusVisible:g},G=J(n.Root,ye),ne=K(G,2),fe=ne[0],ee=ne[1],he=J(n.Track,Te),ge=K(he,2),pe=ge[0],$e=ge[1],te=J(n.InnerTrack,de),se=K(te,2),ve=se[0],me=se[1],Qe=J(n.Thumb,Re),Ce=K(Qe,2),et=Ce[0],tt=Ce[1],rt=J(n.InnerThumb,Se),De=K(rt,2),nt=De[0],at=De[1],it=J(n.ThumbValue,Me),Pe=K(it,2),ot=Pe[0],st=Pe[1],ut=J(n.Tick,Oe),Be=K(ut,2),Ae=Be[0],Le=Be[1],ct=J(n.TickBar,we),Fe=K(ct,2),lt=Fe[0],dt=Fe[1],ft=J(n.Mark,ke),je=K(ft,2),ht=je[0],gt=je[1];return _.createElement(fe,X({"data-baseweb":"slider"},L,ee,{onFocus:yt(ee,V),onBlur:bt(ee,W)}),_.createElement(Je.Range,X({step:c,min:y,max:t,values:A,disabled:v,onChange:function(N){return F({value:N})},onFinalChange:function(N){return z({value:N})},rtl:w.direction==="rtl",renderTrack:function(N){var re=N.props,q=N.children,ae=N.isDragged;return _.createElement(pe,X({onMouseDown:re.onMouseDown,onTouchStart:re.onTouchStart,$isDragged:ae},L,$e),_.createElement(ve,X({$isDragged:ae,ref:re.ref},L,me),q))},renderThumb:function(N){var re=N.props,q=N.index,ae=N.isDragged,ze=b||(!!q&&o||!q&&R||ae)&&!v;return _.createElement(et,X({},re,{onMouseEnter:function(){q===0?B(!0):u(!0)},onMouseLeave:function(){q===0?B(!1):u(!1)},$thumbIndex:q,$isDragged:ae,style:Dt({},re.style)},L,tt,{$isFocusVisible:g&&x===q}),ze&&_.createElement(ot,X({$thumbIndex:q,$isDragged:ae},L,st),I(A[q])),ze&&_.createElement(nt,X({$thumbIndex:q,$isDragged:ae},L,at)))}},l?{renderMark:function(N){var re=N.props,q=N.index;return _.createElement(ht,X({$markIndex:q},re,L,gt))}}:{})),_.createElement(lt,X({},L,dt),_.createElement(Ae,X({},L,Le),I(y)),_.createElement(Ae,X({},L,Le),I(t))))}const Vt=oe("div",{target:"e10fdlpp0"})({position:"relative",":focus-within:has(:focus-visible)":{"--slider-focused":1}}),Nt=oe("div",{target:"e10fdlpp1"})(({disabled:e,theme:r,isDragged:n})=>({alignItems:"center",backgroundColor:e?r.colors.gray60:r.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",display:"flex",justifyContent:"center",height:r.sizes.sliderThumb,width:r.sizes.sliderThumb,boxShadow:n?`0 0 0 0.2rem ${Ve(r.colors.primary,.5)}`:"none",":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 0.2rem ${Ve(r.colors.primary,.5)}`}})),Ut=oe("div",{target:"e10fdlpp2"})(({disabled:e,theme:r})=>({fontFamily:r.genericFonts.bodyFont,fontSize:r.fontSizes.sm,color:e?r.colors.gray60:r.colors.primary,top:"-1.6em",position:"absolute",whiteSpace:"nowrap",backgroundColor:r.colors.transparent,lineHeight:r.lineHeights.base,fontWeight:r.fontWeights.normal,pointerEvents:"none"})),Ht=oe("div",{target:"e10fdlpp3"})({flex:1}),Wt=oe("div",{target:"e10fdlpp4"})(({theme:e})=>({position:"absolute",height:e.spacing.twoXS,left:`calc(${e.sizes.sliderThumb} / 2)`,right:`calc(${e.sizes.sliderThumb} / 2)`})),qt=oe("div",{target:"e10fdlpp5"})(({theme:e,isHovered:r,isDisabled:n})=>({position:"absolute",left:0,right:0,top:"100%",display:"flex",justifyContent:"space-between",pointerEvents:"none",marginTop:`-${e.spacing.md}`,fontSize:e.fontSizes.sm,lineHeight:e.lineHeights.base,fontWeight:e.fontWeights.normal,color:n?e.colors.fadedText40:e.colors.fadedText60,opacity:r?1:"var(--slider-focused, 0)",transition:r?"none":"opacity 300ms 200ms"}));function Kt({minLabel:e,maxLabel:r,isHovered:n,isDisabled:s}){return Ie(qt,{"data-testid":"stSliderTickBar",isHovered:n,isDisabled:s,children:[Z("span",{children:e}),Z("span",{children:r})]})}function Xt({disabled:e,element:r,widgetMgr:n,fragmentId:s}){const[v,S]=Et({getStateFromWidgetMgr:Yt,getDefaultStateFromProto:Zt,getCurrStateFromProto:Gt,updateWidgetMgrState:Jt,element:r,widgetMgr:n,fragmentId:s}),[l,p]=_.useState(v),[F,j]=_.useState(!1),[z,E]=_.useState(!1),y=_.useCallback(()=>j(!0),[]),d=_.useCallback(()=>j(!1),[]),t=_.useRef(null),[a]=_.useState([]),[c]=_.useState([]),f=Tt(),b=l.map(C=>Ee(C,r)),k=Ee(r.min,r),I=Ee(r.max,r),O=r.label;_.useEffect(()=>{p(v)},[v]);const w=_.useCallback(({value:C})=>{S({value:C,fromUi:!0}),E(!1)},[S]),M=_.useCallback(({value:C})=>{p(C),E(!0)},[]),P=_.useCallback(_.forwardRef(function(i,o){const{$thumbIndex:u}=i,h=u||0;a[h]=o,c[h]||=_.createRef();const m=kt(i,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),g=b[h];return Z(Nt,{...m,disabled:i.$disabled===!0,isDragged:i.$isDragged===!0,ref:a[h],"aria-valuetext":g,"aria-label":O,children:Z(Ut,{"data-testid":"stSliderThumbValue",disabled:i.$disabled===!0,ref:c[h],children:g})})}),[]);_.useEffect(()=>{c.map((m,g)=>{m.current&&(m.current.innerText=b[g])}),a.map((m,g)=>{m.current&&m.current.setAttribute("aria-valuetext",b[g])});const C=t.current??null,i=a[0].current,o=a[1]?.current,u=c[0].current,h=c[1]?.current;tr(C,i,o,u,h)});const R=_.useCallback(({$disabled:C})=>({height:f.spacing.twoXS,...C?{background:f.colors.darkenedBgMix25}:{}}),[f.colors.darkenedBgMix25,f.spacing.twoXS]),B=_.useCallback(_.forwardRef(function(i,o){const{children:u,...h}=i;return Ie(Ht,{children:[Z(Wt,{ref:o,children:u}),Z(de,{...h,style:R({$disabled:i.$disabled})})]})}),[]);return Ie(Vt,{ref:t,className:"stSlider","data-testid":"stSlider",onMouseEnter:y,onMouseLeave:d,children:[Z(Mt,{label:r.label,disabled:e,labelVisibility:Ot(r.labelVisibility?.value),children:r.help&&Z(wt,{children:Z(Rt,{content:r.help,placement:St.TOP_RIGHT})})}),Z(zt,{min:r.min,max:r.max,step:r.step,value:er(l,r),onChange:M,onFinalChange:w,disabled:e,overrides:{Thumb:P,Track:{style:{backgroundColor:"none !important",paddingLeft:f.spacing.none,paddingRight:f.spacing.none,paddingTop:`calc((${f.sizes.minElementHeight} - ${f.spacing.twoXS}) / 2)`,paddingBottom:`calc((${f.sizes.minElementHeight} - ${f.spacing.twoXS}) / 2)`}},InnerTrack:B,TickBar:{component:Kt,props:{minLabel:k,maxLabel:I,isHovered:F||z,isDisabled:e}}}})]})}function Yt(e,r){return e.getDoubleArrayValue(r)}function Zt(e){return e.default}function Gt(e){return e.value}function Jt(e,r,n,s){r.setDoubleArrayValue(e,n.value,{fromUi:n.fromUi},s)}function Qt(e){const{dataType:r}=e;return r===_e.DataType.DATETIME||r===_e.DataType.DATE||r===_e.DataType.TIME}function Ee(e,r){const{format:n,options:s}=r;return Qt(r)?$t.utc(e/1e3).format(n):s.length>0?Ne.sprintf(n,s[e]):Ne.sprintf(n,e)}function er(e,r){const{min:n,max:s}=r;let v=e[0],S=e.length>1?e[1]:e[0];return v>S&&(v=S),v<n&&(v=n),v>s&&(v=s),S<n&&(S=n),S>s&&(S=s),e.length>1?[v,S]:[v]}function tr(e,r,n,s,v){!e||!r||!s||(ie(e,r,s),n&&v&&(ie(e,n,v),rr(e,r,n,s,v)))}function ie(e,r,n){const s=e.getBoundingClientRect(),v=r.getBoundingClientRect(),S=n.getBoundingClientRect(),l=v.left+v.width/2,p=l-S.width/2<s.left,F=l+S.width/2>s.right;n.style.left=p?"0":"",n.style.right=F?"0":""}function rr(e,r,n,s,v){const l=e.getBoundingClientRect(),p=r.getBoundingClientRect(),F=n.getBoundingClientRect(),j=s.getBoundingClientRect(),z=v.getBoundingClientRect(),E=l.left+l.width/2,y=p.left+p.width/2,d=F.left+F.width/2,t=y-j.width/2>=l.left,a=d+z.width/2<=l.right,c=p.left-j.width>=l.left,f=F.right+z.width<=l.right,b=t?j.width/2:j.width,k=a?z.width/2:z.width,I=y+b;if(d-k-I>24){ie(e,r,s),ie(e,n,v);return}if(c&&f){s.style.left="",s.style.right=`${Math.round(p.width)}px`,v.style.left=`${Math.round(F.width)}px`,v.style.right="";return}y<E?(ie(e,r,s),v.style.left=`${Math.round(y+b+24-d)}px`,v.style.right=""):(ie(e,n,v),s.style.left="",s.style.right=`${-Math.round(d-k-24-y)}px`)}const cr=_t(_.memo(Xt));export{cr as default};
|