streamlit-nightly 1.41.2.dev20250105__py2.py3-none-any.whl → 1.41.2.dev20250107__py2.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.
Files changed (98) hide show
  1. streamlit/elements/markdown.py +2 -2
  2. streamlit/elements/write.py +1 -1
  3. streamlit/static/index.html +1 -1
  4. streamlit/static/static/js/{FileDownload.esm.hzusuo1b.js → FileDownload.esm.Dod29kzi.js} +1 -1
  5. streamlit/static/static/js/{FormClearHelper.YHWCggTS.js → FormClearHelper.0CIwSBFI.js} +1 -1
  6. streamlit/static/static/js/{Hooks.Bs4Ve5LI.js → Hooks.D0iBCSJR.js} +1 -1
  7. streamlit/static/static/js/{InputInstructions.BLn5uLvO.js → InputInstructions.BGz0VNnm.js} +1 -1
  8. streamlit/static/static/js/ProgressBar.BaPlfiH4.js +2 -0
  9. streamlit/static/static/js/{RenderInPortalIfExists.CH7OWBaV.js → RenderInPortalIfExists.CDLwOGJN.js} +1 -1
  10. streamlit/static/static/js/Toolbar.U2Q07lHA.js +1 -0
  11. streamlit/static/static/js/{base-input.CsYjr-Mv.js → base-input.Fk16kR45.js} +4 -4
  12. streamlit/static/static/js/{createSuper.DdedKqOK.js → createSuper.B8NDjS0T.js} +1 -1
  13. streamlit/static/static/js/data-grid-overlay-editor.C0oC7OWz.js +1 -0
  14. streamlit/static/static/js/{downloader.DTiZHQMC.js → downloader.BLJWoPl1.js} +1 -1
  15. streamlit/static/static/js/{es6.oT7UuwOI.js → es6.D9yZ4-e5.js} +2 -2
  16. streamlit/static/static/js/getPrototypeOf.DKKmv0PS.js +1 -0
  17. streamlit/static/static/js/{iframeResizer.contentWindow.C4V1QE40.js → iframeResizer.contentWindow.Du2ek_IY.js} +1 -1
  18. streamlit/static/static/js/{index.Dq0mtJUi.js → index.B8MC65SU.js} +25 -25
  19. streamlit/static/static/js/{index.BceNwBQ7.js → index.BAADbUet.js} +1 -1
  20. streamlit/static/static/js/index.BEr9HRGP.js +1 -0
  21. streamlit/static/static/js/index.BGyFJsxB.js +1 -0
  22. streamlit/static/static/js/{index.U0queCso.js → index.BY0L_QLh.js} +2 -2
  23. streamlit/static/static/js/index.BZAVJreZ.js +1 -0
  24. streamlit/static/static/js/index.C2_hseSo.js +1 -0
  25. streamlit/static/static/js/{index.BlDvA0Pm.js → index.C73yVjC9.js} +11 -11
  26. streamlit/static/static/js/{index.yge1jSoD.js → index.C9Sks6cD.js} +1 -1
  27. streamlit/static/static/js/{index.CgwMN8Xv.js → index.CCLqv4q8.js} +1 -1
  28. streamlit/static/static/js/index.CGSuEM6K.js +1 -0
  29. streamlit/static/static/js/{index.Bw-My5yL.js → index.CIPlrA_8.js} +1 -1
  30. streamlit/static/static/js/{index.BozobE_y.js → index.CKwgjL0N.js} +1 -1
  31. streamlit/static/static/js/{index.Bo90e_Uc.js → index.CTvaDQgd.js} +2 -2
  32. streamlit/static/static/js/{index.I1VZoGQK.js → index.CaORMlLk.js} +1 -1
  33. streamlit/static/static/js/{index.D3_j16sc.js → index.Cfmr2hoW.js} +1 -1
  34. streamlit/static/static/js/{index.DKS2m2dW.js → index.CgHOvdK_.js} +1 -1
  35. streamlit/static/static/js/{index.DSToQbfG.js → index.Chl3QVe6.js} +1 -1
  36. streamlit/static/static/js/{index.DgYh-jV7.js → index.Cnd636WC.js} +3 -3
  37. streamlit/static/static/js/{index.Cd1M1khv.js → index.CxrCMTqd.js} +3 -3
  38. streamlit/static/static/js/{index.cf6LJRuO.js → index.CzDEy16B.js} +1 -1
  39. streamlit/static/static/js/{index.B00Rrwlo.js → index.D-s5XFne.js} +2 -2
  40. streamlit/static/static/js/{index.BwNWvULL.js → index.DCosyf4Y.js} +1 -1
  41. streamlit/static/static/js/{index.BE3Oy0-w.js → index.DU9T3IwS.js} +1 -1
  42. streamlit/static/static/js/index.DbcRQLkk.js +1 -0
  43. streamlit/static/static/js/index.DcJiNltm.js +197 -0
  44. streamlit/static/static/js/{index.DokSVIB2.js → index.DdG-jRFd.js} +1 -1
  45. streamlit/static/static/js/{index.CWgiCNwz.js → index.DnCNih03.js} +1 -1
  46. streamlit/static/static/js/index.DxFUMDyF.js +1 -0
  47. streamlit/static/static/js/index.HXS4cXj6.js +3 -0
  48. streamlit/static/static/js/{index.BEtyBSSz.js → index.K_IYAbRz.js} +100 -100
  49. streamlit/static/static/js/{index.D2jry5bi.js → index.NpAsSk7C.js} +1 -1
  50. streamlit/static/static/js/index.UMKksAwF.js +1 -0
  51. streamlit/static/static/js/index.clUXhmTv.js +201 -0
  52. streamlit/static/static/js/index.d_eIUHvJ.js +2 -0
  53. streamlit/static/static/js/{index.BOcbB1Se.js → index.n6SGF_yN.js} +1 -1
  54. streamlit/static/static/js/{index.qDaxAO86.js → index.ncJlJcLt.js} +2 -2
  55. streamlit/static/static/js/{input.BZL_gOdc.js → input.BX19stYv.js} +2 -2
  56. streamlit/static/static/js/{memory.DMPJKDWA.js → memory.DrUTC0E1.js} +1 -1
  57. streamlit/static/static/js/mergeWith.DthgK8_y.js +1 -0
  58. streamlit/static/static/js/number-overlay-editor.17BCi9Ve.js +9 -0
  59. streamlit/static/static/js/{sandbox.DUM1HsOb.js → sandbox.5Hd92fh0.js} +1 -1
  60. streamlit/static/static/js/{slicedToArray.B6rsNbE6.js → slicedToArray.Bu7hUD78.js} +1 -1
  61. streamlit/static/static/js/{textarea.BEHsDT2-.js → textarea.B2pXMKyh.js} +2 -2
  62. streamlit/static/static/js/threshold.B8r8f5kt.js +1 -0
  63. streamlit/static/static/js/{timepicker.D7ARfySh.js → timepicker.5G_63qYl.js} +1 -1
  64. streamlit/static/static/js/timer.RueuYoQV.js +1 -0
  65. streamlit/static/static/js/{uniqueId.r-l9CNmZ.js → uniqueId.B7repv29.js} +1 -1
  66. streamlit/static/static/js/{useBasicWidgetState.yEDDcbjV.js → useBasicWidgetState.ZoM17KXF.js} +1 -1
  67. streamlit/static/static/js/{useOnInputChange.MQgT3jRx.js → useOnInputChange.DK_jsnv_.js} +1 -1
  68. streamlit/static/static/js/value.iufjd77T.js +1 -0
  69. streamlit/static/static/js/withFullScreenWrapper.ByjGCoNh.js +1 -0
  70. streamlit/type_util.py +1 -1
  71. {streamlit_nightly-1.41.2.dev20250105.dist-info → streamlit_nightly-1.41.2.dev20250107.dist-info}/METADATA +1 -1
  72. {streamlit_nightly-1.41.2.dev20250105.dist-info → streamlit_nightly-1.41.2.dev20250107.dist-info}/RECORD +76 -76
  73. streamlit/static/static/js/ProgressBar.syQAAKS_.js +0 -2
  74. streamlit/static/static/js/Toolbar.BytO0Vjs.js +0 -1
  75. streamlit/static/static/js/_commonjs-dynamic-modules.TDtrdbi3.js +0 -1
  76. streamlit/static/static/js/data-grid-overlay-editor.HI85rFWc.js +0 -1
  77. streamlit/static/static/js/getPrototypeOf.CfOrwPYw.js +0 -1
  78. streamlit/static/static/js/index.BFuk3D-a.js +0 -1
  79. streamlit/static/static/js/index.BLsk_Naj.js +0 -201
  80. streamlit/static/static/js/index.BtyW8_Lq.js +0 -1
  81. streamlit/static/static/js/index.C7m2u1Hi.js +0 -1
  82. streamlit/static/static/js/index.CKLsExlx.js +0 -2
  83. streamlit/static/static/js/index.CSkOy9Ie.js +0 -1
  84. streamlit/static/static/js/index.D2sEk90l.js +0 -197
  85. streamlit/static/static/js/index.DJaNJkBl.js +0 -1
  86. streamlit/static/static/js/index.IkCWa6ie.js +0 -1
  87. streamlit/static/static/js/index.e2mIXcY7.js +0 -32
  88. streamlit/static/static/js/index.ln_0INpA.js +0 -1
  89. streamlit/static/static/js/index.wXwVYako.js +0 -1
  90. streamlit/static/static/js/number-overlay-editor.DgxZowLy.js +0 -9
  91. streamlit/static/static/js/string.Bl9OLDCw.js +0 -1
  92. streamlit/static/static/js/threshold.skajmqVB.js +0 -1
  93. streamlit/static/static/js/timer.DwZfkapc.js +0 -1
  94. streamlit/static/static/js/withFullScreenWrapper.CkGbHkwr.js +0 -1
  95. {streamlit_nightly-1.41.2.dev20250105.data → streamlit_nightly-1.41.2.dev20250107.data}/scripts/streamlit.cmd +0 -0
  96. {streamlit_nightly-1.41.2.dev20250105.dist-info → streamlit_nightly-1.41.2.dev20250107.dist-info}/WHEEL +0 -0
  97. {streamlit_nightly-1.41.2.dev20250105.dist-info → streamlit_nightly-1.41.2.dev20250107.dist-info}/entry_points.txt +0 -0
  98. {streamlit_nightly-1.41.2.dev20250105.dist-info → streamlit_nightly-1.41.2.dev20250107.dist-info}/top_level.txt +0 -0
@@ -1 +0,0 @@
1
- import{r as s,M as R,bZ as T,a8 as U,j as l,a$ as k,bc as A,b0 as P,aL as B,b1 as D}from"./index.Dq0mtJUi.js";import{u as j}from"./uniqueId.r-l9CNmZ.js";import{u as _,a as $,b as K}from"./useOnInputChange.MQgT3jRx.js";import{I as O}from"./InputInstructions.BLn5uLvO.js";import{a as q}from"./useBasicWidgetState.yEDDcbjV.js";import{T as G}from"./textarea.BEHsDT2-.js";import"./inputUtils.CQWz5UKz.js";import"./FormClearHelper.YHWCggTS.js";import"./base-input.CsYjr-Mv.js";const W=(a,t)=>a.getStringValue(t)??t.default??null,N=a=>a.default??null,Z=a=>a.value??null,w=(a,t,o,u)=>{t.setStringValue(a,o.value,{fromUi:o.fromUi},u)},J=({disabled:a,element:t,widgetMgr:o,fragmentId:u,width:h})=>{var x;const g=s.useRef(j("text_area_")).current,[r,n]=s.useState(!1),[S,b]=s.useState(!1),[i,d]=s.useState(W(o,t)??null),y=s.useCallback(()=>{d(t.default??null),n(!0)},[t]),[I,c]=q({getStateFromWidgetMgr:W,getDefaultStateFromProto:N,getCurrStateFromProto:Z,updateWidgetMgrState:w,element:t,widgetMgr:o,fragmentId:u,onFormCleared:y});_(I,i,d,r);const e=R(),p=s.useCallback(()=>{n(!1),c({value:i,fromUi:!0})},[i,c]),V=s.useCallback(()=>{r&&p(),b(!1)},[r,p]),C=s.useCallback(()=>{b(!0)},[]),F=$({formId:t.formId,maxChars:t.maxChars,setDirty:n,setUiValue:d,setValueWithSource:c}),v=K(t.formId,p,r,o,u,!0),E={width:h},{height:f,placeholder:z,formId:m}=t,H=T({formId:m})?o.allowFormEnterToSubmit(m):r,L=S&&h>e.breakpoints.hideWidgetDetails;return U("div",{className:"stTextArea","data-testid":"stTextArea",style:E,children:[l(D,{label:t.label,disabled:a,labelVisibility:k((x=t.labelVisibility)==null?void 0:x.value),htmlFor:g,children:t.help&&l(A,{children:l(P,{content:t.help,placement:B.TOP_RIGHT})})}),l(G,{value:i??"",placeholder:z,onBlur:V,onFocus:C,onChange:F,onKeyDown:v,"aria-label":t.label,disabled:a,id:g,overrides:{Input:{style:{lineHeight:e.lineHeights.inputWidget,height:f?`${f}px`:"",minHeight:e.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:e.spacing.lg,paddingLeft:e.spacing.lg,paddingBottom:e.spacing.lg,paddingTop:e.spacing.lg}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}}}}),L&&l(O,{dirty:r,value:i??"",maxLength:t.maxChars,type:"multiline",inForm:T({formId:m}),allowEnterToSubmit:H})]})},rt=s.memo(J);export{rt as default};
@@ -1 +0,0 @@
1
- import{r as y,E as _,_ as T,n as E,X as Q,a8 as x,j as h,b2 as J,aL as A,aZ as K,aH as Y,aY as O,b9 as B,d as Z,g as ee,aj as te,M as re,ba as ie,bb as oe,R as ae,O as ne,a0 as se,A as P,au as W,aV as le,aU as de,a$ as ce,bc as ue,b0 as pe,b1 as fe,F as he}from"./index.Dq0mtJUi.js";import{F as ge}from"./FormClearHelper.YHWCggTS.js";import{U as L}from"./UploadFileInfo.C-jY39rj.js";import{P as me,S as ve}from"./ProgressBar.syQAAKS_.js";var z=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{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"}))});z.displayName="Video";var $=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{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";var N=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{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"}))});N.displayName="SwitchCamera";var j;(function(t){t.XSMALL="xsmall",t.SMALL="small",t.MEDIUM="medium",t.LARGE="large"})(j||(j={}));function Se(t,l){switch(t){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 H=E("div",{target:"e19i1xpo0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),V=E("div",{target:"e19i1xpo1"})(({theme:t,width:l})=>({backgroundColor:t.colors.secondaryBg,borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),ye=E("p",{target:"e19i1xpo2"})(({theme:t})=>({marginTop:t.spacing.sm,textAlign:"center"})),Me=E("img",{target:"e19i1xpo3"})(({theme:t,opacity:l})=>({borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,objectFit:"contain",opacity:l})),be=E("a",{target:"e19i1xpo4"})(({theme:t})=>({color:t.colors.primary,display:"block",textDecoration:"none"})),we=E("span",{target:"e19i1xpo5"})({display:"flex",alignItems:"center"}),Ue=E("div",{target:"e19i1xpo6"})(({theme:t})=>({position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:t.zIndices.priority,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Ce=E("div",{target:"e19i1xpo8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),Ee=E("button",{target:"e19i1xpo9"})(({theme:t})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:`${t.sizes.borderWidth} solid ${t.colors.borderColor}`,borderRadius:`0 0 ${t.radii.default} ${t.radii.default}`,"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:`${t.spacing.xs} ${t.spacing.md}`,margin:t.spacing.none,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${Q(t.colors.primary,.5)}`},...Se("medium",t)}));function D({disabled:t,onClick:l,children:r,progress:a}){return x(Ee,{disabled:t||!1,onClick:l||(()=>{}),progress:a||null,"data-testid":"stCameraInputButton",children:[r,a&&h(Ce,{children:h(me,{value:a,size:ve.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})})]})}var F;(function(t){t.USER="user",t.ENVIRONMENT="environment"})(F||(F={}));const Ie=({switchFacingMode:t})=>h(Ue,{"data-testid":"stCameraInputSwitchButton",children:h(J,{content:"Switch camera",placement:A.TOP_RIGHT,children:h(K,{kind:Y.MINIMAL,onClick:t,children:h(O,{content:N,size:"twoXL",color:B.white})})})});var G={exports:{}};(function(t,l){(function(a,o){t.exports=o(y)})(Z,function(r){return function(a){var o={};function n(s){if(o[s])return o[s].exports;var p=o[s]={i:s,l:!1,exports:{}};return a[s].call(p.exports,p,p.exports,n),p.l=!0,p.exports}return n.m=a,n.c=o,n.d=function(s,p,g){n.o(s,p)||Object.defineProperty(s,p,{enumerable:!0,get:g})},n.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},n.t=function(s,p){if(p&1&&(s=n(s)),p&8||p&4&&typeof s=="object"&&s&&s.__esModule)return s;var g=Object.create(null);if(n.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:s}),p&2&&typeof s!="string")for(var C in s)n.d(g,C,(function(U){return s[U]}).bind(null,C));return g},n.n=function(s){var p=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(p,"a",p),p},n.o=function(s,p){return Object.prototype.hasOwnProperty.call(s,p)},n.p="",n(n.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(a,o,n){n.r(o);var s=n("react"),p=function(){var m=function(u,e){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,d){i.__proto__=d}||function(i,d){for(var c in d)d.hasOwnProperty(c)&&(i[c]=d[c])},m(u,e)};return function(u,e){m(u,e);function i(){this.constructor=u}u.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),g=function(){return g=Object.assign||function(m){for(var u,e=1,i=arguments.length;e<i;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)},C=function(m,u){var e={};for(var i in m)Object.prototype.hasOwnProperty.call(m,i)&&u.indexOf(i)<0&&(e[i]=m[i]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,i=Object.getOwnPropertySymbols(m);d<i.length;d++)u.indexOf(i[d])<0&&Object.prototype.propertyIsEnumerable.call(m,i[d])&&(e[i[d]]=m[i[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(i,d){e.call(navigator,u,i,d)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=function(m){p(u,m);function u(e){var i=m.call(this,e)||this;return i.canvas=null,i.ctx=null,i.requestUserMediaId=0,i.unmounted=!1,i.state={hasUserMedia:!1},i}return u.prototype.componentDidMount=function(){var e=this,i=e.state,d=e.props;if(this.unmounted=!1,!U()){d.onUserMediaError("getUserMedia not supported");return}i.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(e){var i=this.props;if(!U()){i.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(e.audioConstraints)!==JSON.stringify(i.audioConstraints),c=JSON.stringify(e.videoConstraints)!==JSON.stringify(i.videoConstraints),M=e.minScreenshotWidth!==i.minScreenshotWidth,S=e.minScreenshotHeight!==i.minScreenshotHeight;(c||M||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(i){e.removeTrack(i),i.stop()}),e.getAudioTracks().map(function(i){e.removeTrack(i),i.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 i=this,d=i.state,c=i.props;if(!d.hasUserMedia)return null;var M=this.getCanvas(e);return M&&M.toDataURL(c.screenshotFormat,c.screenshotQuality)},u.prototype.getCanvas=function(e){var i=this,d=i.state,c=i.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var M=this.video.videoWidth,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var f=M/S;M=c.minScreenshotWidth||this.video.clientWidth,S=M/f,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,M=S*f)}this.canvas=document.createElement("canvas"),this.canvas.width=(e==null?void 0:e.width)||M,this.canvas.height=(e==null?void 0:e.height)||S,this.ctx=this.canvas.getContext("2d")}var w=this,b=w.ctx,v=w.canvas;return b&&v&&(v.width=(e==null?void 0:e.width)||v.width,v.height=(e==null?void 0:e.height)||v.height,c.mirrored&&(b.translate(v.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,(e==null?void 0:e.width)||v.width,(e==null?void 0:e.height)||v.height),c.mirrored&&(b.scale(-1,1),b.translate(-v.width,0))),v},u.prototype.requestUserMedia=function(){var e=this,i=this.props,d=function(S,f){var w={video:typeof f<"u"?f:!0};i.audio&&(w.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(w).then(function(v){e.unmounted||b!==e.requestUserMediaId?u.stopMediaStream(v):e.handleUserMedia(null,v)}).catch(function(v){e.handleUserMedia(v)})};if("mediaDevices"in navigator)d(i.audioConstraints,i.videoConstraints);else{var c=function(S){return{optional:[{sourceId:S}]}},M=function(S){var f=S.deviceId;return typeof f=="string"?f:Array.isArray(f)&&f.length>0?f[0]:typeof f=="object"&&f.ideal?f.ideal:null};MediaStreamTrack.getSources(function(S){var f=null,w=null;S.forEach(function(R){R.kind==="audio"?f=R.id:R.kind==="video"&&(w=R.id)});var b=M(i.audioConstraints);b&&(f=b);var v=M(i.videoConstraints);v&&(w=v),d(c(f),c(w))})}},u.prototype.handleUserMedia=function(e,i){var d=this.props;if(e||!i){this.setState({hasUserMedia:!1}),d.onUserMediaError(e);return}this.stream=i;try{this.video&&(this.video.srcObject=i),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(i)})}d.onUserMedia(i)},u.prototype.render=function(){var e=this,i=this,d=i.state,c=i.props,M=c.audio;c.forceScreenshotSourceSize,c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var S=c.mirrored,f=c.style,w=f===void 0?{}:f,b=c.children,v=C(c,["audio","forceScreenshotSourceSize","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),R=S?g(g({},w),{transform:(w.transform||"")+" scaleX(-1)"}):w,X={getScreenshot:this.getScreenshot.bind(this)};return s.createElement(s.Fragment,null,s.createElement("video",g({autoPlay:!0,src:d.src,muted:!M,playsInline:!0,ref:function(q){e.video=q},style:R},v)),b&&b(X))},u.defaultProps={audio:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(s.Component);o.default=I},react:function(a,o){a.exports=r}}).default})})(G);var Fe=G.exports;const xe=ee(Fe);var k;(function(t){t.PENDING="pending",t.SUCCESS="success",t.ERROR="error"})(k||(k={}));const Re=({width:t})=>x(V,{width:t,children:[h(O,{size:"threeXL",color:B.gray60,content:z}),x(ye,{children:["This app would like to use your camera.",h(be,{href:oe,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Pe=({handleCapture:t,width:l,disabled:r,clearPhotoInProgress:a,setClearPhotoInProgress:o,facingMode:n,setFacingMode:s,testOverride:p})=>{const[g,C]=y.useState(p||"pending"),U=y.useRef(null),[I,m]=y.useState(l),u=y.useCallback(te(1e3,m),[]);y.useEffect(()=>{u(l)},[l,u]);function e(){if(U.current!==null){const d=U.current.getScreenshot();t(d)}}const i=re();return x(H,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!r&&!a?h(Re,{width:I}):ie&&h(Ie,{switchFacingMode:s}),h(V,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!r&&!a,width:I,children:!r&&h(xe,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${i.radii.default} ${i.radii.default} 0 0`},onUserMediaError:()=>{C("error")},onUserMedia:()=>{C("success"),o(!1)},videoConstraints:{width:{ideal:I},facingMode:n}})}),h(D,{onClick:e,disabled:g!=="success"||r||a,children:"Take Photo"})]})},_e=150;class je extends ae.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new ge,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=r=>{this.setState({clearPhotoInProgress:r})},this.setFacingMode=()=>{this.setState(r=>({facingMode:r.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=r=>{if(r===null)return Promise.resolve();this.setState({imgSrc:r,shutter:!0,minShutterEffectPassed:!1});const a=o=>new Promise(n=>setTimeout(n,o));return Te(r,`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(()=>a(_e)).then(()=>{this.setState((o,n)=>({imgSrc:r,shutter:o.shutter,minShutterEffectPassed:!0}))}).catch(o=>{ne(o)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(r=>this.deleteFile(r.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const r=this.createWidgetValue(),{element:a,widgetMgr:o,fragmentId:n}=this.props,s=o.getFileUploaderStateValue(a);se(r,s)||o.setFileUploaderStateValue(a,r,{fromUi:!0},n)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const r=this.createWidgetValue();if(P(r))return;this.setState({imgSrc:null});const{widgetMgr:a,element:o,fragmentId:n}=this.props;a.setFileUploaderStateValue(o,r,{fromUi:!0},n)})},this.deleteFile=r=>{const a=this.getFile(r);P(a)||(a.status.type==="uploading"&&a.status.cancelToken.cancel(),a.status.type==="uploaded"&&a.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(a.status.fileUrls.deleteUrl),this.removeFile(r))},this.addFile=r=>{this.setState(a=>({files:[...a.files,r]}))},this.removeFile=r=>{this.setState(a=>({files:a.files.filter(o=>o.id!==r)}))},this.getFile=r=>this.state.files.find(a=>a.id===r),this.updateFile=(r,a)=>{this.setState(o=>({files:o.files.map(n=>n.id===r?a:n)}))},this.onUploadComplete=(r,a)=>{this.setState(()=>({shutter:!1}));const o=this.getFile(r);P(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:a.fileId,fileUrls:a}))},this.onUploadProgress=(r,a)=>{const o=this.getFile(a);if(P(o)||o.status.type!=="uploading")return;const n=Math.round(r.loaded*100/r.total);o.status.progress!==n&&this.updateFile(a,o.setStatus({type:"uploading",cancelToken:o.status.cancelToken,progress:n}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(r,a)=>{const o=W.CancelToken.source(),n=new L(a.name,a.size,this.nextLocalFileId(),{type:"uploading",cancelToken:o,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,r.uploadUrl,a,s=>this.onUploadProgress(s,n.id),o.token).then(()=>this.onUploadComplete(n.id,r)).catch(s=>{W.isCancel(s)||this.updateFile(n.id,n.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:F.USER},{widgetMgr:r,element:a}=this.props,o=r.getFileUploaderStateValue(a);if(P(o))return l;const{uploadedFileInfo:n}=o;return P(n)||n.length===0?l:{files:n.map(s=>{const p=s.name,g=s.size,C=s.fileId,U=s.fileUrls;return new L(p,g,this.nextLocalFileId(),{type:"uploaded",fileId:C,fileUrls:U})}),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=r=>r.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:r,widgetMgr:a,fragmentId:o}=this.props;a.getFileUploaderStateValue(r)===void 0&&a.setFileUploaderStateValue(r,l,{fromUi:!1},o)}createWidgetValue(){const l=this.state.files.filter(r=>r.status.type==="uploaded").map(r=>{const{name:a,size:o,status:n}=r;return new le({fileId:n.fileId,fileUrls:n.fileUrls,name:a,size:o})});return new de({uploadedFileInfo:l})}render(){var n;const{element:l,widgetMgr:r,disabled:a,width:o}=this.props;return this.formClearHelper.manageFormClearListener(r,l.formId,this.onFormCleared),x(H,{className:"stCameraInput","data-testid":"stCameraInput",children:[h(fe,{label:l.label,disabled:a,labelVisibility:ce((n=l.labelVisibility)==null?void 0:n.value),children:l.help&&h(ue,{children:h(pe,{content:l.help,placement:A.TOP_RIGHT})})}),this.state.imgSrc?x(he,{children:[h(V,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h(Me,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),h(D,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||a,children:this.getProgress()?"Uploading...":x(we,{children:[h(O,{content:$,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h(Pe,{handleCapture:this.handleCapture,width:o,disabled:a,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Te(t,l){return fetch(t).then(r=>r.arrayBuffer()).then(r=>new File([r],l,{type:"image/jpeg"}))}export{je as default};