@stlite/desktop 0.90.12 → 0.90.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/assets/{ErrorOutline.esm-CGVP5MR5.js → ErrorOutline.esm-CJGMKtXr.js} +1 -1
- package/build/assets/{FileDownload.esm-DRw0GU4W.js → FileDownload.esm-DVbGfwz7.js} +1 -1
- package/build/assets/{FileHelper-DPutc5L1.js → FileHelper-BAjDG49X.js} +1 -1
- package/build/assets/{FormClearHelper-CNtDBzvU.js → FormClearHelper-CaLJK07N.js} +1 -1
- package/build/assets/{Hooks-DEqVt10P.js → Hooks-D54IehuR.js} +1 -1
- package/build/assets/{InputInstructions-CYN5pWtc.js → InputInstructions-BLplNLW9.js} +1 -1
- package/build/assets/{Particles-BFhdwScH.js → Particles-VYhfVp_p.js} +1 -1
- package/build/assets/{ProgressBar-BxIGBDpX.js → ProgressBar-DX8k7XSZ.js} +1 -1
- package/build/assets/{Toolbar-DZSYfgER.js → Toolbar-BbbydoLD.js} +1 -1
- package/build/assets/{base-input-CDtHdiX2.js → base-input-d4WKPeU6.js} +1 -1
- package/build/assets/{checkbox-BWPUCDzk.js → checkbox-DUA9ewQT.js} +1 -1
- package/build/assets/{createSuper-DRBibar_.js → createSuper-CoIMxZYP.js} +1 -1
- package/build/assets/{data-grid-overlay-editor-d9lrfvrX.js → data-grid-overlay-editor-cvHWuOOd.js} +1 -1
- package/build/assets/{downloader-CadyDzLl.js → downloader-CR6bzPv-.js} +1 -1
- package/build/assets/{es6-DXJfyb4B.js → es6-BCBcAdQS.js} +2 -2
- package/build/assets/{iframeResizer.contentWindow-BHAHPBQS.js → iframeResizer.contentWindow-CEqjsNrn.js} +1 -1
- package/build/assets/{index-CehLOm7L.js → index-B3GOsGpL.js} +1 -1
- package/build/assets/{index-FcCBykqI.js → index-B58bWjQH.js} +1 -1
- package/build/assets/{index-wWX1T45-.js → index-B7yzG-4X.js} +5 -5
- package/build/assets/{index-CrjEhyMB.js → index-BD2ZweM9.js} +1 -1
- package/build/assets/{index-i0_Oh-Dl.js → index-BGUuVZft.js} +1 -1
- package/build/assets/{index-CrJrTvHb.js → index-BJK2Ym_S.js} +1 -1
- package/build/assets/{index-sq5xGN6c.js → index-BMSSeqlt.js} +1 -1
- package/build/assets/{index-C-z83jR8.js → index-BRiK5gVx.js} +1 -1
- package/build/assets/{index-cja8oZxE.js → index-BdVfRySM.js} +1 -1
- package/build/assets/{index-CdQSBtKU.js → index-Bhgfj5y5.js} +1 -1
- package/build/assets/{index-BayeI3Y8.js → index-Bwfh73dd.js} +1 -1
- package/build/assets/{index-CzHgae1d.js → index-C91sP-jG.js} +1 -1
- package/build/assets/{index-Y5GMER81.js → index-CD0SY35r.js} +1 -1
- package/build/assets/{index-xRpExM0P.js → index-CHBxMYoz.js} +1 -1
- package/build/assets/{index--6Tmibu-.js → index-CIRTE79j.js} +1 -1
- package/build/assets/{index-C5CelRVp.js → index-CJWk1YT9.js} +1 -1
- package/build/assets/{index-CDOZLgUW.js → index-CTZrIDfL.js} +1 -1
- package/build/assets/{index-S2M1jZve.js → index-CdAXvPf5.js} +1 -1
- package/build/assets/{index-C5Vs7DkV.js → index-CeNNLDtJ.js} +1 -1
- package/build/assets/{index-DKFOxClg.js → index-CwPp5UqK.js} +1 -1
- package/build/assets/{index-B4-tzIvm.js → index-D9P3ZYiC.js} +1 -1
- package/build/assets/{index-C0h1sWt9.js → index-DCv3Ovf7.js} +1 -1
- package/build/assets/{index-BphPDeJU.js → index-DOiS7VE9.js} +1 -1
- package/build/assets/{index-DpCruM_r.js → index-D_4iXBI5.js} +1 -1
- package/build/assets/{index-rCaYGFp-.js → index-DoQHaClc.js} +1 -1
- package/build/assets/{index-aw1dvFXB.js → index-Dynm-1sH.js} +1 -1
- package/build/assets/{index-D_h3I9YJ.js → index-HqlJZ3Ag.js} +1 -1
- package/build/assets/{index-6pmK9B6A.js → index-NigQ67t-.js} +1 -1
- package/build/assets/{index-BdtyI7rR.js → index-PHqcnj3c.js} +1 -1
- package/build/assets/{index-H4N5vz5u.js → index-VVwti7cA.js} +1 -1
- package/build/assets/{index-BAYa9u17.js → index-XsxWL5x-.js} +1 -1
- package/build/assets/{index-Pi0boTQ1.js → index-gb2ePejP.js} +1 -1
- package/build/assets/{index-BbEq8Tl6.js → index-j6pFDYKO.js} +1 -1
- package/build/assets/{index-CFC41peg.js → index-mHvUvPYI.js} +1 -1
- package/build/assets/{index-CR1sLAOp.js → index-vLb3c1eZ.js} +1 -1
- package/build/assets/{index-CZdeBPWU.js → index-wUVGuFfU.js} +1 -1
- package/build/assets/{index-cuFX1NrA.js → index-wnKDraWU.js} +4 -4
- package/build/assets/{inherits-uBK3kmcZ.js → inherits-xHSaJdUZ.js} +1 -1
- package/build/assets/{input-1w6Mjo5w.js → input-PliHooUw.js} +1 -1
- package/build/assets/{memory-C-EiHSeQ.js → memory-BJMhKXeY.js} +1 -1
- package/build/assets/{number-overlay-editor-CPu7tgwQ.js → number-overlay-editor-DRf5xgI3.js} +1 -1
- package/build/assets/{sandbox-Dgl94q2K.js → sandbox-DBdCCxaG.js} +1 -1
- package/build/assets/{slicedToArray-BxUjdsw4.js → slicedToArray-Cuk3tbTR.js} +1 -1
- package/build/assets/{timepicker-YeO3C7Qg.js → timepicker-DjzHzJAt.js} +1 -1
- package/build/assets/{uniqueId-Dp_tGnBE.js → uniqueId-ikSpJ9AP.js} +1 -1
- package/build/assets/{useBasicWidgetState-DD4anr8V.js → useBasicWidgetState-raTjAqZP.js} +1 -1
- package/build/assets/{useTextInputAutoExpand-DwrFHugV.js → useTextInputAutoExpand-Uac3U0I_.js} +1 -1
- package/build/assets/{useUpdateUiValue-B6SPuk_P.js → useUpdateUiValue-BbEmiOZQ.js} +1 -1
- package/build/assets/{withFullScreenWrapper-Db_tqc32.js → withFullScreenWrapper-C7u7nPsK.js} +1 -1
- package/build/index.html +1 -1
- package/package.json +4 -4
- package/wheels/streamlit-1.50.0-cp313-none-any.whl +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as D,r as a,a4 as U,u as k,a5 as S,j as i,W as H,l as B,Q as _,T as O,P as w,y as K,a6 as q}from"./index-
|
|
1
|
+
import{s as D,r as a,a4 as U,u as k,a5 as S,j as i,W as H,l as B,Q as _,T as O,P as w,y as K,a6 as q}from"./index-wnKDraWU.js";import{u as A}from"./uniqueId-ikSpJ9AP.js";import{I as G}from"./InputInstructions-BLplNLW9.js";import{u as N}from"./useBasicWidgetState-raTjAqZP.js";import{u as Q,a as $,b as J}from"./useUpdateUiValue-BbEmiOZQ.js";import{I as M}from"./input-PliHooUw.js";import"./FormClearHelper-CaLJK07N.js";import"./inputUtils-CptNuJwn.js";import"./base-input-d4WKPeU6.js";const X=D("div",{target:"e11y4ecf0"})({name:"bjn8wh",styles:"position:relative"});function Y({disabled:s,element:t,widgetMgr:o,fragmentId:u}){const[r,c]=a.useState(()=>I(o,t)??null),{width:W,elementRef:y}=U(),[n,p]=a.useState(!1),T=a.useCallback(()=>{c(t.default??null),p(!0)},[t.default]),[V,m]=N({getStateFromWidgetMgr:I,getDefaultStateFromProto:Z,getCurrStateFromProto:tt,updateWidgetMgrState:et,element:t,widgetMgr:o,fragmentId:u,onFormCleared:T});Q(V,r,c,n);const[C,f]=a.useState(!1),e=k(),[g]=a.useState(()=>A("text_input_")),{placeholder:E,formId:l,icon:d,maxChars:b}=t,h=a.useCallback(()=>{p(!1),m({value:r,fromUi:!0})},[r,m]),F=S({formId:l})?o.allowFormEnterToSubmit(l):n,j=C&&W>e.breakpoints.hideWidgetDetails,v=a.useCallback(()=>{n&&h(),f(!1)},[n,h]),R=a.useCallback(()=>{f(!0)},[]),z=$({formId:l,maxChars:b,setDirty:p,setUiValue:c,setValueWithSource:m}),P=J(l,h,n,o,u),x=d?.startsWith(":material"),L=x?"lg":"base";return i.jsxs(X,{className:"stTextInput","data-testid":"stTextInput",ref:y,children:[i.jsx(H,{label:t.label,disabled:s,labelVisibility:B(t.labelVisibility?.value),htmlFor:g,children:t.help&&i.jsx(_,{children:i.jsx(O,{content:t.help,placement:w.TOP_RIGHT})})}),i.jsx(M,{value:r??"",placeholder:E,onBlur:v,onFocus:R,onChange:z,onKeyPress:P,"aria-label":t.label,disabled:s,id:g,type:st(t),autoComplete:t.autocomplete,startEnhancer:d&&i.jsx(K,{"data-testid":"stTextInputIcon",iconValue:d,size:L}),overrides:{Input:{style:{fontWeight:e.fontWeights.normal,minWidth:0,lineHeight:e.lineHeights.inputWidget,paddingRight:e.spacing.sm,paddingLeft:e.spacing.md,paddingBottom:e.spacing.sm,paddingTop:e.spacing.sm,"::placeholder":{color:e.colors.fadedText60}}},Root:{props:{"data-testid":"stTextInputRootElement"},style:{height:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth,paddingLeft:d?e.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:e.iconSizes.lg,color:x?e.colors.fadedText60:"inherit"}}}}),j&&i.jsx(G,{dirty:n,value:r??"",maxLength:b,inForm:S({formId:l}),allowEnterToSubmit:F})]})}function I(s,t){return s.getStringValue(t)??null}function Z(s){return s.default??null}function tt(s){return s.value??null}function et(s,t,o,u){t.setStringValue(s,o.value,{fromUi:o.fromUi},u)}function st(s){return s.type===q.Type.PASSWORD?"password":"text"}const pt=a.memo(Y);export{pt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as g,r as j,I as E,J as L,j as s,w as b,f as C,x as v}from"./index-
|
|
1
|
+
import{s as g,r as j,I as E,J as L,j as s,w as b,f as C,x as v}from"./index-wnKDraWU.js";import{w as T,E as W}from"./withFullScreenWrapper-C7u7nPsK.js";import{S as x,T as y}from"./Toolbar-BbbydoLD.js";const F=g("div",{target:"e115fcil2"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:e.spacing.lg,maxWidth:"100%",width:t?"100%":"fit-content"}),""),M=g("div",{target:"e115fcil1"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:t?"100%":"auto",flexGrow:t?1:0,">img":{borderRadius:e.radii.default}}),""),R=g("div",{target:"e115fcil0"})(({theme:e})=>({textAlign:"center",marginTop:e.spacing.xs,wordWrap:"break-word",padding:e.spacing.threeXS}),""),H=v.getLogger("ImageList");function O(e,t,r){if(e){if(e.useStretch)return r;if(e.useContent)return;if(e.pixelWidth)return e.pixelWidth}if(t!=null)switch(t){case-1:case-3:case-4:return;case-2:case-5:return r;default:return t>0?t:void 0}}const G=({itemKey:e,image:t,imgStyle:r,buildMediaURL:n,handleImageError:l,shouldStretch:i})=>{const c=b(t.url);return s.jsxs(M,{"data-testid":"stImageContainer",shouldStretch:i,children:[s.jsx("img",{style:r,src:n(t.url),alt:e,onError:l,crossOrigin:c}),t.caption&&s.jsx(R,{"data-testid":"stImageCaption",style:r,children:s.jsx(C,{source:t.caption,allowHTML:!1,isCaption:!0,isLabel:!0})})]})};function U({element:e,endpoints:t,widthConfig:r,disableFullscreenMode:n}){const l=E(e.imgs),{expanded:i,width:c,height:d,expand:f,collapse:h}=L(W),m=c||0,I=O(r,e.width,m),p=r?.useStretch||e.width===-5,a={};d&&i?(a.maxHeight=d,a.objectFit="contain",a.width="100%"):(a.width=I??"100%",a.maxWidth="100%");const S=u=>{const o=u.currentTarget.src;H.error(`Client Error: Image source error - ${o}`),t.sendClientErrorToHost("Image","Image source failed to load","onerror triggered",o)};return s.jsxs(x,{width:m,height:d,useContainerWidth:i,topCentered:!0,children:[s.jsx(y,{target:x,isFullScreen:i,onExpand:f,onCollapse:h,disableFullscreenMode:n}),s.jsx(F,{className:"stImage","data-testid":"stImage",shouldStretch:p,children:l.map((u,o)=>s.jsx(G,{itemKey:o.toString(),image:u,imgStyle:a,buildMediaURL:w=>t.buildMediaURL(w),handleImageError:S,shouldStretch:p},o))})]})}const k=T(U),J=j.memo(k);export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as n,i as c,l as g}from"./index-
|
|
1
|
+
import{r as a,j as n,i as c,l as g}from"./index-wnKDraWU.js";import{u as m}from"./useBasicWidgetState-raTjAqZP.js";import"./FormClearHelper-CaLJK07N.js";const b=(t,e)=>t.getStringValue(e),f=t=>t.default??null,p=t=>t.value??null,d=(t,e,r,o)=>{e.setStringValue(t,r.value,{fromUi:r.fromUi},o)},C=({element:t,disabled:e,widgetMgr:r,fragmentId:o})=>{const[i,l]=m({getStateFromWidgetMgr:b,getDefaultStateFromProto:f,getCurrStateFromProto:p,updateWidgetMgrState:d,element:t,widgetMgr:r,fragmentId:o}),s=a.useCallback(u=>{l({value:u,fromUi:!0})},[l]);return n.jsx(c,{label:t.label,labelVisibility:g(t.labelVisibility?.value),help:t.help,onChange:s,disabled:e,value:i})},x=a.memo(C);export{x as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{ac as _,ad as me,o as R,r as u,u as ye,j as g,W as $e,g as Re,T as Oe,P as _e,f as ne,aE as oe,aF as ie,l as Se}from"./index-
|
|
1
|
+
import{ac as _,ad as me,o as R,r as u,u as ye,j as g,W as $e,g as Re,T as Oe,P as _e,f as ne,aE as oe,aF as ie,l as Se}from"./index-wnKDraWU.js";import{u as Pe}from"./useBasicWidgetState-raTjAqZP.js";import"./FormClearHelper-CaLJK07N.js";var ae={vertical:"vertical",horizontal:"horizontal"};function se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?se(Object(n),!0).forEach(function(r){O(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var I=0,x=1,L=2;function z(e){return e.$isActive?L:e.$isHovered?x:I}function we(e){var t=e.$theme.colors,n=e.$disabled,r=e.$checked,o=e.$isFocusVisible,i=e.$error;if(n)return t.tickFillDisabled;if(r)if(i)switch(z(e)){case I:return t.tickFillErrorSelected;case x:return t.tickFillErrorSelectedHover;case L:return t.tickFillErrorSelectedHoverActive}else switch(z(e)){case I:return t.tickFillSelected;case x:return t.tickFillSelectedHover;case L:return t.tickFillSelectedHoverActive}else return o?t.borderSelected:i?t.tickBorderError:t.tickBorder;return null}function Me(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(z(e)){case I:return t.tickFillError;case x:return t.tickFillErrorHover;case L:return t.tickFillErrorHoverActive}else switch(z(e)){case I:return t.tickFill;case x:return t.tickFillHover;case L:return t.tickFillActive}}function ke(e){var t=e.$labelPlacement,n=t===void 0?"":t,r=e.$theme,o;switch(n){case"top":o="Bottom";break;case"bottom":o="Top";break;case"left":o=r.direction==="rtl"?"Left":"Right";break;default:case"right":o=r.direction==="rtl"?"Right":"Left";break}var i=r.sizing,s=i.scale300;return O({},"padding".concat(o),s)}function Fe(e){var t=e.$disabled,n=e.$theme,r=n.colors;return t?r.contentSecondary:r.contentPrimary}var q=_("div",function(e){var t=e.$disabled,n=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:n==="horizontal"?"row":"column",alignItems:n==="horizontal"?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}});q.displayName="RadioGroupRoot";q.displayName="RadioGroupRoot";var X=_("label",function(e){var t,n=e.$disabled,r=e.$hasDescription,o=e.$labelPlacement,i=e.$theme,s=e.$align,a=i.sizing,c=s==="horizontal",p=i.direction==="rtl"?"Left":"Right";return t={flexDirection:o==="top"||o==="bottom"?"column":"row",display:"flex",alignItems:"center",cursor:n?"not-allowed":"pointer",marginTop:a.scale200},O(t,"margin".concat(p),c?a.scale200:null),O(t,"marginBottom",r&&!c?null:a.scale200),t});X.displayName="Root";X.displayName="Root";var K=_("div",function(e){var t=e.$theme,n=t.animation,r=t.sizing;return{backgroundColor:Me(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?r.scale200:r.scale550,transitionDuration:n.timing200,transitionTimingFunction:n.easeOutCurve,width:e.$checked?r.scale200:r.scale550}});K.displayName="RadioMarkInner";K.displayName="RadioMarkInner";var J=_("div",function(e){var t=e.$theme,n=t.animation,r=t.sizing;return{alignItems:"center",backgroundColor:we(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:r.scale700,justifyContent:"center",marginTop:r.scale0,marginRight:r.scale0,marginBottom:r.scale0,marginLeft:r.scale0,outline:"none",verticalAlign:"middle",width:r.scale700,flexShrink:0,transitionDuration:n.timing200,transitionTimingFunction:n.easeOutCurve}});J.displayName="RadioMarkOuter";J.displayName="RadioMarkOuter";var Q=_("div",function(e){var t=e.$theme.typography;return D(D({verticalAlign:"middle"},ke(e)),{},{color:Fe(e)},t.LabelMedium)});Q.displayName="Label";Q.displayName="Label";var Y=_("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});Y.displayName="Input";Y.displayName="Input";var Z=_("div",function(e){var t,n=e.$theme,r=e.$align,o=r==="horizontal",i=n.direction==="rtl"?"Right":"Left",s=n.direction==="rtl"?"Left":"Right";return D(D({},n.typography.ParagraphSmall),{},(t={color:n.colors.contentSecondary,cursor:"auto"},O(t,"margin".concat(i),r==="horizontal"?null:n.sizing.scale900),O(t,"margin".concat(s),o?n.sizing.scale200:null),O(t,"maxWidth","240px"),t))});Z.displayName="Description";Z.displayName="Description";function N(e){"@babel/helpers - typeof";return N=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(e)}function V(){return V=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},V.apply(this,arguments)}function Ee(e,t){return Te(e)||Le(e,t)||xe(e,t)||Ie()}function Ie(){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 xe(e,t){if(e){if(typeof e=="string")return le(e,t);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 le(e,t)}}function le(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Le(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(e);!(o=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));o=!0);}catch(c){i=!0,a=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function Te(e){if(Array.isArray(e))return e}function je(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ae(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function De(e,t,n){return t&&Ae(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ze(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t)}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},U(e,t)}function Be(e){var t=He();return function(){var r=B(e),o;if(t){var i=B(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Ce(this,o)}}function Ce(e,t){if(t&&(N(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return j(e)}function j(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function He(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},B(e)}function A(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ce=(function(e){ze(n,e);var t=Be(n);function n(){var r;je(this,n);for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return r=t.call.apply(t,[this].concat(i)),A(j(r),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),A(j(r),"handleFocus",function(a,c){me(a)&&r.setState({isFocusVisible:!0}),r.setState({focusedRadioIndex:c}),r.props.onFocus&&r.props.onFocus(a)}),A(j(r),"handleBlur",function(a,c){r.state.isFocusVisible!==!1&&r.setState({isFocusVisible:!1}),r.setState({focusedRadioIndex:-1}),r.props.onBlur&&r.props.onBlur(a)}),r}return De(n,[{key:"render",value:function(){var o=this,i=this.props.overrides,s=i===void 0?{}:i,a=R(s.RadioGroupRoot,q),c=Ee(a,2),p=c[0],b=c[1];return u.createElement(p,V({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},b),u.Children.map(this.props.children,function(f,l){if(!u.isValidElement(f))return null;var d=o.props.value===f.props.value;return u.cloneElement(f,{align:o.props.align,autoFocus:o.props.autoFocus,checked:d,disabled:o.props.disabled||f.props.disabled,error:o.props.error,isFocused:o.state.focusedRadioIndex===l,isFocusVisible:o.state.isFocusVisible,tabIndex:l===0&&!o.props.value||d?"0":"-1",labelPlacement:o.props.labelPlacement,name:o.props.name,onBlur:function(v){return o.handleBlur(v,l)},onFocus:function(v){return o.handleFocus(v,l)},onChange:o.props.onChange,onMouseEnter:o.props.onMouseEnter,onMouseLeave:o.props.onMouseLeave})}))}}]),n})(u.Component);A(ce,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});function G(e){"@babel/helpers - typeof";return G=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(e)}function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$.apply(this,arguments)}function M(e,t){return Ge(e)||Ue(e,t)||Ve(e,t)||Ne()}function Ne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ve(e,t){if(e){if(typeof e=="string")return ue(e,t);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 ue(e,t)}}function ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ue(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(e);!(o=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));o=!0);}catch(c){i=!0,a=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function Ge(e){if(Array.isArray(e))return e}function We(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Xe(e,t,n){return t&&qe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ke(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&W(e,t)}function W(e,t){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},W(e,t)}function Je(e){var t=Ye();return function(){var r=C(e),o;if(t){var i=C(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Qe(this,o)}}function Qe(e,t){if(t&&(G(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return k(e)}function k(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ye(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},C(e)}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ze(e){return e==="top"||e==="left"}function et(e){return e==="bottom"||e==="right"}var tt=function(t){return t.stopPropagation()},pe=(function(e){Ke(n,e);var t=Je(n);function n(){var r;We(this,n);for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return r=t.call.apply(t,[this].concat(i)),F(k(r),"state",{isActive:!1,isHovered:!1}),F(k(r),"onMouseEnter",function(a){r.setState({isHovered:!0}),r.props.onMouseEnter&&r.props.onMouseEnter(a)}),F(k(r),"onMouseLeave",function(a){r.setState({isHovered:!1}),r.props.onMouseLeave&&r.props.onMouseLeave(a)}),F(k(r),"onMouseDown",function(a){r.setState({isActive:!0}),r.props.onMouseDown&&r.props.onMouseDown(a)}),F(k(r),"onMouseUp",function(a){r.setState({isActive:!1}),r.props.onMouseUp&&r.props.onMouseUp(a)}),r}return Xe(n,[{key:"componentDidMount",value:function(){var o;this.props.autoFocus&&(o=this.props.inputRef)!==null&&o!==void 0&&o.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var o=this.props.overrides,i=o===void 0?{}:o,s=R(i.Root,X),a=M(s,2),c=a[0],p=a[1],b=R(i.Label,Q),f=M(b,2),l=f[0],d=f[1],S=R(i.Input,Y),v=M(S,2),P=v[0],H=v[1],T=R(i.Description,Z),E=M(T,2),m=E[0],h=E[1],y=R(i.RadioMarkInner,K),ee=M(y,2),fe=ee[0],de=ee[1],he=R(i.RadioMarkOuter,J),te=M(he,2),ge=te[0],be=te[1],w={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},re=u.createElement(l,$({},w,d),this.props.containsInteractiveElement?u.createElement("div",{onClick:function(ve){return ve.preventDefault()}},this.props.children):this.props.children);return u.createElement(u.Fragment,null,u.createElement(c,$({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},w,p),Ze(this.props.labelPlacement)&&re,u.createElement(ge,$({},w,be),u.createElement(fe,$({},w,de))),u.createElement(P,$({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:tt,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},w,H)),et(this.props.labelPlacement)&&re),!!this.props.description&&u.createElement(m,$({},w,h),this.props.description))}}]),n})(u.Component);F(pe,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:u.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});function rt(e){const t=parseFloat(e.sizes.checkbox),n=parseFloat(e.spacing.threeXS),r=oe(t.toString()),o=Math.round(r*.375);let i=Math.round(oe((t-n).toString()));return i>=r&&(i-=1),[ie(o,"px"),ie(i,"px")]}function nt({disabled:e,horizontal:t,value:n,onChange:r,options:o,captions:i,label:s,labelVisibility:a,help:c}){const[p,b]=u.useState(n??null);u.useEffect(()=>{n!==p&&b(n??null)},[n]);const f=u.useCallback(m=>{const h=parseInt(m.target.value,10);b(h),r(h)},[r]),l=ye(),d=i.length>0,S=o.length>0,v=S?o:["No options to select."],P=e||!S,H=m=>m==""&&t&&d?" ":m,[T,E]=rt(l);return g.jsxs("div",{className:"stRadio","data-testid":"stRadio",children:[g.jsx($e,{label:s,disabled:P,labelVisibility:a,children:c&&g.jsx(Re,{children:g.jsx(Oe,{content:c,placement:_e.TOP_RIGHT})})}),g.jsx(ce,{onChange:f,value:p!==null?p.toString():void 0,disabled:P,align:t?ae.horizontal:ae.vertical,"aria-label":s,"data-testid":"stRadioGroup",overrides:{RadioGroupRoot:{style:{gap:d?l.spacing.sm:l.spacing.none,minHeight:l.sizes.minElementHeight}}},children:v.map((m,h)=>g.jsxs(pe,{value:h.toString(),overrides:{Root:{style:({$isFocusVisible:y})=>({marginBottom:l.spacing.none,marginTop:l.spacing.none,marginRight:d?l.spacing.sm:l.spacing.lg,paddingLeft:l.spacing.none,alignItems:"start",paddingRight:l.spacing.threeXS,backgroundColor:y?l.colors.darkenedBgMix25:""})},RadioMarkOuter:{style:({$checked:y})=>({width:l.sizes.checkbox,height:l.sizes.checkbox,marginTop:"0.35rem",marginRight:l.spacing.none,marginLeft:l.spacing.none,backgroundColor:y&&!P?l.colors.primary:l.colors.fadedText40})},RadioMarkInner:{style:({$checked:y})=>({height:y?T:E,width:y?T:E})},Label:{style:{color:P?l.colors.fadedText40:l.colors.bodyText,position:"relative",top:l.spacing.px}}},children:[g.jsx(ne,{source:m,allowHTML:!1,isLabel:!0,largerLabel:!0}),d&&g.jsx(ne,{source:H(i[h]),allowHTML:!1,isCaption:!0,isLabel:!0})]},h))})]})}const ot=u.memo(nt);function it({disabled:e,element:t,widgetMgr:n,fragmentId:r}){const[o,i]=Pe({getStateFromWidgetMgr:at,getDefaultStateFromProto:st,getCurrStateFromProto:lt,updateWidgetMgrState:ut,element:t,widgetMgr:n,fragmentId:r}),s=u.useCallback(d=>{i({value:d,fromUi:!0})},[i]),{horizontal:a,options:c,captions:p,label:b,labelVisibility:f,help:l}=t;return g.jsx(ot,{label:b,onChange:s,options:c,captions:p,disabled:e,horizontal:a,labelVisibility:Se(f?.value),value:o??null,help:l})}function at(e,t){return e.getIntValue(t)}function st(e){return e.default??null}function lt(e){return e.value??null}function ut(e,t,n,r){t.setIntValue(e,n.value??null,{fromUi:n.fromUi},r)}const ht=u.memo(it);export{ht as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as y,E as R,_,s as x,t as q,j as f,am as X,P as V,c as Q,B as J,an as O,bf as z,b1 as K,a3 as Y,aU as Z,u as ee,bg as te,bh as re,bi as ie,x as oe,aV as se,k as j,bj as ne,bk as ae,W as le,l as de,Q as ce,T as ue}from"./index-cuFX1NrA.js";import{U as W}from"./UploadFileInfo-C-jY39rj.js";import{F as fe}from"./FormClearHelper-CNtDBzvU.js";import{P as pe,S as he}from"./ProgressBar-BxIGBDpX.js";var B=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(R,_({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),y.createElement("rect",{width:24,height:24,fill:"none"}),y.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});B.displayName="SwitchCamera";var L=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(R,_({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});L.displayName="Video";var $=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(R,_({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});$.displayName="X";function ge(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const A=x("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),T=x("div",{target:"etz5kuj8"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),me=x("p",{target:"etz5kuj7"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"}),""),ve=x("img",{target:"etz5kuj6"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),Se=x("a",{target:"etz5kuj5"})(({theme:i})=>({color:i.colors.link,textDecoration:i.linkUnderline?"underline":"none",display:"block"}),""),ye=x("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),be=x("div",{target:"etz5kuj3"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),we=x("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),Ce=x("button",{target:"etz5kuj0"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40,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 ${q(i.colors.primary,.5)}`},...ge("medium",i)}),"");function Me({disabled:i,onClick:l,children:t,progress:s}){return f.jsxs(Ce,{disabled:i||!1,onClick:l||(()=>{}),progress:s||null,"data-testid":"stCameraInputButton",children:[t,s?f.jsx(we,{children:f.jsx(pe,{value:s,size:he.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const N=y.memo(Me);var F=(i=>(i.USER="user",i.ENVIRONMENT="environment",i))(F||{});const Ue=({switchFacingMode:i})=>f.jsx(be,{"data-testid":"stCameraInputSwitchButton",children:f.jsx(X,{content:"Switch camera",placement:V.TOP_RIGHT,children:f.jsx(Q,{kind:J.MINIMAL,onClick:i,children:f.jsx(O,{content:B,size:"twoXL",color:z.white})})})}),xe=y.memo(Ue);var P={exports:{}},Ie=P.exports,k;function Ee(){return k||(k=1,(function(i,l){(function(s,o){i.exports=o(K())})(Ie,function(t){return(function(s){var o={};function n(a){if(o[a])return o[a].exports;var p=o[a]={i:a,l:!1,exports:{}};return s[a].call(p.exports,p,p.exports,n),p.l=!0,p.exports}return n.m=s,n.c=o,n.d=function(a,p,g){n.o(a,p)||Object.defineProperty(a,p,{enumerable:!0,get:g})},n.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},n.t=function(a,p){if(p&1&&(a=n(a)),p&8||p&4&&typeof a=="object"&&a&&a.__esModule)return a;var g=Object.create(null);if(n.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:a}),p&2&&typeof a!="string")for(var U in a)n.d(g,U,(function(M){return a[M]}).bind(null,U));return g},n.n=function(a){var p=a&&a.__esModule?function(){return a.default}:function(){return a};return n.d(p,"a",p),p},n.o=function(a,p){return Object.prototype.hasOwnProperty.call(a,p)},n.p="",n(n.s="./src/react-webcam.tsx")})({"./src/react-webcam.tsx":(function(s,o,n){n.r(o);var a=n("react"),p=(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 I=(function(m){p(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,h=C.canvas;return b&&h&&(h.width=e?.width||h.width,h.height=e?.height||h.height,c.mirrored&&(b.translate(h.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,e?.width||h.width,e?.height||h.height),c.mirrored&&(b.scale(-1,1),b.translate(-h.width,0))),h},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(h){e.unmounted||b!==e.requestUserMediaId?u.stopMediaStream(h):e.handleUserMedia(null,h)}).catch(function(h){e.handleUserMedia(h)})};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(E){E.kind==="audio"?v=E.id:E.kind==="video"&&(C=E.id)});var b=w(r.audioConstraints);b&&(v=b);var h=w(r.videoConstraints);h&&(C=h),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,h=c.children,E=U(c,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),H=v?g(g({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,D={getScreenshot:this.getScreenshot.bind(this)};return a.createElement(a.Fragment,null,a.createElement("video",g({autoPlay:!0,disablePictureInPicture:S,src:d.src,muted:!w,playsInline:!0,ref:function(G){e.video=G},style:H},E)),h&&h(D))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u})(a.Component);o.default=I}),react:(function(s,o){s.exports=t})}).default})})(P)),P.exports}var je=Ee();const Fe=Y(je),Pe=({width:i})=>f.jsxs(T,{width:i,children:[f.jsx(O,{size:"threeXL",color:z.gray60,content:L}),f.jsxs(me,{children:["This app would like to use your camera.",f.jsx(Se,{href:re,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Re=({handleCapture:i,width:l,disabled:t,clearPhotoInProgress:s,setClearPhotoInProgress:o,facingMode:n,setFacingMode:a,testOverride:p})=>{const[g,U]=y.useState(p||"pending"),M=y.useRef(null),[I,m]=y.useState(l),u=y.useCallback(Z(1e3,m),[]);y.useEffect(()=>{u(l)},[l,u]);function e(){if(M.current!==null){const d=M.current.getScreenshot();i(d)}}const r=ee();return f.jsxs(A,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!t&&!s?f.jsx(Pe,{width:I}):te()&&f.jsx(xe,{switchFacingMode:a}),f.jsx(T,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!t&&!s,width:I,children:!t&&f.jsx(Fe,{audio:!1,ref:M,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{U("error")},onUserMedia:()=>{U("success"),o(!1)},videoConstraints:{width:{ideal:I},facingMode:n}})}),f.jsx(N,{onClick:e,disabled:g!=="success"||t||s,children:"Take Photo"})]})},_e=y.memo(Re),Oe=150,Te=oe.getLogger("CameraInput");class We extends y.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new fe,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=t=>{this.setState({clearPhotoInProgress:t})},this.setFacingMode=()=>{this.setState(t=>({facingMode:t.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=t=>{if(t===null)return Promise.resolve();this.setState({imgSrc:t,shutter:!0,minShutterEffectPassed:!1});const s=o=>new Promise(n=>setTimeout(n,o));return ke(t,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(o=>this.props.uploadClient.fetchFileURLs([o]).then(n=>({file:o,fileUrls:n[0]}))).then(({file:o,fileUrls:n})=>this.uploadFile(n,o)).then(()=>s(Oe)).then(()=>{this.setState((o,n)=>({imgSrc:t,shutter:o.shutter,minShutterEffectPassed:!0}))}).catch(o=>{Te.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:s,widgetMgr:o,fragmentId:n}=this.props,a=o.getFileUploaderStateValue(s);se(t,a)||o.setFileUploaderStateValue(s,t,{fromUi:!0},n)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(j(t))return;this.setState({imgSrc:null});const{widgetMgr:s,element:o,fragmentId:n}=this.props;s.setFileUploaderStateValue(o,t,{fromUi:!0},n)})},this.deleteFile=t=>{const s=this.getFile(t);j(s)||(s.status.type==="uploading"&&s.status.abortController.abort(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(s.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(s=>({files:[...s.files,t]}))},this.removeFile=t=>{this.setState(s=>({files:s.files.filter(o=>o.id!==t)}))},this.getFile=t=>this.state.files.find(s=>s.id===t),this.updateFile=(t,s)=>{this.setState(o=>({files:o.files.map(n=>n.id===t?s:n)}))},this.onUploadComplete=(t,s)=>{this.setState(()=>({shutter:!1}));const o=this.getFile(t);j(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},this.onUploadProgress=(t,s)=>{const o=this.getFile(s);if(j(o)||o.status.type!=="uploading")return;const n=Math.round(t.loaded*100/t.total);o.status.progress!==n&&this.updateFile(s,o.setStatus({type:"uploading",abortController:o.status.abortController,progress:n}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(t,s)=>{const o=new AbortController,n=new W(s.name,s.size,this.nextLocalFileId(),{type:"uploading",abortController:o,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,s,a=>this.onUploadProgress(a,n.id),o.signal).then(()=>this.onUploadComplete(n.id,t)).catch(a=>{a instanceof DOMException&&a.name==="AbortError"||this.updateFile(n.id,n.setStatus({type:"error",errorMessage:a?a.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:t,element:s}=this.props,o=t.getFileUploaderStateValue(s);if(j(o))return l;const{uploadedFileInfo:n}=o;return j(n)||n.length===0?l:{files:n.map(a=>{const p=a.name,g=a.size,U=a.fileId,M=a.fileUrls;return new W(p,g,this.nextLocalFileId(),{type:"uploaded",fileId:U,fileUrls:M})}),imgSrc:n.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=t=>t.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:o}=this.props;s.getFileUploaderStateValue(t)===void 0&&s.setFileUploaderStateValue(t,l,{fromUi:!1},o)}createWidgetValue(){const l=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:s,size:o,status:n}=t;return new ne({fileId:n.fileId,fileUrls:n.fileUrls,name:s,size:o})});return new ae({uploadedFileInfo:l})}render(){const{element:l,widgetMgr:t,disabled:s,width:o}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),f.jsxs(A,{className:"stCameraInput","data-testid":"stCameraInput",children:[f.jsx(le,{label:l.label,disabled:s,labelVisibility:de(l.labelVisibility?.value),children:l.help&&f.jsx(ce,{children:f.jsx(ue,{content:l.help,placement:V.TOP_RIGHT})})}),this.state.imgSrc?f.jsxs(f.Fragment,{children:[f.jsx(T,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&f.jsx(ve,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),f.jsx(N,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||s,children:this.getProgress()?"Uploading...":f.jsxs(ye,{children:[f.jsx(O,{content:$,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):f.jsx(_e,{handleCapture:this.handleCapture,width:o,disabled:s,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function ke(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}const $e=ie(We);export{$e as default};
|
|
1
|
+
import{r as y,E as R,_,s as x,t as q,j as f,am as X,P as V,c as Q,B as J,an as O,bf as z,b1 as K,a3 as Y,aU as Z,u as ee,bg as te,bh as re,bi as ie,x as oe,aV as se,k as j,bj as ne,bk as ae,W as le,l as de,Q as ce,T as ue}from"./index-wnKDraWU.js";import{U as W}from"./UploadFileInfo-C-jY39rj.js";import{F as fe}from"./FormClearHelper-CaLJK07N.js";import{P as pe,S as he}from"./ProgressBar-DX8k7XSZ.js";var B=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(R,_({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),y.createElement("rect",{width:24,height:24,fill:"none"}),y.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});B.displayName="SwitchCamera";var L=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(R,_({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});L.displayName="Video";var $=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(R,_({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});$.displayName="X";function ge(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const A=x("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),T=x("div",{target:"etz5kuj8"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),me=x("p",{target:"etz5kuj7"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"}),""),ve=x("img",{target:"etz5kuj6"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),Se=x("a",{target:"etz5kuj5"})(({theme:i})=>({color:i.colors.link,textDecoration:i.linkUnderline?"underline":"none",display:"block"}),""),ye=x("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),be=x("div",{target:"etz5kuj3"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),we=x("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),Ce=x("button",{target:"etz5kuj0"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40,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 ${q(i.colors.primary,.5)}`},...ge("medium",i)}),"");function Me({disabled:i,onClick:l,children:t,progress:s}){return f.jsxs(Ce,{disabled:i||!1,onClick:l||(()=>{}),progress:s||null,"data-testid":"stCameraInputButton",children:[t,s?f.jsx(we,{children:f.jsx(pe,{value:s,size:he.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const N=y.memo(Me);var F=(i=>(i.USER="user",i.ENVIRONMENT="environment",i))(F||{});const Ue=({switchFacingMode:i})=>f.jsx(be,{"data-testid":"stCameraInputSwitchButton",children:f.jsx(X,{content:"Switch camera",placement:V.TOP_RIGHT,children:f.jsx(Q,{kind:J.MINIMAL,onClick:i,children:f.jsx(O,{content:B,size:"twoXL",color:z.white})})})}),xe=y.memo(Ue);var P={exports:{}},Ie=P.exports,k;function Ee(){return k||(k=1,(function(i,l){(function(s,o){i.exports=o(K())})(Ie,function(t){return(function(s){var o={};function n(a){if(o[a])return o[a].exports;var p=o[a]={i:a,l:!1,exports:{}};return s[a].call(p.exports,p,p.exports,n),p.l=!0,p.exports}return n.m=s,n.c=o,n.d=function(a,p,g){n.o(a,p)||Object.defineProperty(a,p,{enumerable:!0,get:g})},n.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},n.t=function(a,p){if(p&1&&(a=n(a)),p&8||p&4&&typeof a=="object"&&a&&a.__esModule)return a;var g=Object.create(null);if(n.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:a}),p&2&&typeof a!="string")for(var U in a)n.d(g,U,(function(M){return a[M]}).bind(null,U));return g},n.n=function(a){var p=a&&a.__esModule?function(){return a.default}:function(){return a};return n.d(p,"a",p),p},n.o=function(a,p){return Object.prototype.hasOwnProperty.call(a,p)},n.p="",n(n.s="./src/react-webcam.tsx")})({"./src/react-webcam.tsx":(function(s,o,n){n.r(o);var a=n("react"),p=(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 I=(function(m){p(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,h=C.canvas;return b&&h&&(h.width=e?.width||h.width,h.height=e?.height||h.height,c.mirrored&&(b.translate(h.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,e?.width||h.width,e?.height||h.height),c.mirrored&&(b.scale(-1,1),b.translate(-h.width,0))),h},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(h){e.unmounted||b!==e.requestUserMediaId?u.stopMediaStream(h):e.handleUserMedia(null,h)}).catch(function(h){e.handleUserMedia(h)})};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(E){E.kind==="audio"?v=E.id:E.kind==="video"&&(C=E.id)});var b=w(r.audioConstraints);b&&(v=b);var h=w(r.videoConstraints);h&&(C=h),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,h=c.children,E=U(c,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),H=v?g(g({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,D={getScreenshot:this.getScreenshot.bind(this)};return a.createElement(a.Fragment,null,a.createElement("video",g({autoPlay:!0,disablePictureInPicture:S,src:d.src,muted:!w,playsInline:!0,ref:function(G){e.video=G},style:H},E)),h&&h(D))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u})(a.Component);o.default=I}),react:(function(s,o){s.exports=t})}).default})})(P)),P.exports}var je=Ee();const Fe=Y(je),Pe=({width:i})=>f.jsxs(T,{width:i,children:[f.jsx(O,{size:"threeXL",color:z.gray60,content:L}),f.jsxs(me,{children:["This app would like to use your camera.",f.jsx(Se,{href:re,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Re=({handleCapture:i,width:l,disabled:t,clearPhotoInProgress:s,setClearPhotoInProgress:o,facingMode:n,setFacingMode:a,testOverride:p})=>{const[g,U]=y.useState(p||"pending"),M=y.useRef(null),[I,m]=y.useState(l),u=y.useCallback(Z(1e3,m),[]);y.useEffect(()=>{u(l)},[l,u]);function e(){if(M.current!==null){const d=M.current.getScreenshot();i(d)}}const r=ee();return f.jsxs(A,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!t&&!s?f.jsx(Pe,{width:I}):te()&&f.jsx(xe,{switchFacingMode:a}),f.jsx(T,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!t&&!s,width:I,children:!t&&f.jsx(Fe,{audio:!1,ref:M,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{U("error")},onUserMedia:()=>{U("success"),o(!1)},videoConstraints:{width:{ideal:I},facingMode:n}})}),f.jsx(N,{onClick:e,disabled:g!=="success"||t||s,children:"Take Photo"})]})},_e=y.memo(Re),Oe=150,Te=oe.getLogger("CameraInput");class We extends y.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new fe,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=t=>{this.setState({clearPhotoInProgress:t})},this.setFacingMode=()=>{this.setState(t=>({facingMode:t.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=t=>{if(t===null)return Promise.resolve();this.setState({imgSrc:t,shutter:!0,minShutterEffectPassed:!1});const s=o=>new Promise(n=>setTimeout(n,o));return ke(t,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(o=>this.props.uploadClient.fetchFileURLs([o]).then(n=>({file:o,fileUrls:n[0]}))).then(({file:o,fileUrls:n})=>this.uploadFile(n,o)).then(()=>s(Oe)).then(()=>{this.setState((o,n)=>({imgSrc:t,shutter:o.shutter,minShutterEffectPassed:!0}))}).catch(o=>{Te.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:s,widgetMgr:o,fragmentId:n}=this.props,a=o.getFileUploaderStateValue(s);se(t,a)||o.setFileUploaderStateValue(s,t,{fromUi:!0},n)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(j(t))return;this.setState({imgSrc:null});const{widgetMgr:s,element:o,fragmentId:n}=this.props;s.setFileUploaderStateValue(o,t,{fromUi:!0},n)})},this.deleteFile=t=>{const s=this.getFile(t);j(s)||(s.status.type==="uploading"&&s.status.abortController.abort(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(s.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(s=>({files:[...s.files,t]}))},this.removeFile=t=>{this.setState(s=>({files:s.files.filter(o=>o.id!==t)}))},this.getFile=t=>this.state.files.find(s=>s.id===t),this.updateFile=(t,s)=>{this.setState(o=>({files:o.files.map(n=>n.id===t?s:n)}))},this.onUploadComplete=(t,s)=>{this.setState(()=>({shutter:!1}));const o=this.getFile(t);j(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},this.onUploadProgress=(t,s)=>{const o=this.getFile(s);if(j(o)||o.status.type!=="uploading")return;const n=Math.round(t.loaded*100/t.total);o.status.progress!==n&&this.updateFile(s,o.setStatus({type:"uploading",abortController:o.status.abortController,progress:n}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(t,s)=>{const o=new AbortController,n=new W(s.name,s.size,this.nextLocalFileId(),{type:"uploading",abortController:o,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,s,a=>this.onUploadProgress(a,n.id),o.signal).then(()=>this.onUploadComplete(n.id,t)).catch(a=>{a instanceof DOMException&&a.name==="AbortError"||this.updateFile(n.id,n.setStatus({type:"error",errorMessage:a?a.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:t,element:s}=this.props,o=t.getFileUploaderStateValue(s);if(j(o))return l;const{uploadedFileInfo:n}=o;return j(n)||n.length===0?l:{files:n.map(a=>{const p=a.name,g=a.size,U=a.fileId,M=a.fileUrls;return new W(p,g,this.nextLocalFileId(),{type:"uploaded",fileId:U,fileUrls:M})}),imgSrc:n.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=t=>t.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:o}=this.props;s.getFileUploaderStateValue(t)===void 0&&s.setFileUploaderStateValue(t,l,{fromUi:!1},o)}createWidgetValue(){const l=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:s,size:o,status:n}=t;return new ne({fileId:n.fileId,fileUrls:n.fileUrls,name:s,size:o})});return new ae({uploadedFileInfo:l})}render(){const{element:l,widgetMgr:t,disabled:s,width:o}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),f.jsxs(A,{className:"stCameraInput","data-testid":"stCameraInput",children:[f.jsx(le,{label:l.label,disabled:s,labelVisibility:de(l.labelVisibility?.value),children:l.help&&f.jsx(ce,{children:f.jsx(ue,{content:l.help,placement:V.TOP_RIGHT})})}),this.state.imgSrc?f.jsxs(f.Fragment,{children:[f.jsx(T,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&f.jsx(ve,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),f.jsx(N,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||s,children:this.getProgress()?"Uploading...":f.jsxs(ye,{children:[f.jsx(O,{content:$,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):f.jsx(_e,{handleCapture:this.handleCapture,width:o,disabled:s,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function ke(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}const $e=ie(We);export{$e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as p,r as i,v as y,w as T,j as f,x}from"./index-
|
|
1
|
+
import{s as p,r as i,v as y,w as T,j as f,x}from"./index-wnKDraWU.js";const h=p("div",{target:"exyuj7n1"})(()=>({lineHeight:0}),""),L=p("audio",{target:"exyuj7n0"})(({theme:r})=>({width:"100%",height:r.sizes.minElementHeight,margin:0,padding:0}),""),S=x.getLogger("Audio");function j({element:r,endpoints:a,elementMgr:d}){const o=i.useRef(null),{startTime:n,endTime:s,loop:u,autoplay:E}=r,m=i.useMemo(()=>{if(!r.id)return!0;const e=d.getElementState(r.id,"preventAutoplay");return e||d.setElementState(r.id,"preventAutoplay",!0),e??!1},[r.id,d]);i.useEffect(()=>{o.current&&(o.current.currentTime=n)},[n]),i.useEffect(()=>{const e=o.current,t=()=>{e&&(e.currentTime=r.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[r]),i.useEffect(()=>{const e=o.current;if(!e)return;let t=!1;const l=()=>{s>0&&e.currentTime>=s&&(u?(e.currentTime=n||0,e.play()):t||(t=!0,e.pause()))};return s>0&&e.addEventListener("timeupdate",l),()=>{e&&s>0&&e.removeEventListener("timeupdate",l)}},[s,u,n]),i.useEffect(()=>{const e=o.current;if(!e)return;const t=()=>{u&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[u,n]);const c=y(r.url),A=T(c),v=a.buildMediaURL(c),g=e=>{const t=e.currentTarget.src;S.error(`Client Error: Audio source error - ${t}`),a.sendClientErrorToHost("Audio","Audio source failed to load","onerror triggered",t)};return f.jsx(h,{children:f.jsx(L,{className:"stAudio","data-testid":"stAudio",ref:o,controls:!0,autoPlay:E&&!m,src:v,onError:g,crossOrigin:A})})}const C=i.memo(j);export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,u as T,h as k,j as c,S as C,e as y,l as S,f as L,g as W,T as B,P as R,t as w,C as E}from"./index-
|
|
1
|
+
import{r as p,u as T,h as k,j as c,S as C,e as y,l as S,f as L,g as W,T as B,P as R,t as w,C as E}from"./index-wnKDraWU.js";import{u as P}from"./useBasicWidgetState-raTjAqZP.js";import{S as j,L as $,a as m}from"./checkbox-DUA9ewQT.js";import"./FormClearHelper-CaLJK07N.js";function v({element:t,disabled:a,widgetMgr:n,fragmentId:d}){const[f,g]=P({getStateFromWidgetMgr:X,getDefaultStateFromProto:H,getCurrStateFromProto:M,updateWidgetMgrState:V,element:t,widgetMgr:n,fragmentId:d}),x=p.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),e=T(),{colors:o,spacing:h,sizes:r}=e,u=k(e),b=a?o.fadedText40:o.bodyText;return c.jsx(C,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:c.jsx(j,{checked:f,disabled:a,onChange:x,"aria-label":t.label,checkmarkType:t.type===E.StyleType.TOGGLE?m.toggle:m.default,labelPlacement:$.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?o.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let s=u?o.bgColor:o.bodyText;return a&&(s=u?o.gray70:o.gray90),{width:`calc(${r.checkbox} - ${e.spacing.twoXS})`,height:`calc(${r.checkbox} - ${e.spacing.twoXS})`,transform:i?`translateX(${r.checkbox})`:"",backgroundColor:s,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:s})=>{let l=o.fadedText40;return s&&!a&&(l=o.fadedText20),i&&!a&&(l=o.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:e.spacing.twoXS,paddingLeft:e.spacing.threeXS,paddingRight:e.spacing.threeXS,width:`calc(2 * ${r.checkbox})`,minWidth:`calc(2 * ${r.checkbox})`,height:r.checkbox,minHeight:r.checkbox,borderBottomLeftRadius:e.radii.full,borderTopLeftRadius:e.radii.full,borderBottomRightRadius:e.radii.full,borderTopRightRadius:e.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:s})=>{const l=s&&!a?o.primary:o.fadedText40;return{outline:0,width:r.checkbox,height:r.checkbox,marginTop:e.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&s?`0 0 0 0.2rem ${w(o.primary,.5)}`:"",borderLeftWidth:r.borderWidth,borderRightWidth:r.borderWidth,borderTopWidth:r.borderWidth,borderBottomWidth:r.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:e.lineHeights.small,paddingLeft:e.spacing.sm,position:"relative",color:b}}},children:c.jsxs(y,{visibility:S(t.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[c.jsx(L,{source:t.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),t.help&&c.jsx(W,{color:b,children:c.jsx(B,{content:t.help,placement:R.TOP_RIGHT})})]})})})}function X(t,a){return t.getBoolValue(a)}function H(t){return t.default??null}function M(t){return t.value??null}function V(t,a,n,d){a.setBoolValue(t,n.value,{fromUi:n.fromUi},d)}const U=p.memo(v);export{U as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as L,r as i,v as N,I as U,w as O,V as R,j as p,x as w}from"./index-
|
|
1
|
+
import{s as L,r as i,v as N,I as U,w as O,V as R,j as p,x as w}from"./index-wnKDraWU.js";const x=L("iframe",{target:"evvcert0"})(({theme:r})=>({colorScheme:"normal",border:"none",padding:r.spacing.none,margin:r.spacing.none,width:"100%",aspectRatio:"16 / 9"}),""),A=w.getLogger("Video"),j={width:"100%"};function P({element:r,endpoints:o,elementMgr:f}){const n=i.useRef(null),{type:v,url:g,startTime:a,subtitles:y,endTime:s,loop:d,autoplay:m,muted:E}=r,c=N(g),l=U(y);let V=O(c);const b=i.useMemo(()=>{if(!r.id)return!0;const e=f.getElementState(r.id,"preventAutoplay");return e||f.setElementState(r.id,"preventAutoplay",!0),e??!1},[r.id,f]),S=i.useMemo(()=>JSON.stringify(l?l.map(e=>o.buildMediaURL(`${e.url}`)):[]),[l,o]);i.useEffect(()=>{const e=JSON.parse(S);e.length!==0&&e.forEach(t=>{o.checkSourceUrlResponse(t,"Video Subtitle")})},[S,o]),i.useEffect(()=>{n.current&&(n.current.currentTime=a)},[a]),i.useEffect(()=>{const e=n.current,t=()=>{e&&(e.currentTime=r.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[r]),i.useEffect(()=>{const e=n.current;if(!e)return;let t=!1;const u=()=>{s>0&&e.currentTime>=s&&(d?(e.currentTime=a||0,e.play()):t||(t=!0,e.pause()))};return s>0&&e.addEventListener("timeupdate",u),()=>{e&&s>0&&e.removeEventListener("timeupdate",u)}},[s,d,a]),i.useEffect(()=>{const e=n.current;if(!e)return;const t=()=>{d&&(e.currentTime=a||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[d,a]);const h=e=>{const t=new URL(e);if(a&&!isNaN(a)&&t.searchParams.append("start",a.toString()),s&&!isNaN(s)&&t.searchParams.append("end",s.toString()),d){t.searchParams.append("loop","1");const u=t.pathname.split("/").pop();u&&t.searchParams.append("playlist",u)}return m&&t.searchParams.append("autoplay","1"),E&&t.searchParams.append("mute","1"),t.toString()};if(v===R.Type.YOUTUBE_IFRAME)return p.jsx(x,{className:"stVideo","data-testid":"stVideo",title:c,src:h(c),allow:"autoplay; encrypted-media",allowFullScreen:!0});const T=e=>{const t=e.currentTarget.src;A.error(`Client Error: Video source error - ${t}`),o.sendClientErrorToHost("Video","Video source failed to load","onerror triggered",t)};return p.jsx("video",{className:"stVideo","data-testid":"stVideo",ref:n,controls:!0,muted:E,autoPlay:m&&!b,src:o.buildMediaURL(c),style:j,crossOrigin:V,onError:T,children:l?.map((e,t)=>p.jsx("track",{kind:"captions",src:o.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0,"data-testid":"stVideoSubtitle"},t))})}const I=i.memo(P);export{I as default};
|