@micromag/viewer-build 0.2.375 → 0.2.379

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 (38) hide show
  1. package/build/asset-manifest.json +32 -32
  2. package/build/index.html +1 -1
  3. package/build/static/js/{0.d6615697.chunk.js → 0.ae1e2b23.chunk.js} +2 -2
  4. package/build/static/js/{0.d6615697.chunk.js.map → 0.ae1e2b23.chunk.js.map} +1 -1
  5. package/build/static/js/{1.84e1cdcb.chunk.js → 1.dc635ac3.chunk.js} +2 -2
  6. package/build/static/js/{1.84e1cdcb.chunk.js.map → 1.dc635ac3.chunk.js.map} +1 -1
  7. package/build/static/js/{10.8b0419b5.chunk.js → 10.c4c543ba.chunk.js} +2 -2
  8. package/build/static/js/{10.8b0419b5.chunk.js.map → 10.c4c543ba.chunk.js.map} +1 -1
  9. package/build/static/js/{11.e1e1974b.chunk.js → 11.926ced06.chunk.js} +2 -2
  10. package/build/static/js/{11.e1e1974b.chunk.js.map → 11.926ced06.chunk.js.map} +1 -1
  11. package/build/static/js/{12.16cd885e.chunk.js → 12.08deb037.chunk.js} +2 -2
  12. package/build/static/js/{12.16cd885e.chunk.js.map → 12.08deb037.chunk.js.map} +1 -1
  13. package/build/static/js/{15.45593407.chunk.js → 15.31f10001.chunk.js} +2 -2
  14. package/build/static/js/{15.45593407.chunk.js.map → 15.31f10001.chunk.js.map} +1 -1
  15. package/build/static/js/{2.bf398c67.chunk.js → 2.c4cf9c8a.chunk.js} +2 -2
  16. package/build/static/js/{2.bf398c67.chunk.js.map → 2.c4cf9c8a.chunk.js.map} +1 -1
  17. package/build/static/js/5.489576ba.chunk.js +3 -0
  18. package/build/static/js/{5.ed62aa71.chunk.js.LICENSE.txt → 5.489576ba.chunk.js.LICENSE.txt} +0 -0
  19. package/build/static/js/5.489576ba.chunk.js.map +1 -0
  20. package/build/static/js/{6.a8954d03.chunk.js → 6.4ed08336.chunk.js} +2 -2
  21. package/build/static/js/6.4ed08336.chunk.js.map +1 -0
  22. package/build/static/js/{7.8d671ab5.chunk.js → 7.30c6cad9.chunk.js} +2 -2
  23. package/build/static/js/{7.8d671ab5.chunk.js.map → 7.30c6cad9.chunk.js.map} +1 -1
  24. package/build/static/js/{8.2d291684.chunk.js → 8.959d6a7c.chunk.js} +2 -2
  25. package/build/static/js/{8.2d291684.chunk.js.map → 8.959d6a7c.chunk.js.map} +1 -1
  26. package/build/static/js/{9.13fb035e.chunk.js → 9.13a28a70.chunk.js} +2 -2
  27. package/build/static/js/{9.13fb035e.chunk.js.map → 9.13a28a70.chunk.js.map} +1 -1
  28. package/build/static/js/main.ab525e20.chunk.js +2 -0
  29. package/build/static/js/main.ab525e20.chunk.js.map +1 -0
  30. package/build/static/js/runtime-main.db3c76f2.js +2 -0
  31. package/build/static/js/{runtime-main.78efeb88.js.map → runtime-main.db3c76f2.js.map} +1 -1
  32. package/package.json +7 -7
  33. package/build/static/js/5.ed62aa71.chunk.js +0 -3
  34. package/build/static/js/5.ed62aa71.chunk.js.map +0 -1
  35. package/build/static/js/6.a8954d03.chunk.js.map +0 -1
  36. package/build/static/js/main.2c973f79.chunk.js +0 -2
  37. package/build/static/js/main.2c973f79.chunk.js.map +0 -1
  38. package/build/static/js/runtime-main.78efeb88.js +0 -2
@@ -1,2 +1,2 @@
1
- (this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[7],{453:function(e,t,i){var r=i(457);function n(t,i,o){return"undefined"!==typeof Reflect&&Reflect.get?e.exports=n=Reflect.get:e.exports=n=function(e,t,i){var n=r(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(i):o.value}},n(t,i,o||t)}e.exports=n},457:function(e,t,i){var r=i(149);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e}},477:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(){return r("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55"},r("path",{d:"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z",fillRule:"evenodd"}))}},500:function(e,t,i){"use strict";var r=i(96),n={"audio/mp3":"mp3","audio/mp4":"mp4","audio/ogg":"ogg","audio/webm":"webm","image/gif":"gif","image/heic":"heic","image/heif":"heif","image/jpeg":"jpg","image/png":"png","image/svg+xml":"svg","video/mp4":"mp4","video/ogg":"ogv","video/quicktime":"mov","video/webm":"webm","video/x-matroska":"mkv","video/x-msvideo":"avi"};e.exports=function(e){var t=e.split(";",1);return e=r(t,1)[0],n[e]||null}},501:function(e,t,i){"use strict";e.exports=function(e,t,i){return new Promise((function(r){e.toBlob(r,t,i)}))}},502:function(e,t,i){"use strict";e.exports=function(){return"function"===typeof MediaRecorder&&!!MediaRecorder.prototype&&"function"===typeof MediaRecorder.prototype.start}},503:function(e,t,i){"use strict";var r=i(20),n=i(21),o=i(24),s=i(25);function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},a.apply(this,arguments)}var c=i(17),u=c.h,d=c.Component,p=i(504),l=i(505),h=i(506),g=i(508),v=i(509),m=i(510);function f(e,t){return-1!==e.indexOf(t)}var y=function(e){o(i,e);var t=s(i);function i(){return r(this,i),t.apply(this,arguments)}return n(i,[{key:"componentDidMount",value:function(){(0,this.props.onFocus)()}},{key:"componentWillUnmount",value:function(){(0,this.props.onStop)()}},{key:"render",value:function(){var e=this,t=this.props,i=t.src,r=t.recordedVideo,n=t.recording,o=t.modes,s=t.supportsRecording,c=t.videoSources,d=t.showVideoSourceDropdown,y=t.showRecordingLength,b=t.onSubmit,w=t.i18n,S=t.mirror,R=t.onSnapshot,k=t.onStartRecording,C=t.onStopRecording,x=t.onDiscardRecordedVideo,P=t.recordingLengthSeconds,I=!!r,M=!I&&s&&(f(o,"video-only")||f(o,"audio-only")||f(o,"video-audio")),T=!I&&f(o,"picture"),V=s&&y,L=d&&c&&c.length>1,D={playsinline:!0};return r?(D.muted=!1,D.controls=!0,D.src=r,this.videoElement&&(this.videoElement.srcObject=void 0)):(D.muted=!0,D.autoplay=!0,D.srcObject=i),u("div",{className:"uppy uppy-Webcam-container"},u("div",{className:"uppy-Webcam-videoContainer"},u("video",a({ref:function(t){return e.videoElement=t},className:"uppy-Webcam-video ".concat(S?"uppy-Webcam-video--mirrored":"")},D))),u("div",{className:"uppy-Webcam-footer"},u("div",{className:"uppy-Webcam-videoSourceContainer"},L?g(this.props):null),u("div",{className:"uppy-Webcam-buttonContainer"},T&&u(p,{onSnapshot:R,i18n:w}),M&&u(l,{recording:n,onStartRecording:k,onStopRecording:C,i18n:w}),I&&u(v,{onSubmit:b,i18n:w}),I&&u(m,{onDiscard:x,i18n:w})),V&&u("div",{className:"uppy-Webcam-recordingLength"},u(h,{recordingLengthSeconds:P,i18n:w}))))}}]),i}(d);e.exports=y},504:function(e,t,i){"use strict";var r=i(17).h,n=i(477);e.exports=function(e){var t=e.onSnapshot,i=e.i18n;return r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:i("takePicture"),"aria-label":i("takePicture"),onClick:t,"data-uppy-super-focusable":!0},n())}},505:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.recording,i=e.onStartRecording,n=e.onStopRecording,o=e.i18n;return t?r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:o("stopRecording"),"aria-label":o("stopRecording"),onClick:n,"data-uppy-super-focusable":!0},r("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},r("rect",{x:"15",y:"15",width:"70",height:"70"}))):r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:o("startRecording"),"aria-label":o("startRecording"),onClick:i,"data-uppy-super-focusable":!0},r("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},r("circle",{cx:"50",cy:"50",r:"40"})))}},506:function(e,t,i){"use strict";var r=i(17).h,n=i(507);e.exports=function(e){var t=e.recordingLengthSeconds,i=e.i18n,o=n(t);return r("span",{"aria-label":i("recordingLength",{recording_length:o})},o)}},507:function(e,t,i){"use strict";e.exports=function(e){return"".concat(Math.floor(e/60),":").concat(String(e%60).padStart(2,0))}},508:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.currentDeviceId,i=e.videoSources,n=e.onChangeVideoSource;return r("div",{className:"uppy-Webcam-videoSource"},r("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:function(e){n(e.target.value)}},i.map((function(e){return r("option",{key:e.deviceId,value:e.deviceId,selected:e.deviceId===t},e.label)}))))}},509:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.onSubmit,i=e.i18n;return r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit",type:"button",title:i("submitRecordedFile"),"aria-label":i("submitRecordedFile"),onClick:t,"data-uppy-super-focusable":!0},r("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},r("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})))}},510:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.onDiscard,i=e.i18n;return r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:i("discardRecordedFile"),"aria-label":i("discardRecordedFile"),onClick:t,"data-uppy-super-focusable":!0},r("svg",{width:"13",height:"13",viewBox:"0 0 13 13",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},r("g",{fill:"#FFF",fillRule:"evenodd"},r("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),r("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"}))))}},511:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){return r("div",{className:"uppy-Webcam-permissons"},r("div",{className:"uppy-Webcam-permissonsIcon"},e.icon()),r("h1",{className:"uppy-Webcam-title"},e.hasCamera?e.i18n("allowAccessTitle"):e.i18n("noCameraTitle")),r("p",null,e.hasCamera?e.i18n("allowAccessDescription"):e.i18n("noCameraDescription")))}},535:function(e,t,i){"use strict";var r,n,o,s=i(51),a=i(226),c=i(29),u=i(20),d=i(21),p=i(56),l=i(453),h=i(149),g=i(24),v=i(25);function m(){return m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},m.apply(this,arguments)}function f(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var y=0;function b(e){return"__private_"+y+++"_"+e}var w=i(17).h,S=i(53).UIPlugin,R=i(500),k=i(232),C=i(501),x=i(502),P=i(477),I=i(503),M=i(511);function T(e){return"."===e[0]?k[e.slice(1)]:e}function V(e){return/^video\/[^*]+$/.test(e)}function L(e){return/^image\/[^*]+$/.test(e)}e.exports=(n=b("enableMirror"),o=r=function(e){g(i,e);var t=v(i);function i(e,r){var o;u(this,i),o=t.call(this,e,r),Object.defineProperty(p(o),n,{writable:!0,value:void 0}),o.mediaDevices=navigator.mediaDevices,o.supportsUserMedia=!!o.mediaDevices,o.protocol=location.protocol.match(/https/i)?"https":"http",o.id=o.opts.id||"Webcam",o.type="acquirer",o.capturedMediaFile=null,o.icon=function(){return w("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},w("g",{fill:"none",fillRule:"evenodd"},w("rect",{className:"uppy-ProviderIconBg",fill:"#03BFEF",width:"32",height:"32",rx:"16"}),w("path",{d:"M22 11c1.133 0 2 .867 2 2v7.333c0 1.134-.867 2-2 2H10c-1.133 0-2-.866-2-2V13c0-1.133.867-2 2-2h2.333l1.134-1.733C13.6 9.133 13.8 9 14 9h4c.2 0 .4.133.533.267L19.667 11H22zm-6 1.533a3.764 3.764 0 0 0-3.8 3.8c0 2.129 1.672 3.801 3.8 3.801s3.8-1.672 3.8-3.8c0-2.13-1.672-3.801-3.8-3.801zm0 6.261c-1.395 0-2.46-1.066-2.46-2.46 0-1.395 1.065-2.461 2.46-2.461s2.46 1.066 2.46 2.46c0 1.395-1.065 2.461-2.46 2.461z",fill:"#FFF",fillRule:"nonzero"})))},o.defaultLocale={strings:{pluginNameCamera:"Camera",smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",allowAccessTitle:"Please allow access to your camera",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site.",noCameraTitle:"Camera Not Available",noCameraDescription:"In order to take pictures or record video, please connect a camera device",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",recordingLength:"Recording length %{recording_length}",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file"}};var s={onBeforeSnapshot:function(){return Promise.resolve()},countdown:!1,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,showVideoSourceDropdown:!1,facingMode:"user",preferredImageMimeType:null,preferredVideoMimeType:null,showRecordingLength:!1};return o.opts=c(c({},s),r),o.i18nInit(),o.title=o.i18n("pluginNameCamera"),f(p(o),n)[n]=o.opts.mirror,o.install=o.install.bind(p(o)),o.setPluginState=o.setPluginState.bind(p(o)),o.render=o.render.bind(p(o)),o.start=o.start.bind(p(o)),o.stop=o.stop.bind(p(o)),o.takeSnapshot=o.takeSnapshot.bind(p(o)),o.startRecording=o.startRecording.bind(p(o)),o.stopRecording=o.stopRecording.bind(p(o)),o.discardRecordedVideo=o.discardRecordedVideo.bind(p(o)),o.submit=o.submit.bind(p(o)),o.oneTwoThreeSmile=o.oneTwoThreeSmile.bind(p(o)),o.focus=o.focus.bind(p(o)),o.changeVideoSource=o.changeVideoSource.bind(p(o)),o.webcamActive=!1,o.opts.countdown&&(o.opts.onBeforeSnapshot=o.oneTwoThreeSmile),o.setPluginState({hasCamera:!1,cameraReady:!1,cameraError:null,recordingLengthSeconds:0,videoSources:[],currentDeviceId:null}),o}return d(i,[{key:"setOptions",value:function(e){l(h(i.prototype),"setOptions",this).call(this,c(c({},e),{},{videoConstraints:c(c({},this.opts.videoConstraints),null==e?void 0:e.videoConstraints)}))}},{key:"hasCameraCheck",value:function(){return this.mediaDevices?this.mediaDevices.enumerateDevices().then((function(e){return e.some((function(e){return"videoinput"===e.kind}))})):Promise.resolve(!1)}},{key:"isAudioOnly",value:function(){return 1===this.opts.modes.length&&"audio-only"===this.opts.modes[0]}},{key:"getConstraints",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=-1!==this.opts.modes.indexOf("video-audio")||-1!==this.opts.modes.indexOf("audio-only"),i=!this.isAudioOnly()&&(-1!==this.opts.modes.indexOf("video-audio")||-1!==this.opts.modes.indexOf("video-only")||-1!==this.opts.modes.indexOf("picture")),r=c(c({},this.opts.videoConstraints||{facingMode:this.opts.facingMode}),e?{deviceId:e,facingMode:null}:{});return{audio:t,video:!!i&&r}}},{key:"start",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!this.supportsUserMedia)return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0,this.opts.mirror&&(f(this,n)[n]=!0);var i=this.getConstraints(t&&t.deviceId?t.deviceId:null);this.hasCameraCheck().then((function(r){return e.setPluginState({hasCamera:r}),e.mediaDevices.getUserMedia(i).then((function(i){e.stream=i;var r=null,n=e.isAudioOnly()?i.getAudioTracks():i.getVideoTracks();t&&t.deviceId?n.forEach((function(e){e.getSettings().deviceId===t.deviceId&&(r=e.getSettings().deviceId)})):r=n[0].getSettings().deviceId,e.updateVideoSources(),e.setPluginState({currentDeviceId:r,cameraReady:!0})})).catch((function(t){e.setPluginState({cameraReady:!1,cameraError:t}),e.uppy.info(t.message,"error")}))}))}},{key:"getMediaRecorderOptions",value:function(){var e={};if(MediaRecorder.isTypeSupported){var t=this.uppy.opts.restrictions,i=[];this.opts.preferredVideoMimeType?i=[this.opts.preferredVideoMimeType]:t.allowedFileTypes&&(i=t.allowedFileTypes.map(T).filter(V));var r=i.filter((function(e){return MediaRecorder.isTypeSupported(e)&&R(e)}));r.length>0&&(e.mimeType=r[0])}return e}},{key:"startRecording",value:function(){var e=this;this.recorder=new MediaRecorder(this.stream,this.getMediaRecorderOptions()),this.recordingChunks=[];var t=!1;this.recorder.addEventListener("dataavailable",(function(i){e.recordingChunks.push(i.data);var r=e.uppy.opts.restrictions;if(e.recordingChunks.length>1&&null!=r.maxFileSize&&!t){var n=e.recordingChunks.reduce((function(e,t){return e+t.size}),0),o=3*((n-e.recordingChunks[0].size)/(e.recordingChunks.length-1));n>Math.max(0,r.maxFileSize-o)&&(t=!0,e.uppy.info(e.i18n("recordingStoppedMaxSize"),"warning",4e3),e.stopRecording())}})),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval((function(){var t=e.getPluginState().recordingLengthSeconds;e.setPluginState({recordingLengthSeconds:t+1})}),1e3)),this.setPluginState({isRecording:!0})}},{key:"stopRecording",value:function(){var e=this;return new Promise((function(t){e.recorder.addEventListener("stop",(function(){t()})),e.recorder.stop(),e.opts.showRecordingLength&&(clearInterval(e.recordingLengthTimer),e.setPluginState({recordingLengthSeconds:0}))})).then((function(){return e.setPluginState({isRecording:!1}),e.getVideo()})).then((function(t){try{e.capturedMediaFile=t,e.setPluginState({recordedVideo:URL.createObjectURL(t.data)}),f(e,n)[n]=!1}catch(i){i.isRestriction||e.uppy.log(i)}})).then((function(){e.recordingChunks=null,e.recorder=null}),(function(t){throw e.recordingChunks=null,e.recorder=null,t}))}},{key:"discardRecordedVideo",value:function(){this.setPluginState({recordedVideo:null}),this.opts.mirror&&(f(this,n)[n]=!0),this.capturedMediaFile=null}},{key:"submit",value:function(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(e){e.isRestriction||this.uppy.log(e,"error")}}},{key:"stop",value:function(){var e=a(s.mark((function e(){var t,i,r=this;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.stream&&(t=this.stream.getAudioTracks(),i=this.stream.getVideoTracks(),t.concat(i).forEach((function(e){return e.stop()}))),!this.recorder){e.next=4;break}return e.next=4,new Promise((function(e){r.recorder.addEventListener("stop",e,{once:!0}),r.recorder.stop(),r.opts.showRecordingLength&&clearInterval(r.recordingLengthTimer)}));case 4:this.recordingChunks=null,this.recorder=null,this.webcamActive=!1,this.stream=null,this.setPluginState({recordedVideo:null,isRecording:!1,recordingLengthSeconds:0});case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getVideoElement",value:function(){return this.el.querySelector(".uppy-Webcam-video")}},{key:"oneTwoThreeSmile",value:function(){var e=this;return new Promise((function(t,i){var r=e.opts.countdown,n=setInterval((function(){if(!e.webcamActive)return clearInterval(n),e.captureInProgress=!1,i(new Error("Webcam is not active"));r>0?(e.uppy.info("".concat(r,"..."),"warning",800),r--):(clearInterval(n),e.uppy.info(e.i18n("smile"),"success",1500),setTimeout((function(){return t()}),1500))}),1e3)}))}},{key:"takeSnapshot",value:function(){var e=this;this.captureInProgress||(this.captureInProgress=!0,this.opts.onBeforeSnapshot().catch((function(t){var i="object"===typeof t?t.message:t;return e.uppy.info(i,"error",5e3),Promise.reject(new Error("onBeforeSnapshot: ".concat(i)))})).then((function(){return e.getImage()})).then((function(t){e.captureInProgress=!1;try{e.uppy.addFile(t)}catch(i){i.isRestriction||e.uppy.log(i)}}),(function(t){throw e.captureInProgress=!1,t})))}},{key:"getImage",value:function(){var e=this,t=this.getVideoElement();if(!t)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));var i=t.videoWidth,r=t.videoHeight,n=document.createElement("canvas");n.width=i,n.height=r,n.getContext("2d").drawImage(t,0,0);var o=this.uppy.opts.restrictions,s=[];this.opts.preferredImageMimeType?s=[this.opts.preferredImageMimeType]:o.allowedFileTypes&&(s=o.allowedFileTypes.map(T).filter(L));var a=s[0]||"image/jpeg",c=R(a)||"jpg",u="cam-".concat(Date.now(),".").concat(c);return C(n,a).then((function(t){return{source:e.id,name:u,data:new Blob([t],{type:a}),type:a}}))}},{key:"getVideo",value:function(){var e=this.recordingChunks.find((function(e){var t;return(null==(t=e.type)?void 0:t.length)>0})).type,t=R(e);if(!t)return Promise.reject(new Error('Could not retrieve recording: Unsupported media type "'.concat(e,'"')));var i="webcam-".concat(Date.now(),".").concat(t),r=new Blob(this.recordingChunks,{type:e}),n={source:this.id,name:i,data:new Blob([r],{type:e}),type:e};return Promise.resolve(n)}},{key:"focus",value:function(){var e=this;this.opts.countdown&&setTimeout((function(){e.uppy.info(e.i18n("smile"),"success",1500)}),1e3)}},{key:"changeVideoSource",value:function(e){this.stop(),this.start({deviceId:e})}},{key:"updateVideoSources",value:function(){var e=this;this.mediaDevices.enumerateDevices().then((function(t){e.setPluginState({videoSources:t.filter((function(e){return"videoinput"===e.kind}))})}))}},{key:"render",value:function(){this.webcamActive||this.start();var e=this.getPluginState();return e.cameraReady&&e.hasCamera?w(I,m({},e,{onChangeVideoSource:this.changeVideoSource,onSnapshot:this.takeSnapshot,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,onDiscardRecordedVideo:this.discardRecordedVideo,onSubmit:this.submit,onFocus:this.focus,onStop:this.stop,i18n:this.i18n,modes:this.opts.modes,showRecordingLength:this.opts.showRecordingLength,showVideoSourceDropdown:this.opts.showVideoSourceDropdown,supportsRecording:x(),recording:e.isRecording,mirror:f(this,n)[n],src:this.stream})):w(M,{icon:P,i18n:this.i18n,hasCamera:e.hasCamera})}},{key:"install",value:function(){var e=this;this.setPluginState({cameraReady:!1,recordingLengthSeconds:0});var t=this.opts.target;t&&this.mount(t,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=function(){if(e.updateVideoSources(),e.stream){var t=!0,i=e.getPluginState(),r=i.videoSources,n=i.currentDeviceId;r.forEach((function(e){n===e.deviceId&&(t=!1)})),t&&(e.stop(),e.start())}})}},{key:"uninstall",value:function(){this.stop(),this.unmount()}},{key:"onUnmount",value:function(){this.stop()}}]),i}(S),r.VERSION="2.0.4",o)}}]);
2
- //# sourceMappingURL=7.8d671ab5.chunk.js.map
1
+ (this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[7],{453:function(e,t,i){var r=i(457);function n(t,i,o){return"undefined"!==typeof Reflect&&Reflect.get?e.exports=n=Reflect.get:e.exports=n=function(e,t,i){var n=r(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(i):o.value}},n(t,i,o||t)}e.exports=n},457:function(e,t,i){var r=i(149);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e}},477:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(){return r("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55"},r("path",{d:"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z",fillRule:"evenodd"}))}},500:function(e,t,i){"use strict";var r=i(95),n={"audio/mp3":"mp3","audio/mp4":"mp4","audio/ogg":"ogg","audio/webm":"webm","image/gif":"gif","image/heic":"heic","image/heif":"heif","image/jpeg":"jpg","image/png":"png","image/svg+xml":"svg","video/mp4":"mp4","video/ogg":"ogv","video/quicktime":"mov","video/webm":"webm","video/x-matroska":"mkv","video/x-msvideo":"avi"};e.exports=function(e){var t=e.split(";",1);return e=r(t,1)[0],n[e]||null}},501:function(e,t,i){"use strict";e.exports=function(e,t,i){return new Promise((function(r){e.toBlob(r,t,i)}))}},502:function(e,t,i){"use strict";e.exports=function(){return"function"===typeof MediaRecorder&&!!MediaRecorder.prototype&&"function"===typeof MediaRecorder.prototype.start}},503:function(e,t,i){"use strict";var r=i(19),n=i(20),o=i(24),s=i(25);function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},a.apply(this,arguments)}var c=i(17),u=c.h,d=c.Component,p=i(504),l=i(505),h=i(506),g=i(508),v=i(509),m=i(510);function f(e,t){return-1!==e.indexOf(t)}var y=function(e){o(i,e);var t=s(i);function i(){return r(this,i),t.apply(this,arguments)}return n(i,[{key:"componentDidMount",value:function(){(0,this.props.onFocus)()}},{key:"componentWillUnmount",value:function(){(0,this.props.onStop)()}},{key:"render",value:function(){var e=this,t=this.props,i=t.src,r=t.recordedVideo,n=t.recording,o=t.modes,s=t.supportsRecording,c=t.videoSources,d=t.showVideoSourceDropdown,y=t.showRecordingLength,b=t.onSubmit,w=t.i18n,S=t.mirror,R=t.onSnapshot,k=t.onStartRecording,C=t.onStopRecording,x=t.onDiscardRecordedVideo,P=t.recordingLengthSeconds,I=!!r,M=!I&&s&&(f(o,"video-only")||f(o,"audio-only")||f(o,"video-audio")),T=!I&&f(o,"picture"),V=s&&y,L=d&&c&&c.length>1,D={playsinline:!0};return r?(D.muted=!1,D.controls=!0,D.src=r,this.videoElement&&(this.videoElement.srcObject=void 0)):(D.muted=!0,D.autoplay=!0,D.srcObject=i),u("div",{className:"uppy uppy-Webcam-container"},u("div",{className:"uppy-Webcam-videoContainer"},u("video",a({ref:function(t){return e.videoElement=t},className:"uppy-Webcam-video ".concat(S?"uppy-Webcam-video--mirrored":"")},D))),u("div",{className:"uppy-Webcam-footer"},u("div",{className:"uppy-Webcam-videoSourceContainer"},L?g(this.props):null),u("div",{className:"uppy-Webcam-buttonContainer"},T&&u(p,{onSnapshot:R,i18n:w}),M&&u(l,{recording:n,onStartRecording:k,onStopRecording:C,i18n:w}),I&&u(v,{onSubmit:b,i18n:w}),I&&u(m,{onDiscard:x,i18n:w})),V&&u("div",{className:"uppy-Webcam-recordingLength"},u(h,{recordingLengthSeconds:P,i18n:w}))))}}]),i}(d);e.exports=y},504:function(e,t,i){"use strict";var r=i(17).h,n=i(477);e.exports=function(e){var t=e.onSnapshot,i=e.i18n;return r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:i("takePicture"),"aria-label":i("takePicture"),onClick:t,"data-uppy-super-focusable":!0},n())}},505:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.recording,i=e.onStartRecording,n=e.onStopRecording,o=e.i18n;return t?r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:o("stopRecording"),"aria-label":o("stopRecording"),onClick:n,"data-uppy-super-focusable":!0},r("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},r("rect",{x:"15",y:"15",width:"70",height:"70"}))):r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:o("startRecording"),"aria-label":o("startRecording"),onClick:i,"data-uppy-super-focusable":!0},r("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},r("circle",{cx:"50",cy:"50",r:"40"})))}},506:function(e,t,i){"use strict";var r=i(17).h,n=i(507);e.exports=function(e){var t=e.recordingLengthSeconds,i=e.i18n,o=n(t);return r("span",{"aria-label":i("recordingLength",{recording_length:o})},o)}},507:function(e,t,i){"use strict";e.exports=function(e){return"".concat(Math.floor(e/60),":").concat(String(e%60).padStart(2,0))}},508:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.currentDeviceId,i=e.videoSources,n=e.onChangeVideoSource;return r("div",{className:"uppy-Webcam-videoSource"},r("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:function(e){n(e.target.value)}},i.map((function(e){return r("option",{key:e.deviceId,value:e.deviceId,selected:e.deviceId===t},e.label)}))))}},509:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.onSubmit,i=e.i18n;return r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit",type:"button",title:i("submitRecordedFile"),"aria-label":i("submitRecordedFile"),onClick:t,"data-uppy-super-focusable":!0},r("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},r("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})))}},510:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.onDiscard,i=e.i18n;return r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:i("discardRecordedFile"),"aria-label":i("discardRecordedFile"),onClick:t,"data-uppy-super-focusable":!0},r("svg",{width:"13",height:"13",viewBox:"0 0 13 13",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},r("g",{fill:"#FFF",fillRule:"evenodd"},r("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),r("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"}))))}},511:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){return r("div",{className:"uppy-Webcam-permissons"},r("div",{className:"uppy-Webcam-permissonsIcon"},e.icon()),r("h1",{className:"uppy-Webcam-title"},e.hasCamera?e.i18n("allowAccessTitle"):e.i18n("noCameraTitle")),r("p",null,e.hasCamera?e.i18n("allowAccessDescription"):e.i18n("noCameraDescription")))}},535:function(e,t,i){"use strict";var r,n,o,s=i(51),a=i(226),c=i(29),u=i(19),d=i(20),p=i(56),l=i(453),h=i(149),g=i(24),v=i(25);function m(){return m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},m.apply(this,arguments)}function f(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var y=0;function b(e){return"__private_"+y+++"_"+e}var w=i(17).h,S=i(53).UIPlugin,R=i(500),k=i(232),C=i(501),x=i(502),P=i(477),I=i(503),M=i(511);function T(e){return"."===e[0]?k[e.slice(1)]:e}function V(e){return/^video\/[^*]+$/.test(e)}function L(e){return/^image\/[^*]+$/.test(e)}e.exports=(n=b("enableMirror"),o=r=function(e){g(i,e);var t=v(i);function i(e,r){var o;u(this,i),o=t.call(this,e,r),Object.defineProperty(p(o),n,{writable:!0,value:void 0}),o.mediaDevices=navigator.mediaDevices,o.supportsUserMedia=!!o.mediaDevices,o.protocol=location.protocol.match(/https/i)?"https":"http",o.id=o.opts.id||"Webcam",o.type="acquirer",o.capturedMediaFile=null,o.icon=function(){return w("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},w("g",{fill:"none",fillRule:"evenodd"},w("rect",{className:"uppy-ProviderIconBg",fill:"#03BFEF",width:"32",height:"32",rx:"16"}),w("path",{d:"M22 11c1.133 0 2 .867 2 2v7.333c0 1.134-.867 2-2 2H10c-1.133 0-2-.866-2-2V13c0-1.133.867-2 2-2h2.333l1.134-1.733C13.6 9.133 13.8 9 14 9h4c.2 0 .4.133.533.267L19.667 11H22zm-6 1.533a3.764 3.764 0 0 0-3.8 3.8c0 2.129 1.672 3.801 3.8 3.801s3.8-1.672 3.8-3.8c0-2.13-1.672-3.801-3.8-3.801zm0 6.261c-1.395 0-2.46-1.066-2.46-2.46 0-1.395 1.065-2.461 2.46-2.461s2.46 1.066 2.46 2.46c0 1.395-1.065 2.461-2.46 2.461z",fill:"#FFF",fillRule:"nonzero"})))},o.defaultLocale={strings:{pluginNameCamera:"Camera",smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",allowAccessTitle:"Please allow access to your camera",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site.",noCameraTitle:"Camera Not Available",noCameraDescription:"In order to take pictures or record video, please connect a camera device",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",recordingLength:"Recording length %{recording_length}",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file"}};var s={onBeforeSnapshot:function(){return Promise.resolve()},countdown:!1,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,showVideoSourceDropdown:!1,facingMode:"user",preferredImageMimeType:null,preferredVideoMimeType:null,showRecordingLength:!1};return o.opts=c(c({},s),r),o.i18nInit(),o.title=o.i18n("pluginNameCamera"),f(p(o),n)[n]=o.opts.mirror,o.install=o.install.bind(p(o)),o.setPluginState=o.setPluginState.bind(p(o)),o.render=o.render.bind(p(o)),o.start=o.start.bind(p(o)),o.stop=o.stop.bind(p(o)),o.takeSnapshot=o.takeSnapshot.bind(p(o)),o.startRecording=o.startRecording.bind(p(o)),o.stopRecording=o.stopRecording.bind(p(o)),o.discardRecordedVideo=o.discardRecordedVideo.bind(p(o)),o.submit=o.submit.bind(p(o)),o.oneTwoThreeSmile=o.oneTwoThreeSmile.bind(p(o)),o.focus=o.focus.bind(p(o)),o.changeVideoSource=o.changeVideoSource.bind(p(o)),o.webcamActive=!1,o.opts.countdown&&(o.opts.onBeforeSnapshot=o.oneTwoThreeSmile),o.setPluginState({hasCamera:!1,cameraReady:!1,cameraError:null,recordingLengthSeconds:0,videoSources:[],currentDeviceId:null}),o}return d(i,[{key:"setOptions",value:function(e){l(h(i.prototype),"setOptions",this).call(this,c(c({},e),{},{videoConstraints:c(c({},this.opts.videoConstraints),null==e?void 0:e.videoConstraints)}))}},{key:"hasCameraCheck",value:function(){return this.mediaDevices?this.mediaDevices.enumerateDevices().then((function(e){return e.some((function(e){return"videoinput"===e.kind}))})):Promise.resolve(!1)}},{key:"isAudioOnly",value:function(){return 1===this.opts.modes.length&&"audio-only"===this.opts.modes[0]}},{key:"getConstraints",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=-1!==this.opts.modes.indexOf("video-audio")||-1!==this.opts.modes.indexOf("audio-only"),i=!this.isAudioOnly()&&(-1!==this.opts.modes.indexOf("video-audio")||-1!==this.opts.modes.indexOf("video-only")||-1!==this.opts.modes.indexOf("picture")),r=c(c({},this.opts.videoConstraints||{facingMode:this.opts.facingMode}),e?{deviceId:e,facingMode:null}:{});return{audio:t,video:!!i&&r}}},{key:"start",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!this.supportsUserMedia)return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0,this.opts.mirror&&(f(this,n)[n]=!0);var i=this.getConstraints(t&&t.deviceId?t.deviceId:null);this.hasCameraCheck().then((function(r){return e.setPluginState({hasCamera:r}),e.mediaDevices.getUserMedia(i).then((function(i){e.stream=i;var r=null,n=e.isAudioOnly()?i.getAudioTracks():i.getVideoTracks();t&&t.deviceId?n.forEach((function(e){e.getSettings().deviceId===t.deviceId&&(r=e.getSettings().deviceId)})):r=n[0].getSettings().deviceId,e.updateVideoSources(),e.setPluginState({currentDeviceId:r,cameraReady:!0})})).catch((function(t){e.setPluginState({cameraReady:!1,cameraError:t}),e.uppy.info(t.message,"error")}))}))}},{key:"getMediaRecorderOptions",value:function(){var e={};if(MediaRecorder.isTypeSupported){var t=this.uppy.opts.restrictions,i=[];this.opts.preferredVideoMimeType?i=[this.opts.preferredVideoMimeType]:t.allowedFileTypes&&(i=t.allowedFileTypes.map(T).filter(V));var r=i.filter((function(e){return MediaRecorder.isTypeSupported(e)&&R(e)}));r.length>0&&(e.mimeType=r[0])}return e}},{key:"startRecording",value:function(){var e=this;this.recorder=new MediaRecorder(this.stream,this.getMediaRecorderOptions()),this.recordingChunks=[];var t=!1;this.recorder.addEventListener("dataavailable",(function(i){e.recordingChunks.push(i.data);var r=e.uppy.opts.restrictions;if(e.recordingChunks.length>1&&null!=r.maxFileSize&&!t){var n=e.recordingChunks.reduce((function(e,t){return e+t.size}),0),o=3*((n-e.recordingChunks[0].size)/(e.recordingChunks.length-1));n>Math.max(0,r.maxFileSize-o)&&(t=!0,e.uppy.info(e.i18n("recordingStoppedMaxSize"),"warning",4e3),e.stopRecording())}})),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval((function(){var t=e.getPluginState().recordingLengthSeconds;e.setPluginState({recordingLengthSeconds:t+1})}),1e3)),this.setPluginState({isRecording:!0})}},{key:"stopRecording",value:function(){var e=this;return new Promise((function(t){e.recorder.addEventListener("stop",(function(){t()})),e.recorder.stop(),e.opts.showRecordingLength&&(clearInterval(e.recordingLengthTimer),e.setPluginState({recordingLengthSeconds:0}))})).then((function(){return e.setPluginState({isRecording:!1}),e.getVideo()})).then((function(t){try{e.capturedMediaFile=t,e.setPluginState({recordedVideo:URL.createObjectURL(t.data)}),f(e,n)[n]=!1}catch(i){i.isRestriction||e.uppy.log(i)}})).then((function(){e.recordingChunks=null,e.recorder=null}),(function(t){throw e.recordingChunks=null,e.recorder=null,t}))}},{key:"discardRecordedVideo",value:function(){this.setPluginState({recordedVideo:null}),this.opts.mirror&&(f(this,n)[n]=!0),this.capturedMediaFile=null}},{key:"submit",value:function(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(e){e.isRestriction||this.uppy.log(e,"error")}}},{key:"stop",value:function(){var e=a(s.mark((function e(){var t,i,r=this;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.stream&&(t=this.stream.getAudioTracks(),i=this.stream.getVideoTracks(),t.concat(i).forEach((function(e){return e.stop()}))),!this.recorder){e.next=4;break}return e.next=4,new Promise((function(e){r.recorder.addEventListener("stop",e,{once:!0}),r.recorder.stop(),r.opts.showRecordingLength&&clearInterval(r.recordingLengthTimer)}));case 4:this.recordingChunks=null,this.recorder=null,this.webcamActive=!1,this.stream=null,this.setPluginState({recordedVideo:null,isRecording:!1,recordingLengthSeconds:0});case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getVideoElement",value:function(){return this.el.querySelector(".uppy-Webcam-video")}},{key:"oneTwoThreeSmile",value:function(){var e=this;return new Promise((function(t,i){var r=e.opts.countdown,n=setInterval((function(){if(!e.webcamActive)return clearInterval(n),e.captureInProgress=!1,i(new Error("Webcam is not active"));r>0?(e.uppy.info("".concat(r,"..."),"warning",800),r--):(clearInterval(n),e.uppy.info(e.i18n("smile"),"success",1500),setTimeout((function(){return t()}),1500))}),1e3)}))}},{key:"takeSnapshot",value:function(){var e=this;this.captureInProgress||(this.captureInProgress=!0,this.opts.onBeforeSnapshot().catch((function(t){var i="object"===typeof t?t.message:t;return e.uppy.info(i,"error",5e3),Promise.reject(new Error("onBeforeSnapshot: ".concat(i)))})).then((function(){return e.getImage()})).then((function(t){e.captureInProgress=!1;try{e.uppy.addFile(t)}catch(i){i.isRestriction||e.uppy.log(i)}}),(function(t){throw e.captureInProgress=!1,t})))}},{key:"getImage",value:function(){var e=this,t=this.getVideoElement();if(!t)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));var i=t.videoWidth,r=t.videoHeight,n=document.createElement("canvas");n.width=i,n.height=r,n.getContext("2d").drawImage(t,0,0);var o=this.uppy.opts.restrictions,s=[];this.opts.preferredImageMimeType?s=[this.opts.preferredImageMimeType]:o.allowedFileTypes&&(s=o.allowedFileTypes.map(T).filter(L));var a=s[0]||"image/jpeg",c=R(a)||"jpg",u="cam-".concat(Date.now(),".").concat(c);return C(n,a).then((function(t){return{source:e.id,name:u,data:new Blob([t],{type:a}),type:a}}))}},{key:"getVideo",value:function(){var e=this.recordingChunks.find((function(e){var t;return(null==(t=e.type)?void 0:t.length)>0})).type,t=R(e);if(!t)return Promise.reject(new Error('Could not retrieve recording: Unsupported media type "'.concat(e,'"')));var i="webcam-".concat(Date.now(),".").concat(t),r=new Blob(this.recordingChunks,{type:e}),n={source:this.id,name:i,data:new Blob([r],{type:e}),type:e};return Promise.resolve(n)}},{key:"focus",value:function(){var e=this;this.opts.countdown&&setTimeout((function(){e.uppy.info(e.i18n("smile"),"success",1500)}),1e3)}},{key:"changeVideoSource",value:function(e){this.stop(),this.start({deviceId:e})}},{key:"updateVideoSources",value:function(){var e=this;this.mediaDevices.enumerateDevices().then((function(t){e.setPluginState({videoSources:t.filter((function(e){return"videoinput"===e.kind}))})}))}},{key:"render",value:function(){this.webcamActive||this.start();var e=this.getPluginState();return e.cameraReady&&e.hasCamera?w(I,m({},e,{onChangeVideoSource:this.changeVideoSource,onSnapshot:this.takeSnapshot,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,onDiscardRecordedVideo:this.discardRecordedVideo,onSubmit:this.submit,onFocus:this.focus,onStop:this.stop,i18n:this.i18n,modes:this.opts.modes,showRecordingLength:this.opts.showRecordingLength,showVideoSourceDropdown:this.opts.showVideoSourceDropdown,supportsRecording:x(),recording:e.isRecording,mirror:f(this,n)[n],src:this.stream})):w(M,{icon:P,i18n:this.i18n,hasCamera:e.hasCamera})}},{key:"install",value:function(){var e=this;this.setPluginState({cameraReady:!1,recordingLengthSeconds:0});var t=this.opts.target;t&&this.mount(t,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=function(){if(e.updateVideoSources(),e.stream){var t=!0,i=e.getPluginState(),r=i.videoSources,n=i.currentDeviceId;r.forEach((function(e){n===e.deviceId&&(t=!1)})),t&&(e.stop(),e.start())}})}},{key:"uninstall",value:function(){this.stop(),this.unmount()}},{key:"onUnmount",value:function(){this.stop()}}]),i}(S),r.VERSION="2.0.4",o)}}]);
2
+ //# sourceMappingURL=7.30c6cad9.chunk.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/get.js","../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/superPropBase.js","../../../node_modules/@uppy/webcam/lib/CameraIcon.js","../../../node_modules/@uppy/utils/lib/getFileTypeExtension.js","../../../node_modules/@uppy/utils/lib/canvasToBlob.js","../../../node_modules/@uppy/webcam/lib/supportsMediaRecorder.js","../../../node_modules/@uppy/webcam/lib/CameraScreen.js","../../../node_modules/@uppy/webcam/lib/SnapshotButton.js","../../../node_modules/@uppy/webcam/lib/RecordButton.js","../../../node_modules/@uppy/webcam/lib/RecordingLength.js","../../../node_modules/@uppy/webcam/lib/formatSeconds.js","../../../node_modules/@uppy/webcam/lib/VideoSourceSelect.js","../../../node_modules/@uppy/webcam/lib/SubmitButton.js","../../../node_modules/@uppy/webcam/lib/DiscardButton.js","../../../node_modules/@uppy/webcam/lib/PermissionsScreen.js","../../../node_modules/@uppy/webcam/lib/index.js"],"names":["superPropBase","_get","target","property","receiver","Reflect","get","module","exports","base","desc","Object","getOwnPropertyDescriptor","call","value","getPrototypeOf","object","prototype","hasOwnProperty","h","require","focusable","fill","width","height","viewBox","d","fillRule","mimeToExtensions","mimeType","split","canvas","type","quality","Promise","resolve","toBlob","MediaRecorder","start","_extends","assign","i","arguments","length","source","key","apply","this","Component","SnapshotButton","RecordButton","RecordingLength","VideoSourceSelect","SubmitButton","DiscardButton","isModeAvailable","modes","mode","indexOf","CameraScreen","onFocus","props","onStop","src","recordedVideo","recording","supportsRecording","videoSources","showVideoSourceDropdown","showRecordingLength","onSubmit","i18n","mirror","onSnapshot","onStartRecording","onStopRecording","onDiscardRecordedVideo","recordingLengthSeconds","hasRecordedVideo","shouldShowRecordButton","shouldShowSnapshotButton","shouldShowRecordingLength","shouldShowVideoSourceDropdown","videoProps","playsinline","muted","controls","videoElement","srcObject","undefined","autoplay","className","ref","onDiscard","CameraIcon","title","onClick","x","y","cx","cy","r","formatSeconds","formattedRecordingLengthSeconds","recording_length","seconds","Math","floor","String","padStart","currentDeviceId","onChangeVideoSource","onChange","event","map","videoSource","deviceId","selected","label","xmlns","icon","hasCamera","_class","_enableMirror","_temp","_classPrivateFieldLooseBase","privateKey","TypeError","id","_classPrivateFieldLooseKey","name","UIPlugin","getFileTypeExtension","mimeTypes","canvasToBlob","supportsMediaRecorder","PermissionsScreen","toMimeType","fileType","slice","isVideoMimeType","test","isImageMimeType","uppy","opts","defineProperty","writable","mediaDevices","navigator","supportsUserMedia","protocol","location","match","capturedMediaFile","rx","defaultLocale","strings","pluginNameCamera","smile","takePicture","startRecording","stopRecording","allowAccessTitle","allowAccessDescription","noCameraTitle","noCameraDescription","recordingStoppedMaxSize","recordingLength","submitRecordedFile","discardRecordedFile","defaultOptions","onBeforeSnapshot","countdown","facingMode","preferredImageMimeType","preferredVideoMimeType","i18nInit","install","bind","setPluginState","render","stop","takeSnapshot","discardRecordedVideo","submit","oneTwoThreeSmile","focus","changeVideoSource","webcamActive","cameraReady","cameraError","newOpts","videoConstraints","enumerateDevices","then","devices","some","device","kind","acceptsAudio","acceptsVideo","isAudioOnly","audio","video","options","reject","Error","constraints","getConstraints","hasCameraCheck","getUserMedia","stream","tracks","getAudioTracks","getVideoTracks","forEach","track","getSettings","updateVideoSources","err","info","message","isTypeSupported","restrictions","preferredVideoMimeTypes","allowedFileTypes","filter","acceptableMimeTypes","candidateType","recorder","getMediaRecorderOptions","recordingChunks","stoppingBecauseOfMaxSize","addEventListener","push","data","maxFileSize","totalSize","reduce","acc","chunk","size","expectedEndChunkSize","max","recordingLengthTimer","setInterval","currentRecordingLength","getPluginState","isRecording","clearInterval","getVideo","file","URL","createObjectURL","isRestriction","log","error","addFile","audioTracks","videoTracks","concat","once","el","querySelector","count","countDown","captureInProgress","setTimeout","getImage","tagFile","getVideoElement","videoWidth","videoHeight","document","createElement","getContext","drawImage","preferredImageMimeTypes","ext","Date","now","blob","Blob","find","_blob$type","fileExtension","webcamState","mount","ondevicechange","restartStream","unmount","VERSION"],"mappings":"2HAAA,IAAIA,EAAgB,EAAQ,KAE5B,SAASC,EAAKC,EAAQC,EAAUC,GAiB9B,MAhBuB,qBAAZC,SAA2BA,QAAQC,IAC5CC,EAAOC,QAAUP,EAAOI,QAAQC,IAEhCC,EAAOC,QAAUP,EAAO,SAAcC,EAAQC,EAAUC,GACtD,IAAIK,EAAOT,EAAcE,EAAQC,GACjC,GAAKM,EAAL,CACA,IAAIC,EAAOC,OAAOC,yBAAyBH,EAAMN,GAEjD,OAAIO,EAAKJ,IACAI,EAAKJ,IAAIO,KAAKT,GAGhBM,EAAKI,QAITb,EAAKC,EAAQC,EAAUC,GAAYF,GAG5CK,EAAOC,QAAUP,G,oBCtBjB,IAAIc,EAAiB,EAAQ,KAW7BR,EAAOC,QATP,SAAwBQ,EAAQb,GAC9B,MAAQQ,OAAOM,UAAUC,eAAeL,KAAKG,EAAQb,IAEpC,QADfa,EAASD,EAAeC,MAI1B,OAAOA,I,iCCNT,IACEG,EACEC,EAAQ,IADVD,EAGFZ,EAAOC,QAAU,WACf,OAAOW,EAAE,MAAO,CACd,cAAe,OACfE,UAAW,QACXC,KAAM,UACNC,MAAO,KACPC,OAAQ,K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kBAC1BlH,WAAY1B,KAAKuI,aACjB5G,iBAAkB3B,KAAKiH,eACvBrF,gBAAiB5B,KAAKkH,cACtBrF,uBAAwB7B,KAAKwI,qBAC7BjH,SAAUvB,KAAKyI,OACf5H,QAASb,KAAK2I,MACd5H,OAAQf,KAAKsI,KACb9G,KAAMxB,KAAKwB,KACXf,MAAOT,KAAKiG,KAAKxF,MACjBa,oBAAqBtB,KAAKiG,KAAK3E,oBAC/BD,wBAAyBrB,KAAKiG,KAAK5E,wBACnCF,kBAAmBqE,IACnBtE,UAAW6N,EAAYtC,YACvBhL,OAAQqD,EAA4B9E,KAAM4E,GAAeA,GACzD5D,IAAKhB,KAAKoK,UAxBHhM,EAAEqH,EAAmB,CAC1BhB,KAAM1B,EACNvB,KAAMxB,KAAKwB,KACXkD,UAAWqK,EAAYrK,cAnhB2E,qBA4iBxG,WAAU,WACR1E,KAAKoI,eAAe,CAClBU,aAAa,EACbhH,uBAAwB,IAE1B,IACE3E,EACE6C,KAAKiG,KADP9I,OAGEA,GACF6C,KAAKgP,MAAM7R,EAAQ6C,MAGjBA,KAAKoG,eACPpG,KAAK2K,qBAEL3K,KAAKoG,aAAa6I,eAAiB,WAGjC,GAFA,EAAKtE,qBAED,EAAKP,OAAQ,CACf,IAAI8E,GAAgB,EACpB,EAGI,EAAK1C,iBAFPpL,EADF,EACEA,aACA2C,EAFF,EAEEA,gBAEF3C,EAAaoJ,SAAQ,SAAApG,GACfL,IAAoBK,EAAYC,WAClC6K,GAAgB,MAIhBA,IACF,EAAK5G,OACL,EAAK/I,cA7kByF,uBAolBxG,WACES,KAAKsI,OACLtI,KAAKmP,YAtlBiG,uBAylBxG,WACEnP,KAAKsI,WA1lBiG,GAAwBlD,GA6lB9HT,EAAOyK,QAAU,QAASvK","file":"static/js/7.8d671ab5.chunk.js","sourcesContent":["var superPropBase = require(\"./superPropBase\");\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nmodule.exports = _get;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = () => {\n return h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n fill: \"#0097DC\",\n width: \"66\",\n height: \"55\",\n viewBox: \"0 0 66 55\"\n }, h(\"path\", {\n d: \"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z\",\n fillRule: \"evenodd\"\n }));\n};","\"use strict\";\n\nconst mimeToExtensions = {\n 'audio/mp3': 'mp3',\n 'audio/mp4': 'mp4',\n 'audio/ogg': 'ogg',\n 'audio/webm': 'webm',\n 'image/gif': 'gif',\n 'image/heic': 'heic',\n 'image/heif': 'heif',\n 'image/jpeg': 'jpg',\n 'image/png': 'png',\n 'image/svg+xml': 'svg',\n 'video/mp4': 'mp4',\n 'video/ogg': 'ogv',\n 'video/quicktime': 'mov',\n 'video/webm': 'webm',\n 'video/x-matroska': 'mkv',\n 'video/x-msvideo': 'avi'\n};\n\nmodule.exports = function getFileTypeExtension(mimeType) {\n // Remove the ; bit in 'video/x-matroska;codecs=avc1'\n // eslint-disable-next-line no-param-reassign\n [mimeType] = mimeType.split(';', 1);\n return mimeToExtensions[mimeType] || null;\n};","\"use strict\";\n\n/**\n * Save a <canvas> element's content to a Blob object.\n *\n * @param {HTMLCanvasElement} canvas\n * @returns {Promise}\n */\nmodule.exports = function canvasToBlob(canvas, type, quality) {\n return new Promise(resolve => {\n canvas.toBlob(resolve, type, quality);\n });\n};","\"use strict\";\n\nmodule.exports = function supportsMediaRecorder() {\n /* eslint-disable compat/compat */\n return typeof MediaRecorder === 'function' && !!MediaRecorder.prototype && typeof MediaRecorder.prototype.start === 'function';\n /* eslint-enable compat/compat */\n};","\"use strict\";\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\n/* eslint-disable jsx-a11y/media-has-caption */\nconst {\n h,\n Component\n} = require('preact');\n\nconst SnapshotButton = require('./SnapshotButton');\n\nconst RecordButton = require('./RecordButton');\n\nconst RecordingLength = require('./RecordingLength');\n\nconst VideoSourceSelect = require('./VideoSourceSelect');\n\nconst SubmitButton = require('./SubmitButton');\n\nconst DiscardButton = require('./DiscardButton');\n\nfunction isModeAvailable(modes, mode) {\n return modes.indexOf(mode) !== -1;\n}\n\nclass CameraScreen extends Component {\n componentDidMount() {\n const {\n onFocus\n } = this.props;\n onFocus();\n }\n\n componentWillUnmount() {\n const {\n onStop\n } = this.props;\n onStop();\n }\n\n render() {\n const {\n src,\n recordedVideo,\n recording,\n modes,\n supportsRecording,\n videoSources,\n showVideoSourceDropdown,\n showRecordingLength,\n onSubmit,\n i18n,\n mirror,\n onSnapshot,\n onStartRecording,\n onStopRecording,\n onDiscardRecordedVideo,\n recordingLengthSeconds\n } = this.props;\n const hasRecordedVideo = !!recordedVideo;\n const shouldShowRecordButton = !hasRecordedVideo && supportsRecording && (isModeAvailable(modes, 'video-only') || isModeAvailable(modes, 'audio-only') || isModeAvailable(modes, 'video-audio'));\n const shouldShowSnapshotButton = !hasRecordedVideo && isModeAvailable(modes, 'picture');\n const shouldShowRecordingLength = supportsRecording && showRecordingLength;\n const shouldShowVideoSourceDropdown = showVideoSourceDropdown && videoSources && videoSources.length > 1;\n const videoProps = {\n playsinline: true\n };\n\n if (recordedVideo) {\n videoProps.muted = false;\n videoProps.controls = true;\n videoProps.src = recordedVideo; // reset srcObject in dom. If not resetted, stream sticks in element\n\n if (this.videoElement) {\n this.videoElement.srcObject = undefined;\n }\n } else {\n videoProps.muted = true;\n videoProps.autoplay = true;\n videoProps.srcObject = src;\n }\n\n return h(\"div\", {\n className: \"uppy uppy-Webcam-container\"\n }, h(\"div\", {\n className: \"uppy-Webcam-videoContainer\"\n }, h(\"video\", _extends({\n /* eslint-disable-next-line no-return-assign */\n ref: videoElement => this.videoElement = videoElement,\n className: `uppy-Webcam-video ${mirror ? 'uppy-Webcam-video--mirrored' : ''}`\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n\n }, videoProps))), h(\"div\", {\n className: \"uppy-Webcam-footer\"\n }, h(\"div\", {\n className: \"uppy-Webcam-videoSourceContainer\"\n }, shouldShowVideoSourceDropdown ? VideoSourceSelect(this.props) : null), h(\"div\", {\n className: \"uppy-Webcam-buttonContainer\"\n }, shouldShowSnapshotButton && h(SnapshotButton, {\n onSnapshot: onSnapshot,\n i18n: i18n\n }), shouldShowRecordButton && h(RecordButton, {\n recording: recording,\n onStartRecording: onStartRecording,\n onStopRecording: onStopRecording,\n i18n: i18n\n }), hasRecordedVideo && h(SubmitButton, {\n onSubmit: onSubmit,\n i18n: i18n\n }), hasRecordedVideo && h(DiscardButton, {\n onDiscard: onDiscardRecordedVideo,\n i18n: i18n\n })), shouldShowRecordingLength && h(\"div\", {\n className: \"uppy-Webcam-recordingLength\"\n }, h(RecordingLength, {\n recordingLengthSeconds: recordingLengthSeconds,\n i18n: i18n\n }))));\n }\n\n}\n\nmodule.exports = CameraScreen;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nconst CameraIcon = require('./CameraIcon');\n\nmodule.exports = ({\n onSnapshot,\n i18n\n}) => {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture\",\n type: \"button\",\n title: i18n('takePicture'),\n \"aria-label\": i18n('takePicture'),\n onClick: onSnapshot,\n \"data-uppy-super-focusable\": true\n }, CameraIcon());\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = function RecordButton({\n recording,\n onStartRecording,\n onStopRecording,\n i18n\n}) {\n if (recording) {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button\",\n type: \"button\",\n title: i18n('stopRecording'),\n \"aria-label\": i18n('stopRecording'),\n onClick: onStopRecording,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\",\n width: \"100\",\n height: \"100\",\n viewBox: \"0 0 100 100\"\n }, h(\"rect\", {\n x: \"15\",\n y: \"15\",\n width: \"70\",\n height: \"70\"\n })));\n }\n\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button\",\n type: \"button\",\n title: i18n('startRecording'),\n \"aria-label\": i18n('startRecording'),\n onClick: onStartRecording,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\",\n width: \"100\",\n height: \"100\",\n viewBox: \"0 0 100 100\"\n }, h(\"circle\", {\n cx: \"50\",\n cy: \"50\",\n r: \"40\"\n })));\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nconst formatSeconds = require('./formatSeconds');\n\nmodule.exports = function RecordingLength({\n recordingLengthSeconds,\n i18n\n}) {\n const formattedRecordingLengthSeconds = formatSeconds(recordingLengthSeconds);\n return h(\"span\", {\n \"aria-label\": i18n('recordingLength', {\n recording_length: formattedRecordingLengthSeconds\n })\n }, formattedRecordingLengthSeconds);\n};","\"use strict\";\n\n/**\n * Takes an Integer value of seconds (e.g. 83) and converts it into a human-readable formatted string (e.g. '1:23').\n *\n * @param {Integer} seconds\n * @returns {string} the formatted seconds (e.g. '1:23' for 1 minute and 23 seconds)\n *\n */\nmodule.exports = function formatSeconds(seconds) {\n return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, 0)}`;\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = ({\n currentDeviceId,\n videoSources,\n onChangeVideoSource\n}) => {\n return h(\"div\", {\n className: \"uppy-Webcam-videoSource\"\n }, h(\"select\", {\n className: \"uppy-u-reset uppy-Webcam-videoSource-select\",\n onChange: event => {\n onChangeVideoSource(event.target.value);\n }\n }, videoSources.map(videoSource => h(\"option\", {\n key: videoSource.deviceId,\n value: videoSource.deviceId,\n selected: videoSource.deviceId === currentDeviceId\n }, videoSource.label))));\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nfunction SubmitButton({\n onSubmit,\n i18n\n}) {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit\",\n type: \"button\",\n title: i18n('submitRecordedFile'),\n \"aria-label\": i18n('submitRecordedFile'),\n onClick: onSubmit,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n width: \"12\",\n height: \"9\",\n viewBox: \"0 0 12 9\",\n xmlns: \"http://www.w3.org/2000/svg\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\"\n }, h(\"path\", {\n fill: \"#fff\",\n fillRule: \"nonzero\",\n d: \"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z\"\n })));\n}\n\nmodule.exports = SubmitButton;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nfunction DiscardButton({\n onDiscard,\n i18n\n}) {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button\",\n type: \"button\",\n title: i18n('discardRecordedFile'),\n \"aria-label\": i18n('discardRecordedFile'),\n onClick: onDiscard,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n width: \"13\",\n height: \"13\",\n viewBox: \"0 0 13 13\",\n xmlns: \"http://www.w3.org/2000/svg\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\"\n }, h(\"g\", {\n fill: \"#FFF\",\n fillRule: \"evenodd\"\n }, h(\"path\", {\n d: \"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z\"\n }), h(\"path\", {\n d: \"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z\"\n }))));\n}\n\nmodule.exports = DiscardButton;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = props => {\n return h(\"div\", {\n className: \"uppy-Webcam-permissons\"\n }, h(\"div\", {\n className: \"uppy-Webcam-permissonsIcon\"\n }, props.icon()), h(\"h1\", {\n className: \"uppy-Webcam-title\"\n }, props.hasCamera ? props.i18n('allowAccessTitle') : props.i18n('noCameraTitle')), h(\"p\", null, props.hasCamera ? props.i18n('allowAccessDescription') : props.i18n('noCameraDescription')));\n};","\"use strict\";\n\nvar _class, _enableMirror, _temp;\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError(\"attempted to use private field on non-instance\"); } return receiver; }\n\nvar id = 0;\n\nfunction _classPrivateFieldLooseKey(name) { return \"__private_\" + id++ + \"_\" + name; }\n\nconst {\n h\n} = require('preact');\n\nconst {\n UIPlugin\n} = require('@uppy/core');\n\nconst getFileTypeExtension = require('@uppy/utils/lib/getFileTypeExtension');\n\nconst mimeTypes = require('@uppy/utils/lib/mimeTypes');\n\nconst canvasToBlob = require('@uppy/utils/lib/canvasToBlob');\n\nconst supportsMediaRecorder = require('./supportsMediaRecorder');\n\nconst CameraIcon = require('./CameraIcon');\n\nconst CameraScreen = require('./CameraScreen');\n\nconst PermissionsScreen = require('./PermissionsScreen');\n/**\n * Normalize a MIME type or file extension into a MIME type.\n *\n * @param {string} fileType - MIME type or a file extension prefixed with `.`.\n * @returns {string|undefined} The MIME type or `undefined` if the fileType is an extension and is not known.\n */\n\n\nfunction toMimeType(fileType) {\n if (fileType[0] === '.') {\n return mimeTypes[fileType.slice(1)];\n }\n\n return fileType;\n}\n/**\n * Is this MIME type a video?\n *\n * @param {string} mimeType - MIME type.\n * @returns {boolean}\n */\n\n\nfunction isVideoMimeType(mimeType) {\n return /^video\\/[^*]+$/.test(mimeType);\n}\n/**\n * Is this MIME type an image?\n *\n * @param {string} mimeType - MIME type.\n * @returns {boolean}\n */\n\n\nfunction isImageMimeType(mimeType) {\n return /^image\\/[^*]+$/.test(mimeType);\n}\n\nfunction getMediaDevices() {\n // bug in the compatibility data\n // eslint-disable-next-line compat/compat\n return navigator.mediaDevices;\n}\n/**\n * Webcam\n */\n\n\nmodule.exports = (_temp = (_enableMirror = /*#__PURE__*/_classPrivateFieldLooseKey(\"enableMirror\"), _class = class Webcam extends UIPlugin {\n // eslint-disable-next-line global-require\n // enableMirror is used to toggle mirroring, for instance when discarding the video,\n // while `opts.mirror` is used to remember the initial user setting\n constructor(uppy, opts) {\n super(uppy, opts);\n Object.defineProperty(this, _enableMirror, {\n writable: true,\n value: void 0\n });\n this.mediaDevices = getMediaDevices();\n this.supportsUserMedia = !!this.mediaDevices; // eslint-disable-next-line no-restricted-globals\n\n this.protocol = location.protocol.match(/https/i) ? 'https' : 'http';\n this.id = this.opts.id || 'Webcam';\n this.type = 'acquirer';\n this.capturedMediaFile = null;\n\n this.icon = () => h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n width: \"32\",\n height: \"32\",\n viewBox: \"0 0 32 32\"\n }, h(\"g\", {\n fill: \"none\",\n fillRule: \"evenodd\"\n }, h(\"rect\", {\n className: \"uppy-ProviderIconBg\",\n fill: \"#03BFEF\",\n width: \"32\",\n height: \"32\",\n rx: \"16\"\n }), h(\"path\", {\n d: \"M22 11c1.133 0 2 .867 2 2v7.333c0 1.134-.867 2-2 2H10c-1.133 0-2-.866-2-2V13c0-1.133.867-2 2-2h2.333l1.134-1.733C13.6 9.133 13.8 9 14 9h4c.2 0 .4.133.533.267L19.667 11H22zm-6 1.533a3.764 3.764 0 0 0-3.8 3.8c0 2.129 1.672 3.801 3.8 3.801s3.8-1.672 3.8-3.8c0-2.13-1.672-3.801-3.8-3.801zm0 6.261c-1.395 0-2.46-1.066-2.46-2.46 0-1.395 1.065-2.461 2.46-2.461s2.46 1.066 2.46 2.46c0 1.395-1.065 2.461-2.46 2.461z\",\n fill: \"#FFF\",\n fillRule: \"nonzero\"\n })));\n\n this.defaultLocale = {\n strings: {\n pluginNameCamera: 'Camera',\n smile: 'Smile!',\n takePicture: 'Take a picture',\n startRecording: 'Begin video recording',\n stopRecording: 'Stop video recording',\n allowAccessTitle: 'Please allow access to your camera',\n allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.',\n noCameraTitle: 'Camera Not Available',\n noCameraDescription: 'In order to take pictures or record video, please connect a camera device',\n recordingStoppedMaxSize: 'Recording stopped because the file size is about to exceed the limit',\n recordingLength: 'Recording length %{recording_length}',\n submitRecordedFile: 'Submit recorded file',\n discardRecordedFile: 'Discard recorded file'\n }\n }; // set default options\n\n const defaultOptions = {\n onBeforeSnapshot: () => Promise.resolve(),\n countdown: false,\n modes: ['video-audio', 'video-only', 'audio-only', 'picture'],\n mirror: true,\n showVideoSourceDropdown: false,\n facingMode: 'user',\n preferredImageMimeType: null,\n preferredVideoMimeType: null,\n showRecordingLength: false\n };\n this.opts = { ...defaultOptions,\n ...opts\n };\n this.i18nInit();\n this.title = this.i18n('pluginNameCamera');\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = this.opts.mirror;\n this.install = this.install.bind(this);\n this.setPluginState = this.setPluginState.bind(this);\n this.render = this.render.bind(this); // Camera controls\n\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.takeSnapshot = this.takeSnapshot.bind(this);\n this.startRecording = this.startRecording.bind(this);\n this.stopRecording = this.stopRecording.bind(this);\n this.discardRecordedVideo = this.discardRecordedVideo.bind(this);\n this.submit = this.submit.bind(this);\n this.oneTwoThreeSmile = this.oneTwoThreeSmile.bind(this);\n this.focus = this.focus.bind(this);\n this.changeVideoSource = this.changeVideoSource.bind(this);\n this.webcamActive = false;\n\n if (this.opts.countdown) {\n this.opts.onBeforeSnapshot = this.oneTwoThreeSmile;\n }\n\n this.setPluginState({\n hasCamera: false,\n cameraReady: false,\n cameraError: null,\n recordingLengthSeconds: 0,\n videoSources: [],\n currentDeviceId: null\n });\n }\n\n setOptions(newOpts) {\n super.setOptions({ ...newOpts,\n videoConstraints: { // May be undefined but ... handles that\n ...this.opts.videoConstraints,\n ...(newOpts == null ? void 0 : newOpts.videoConstraints)\n }\n });\n }\n\n hasCameraCheck() {\n if (!this.mediaDevices) {\n return Promise.resolve(false);\n }\n\n return this.mediaDevices.enumerateDevices().then(devices => {\n return devices.some(device => device.kind === 'videoinput');\n });\n }\n\n isAudioOnly() {\n return this.opts.modes.length === 1 && this.opts.modes[0] === 'audio-only';\n }\n\n getConstraints(deviceId = null) {\n const acceptsAudio = this.opts.modes.indexOf('video-audio') !== -1 || this.opts.modes.indexOf('audio-only') !== -1;\n const acceptsVideo = !this.isAudioOnly() && (this.opts.modes.indexOf('video-audio') !== -1 || this.opts.modes.indexOf('video-only') !== -1 || this.opts.modes.indexOf('picture') !== -1);\n const videoConstraints = { ...(this.opts.videoConstraints || {\n facingMode: this.opts.facingMode\n }),\n // facingMode takes precedence over deviceId, and not needed\n // when specific device is selected\n ...(deviceId ? {\n deviceId,\n facingMode: null\n } : {})\n };\n return {\n audio: acceptsAudio,\n video: acceptsVideo ? videoConstraints : false\n };\n } // eslint-disable-next-line consistent-return\n\n\n start(options = null) {\n if (!this.supportsUserMedia) {\n return Promise.reject(new Error('Webcam access not supported'));\n }\n\n this.webcamActive = true;\n\n if (this.opts.mirror) {\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = true;\n }\n\n const constraints = this.getConstraints(options && options.deviceId ? options.deviceId : null);\n this.hasCameraCheck().then(hasCamera => {\n this.setPluginState({\n hasCamera\n }); // ask user for access to their camera\n\n return this.mediaDevices.getUserMedia(constraints).then(stream => {\n this.stream = stream;\n let currentDeviceId = null;\n const tracks = this.isAudioOnly() ? stream.getAudioTracks() : stream.getVideoTracks();\n\n if (!options || !options.deviceId) {\n currentDeviceId = tracks[0].getSettings().deviceId;\n } else {\n tracks.forEach(track => {\n if (track.getSettings().deviceId === options.deviceId) {\n currentDeviceId = track.getSettings().deviceId;\n }\n });\n } // Update the sources now, so we can access the names.\n\n\n this.updateVideoSources();\n this.setPluginState({\n currentDeviceId,\n cameraReady: true\n });\n }).catch(err => {\n this.setPluginState({\n cameraReady: false,\n cameraError: err\n });\n this.uppy.info(err.message, 'error');\n });\n });\n }\n /**\n * @returns {object}\n */\n\n\n getMediaRecorderOptions() {\n const options = {}; // Try to use the `opts.preferredVideoMimeType` or one of the `allowedFileTypes` for the recording.\n // If the browser doesn't support it, we'll fall back to the browser default instead.\n // Safari doesn't have the `isTypeSupported` API.\n\n if (MediaRecorder.isTypeSupported) {\n const {\n restrictions\n } = this.uppy.opts;\n let preferredVideoMimeTypes = [];\n\n if (this.opts.preferredVideoMimeType) {\n preferredVideoMimeTypes = [this.opts.preferredVideoMimeType];\n } else if (restrictions.allowedFileTypes) {\n preferredVideoMimeTypes = restrictions.allowedFileTypes.map(toMimeType).filter(isVideoMimeType);\n }\n\n const filterSupportedTypes = candidateType => MediaRecorder.isTypeSupported(candidateType) && getFileTypeExtension(candidateType);\n\n const acceptableMimeTypes = preferredVideoMimeTypes.filter(filterSupportedTypes);\n\n if (acceptableMimeTypes.length > 0) {\n // eslint-disable-next-line prefer-destructuring\n options.mimeType = acceptableMimeTypes[0];\n }\n }\n\n return options;\n }\n\n startRecording() {\n // only used if supportsMediaRecorder() returned true\n // eslint-disable-next-line compat/compat\n this.recorder = new MediaRecorder(this.stream, this.getMediaRecorderOptions());\n this.recordingChunks = [];\n let stoppingBecauseOfMaxSize = false;\n this.recorder.addEventListener('dataavailable', event => {\n this.recordingChunks.push(event.data);\n const {\n restrictions\n } = this.uppy.opts;\n\n if (this.recordingChunks.length > 1 && restrictions.maxFileSize != null && !stoppingBecauseOfMaxSize) {\n const totalSize = this.recordingChunks.reduce((acc, chunk) => acc + chunk.size, 0); // Exclude the initial chunk from the average size calculation because it is likely to be a very small outlier\n\n const averageChunkSize = (totalSize - this.recordingChunks[0].size) / (this.recordingChunks.length - 1);\n const expectedEndChunkSize = averageChunkSize * 3;\n const maxSize = Math.max(0, restrictions.maxFileSize - expectedEndChunkSize);\n\n if (totalSize > maxSize) {\n stoppingBecauseOfMaxSize = true;\n this.uppy.info(this.i18n('recordingStoppedMaxSize'), 'warning', 4000);\n this.stopRecording();\n }\n }\n }); // use a \"time slice\" of 500ms: ondataavailable will be called each 500ms\n // smaller time slices mean we can more accurately check the max file size restriction\n\n this.recorder.start(500);\n\n if (this.opts.showRecordingLength) {\n // Start the recordingLengthTimer if we are showing the recording length.\n this.recordingLengthTimer = setInterval(() => {\n const currentRecordingLength = this.getPluginState().recordingLengthSeconds;\n this.setPluginState({\n recordingLengthSeconds: currentRecordingLength + 1\n });\n }, 1000);\n }\n\n this.setPluginState({\n isRecording: true\n });\n }\n\n stopRecording() {\n const stopped = new Promise(resolve => {\n this.recorder.addEventListener('stop', () => {\n resolve();\n });\n this.recorder.stop();\n\n if (this.opts.showRecordingLength) {\n // Stop the recordingLengthTimer if we are showing the recording length.\n clearInterval(this.recordingLengthTimer);\n this.setPluginState({\n recordingLengthSeconds: 0\n });\n }\n });\n return stopped.then(() => {\n this.setPluginState({\n isRecording: false\n });\n return this.getVideo();\n }).then(file => {\n try {\n this.capturedMediaFile = file; // create object url for capture result preview\n\n this.setPluginState({\n // eslint-disable-next-line compat/compat\n recordedVideo: URL.createObjectURL(file.data)\n });\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = false;\n } catch (err) {\n // Logging the error, exept restrictions, which is handled in Core\n if (!err.isRestriction) {\n this.uppy.log(err);\n }\n }\n }).then(() => {\n this.recordingChunks = null;\n this.recorder = null;\n }, error => {\n this.recordingChunks = null;\n this.recorder = null;\n throw error;\n });\n }\n\n discardRecordedVideo() {\n this.setPluginState({\n recordedVideo: null\n });\n\n if (this.opts.mirror) {\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = true;\n }\n\n this.capturedMediaFile = null;\n }\n\n submit() {\n try {\n if (this.capturedMediaFile) {\n this.uppy.addFile(this.capturedMediaFile);\n }\n } catch (err) {\n // Logging the error, exept restrictions, which is handled in Core\n if (!err.isRestriction) {\n this.uppy.log(err, 'error');\n }\n }\n }\n\n async stop() {\n if (this.stream) {\n const audioTracks = this.stream.getAudioTracks();\n const videoTracks = this.stream.getVideoTracks();\n audioTracks.concat(videoTracks).forEach(track => track.stop());\n }\n\n if (this.recorder) {\n await new Promise(resolve => {\n this.recorder.addEventListener('stop', resolve, {\n once: true\n });\n this.recorder.stop();\n\n if (this.opts.showRecordingLength) {\n clearInterval(this.recordingLengthTimer);\n }\n });\n }\n\n this.recordingChunks = null;\n this.recorder = null;\n this.webcamActive = false;\n this.stream = null;\n this.setPluginState({\n recordedVideo: null,\n isRecording: false,\n recordingLengthSeconds: 0\n });\n }\n\n getVideoElement() {\n return this.el.querySelector('.uppy-Webcam-video');\n }\n\n oneTwoThreeSmile() {\n return new Promise((resolve, reject) => {\n let count = this.opts.countdown; // eslint-disable-next-line consistent-return\n\n const countDown = setInterval(() => {\n if (!this.webcamActive) {\n clearInterval(countDown);\n this.captureInProgress = false;\n return reject(new Error('Webcam is not active'));\n }\n\n if (count > 0) {\n this.uppy.info(`${count}...`, 'warning', 800);\n count--;\n } else {\n clearInterval(countDown);\n this.uppy.info(this.i18n('smile'), 'success', 1500);\n setTimeout(() => resolve(), 1500);\n }\n }, 1000);\n });\n }\n\n takeSnapshot() {\n if (this.captureInProgress) return;\n this.captureInProgress = true;\n this.opts.onBeforeSnapshot().catch(err => {\n const message = typeof err === 'object' ? err.message : err;\n this.uppy.info(message, 'error', 5000);\n return Promise.reject(new Error(`onBeforeSnapshot: ${message}`));\n }).then(() => {\n return this.getImage();\n }).then(tagFile => {\n this.captureInProgress = false;\n\n try {\n this.uppy.addFile(tagFile);\n } catch (err) {\n // Logging the error, except restrictions, which is handled in Core\n if (!err.isRestriction) {\n this.uppy.log(err);\n }\n }\n }, error => {\n this.captureInProgress = false;\n throw error;\n });\n }\n\n getImage() {\n const video = this.getVideoElement();\n\n if (!video) {\n return Promise.reject(new Error('No video element found, likely due to the Webcam tab being closed.'));\n }\n\n const width = video.videoWidth;\n const height = video.videoHeight;\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n ctx.drawImage(video, 0, 0);\n const {\n restrictions\n } = this.uppy.opts;\n let preferredImageMimeTypes = [];\n\n if (this.opts.preferredImageMimeType) {\n preferredImageMimeTypes = [this.opts.preferredImageMimeType];\n } else if (restrictions.allowedFileTypes) {\n preferredImageMimeTypes = restrictions.allowedFileTypes.map(toMimeType).filter(isImageMimeType);\n }\n\n const mimeType = preferredImageMimeTypes[0] || 'image/jpeg';\n const ext = getFileTypeExtension(mimeType) || 'jpg';\n const name = `cam-${Date.now()}.${ext}`;\n return canvasToBlob(canvas, mimeType).then(blob => {\n return {\n source: this.id,\n name,\n data: new Blob([blob], {\n type: mimeType\n }),\n type: mimeType\n };\n });\n }\n\n getVideo() {\n // Sometimes in iOS Safari, Blobs (especially the first Blob in the recordingChunks Array)\n // have empty 'type' attributes (e.g. '') so we need to find a Blob that has a defined 'type'\n // attribute in order to determine the correct MIME type.\n const mimeType = this.recordingChunks.find(blob => {\n var _blob$type;\n\n return ((_blob$type = blob.type) == null ? void 0 : _blob$type.length) > 0;\n }).type;\n const fileExtension = getFileTypeExtension(mimeType);\n\n if (!fileExtension) {\n return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type \"${mimeType}\"`));\n }\n\n const name = `webcam-${Date.now()}.${fileExtension}`;\n const blob = new Blob(this.recordingChunks, {\n type: mimeType\n });\n const file = {\n source: this.id,\n name,\n data: new Blob([blob], {\n type: mimeType\n }),\n type: mimeType\n };\n return Promise.resolve(file);\n }\n\n focus() {\n if (!this.opts.countdown) return;\n setTimeout(() => {\n this.uppy.info(this.i18n('smile'), 'success', 1500);\n }, 1000);\n }\n\n changeVideoSource(deviceId) {\n this.stop();\n this.start({\n deviceId\n });\n }\n\n updateVideoSources() {\n this.mediaDevices.enumerateDevices().then(devices => {\n this.setPluginState({\n videoSources: devices.filter(device => device.kind === 'videoinput')\n });\n });\n }\n\n render() {\n if (!this.webcamActive) {\n this.start();\n }\n\n const webcamState = this.getPluginState();\n\n if (!webcamState.cameraReady || !webcamState.hasCamera) {\n return h(PermissionsScreen, {\n icon: CameraIcon,\n i18n: this.i18n,\n hasCamera: webcamState.hasCamera\n });\n }\n\n return h(CameraScreen // eslint-disable-next-line react/jsx-props-no-spreading\n , _extends({}, webcamState, {\n onChangeVideoSource: this.changeVideoSource,\n onSnapshot: this.takeSnapshot,\n onStartRecording: this.startRecording,\n onStopRecording: this.stopRecording,\n onDiscardRecordedVideo: this.discardRecordedVideo,\n onSubmit: this.submit,\n onFocus: this.focus,\n onStop: this.stop,\n i18n: this.i18n,\n modes: this.opts.modes,\n showRecordingLength: this.opts.showRecordingLength,\n showVideoSourceDropdown: this.opts.showVideoSourceDropdown,\n supportsRecording: supportsMediaRecorder(),\n recording: webcamState.isRecording,\n mirror: _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror],\n src: this.stream\n }));\n }\n\n install() {\n this.setPluginState({\n cameraReady: false,\n recordingLengthSeconds: 0\n });\n const {\n target\n } = this.opts;\n\n if (target) {\n this.mount(target, this);\n }\n\n if (this.mediaDevices) {\n this.updateVideoSources();\n\n this.mediaDevices.ondevicechange = () => {\n this.updateVideoSources();\n\n if (this.stream) {\n let restartStream = true;\n const {\n videoSources,\n currentDeviceId\n } = this.getPluginState();\n videoSources.forEach(videoSource => {\n if (currentDeviceId === videoSource.deviceId) {\n restartStream = false;\n }\n });\n\n if (restartStream) {\n this.stop();\n this.start();\n }\n }\n };\n }\n }\n\n uninstall() {\n this.stop();\n this.unmount();\n }\n\n onUnmount() {\n this.stop();\n }\n\n}), _class.VERSION = \"2.0.4\", _temp);"],"sourceRoot":""}
1
+ {"version":3,"sources":["../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/get.js","../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/superPropBase.js","../../../node_modules/@uppy/webcam/lib/CameraIcon.js","../../../node_modules/@uppy/utils/lib/getFileTypeExtension.js","../../../node_modules/@uppy/utils/lib/canvasToBlob.js","../../../node_modules/@uppy/webcam/lib/supportsMediaRecorder.js","../../../node_modules/@uppy/webcam/lib/CameraScreen.js","../../../node_modules/@uppy/webcam/lib/SnapshotButton.js","../../../node_modules/@uppy/webcam/lib/RecordButton.js","../../../node_modules/@uppy/webcam/lib/RecordingLength.js","../../../node_modules/@uppy/webcam/lib/formatSeconds.js","../../../node_modules/@uppy/webcam/lib/VideoSourceSelect.js","../../../node_modules/@uppy/webcam/lib/SubmitButton.js","../../../node_modules/@uppy/webcam/lib/DiscardButton.js","../../../node_modules/@uppy/webcam/lib/PermissionsScreen.js","../../../node_modules/@uppy/webcam/lib/index.js"],"names":["superPropBase","_get","target","property","receiver","Reflect","get","module","exports","base","desc","Object","getOwnPropertyDescriptor","call","value","getPrototypeOf","object","prototype","hasOwnProperty","h","require","focusable","fill","width","height","viewBox","d","fillRule","mimeToExtensions","mimeType","split","canvas","type","quality","Promise","resolve","toBlob","MediaRecorder","start","_extends","assign","i","arguments","length","source","key","apply","this","Component","SnapshotButton","RecordButton","RecordingLength","VideoSourceSelect","SubmitButton","DiscardButton","isModeAvailable","modes","mode","indexOf","CameraScreen","onFocus","props","onStop","src","recordedVideo","recording","supportsRecording","videoSources","showVideoSourceDropdown","showRecordingLength","onSubmit","i18n","mirror","onSnapshot","onStartRecording","onStopRecording","onDiscardRecordedVideo","recordingLengthSeconds","hasRecordedVideo","shouldShowRecordButton","shouldShowSnapshotButton","shouldShowRecordingLength","shouldShowVideoSourceDropdown","videoProps","playsinline","muted","controls","videoElement","srcObject","undefined","autoplay","className","ref","onDiscard","CameraIcon","title","onClick","x","y","cx","cy","r","formatSeconds","formattedRecordingLengthSeconds","recording_length","seconds","Math","floor","String","padStart","currentDeviceId","onChangeVideoSource","onChange","event","map","videoSource","deviceId","selected","label","xmlns","icon","hasCamera","_class","_enableMirror","_temp","_classPrivateFieldLooseBase","privateKey","TypeError","id","_classPrivateFieldLooseKey","name","UIPlugin","getFileTypeExtension","mimeTypes","canvasToBlob","supportsMediaRecorder","PermissionsScreen","toMimeType","fileType","slice","isVideoMimeType","test","isImageMimeType","uppy","opts","defineProperty","writable","mediaDevices","navigator","supportsUserMedia","protocol","location","match","capturedMediaFile","rx","defaultLocale","strings","pluginNameCamera","smile","takePicture","startRecording","stopRecording","allowAccessTitle","allowAccessDescription","noCameraTitle","noCameraDescription","recordingStoppedMaxSize","recordingLength","submitRecordedFile","discardRecordedFile","defaultOptions","onBeforeSnapshot","countdown","facingMode","preferredImageMimeType","preferredVideoMimeType","i18nInit","install","bind","setPluginState","render","stop","takeSnapshot","discardRecordedVideo","submit","oneTwoThreeSmile","focus","changeVideoSource","webcamActive","cameraReady","cameraError","newOpts","videoConstraints","enumerateDevices","then","devices","some","device","kind","acceptsAudio","acceptsVideo","isAudioOnly","audio","video","options","reject","Error","constraints","getConstraints","hasCameraCheck","getUserMedia","stream","tracks","getAudioTracks","getVideoTracks","forEach","track","getSettings","updateVideoSources","err","info","message","isTypeSupported","restrictions","preferredVideoMimeTypes","allowedFileTypes","filter","acceptableMimeTypes","candidateType","recorder","getMediaRecorderOptions","recordingChunks","stoppingBecauseOfMaxSize","addEventListener","push","data","maxFileSize","totalSize","reduce","acc","chunk","size","expectedEndChunkSize","max","recordingLengthTimer","setInterval","currentRecordingLength","getPluginState","isRecording","clearInterval","getVideo","file","URL","createObjectURL","isRestriction","log","error","addFile","audioTracks","videoTracks","concat","once","el","querySelector","count","countDown","captureInProgress","setTimeout","getImage","tagFile","getVideoElement","videoWidth","videoHeight","document","createElement","getContext","drawImage","preferredImageMimeTypes","ext","Date","now","blob","Blob","find","_blob$type","fileExtension","webcamState","mount","ondevicechange","restartStream","unmount","VERSION"],"mappings":"2HAAA,IAAIA,EAAgB,EAAQ,KAE5B,SAASC,EAAKC,EAAQC,EAAUC,GAiB9B,MAhBuB,qBAAZC,SAA2BA,QAAQC,IAC5CC,EAAOC,QAAUP,EAAOI,QAAQC,IAEhCC,EAAOC,QAAUP,EAAO,SAAcC,EAAQC,EAAUC,GACtD,IAAIK,EAAOT,EAAcE,EAAQC,GACjC,GAAKM,EAAL,CACA,IAAIC,EAAOC,OAAOC,yBAAyBH,EAAMN,GAEjD,OAAIO,EAAKJ,IACAI,EAAKJ,IAAIO,KAAKT,GAGhBM,EAAKI,QAITb,EAAKC,EAAQC,EAAUC,GAAYF,GAG5CK,EAAOC,QAAUP,G,oBCtBjB,IAAIc,EAAiB,EAAQ,KAW7BR,EAAOC,QATP,SAAwBQ,EAAQb,GAC9B,MAAQQ,OAAOM,UAAUC,eAAeL,KAAKG,EAAQb,IAEpC,QADfa,EAASD,EAAeC,MAI1B,OAAOA,I,iCCNT,IACEG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/7.30c6cad9.chunk.js","sourcesContent":["var superPropBase = require(\"./superPropBase\");\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nmodule.exports = _get;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = () => {\n return h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n fill: \"#0097DC\",\n width: \"66\",\n height: \"55\",\n viewBox: \"0 0 66 55\"\n }, h(\"path\", {\n d: \"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z\",\n fillRule: \"evenodd\"\n }));\n};","\"use strict\";\n\nconst mimeToExtensions = {\n 'audio/mp3': 'mp3',\n 'audio/mp4': 'mp4',\n 'audio/ogg': 'ogg',\n 'audio/webm': 'webm',\n 'image/gif': 'gif',\n 'image/heic': 'heic',\n 'image/heif': 'heif',\n 'image/jpeg': 'jpg',\n 'image/png': 'png',\n 'image/svg+xml': 'svg',\n 'video/mp4': 'mp4',\n 'video/ogg': 'ogv',\n 'video/quicktime': 'mov',\n 'video/webm': 'webm',\n 'video/x-matroska': 'mkv',\n 'video/x-msvideo': 'avi'\n};\n\nmodule.exports = function getFileTypeExtension(mimeType) {\n // Remove the ; bit in 'video/x-matroska;codecs=avc1'\n // eslint-disable-next-line no-param-reassign\n [mimeType] = mimeType.split(';', 1);\n return mimeToExtensions[mimeType] || null;\n};","\"use strict\";\n\n/**\n * Save a <canvas> element's content to a Blob object.\n *\n * @param {HTMLCanvasElement} canvas\n * @returns {Promise}\n */\nmodule.exports = function canvasToBlob(canvas, type, quality) {\n return new Promise(resolve => {\n canvas.toBlob(resolve, type, quality);\n });\n};","\"use strict\";\n\nmodule.exports = function supportsMediaRecorder() {\n /* eslint-disable compat/compat */\n return typeof MediaRecorder === 'function' && !!MediaRecorder.prototype && typeof MediaRecorder.prototype.start === 'function';\n /* eslint-enable compat/compat */\n};","\"use strict\";\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\n/* eslint-disable jsx-a11y/media-has-caption */\nconst {\n h,\n Component\n} = require('preact');\n\nconst SnapshotButton = require('./SnapshotButton');\n\nconst RecordButton = require('./RecordButton');\n\nconst RecordingLength = require('./RecordingLength');\n\nconst VideoSourceSelect = require('./VideoSourceSelect');\n\nconst SubmitButton = require('./SubmitButton');\n\nconst DiscardButton = require('./DiscardButton');\n\nfunction isModeAvailable(modes, mode) {\n return modes.indexOf(mode) !== -1;\n}\n\nclass CameraScreen extends Component {\n componentDidMount() {\n const {\n onFocus\n } = this.props;\n onFocus();\n }\n\n componentWillUnmount() {\n const {\n onStop\n } = this.props;\n onStop();\n }\n\n render() {\n const {\n src,\n recordedVideo,\n recording,\n modes,\n supportsRecording,\n videoSources,\n showVideoSourceDropdown,\n showRecordingLength,\n onSubmit,\n i18n,\n mirror,\n onSnapshot,\n onStartRecording,\n onStopRecording,\n onDiscardRecordedVideo,\n recordingLengthSeconds\n } = this.props;\n const hasRecordedVideo = !!recordedVideo;\n const shouldShowRecordButton = !hasRecordedVideo && supportsRecording && (isModeAvailable(modes, 'video-only') || isModeAvailable(modes, 'audio-only') || isModeAvailable(modes, 'video-audio'));\n const shouldShowSnapshotButton = !hasRecordedVideo && isModeAvailable(modes, 'picture');\n const shouldShowRecordingLength = supportsRecording && showRecordingLength;\n const shouldShowVideoSourceDropdown = showVideoSourceDropdown && videoSources && videoSources.length > 1;\n const videoProps = {\n playsinline: true\n };\n\n if (recordedVideo) {\n videoProps.muted = false;\n videoProps.controls = true;\n videoProps.src = recordedVideo; // reset srcObject in dom. If not resetted, stream sticks in element\n\n if (this.videoElement) {\n this.videoElement.srcObject = undefined;\n }\n } else {\n videoProps.muted = true;\n videoProps.autoplay = true;\n videoProps.srcObject = src;\n }\n\n return h(\"div\", {\n className: \"uppy uppy-Webcam-container\"\n }, h(\"div\", {\n className: \"uppy-Webcam-videoContainer\"\n }, h(\"video\", _extends({\n /* eslint-disable-next-line no-return-assign */\n ref: videoElement => this.videoElement = videoElement,\n className: `uppy-Webcam-video ${mirror ? 'uppy-Webcam-video--mirrored' : ''}`\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n\n }, videoProps))), h(\"div\", {\n className: \"uppy-Webcam-footer\"\n }, h(\"div\", {\n className: \"uppy-Webcam-videoSourceContainer\"\n }, shouldShowVideoSourceDropdown ? VideoSourceSelect(this.props) : null), h(\"div\", {\n className: \"uppy-Webcam-buttonContainer\"\n }, shouldShowSnapshotButton && h(SnapshotButton, {\n onSnapshot: onSnapshot,\n i18n: i18n\n }), shouldShowRecordButton && h(RecordButton, {\n recording: recording,\n onStartRecording: onStartRecording,\n onStopRecording: onStopRecording,\n i18n: i18n\n }), hasRecordedVideo && h(SubmitButton, {\n onSubmit: onSubmit,\n i18n: i18n\n }), hasRecordedVideo && h(DiscardButton, {\n onDiscard: onDiscardRecordedVideo,\n i18n: i18n\n })), shouldShowRecordingLength && h(\"div\", {\n className: \"uppy-Webcam-recordingLength\"\n }, h(RecordingLength, {\n recordingLengthSeconds: recordingLengthSeconds,\n i18n: i18n\n }))));\n }\n\n}\n\nmodule.exports = CameraScreen;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nconst CameraIcon = require('./CameraIcon');\n\nmodule.exports = ({\n onSnapshot,\n i18n\n}) => {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture\",\n type: \"button\",\n title: i18n('takePicture'),\n \"aria-label\": i18n('takePicture'),\n onClick: onSnapshot,\n \"data-uppy-super-focusable\": true\n }, CameraIcon());\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = function RecordButton({\n recording,\n onStartRecording,\n onStopRecording,\n i18n\n}) {\n if (recording) {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button\",\n type: \"button\",\n title: i18n('stopRecording'),\n \"aria-label\": i18n('stopRecording'),\n onClick: onStopRecording,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\",\n width: \"100\",\n height: \"100\",\n viewBox: \"0 0 100 100\"\n }, h(\"rect\", {\n x: \"15\",\n y: \"15\",\n width: \"70\",\n height: \"70\"\n })));\n }\n\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button\",\n type: \"button\",\n title: i18n('startRecording'),\n \"aria-label\": i18n('startRecording'),\n onClick: onStartRecording,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\",\n width: \"100\",\n height: \"100\",\n viewBox: \"0 0 100 100\"\n }, h(\"circle\", {\n cx: \"50\",\n cy: \"50\",\n r: \"40\"\n })));\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nconst formatSeconds = require('./formatSeconds');\n\nmodule.exports = function RecordingLength({\n recordingLengthSeconds,\n i18n\n}) {\n const formattedRecordingLengthSeconds = formatSeconds(recordingLengthSeconds);\n return h(\"span\", {\n \"aria-label\": i18n('recordingLength', {\n recording_length: formattedRecordingLengthSeconds\n })\n }, formattedRecordingLengthSeconds);\n};","\"use strict\";\n\n/**\n * Takes an Integer value of seconds (e.g. 83) and converts it into a human-readable formatted string (e.g. '1:23').\n *\n * @param {Integer} seconds\n * @returns {string} the formatted seconds (e.g. '1:23' for 1 minute and 23 seconds)\n *\n */\nmodule.exports = function formatSeconds(seconds) {\n return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, 0)}`;\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = ({\n currentDeviceId,\n videoSources,\n onChangeVideoSource\n}) => {\n return h(\"div\", {\n className: \"uppy-Webcam-videoSource\"\n }, h(\"select\", {\n className: \"uppy-u-reset uppy-Webcam-videoSource-select\",\n onChange: event => {\n onChangeVideoSource(event.target.value);\n }\n }, videoSources.map(videoSource => h(\"option\", {\n key: videoSource.deviceId,\n value: videoSource.deviceId,\n selected: videoSource.deviceId === currentDeviceId\n }, videoSource.label))));\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nfunction SubmitButton({\n onSubmit,\n i18n\n}) {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit\",\n type: \"button\",\n title: i18n('submitRecordedFile'),\n \"aria-label\": i18n('submitRecordedFile'),\n onClick: onSubmit,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n width: \"12\",\n height: \"9\",\n viewBox: \"0 0 12 9\",\n xmlns: \"http://www.w3.org/2000/svg\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\"\n }, h(\"path\", {\n fill: \"#fff\",\n fillRule: \"nonzero\",\n d: \"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z\"\n })));\n}\n\nmodule.exports = SubmitButton;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nfunction DiscardButton({\n onDiscard,\n i18n\n}) {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button\",\n type: \"button\",\n title: i18n('discardRecordedFile'),\n \"aria-label\": i18n('discardRecordedFile'),\n onClick: onDiscard,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n width: \"13\",\n height: \"13\",\n viewBox: \"0 0 13 13\",\n xmlns: \"http://www.w3.org/2000/svg\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\"\n }, h(\"g\", {\n fill: \"#FFF\",\n fillRule: \"evenodd\"\n }, h(\"path\", {\n d: \"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z\"\n }), h(\"path\", {\n d: \"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z\"\n }))));\n}\n\nmodule.exports = DiscardButton;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = props => {\n return h(\"div\", {\n className: \"uppy-Webcam-permissons\"\n }, h(\"div\", {\n className: \"uppy-Webcam-permissonsIcon\"\n }, props.icon()), h(\"h1\", {\n className: \"uppy-Webcam-title\"\n }, props.hasCamera ? props.i18n('allowAccessTitle') : props.i18n('noCameraTitle')), h(\"p\", null, props.hasCamera ? props.i18n('allowAccessDescription') : props.i18n('noCameraDescription')));\n};","\"use strict\";\n\nvar _class, _enableMirror, _temp;\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError(\"attempted to use private field on non-instance\"); } return receiver; }\n\nvar id = 0;\n\nfunction _classPrivateFieldLooseKey(name) { return \"__private_\" + id++ + \"_\" + name; }\n\nconst {\n h\n} = require('preact');\n\nconst {\n UIPlugin\n} = require('@uppy/core');\n\nconst getFileTypeExtension = require('@uppy/utils/lib/getFileTypeExtension');\n\nconst mimeTypes = require('@uppy/utils/lib/mimeTypes');\n\nconst canvasToBlob = require('@uppy/utils/lib/canvasToBlob');\n\nconst supportsMediaRecorder = require('./supportsMediaRecorder');\n\nconst CameraIcon = require('./CameraIcon');\n\nconst CameraScreen = require('./CameraScreen');\n\nconst PermissionsScreen = require('./PermissionsScreen');\n/**\n * Normalize a MIME type or file extension into a MIME type.\n *\n * @param {string} fileType - MIME type or a file extension prefixed with `.`.\n * @returns {string|undefined} The MIME type or `undefined` if the fileType is an extension and is not known.\n */\n\n\nfunction toMimeType(fileType) {\n if (fileType[0] === '.') {\n return mimeTypes[fileType.slice(1)];\n }\n\n return fileType;\n}\n/**\n * Is this MIME type a video?\n *\n * @param {string} mimeType - MIME type.\n * @returns {boolean}\n */\n\n\nfunction isVideoMimeType(mimeType) {\n return /^video\\/[^*]+$/.test(mimeType);\n}\n/**\n * Is this MIME type an image?\n *\n * @param {string} mimeType - MIME type.\n * @returns {boolean}\n */\n\n\nfunction isImageMimeType(mimeType) {\n return /^image\\/[^*]+$/.test(mimeType);\n}\n\nfunction getMediaDevices() {\n // bug in the compatibility data\n // eslint-disable-next-line compat/compat\n return navigator.mediaDevices;\n}\n/**\n * Webcam\n */\n\n\nmodule.exports = (_temp = (_enableMirror = /*#__PURE__*/_classPrivateFieldLooseKey(\"enableMirror\"), _class = class Webcam extends UIPlugin {\n // eslint-disable-next-line global-require\n // enableMirror is used to toggle mirroring, for instance when discarding the video,\n // while `opts.mirror` is used to remember the initial user setting\n constructor(uppy, opts) {\n super(uppy, opts);\n Object.defineProperty(this, _enableMirror, {\n writable: true,\n value: void 0\n });\n this.mediaDevices = getMediaDevices();\n this.supportsUserMedia = !!this.mediaDevices; // eslint-disable-next-line no-restricted-globals\n\n this.protocol = location.protocol.match(/https/i) ? 'https' : 'http';\n this.id = this.opts.id || 'Webcam';\n this.type = 'acquirer';\n this.capturedMediaFile = null;\n\n this.icon = () => h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n width: \"32\",\n height: \"32\",\n viewBox: \"0 0 32 32\"\n }, h(\"g\", {\n fill: \"none\",\n fillRule: \"evenodd\"\n }, h(\"rect\", {\n className: \"uppy-ProviderIconBg\",\n fill: \"#03BFEF\",\n width: \"32\",\n height: \"32\",\n rx: \"16\"\n }), h(\"path\", {\n d: \"M22 11c1.133 0 2 .867 2 2v7.333c0 1.134-.867 2-2 2H10c-1.133 0-2-.866-2-2V13c0-1.133.867-2 2-2h2.333l1.134-1.733C13.6 9.133 13.8 9 14 9h4c.2 0 .4.133.533.267L19.667 11H22zm-6 1.533a3.764 3.764 0 0 0-3.8 3.8c0 2.129 1.672 3.801 3.8 3.801s3.8-1.672 3.8-3.8c0-2.13-1.672-3.801-3.8-3.801zm0 6.261c-1.395 0-2.46-1.066-2.46-2.46 0-1.395 1.065-2.461 2.46-2.461s2.46 1.066 2.46 2.46c0 1.395-1.065 2.461-2.46 2.461z\",\n fill: \"#FFF\",\n fillRule: \"nonzero\"\n })));\n\n this.defaultLocale = {\n strings: {\n pluginNameCamera: 'Camera',\n smile: 'Smile!',\n takePicture: 'Take a picture',\n startRecording: 'Begin video recording',\n stopRecording: 'Stop video recording',\n allowAccessTitle: 'Please allow access to your camera',\n allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.',\n noCameraTitle: 'Camera Not Available',\n noCameraDescription: 'In order to take pictures or record video, please connect a camera device',\n recordingStoppedMaxSize: 'Recording stopped because the file size is about to exceed the limit',\n recordingLength: 'Recording length %{recording_length}',\n submitRecordedFile: 'Submit recorded file',\n discardRecordedFile: 'Discard recorded file'\n }\n }; // set default options\n\n const defaultOptions = {\n onBeforeSnapshot: () => Promise.resolve(),\n countdown: false,\n modes: ['video-audio', 'video-only', 'audio-only', 'picture'],\n mirror: true,\n showVideoSourceDropdown: false,\n facingMode: 'user',\n preferredImageMimeType: null,\n preferredVideoMimeType: null,\n showRecordingLength: false\n };\n this.opts = { ...defaultOptions,\n ...opts\n };\n this.i18nInit();\n this.title = this.i18n('pluginNameCamera');\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = this.opts.mirror;\n this.install = this.install.bind(this);\n this.setPluginState = this.setPluginState.bind(this);\n this.render = this.render.bind(this); // Camera controls\n\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.takeSnapshot = this.takeSnapshot.bind(this);\n this.startRecording = this.startRecording.bind(this);\n this.stopRecording = this.stopRecording.bind(this);\n this.discardRecordedVideo = this.discardRecordedVideo.bind(this);\n this.submit = this.submit.bind(this);\n this.oneTwoThreeSmile = this.oneTwoThreeSmile.bind(this);\n this.focus = this.focus.bind(this);\n this.changeVideoSource = this.changeVideoSource.bind(this);\n this.webcamActive = false;\n\n if (this.opts.countdown) {\n this.opts.onBeforeSnapshot = this.oneTwoThreeSmile;\n }\n\n this.setPluginState({\n hasCamera: false,\n cameraReady: false,\n cameraError: null,\n recordingLengthSeconds: 0,\n videoSources: [],\n currentDeviceId: null\n });\n }\n\n setOptions(newOpts) {\n super.setOptions({ ...newOpts,\n videoConstraints: { // May be undefined but ... handles that\n ...this.opts.videoConstraints,\n ...(newOpts == null ? void 0 : newOpts.videoConstraints)\n }\n });\n }\n\n hasCameraCheck() {\n if (!this.mediaDevices) {\n return Promise.resolve(false);\n }\n\n return this.mediaDevices.enumerateDevices().then(devices => {\n return devices.some(device => device.kind === 'videoinput');\n });\n }\n\n isAudioOnly() {\n return this.opts.modes.length === 1 && this.opts.modes[0] === 'audio-only';\n }\n\n getConstraints(deviceId = null) {\n const acceptsAudio = this.opts.modes.indexOf('video-audio') !== -1 || this.opts.modes.indexOf('audio-only') !== -1;\n const acceptsVideo = !this.isAudioOnly() && (this.opts.modes.indexOf('video-audio') !== -1 || this.opts.modes.indexOf('video-only') !== -1 || this.opts.modes.indexOf('picture') !== -1);\n const videoConstraints = { ...(this.opts.videoConstraints || {\n facingMode: this.opts.facingMode\n }),\n // facingMode takes precedence over deviceId, and not needed\n // when specific device is selected\n ...(deviceId ? {\n deviceId,\n facingMode: null\n } : {})\n };\n return {\n audio: acceptsAudio,\n video: acceptsVideo ? videoConstraints : false\n };\n } // eslint-disable-next-line consistent-return\n\n\n start(options = null) {\n if (!this.supportsUserMedia) {\n return Promise.reject(new Error('Webcam access not supported'));\n }\n\n this.webcamActive = true;\n\n if (this.opts.mirror) {\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = true;\n }\n\n const constraints = this.getConstraints(options && options.deviceId ? options.deviceId : null);\n this.hasCameraCheck().then(hasCamera => {\n this.setPluginState({\n hasCamera\n }); // ask user for access to their camera\n\n return this.mediaDevices.getUserMedia(constraints).then(stream => {\n this.stream = stream;\n let currentDeviceId = null;\n const tracks = this.isAudioOnly() ? stream.getAudioTracks() : stream.getVideoTracks();\n\n if (!options || !options.deviceId) {\n currentDeviceId = tracks[0].getSettings().deviceId;\n } else {\n tracks.forEach(track => {\n if (track.getSettings().deviceId === options.deviceId) {\n currentDeviceId = track.getSettings().deviceId;\n }\n });\n } // Update the sources now, so we can access the names.\n\n\n this.updateVideoSources();\n this.setPluginState({\n currentDeviceId,\n cameraReady: true\n });\n }).catch(err => {\n this.setPluginState({\n cameraReady: false,\n cameraError: err\n });\n this.uppy.info(err.message, 'error');\n });\n });\n }\n /**\n * @returns {object}\n */\n\n\n getMediaRecorderOptions() {\n const options = {}; // Try to use the `opts.preferredVideoMimeType` or one of the `allowedFileTypes` for the recording.\n // If the browser doesn't support it, we'll fall back to the browser default instead.\n // Safari doesn't have the `isTypeSupported` API.\n\n if (MediaRecorder.isTypeSupported) {\n const {\n restrictions\n } = this.uppy.opts;\n let preferredVideoMimeTypes = [];\n\n if (this.opts.preferredVideoMimeType) {\n preferredVideoMimeTypes = [this.opts.preferredVideoMimeType];\n } else if (restrictions.allowedFileTypes) {\n preferredVideoMimeTypes = restrictions.allowedFileTypes.map(toMimeType).filter(isVideoMimeType);\n }\n\n const filterSupportedTypes = candidateType => MediaRecorder.isTypeSupported(candidateType) && getFileTypeExtension(candidateType);\n\n const acceptableMimeTypes = preferredVideoMimeTypes.filter(filterSupportedTypes);\n\n if (acceptableMimeTypes.length > 0) {\n // eslint-disable-next-line prefer-destructuring\n options.mimeType = acceptableMimeTypes[0];\n }\n }\n\n return options;\n }\n\n startRecording() {\n // only used if supportsMediaRecorder() returned true\n // eslint-disable-next-line compat/compat\n this.recorder = new MediaRecorder(this.stream, this.getMediaRecorderOptions());\n this.recordingChunks = [];\n let stoppingBecauseOfMaxSize = false;\n this.recorder.addEventListener('dataavailable', event => {\n this.recordingChunks.push(event.data);\n const {\n restrictions\n } = this.uppy.opts;\n\n if (this.recordingChunks.length > 1 && restrictions.maxFileSize != null && !stoppingBecauseOfMaxSize) {\n const totalSize = this.recordingChunks.reduce((acc, chunk) => acc + chunk.size, 0); // Exclude the initial chunk from the average size calculation because it is likely to be a very small outlier\n\n const averageChunkSize = (totalSize - this.recordingChunks[0].size) / (this.recordingChunks.length - 1);\n const expectedEndChunkSize = averageChunkSize * 3;\n const maxSize = Math.max(0, restrictions.maxFileSize - expectedEndChunkSize);\n\n if (totalSize > maxSize) {\n stoppingBecauseOfMaxSize = true;\n this.uppy.info(this.i18n('recordingStoppedMaxSize'), 'warning', 4000);\n this.stopRecording();\n }\n }\n }); // use a \"time slice\" of 500ms: ondataavailable will be called each 500ms\n // smaller time slices mean we can more accurately check the max file size restriction\n\n this.recorder.start(500);\n\n if (this.opts.showRecordingLength) {\n // Start the recordingLengthTimer if we are showing the recording length.\n this.recordingLengthTimer = setInterval(() => {\n const currentRecordingLength = this.getPluginState().recordingLengthSeconds;\n this.setPluginState({\n recordingLengthSeconds: currentRecordingLength + 1\n });\n }, 1000);\n }\n\n this.setPluginState({\n isRecording: true\n });\n }\n\n stopRecording() {\n const stopped = new Promise(resolve => {\n this.recorder.addEventListener('stop', () => {\n resolve();\n });\n this.recorder.stop();\n\n if (this.opts.showRecordingLength) {\n // Stop the recordingLengthTimer if we are showing the recording length.\n clearInterval(this.recordingLengthTimer);\n this.setPluginState({\n recordingLengthSeconds: 0\n });\n }\n });\n return stopped.then(() => {\n this.setPluginState({\n isRecording: false\n });\n return this.getVideo();\n }).then(file => {\n try {\n this.capturedMediaFile = file; // create object url for capture result preview\n\n this.setPluginState({\n // eslint-disable-next-line compat/compat\n recordedVideo: URL.createObjectURL(file.data)\n });\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = false;\n } catch (err) {\n // Logging the error, exept restrictions, which is handled in Core\n if (!err.isRestriction) {\n this.uppy.log(err);\n }\n }\n }).then(() => {\n this.recordingChunks = null;\n this.recorder = null;\n }, error => {\n this.recordingChunks = null;\n this.recorder = null;\n throw error;\n });\n }\n\n discardRecordedVideo() {\n this.setPluginState({\n recordedVideo: null\n });\n\n if (this.opts.mirror) {\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = true;\n }\n\n this.capturedMediaFile = null;\n }\n\n submit() {\n try {\n if (this.capturedMediaFile) {\n this.uppy.addFile(this.capturedMediaFile);\n }\n } catch (err) {\n // Logging the error, exept restrictions, which is handled in Core\n if (!err.isRestriction) {\n this.uppy.log(err, 'error');\n }\n }\n }\n\n async stop() {\n if (this.stream) {\n const audioTracks = this.stream.getAudioTracks();\n const videoTracks = this.stream.getVideoTracks();\n audioTracks.concat(videoTracks).forEach(track => track.stop());\n }\n\n if (this.recorder) {\n await new Promise(resolve => {\n this.recorder.addEventListener('stop', resolve, {\n once: true\n });\n this.recorder.stop();\n\n if (this.opts.showRecordingLength) {\n clearInterval(this.recordingLengthTimer);\n }\n });\n }\n\n this.recordingChunks = null;\n this.recorder = null;\n this.webcamActive = false;\n this.stream = null;\n this.setPluginState({\n recordedVideo: null,\n isRecording: false,\n recordingLengthSeconds: 0\n });\n }\n\n getVideoElement() {\n return this.el.querySelector('.uppy-Webcam-video');\n }\n\n oneTwoThreeSmile() {\n return new Promise((resolve, reject) => {\n let count = this.opts.countdown; // eslint-disable-next-line consistent-return\n\n const countDown = setInterval(() => {\n if (!this.webcamActive) {\n clearInterval(countDown);\n this.captureInProgress = false;\n return reject(new Error('Webcam is not active'));\n }\n\n if (count > 0) {\n this.uppy.info(`${count}...`, 'warning', 800);\n count--;\n } else {\n clearInterval(countDown);\n this.uppy.info(this.i18n('smile'), 'success', 1500);\n setTimeout(() => resolve(), 1500);\n }\n }, 1000);\n });\n }\n\n takeSnapshot() {\n if (this.captureInProgress) return;\n this.captureInProgress = true;\n this.opts.onBeforeSnapshot().catch(err => {\n const message = typeof err === 'object' ? err.message : err;\n this.uppy.info(message, 'error', 5000);\n return Promise.reject(new Error(`onBeforeSnapshot: ${message}`));\n }).then(() => {\n return this.getImage();\n }).then(tagFile => {\n this.captureInProgress = false;\n\n try {\n this.uppy.addFile(tagFile);\n } catch (err) {\n // Logging the error, except restrictions, which is handled in Core\n if (!err.isRestriction) {\n this.uppy.log(err);\n }\n }\n }, error => {\n this.captureInProgress = false;\n throw error;\n });\n }\n\n getImage() {\n const video = this.getVideoElement();\n\n if (!video) {\n return Promise.reject(new Error('No video element found, likely due to the Webcam tab being closed.'));\n }\n\n const width = video.videoWidth;\n const height = video.videoHeight;\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n ctx.drawImage(video, 0, 0);\n const {\n restrictions\n } = this.uppy.opts;\n let preferredImageMimeTypes = [];\n\n if (this.opts.preferredImageMimeType) {\n preferredImageMimeTypes = [this.opts.preferredImageMimeType];\n } else if (restrictions.allowedFileTypes) {\n preferredImageMimeTypes = restrictions.allowedFileTypes.map(toMimeType).filter(isImageMimeType);\n }\n\n const mimeType = preferredImageMimeTypes[0] || 'image/jpeg';\n const ext = getFileTypeExtension(mimeType) || 'jpg';\n const name = `cam-${Date.now()}.${ext}`;\n return canvasToBlob(canvas, mimeType).then(blob => {\n return {\n source: this.id,\n name,\n data: new Blob([blob], {\n type: mimeType\n }),\n type: mimeType\n };\n });\n }\n\n getVideo() {\n // Sometimes in iOS Safari, Blobs (especially the first Blob in the recordingChunks Array)\n // have empty 'type' attributes (e.g. '') so we need to find a Blob that has a defined 'type'\n // attribute in order to determine the correct MIME type.\n const mimeType = this.recordingChunks.find(blob => {\n var _blob$type;\n\n return ((_blob$type = blob.type) == null ? void 0 : _blob$type.length) > 0;\n }).type;\n const fileExtension = getFileTypeExtension(mimeType);\n\n if (!fileExtension) {\n return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type \"${mimeType}\"`));\n }\n\n const name = `webcam-${Date.now()}.${fileExtension}`;\n const blob = new Blob(this.recordingChunks, {\n type: mimeType\n });\n const file = {\n source: this.id,\n name,\n data: new Blob([blob], {\n type: mimeType\n }),\n type: mimeType\n };\n return Promise.resolve(file);\n }\n\n focus() {\n if (!this.opts.countdown) return;\n setTimeout(() => {\n this.uppy.info(this.i18n('smile'), 'success', 1500);\n }, 1000);\n }\n\n changeVideoSource(deviceId) {\n this.stop();\n this.start({\n deviceId\n });\n }\n\n updateVideoSources() {\n this.mediaDevices.enumerateDevices().then(devices => {\n this.setPluginState({\n videoSources: devices.filter(device => device.kind === 'videoinput')\n });\n });\n }\n\n render() {\n if (!this.webcamActive) {\n this.start();\n }\n\n const webcamState = this.getPluginState();\n\n if (!webcamState.cameraReady || !webcamState.hasCamera) {\n return h(PermissionsScreen, {\n icon: CameraIcon,\n i18n: this.i18n,\n hasCamera: webcamState.hasCamera\n });\n }\n\n return h(CameraScreen // eslint-disable-next-line react/jsx-props-no-spreading\n , _extends({}, webcamState, {\n onChangeVideoSource: this.changeVideoSource,\n onSnapshot: this.takeSnapshot,\n onStartRecording: this.startRecording,\n onStopRecording: this.stopRecording,\n onDiscardRecordedVideo: this.discardRecordedVideo,\n onSubmit: this.submit,\n onFocus: this.focus,\n onStop: this.stop,\n i18n: this.i18n,\n modes: this.opts.modes,\n showRecordingLength: this.opts.showRecordingLength,\n showVideoSourceDropdown: this.opts.showVideoSourceDropdown,\n supportsRecording: supportsMediaRecorder(),\n recording: webcamState.isRecording,\n mirror: _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror],\n src: this.stream\n }));\n }\n\n install() {\n this.setPluginState({\n cameraReady: false,\n recordingLengthSeconds: 0\n });\n const {\n target\n } = this.opts;\n\n if (target) {\n this.mount(target, this);\n }\n\n if (this.mediaDevices) {\n this.updateVideoSources();\n\n this.mediaDevices.ondevicechange = () => {\n this.updateVideoSources();\n\n if (this.stream) {\n let restartStream = true;\n const {\n videoSources,\n currentDeviceId\n } = this.getPluginState();\n videoSources.forEach(videoSource => {\n if (currentDeviceId === videoSource.deviceId) {\n restartStream = false;\n }\n });\n\n if (restartStream) {\n this.stop();\n this.start();\n }\n }\n };\n }\n }\n\n uninstall() {\n this.stop();\n this.unmount();\n }\n\n onUnmount() {\n this.stop();\n }\n\n}), _class.VERSION = \"2.0.4\", _temp);"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- (this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[8],{529:function(e,i,t){"use strict";var o=t(20),n=t(21),r=t(453),s=t(149),l=t(24),a=t(25),u=t(460).ProviderViews;e.exports=function(e){l(t,e);var i=a(t);function t(){return o(this,t),i.apply(this,arguments)}return n(t,[{key:"toggleCheckbox",value:function(e,i){e.stopPropagation(),e.preventDefault(),i.custom.isSharedDrive||r(s(t.prototype),"toggleCheckbox",this).call(this,e,i)}}]),t}(u)},539:function(e,i,t){"use strict";var o,n,r=t(20),s=t(21),l=t(56),a=t(24),u=t(25),p=t(53).UIPlugin,c=t(450).Provider,h=t(17).h,v=t(529);e.exports=(n=o=function(e){a(t,e);var i=u(t);function t(e,o){var n;return r(this,t),(n=i.call(this,e,o)).id=n.opts.id||"GoogleDrive",n.title=n.opts.title||"Google Drive",c.initPlugin(l(n),o),n.title=n.opts.title||"Google Drive",n.icon=function(){return h("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},h("g",{fill:"none",fillRule:"evenodd"},h("rect",{className:"uppy-ProviderIconBg",fill:"#4285F4",width:"32",height:"32",rx:"16"}),h("path",{d:"M25.216 17.736L19.043 7h-6.086l6.175 10.736h6.084zm-11.275.896L10.9 24h11.723l3.04-5.368H13.942zm-1.789-10.29l-5.816 10.29L9.38 24l5.905-10.29-3.132-5.369z",fill:"#FFF"})))},n.provider=new c(e,{companionUrl:n.opts.companionUrl,companionHeaders:n.opts.companionHeaders,companionKeysParams:n.opts.companionKeysParams,companionCookiesRule:n.opts.companionCookiesRule,provider:"drive",pluginId:n.id}),n.defaultLocale={strings:{pluginNameGoogleDrive:"Google Drive"}},n.i18nInit(),n.title=n.i18n("pluginNameGoogleDrive"),n.onFirstRender=n.onFirstRender.bind(l(n)),n.render=n.render.bind(l(n)),n}return s(t,[{key:"install",value:function(){this.view=new v(this,{provider:this.provider});var e=this.opts.target;e&&this.mount(e,this)}},{key:"uninstall",value:function(){this.view.tearDown(),this.unmount()}},{key:"onFirstRender",value:function(){return Promise.all([this.provider.fetchPreAuthToken(),this.view.getFolder("root","/")])}},{key:"render",value:function(e){return this.view.render(e)}}]),t}(p),o.VERSION="2.0.4",n)}}]);
2
- //# sourceMappingURL=8.2d291684.chunk.js.map
1
+ (this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[8],{529:function(e,i,t){"use strict";var o=t(19),n=t(20),r=t(453),s=t(149),l=t(24),a=t(25),u=t(460).ProviderViews;e.exports=function(e){l(t,e);var i=a(t);function t(){return o(this,t),i.apply(this,arguments)}return n(t,[{key:"toggleCheckbox",value:function(e,i){e.stopPropagation(),e.preventDefault(),i.custom.isSharedDrive||r(s(t.prototype),"toggleCheckbox",this).call(this,e,i)}}]),t}(u)},539:function(e,i,t){"use strict";var o,n,r=t(19),s=t(20),l=t(56),a=t(24),u=t(25),p=t(53).UIPlugin,c=t(450).Provider,h=t(17).h,v=t(529);e.exports=(n=o=function(e){a(t,e);var i=u(t);function t(e,o){var n;return r(this,t),(n=i.call(this,e,o)).id=n.opts.id||"GoogleDrive",n.title=n.opts.title||"Google Drive",c.initPlugin(l(n),o),n.title=n.opts.title||"Google Drive",n.icon=function(){return h("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},h("g",{fill:"none",fillRule:"evenodd"},h("rect",{className:"uppy-ProviderIconBg",fill:"#4285F4",width:"32",height:"32",rx:"16"}),h("path",{d:"M25.216 17.736L19.043 7h-6.086l6.175 10.736h6.084zm-11.275.896L10.9 24h11.723l3.04-5.368H13.942zm-1.789-10.29l-5.816 10.29L9.38 24l5.905-10.29-3.132-5.369z",fill:"#FFF"})))},n.provider=new c(e,{companionUrl:n.opts.companionUrl,companionHeaders:n.opts.companionHeaders,companionKeysParams:n.opts.companionKeysParams,companionCookiesRule:n.opts.companionCookiesRule,provider:"drive",pluginId:n.id}),n.defaultLocale={strings:{pluginNameGoogleDrive:"Google Drive"}},n.i18nInit(),n.title=n.i18n("pluginNameGoogleDrive"),n.onFirstRender=n.onFirstRender.bind(l(n)),n.render=n.render.bind(l(n)),n}return s(t,[{key:"install",value:function(){this.view=new v(this,{provider:this.provider});var e=this.opts.target;e&&this.mount(e,this)}},{key:"uninstall",value:function(){this.view.tearDown(),this.unmount()}},{key:"onFirstRender",value:function(){return Promise.all([this.provider.fetchPreAuthToken(),this.view.getFolder("root","/")])}},{key:"render",value:function(e){return this.view.render(e)}}]),t}(p),o.VERSION="2.0.4",n)}}]);
2
+ //# sourceMappingURL=8.959d6a7c.chunk.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/@uppy/google-drive/lib/DriveProviderViews.js","../../../node_modules/@uppy/google-drive/lib/index.js"],"names":["ProviderViews","require","module","exports","e","file","stopPropagation","preventDefault","custom","isSharedDrive","_class","_temp","UIPlugin","Provider","h","DriveProviderViews","uppy","opts","id","title","initPlugin","icon","focusable","width","height","viewBox","fill","fillRule","className","rx","d","provider","companionUrl","companionHeaders","companionKeysParams","companionCookiesRule","pluginId","defaultLocale","strings","pluginNameGoogleDrive","i18nInit","i18n","onFirstRender","bind","render","this","view","target","mount","tearDown","unmount","Promise","all","fetchPreAuthToken","getFolder","state","VERSION"],"mappings":"8LAGEA,EACEC,EAAQ,KADVD,cAGFE,EAAOC,QAAP,4HACE,SAAeC,EAAGC,GAChBD,EAAEE,kBACFF,EAAEG,iBAEGF,EAAKG,OAAOC,eACf,kDAAqBL,EAAGC,OAN9B,GAAkDL,I,qCCJ9CU,EAAQC,E,wCAGVC,EACEX,EAAQ,IADVW,SAIAC,EACEZ,EAAQ,KADVY,SAIAC,EACEb,EAAQ,IADVa,EAGIC,EAAqBd,EAAQ,KAEnCC,EAAOC,SAAWQ,EAAQD,EAAM,8BAC9B,WAAYM,EAAMC,GAAM,wBACtB,cAAMD,EAAMC,IACPC,GAAK,EAAKD,KAAKC,IAAM,cAC1B,EAAKC,MAAQ,EAAKF,KAAKE,OAAS,eAChCN,EAASO,WAAT,KAA0BH,GAC1B,EAAKE,MAAQ,EAAKF,KAAKE,OAAS,eAEhC,EAAKE,KAAO,kBAAMP,EAAE,MAAO,CACzB,cAAe,OACfQ,UAAW,QACXC,MAAO,KACPC,OAAQ,KACRC,QAAS,aACRX,EAAE,IAAK,CACRY,KAAM,OACNC,SAAU,WACTb,EAAE,OAAQ,CACXc,UAAW,sBACXF,KAAM,UACNH,MAAO,KACPC,OAAQ,KACRK,GAAI,OACFf,EAAE,OAAQ,CACZgB,EAAG,8JACHJ,KAAM,YAGR,EAAKK,SAAW,IAAIlB,EAASG,EAAM,CACjCgB,aAAc,EAAKf,KAAKe,aACxBC,iBAAkB,EAAKhB,KAAKgB,iBAC5BC,oBAAqB,EAAKjB,KAAKiB,oBAC/BC,qBAAsB,EAAKlB,KAAKkB,qBAChCJ,SAAU,QACVK,SAAU,EAAKlB,KAEjB,EAAKmB,cAAgB,CACnBC,QAAS,CACPC,sBAAuB,iBAG3B,EAAKC,WACL,EAAKrB,MAAQ,EAAKsB,KAAK,yBACvB,EAAKC,cAAgB,EAAKA,cAAcC,KAAnB,MACrB,EAAKC,OAAS,EAAKA,OAAOD,KAAZ,MA3CQ,EADM,iCA+C9B,WACEE,KAAKC,KAAO,IAAI/B,EAAmB8B,KAAM,CACvCd,SAAUc,KAAKd,WAEjB,IACEgB,EACEF,KAAK5B,KADP8B,OAGEA,GACFF,KAAKG,MAAMD,EAAQF,QAxDO,uBA4D9B,WACEA,KAAKC,KAAKG,WACVJ,KAAKK,YA9DuB,2BAiE9B,WACE,OAAOC,QAAQC,IAAI,CAACP,KAAKd,SAASsB,oBAAqBR,KAAKC,KAAKQ,UAAU,OAAQ,SAlEvD,oBAqE9B,SAAOC,GACL,OAAOV,KAAKC,KAAKF,OAAOW,OAtEI,GAA6B3C,GAyE1DF,EAAO8C,QAAU,QAAS7C","file":"static/js/8.2d291684.chunk.js","sourcesContent":["\"use strict\";\n\nconst {\n ProviderViews\n} = require('@uppy/provider-views');\n\nmodule.exports = class DriveProviderViews extends ProviderViews {\n toggleCheckbox(e, file) {\n e.stopPropagation();\n e.preventDefault(); // Shared Drives aren't selectable; for all else, defer to the base ProviderView.\n\n if (!file.custom.isSharedDrive) {\n super.toggleCheckbox(e, file);\n }\n }\n\n};","\"use strict\";\n\nvar _class, _temp;\n\nconst {\n UIPlugin\n} = require('@uppy/core');\n\nconst {\n Provider\n} = require('@uppy/companion-client');\n\nconst {\n h\n} = require('preact');\n\nconst DriveProviderViews = require('./DriveProviderViews');\n\nmodule.exports = (_temp = _class = class GoogleDrive extends UIPlugin {\n constructor(uppy, opts) {\n super(uppy, opts);\n this.id = this.opts.id || 'GoogleDrive';\n this.title = this.opts.title || 'Google Drive';\n Provider.initPlugin(this, opts);\n this.title = this.opts.title || 'Google Drive';\n\n this.icon = () => h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n width: \"32\",\n height: \"32\",\n viewBox: \"0 0 32 32\"\n }, h(\"g\", {\n fill: \"none\",\n fillRule: \"evenodd\"\n }, h(\"rect\", {\n className: \"uppy-ProviderIconBg\",\n fill: \"#4285F4\",\n width: \"32\",\n height: \"32\",\n rx: \"16\"\n }), h(\"path\", {\n d: \"M25.216 17.736L19.043 7h-6.086l6.175 10.736h6.084zm-11.275.896L10.9 24h11.723l3.04-5.368H13.942zm-1.789-10.29l-5.816 10.29L9.38 24l5.905-10.29-3.132-5.369z\",\n fill: \"#FFF\"\n })));\n\n this.provider = new Provider(uppy, {\n companionUrl: this.opts.companionUrl,\n companionHeaders: this.opts.companionHeaders,\n companionKeysParams: this.opts.companionKeysParams,\n companionCookiesRule: this.opts.companionCookiesRule,\n provider: 'drive',\n pluginId: this.id\n });\n this.defaultLocale = {\n strings: {\n pluginNameGoogleDrive: 'Google Drive'\n }\n };\n this.i18nInit();\n this.title = this.i18n('pluginNameGoogleDrive');\n this.onFirstRender = this.onFirstRender.bind(this);\n this.render = this.render.bind(this);\n }\n\n install() {\n this.view = new DriveProviderViews(this, {\n provider: this.provider\n });\n const {\n target\n } = this.opts;\n\n if (target) {\n this.mount(target, this);\n }\n }\n\n uninstall() {\n this.view.tearDown();\n this.unmount();\n }\n\n onFirstRender() {\n return Promise.all([this.provider.fetchPreAuthToken(), this.view.getFolder('root', '/')]);\n }\n\n render(state) {\n return this.view.render(state);\n }\n\n}, _class.VERSION = \"2.0.4\", _temp);"],"sourceRoot":""}
1
+ {"version":3,"sources":["../../../node_modules/@uppy/google-drive/lib/DriveProviderViews.js","../../../node_modules/@uppy/google-drive/lib/index.js"],"names":["ProviderViews","require","module","exports","e","file","stopPropagation","preventDefault","custom","isSharedDrive","_class","_temp","UIPlugin","Provider","h","DriveProviderViews","uppy","opts","id","title","initPlugin","icon","focusable","width","height","viewBox","fill","fillRule","className","rx","d","provider","companionUrl","companionHeaders","companionKeysParams","companionCookiesRule","pluginId","defaultLocale","strings","pluginNameGoogleDrive","i18nInit","i18n","onFirstRender","bind","render","this","view","target","mount","tearDown","unmount","Promise","all","fetchPreAuthToken","getFolder","state","VERSION"],"mappings":"8LAGEA,EACEC,EAAQ,KADVD,cAGFE,EAAOC,QAAP,4HACE,SAAeC,EAAGC,GAChBD,EAAEE,kBACFF,EAAEG,iBAEGF,EAAKG,OAAOC,eACf,kDAAqBL,EAAGC,OAN9B,GAAkDL,I,qCCJ9CU,EAAQC,E,wCAGVC,EACEX,EAAQ,IADVW,SAIAC,EACEZ,EAAQ,KADVY,SAIAC,EACEb,EAAQ,IADVa,EAGIC,EAAqBd,EAAQ,KAEnCC,EAAOC,SAAWQ,EAAQD,EAAM,8BAC9B,WAAYM,EAAMC,GAAM,wBACtB,cAAMD,EAAMC,IACPC,GAAK,EAAKD,KAAKC,IAAM,cAC1B,EAAKC,MAAQ,EAAKF,KAAKE,OAAS,eAChCN,EAASO,WAAT,KAA0BH,GAC1B,EAAKE,MAAQ,EAAKF,KAAKE,OAAS,eAEhC,EAAKE,KAAO,kBAAMP,EAAE,MAAO,CACzB,cAAe,OACfQ,UAAW,QACXC,MAAO,KACPC,OAAQ,KACRC,QAAS,aACRX,EAAE,IAAK,CACRY,KAAM,OACNC,SAAU,WACTb,EAAE,OAAQ,CACXc,UAAW,sBACXF,KAAM,UACNH,MAAO,KACPC,OAAQ,KACRK,GAAI,OACFf,EAAE,OAAQ,CACZgB,EAAG,8JACHJ,KAAM,YAGR,EAAKK,SAAW,IAAIlB,EAASG,EAAM,CACjCgB,aAAc,EAAKf,KAAKe,aACxBC,iBAAkB,EAAKhB,KAAKgB,iBAC5BC,oBAAqB,EAAKjB,KAAKiB,oBAC/BC,qBAAsB,EAAKlB,KAAKkB,qBAChCJ,SAAU,QACVK,SAAU,EAAKlB,KAEjB,EAAKmB,cAAgB,CACnBC,QAAS,CACPC,sBAAuB,iBAG3B,EAAKC,WACL,EAAKrB,MAAQ,EAAKsB,KAAK,yBACvB,EAAKC,cAAgB,EAAKA,cAAcC,KAAnB,MACrB,EAAKC,OAAS,EAAKA,OAAOD,KAAZ,MA3CQ,EADM,iCA+C9B,WACEE,KAAKC,KAAO,IAAI/B,EAAmB8B,KAAM,CACvCd,SAAUc,KAAKd,WAEjB,IACEgB,EACEF,KAAK5B,KADP8B,OAGEA,GACFF,KAAKG,MAAMD,EAAQF,QAxDO,uBA4D9B,WACEA,KAAKC,KAAKG,WACVJ,KAAKK,YA9DuB,2BAiE9B,WACE,OAAOC,QAAQC,IAAI,CAACP,KAAKd,SAASsB,oBAAqBR,KAAKC,KAAKQ,UAAU,OAAQ,SAlEvD,oBAqE9B,SAAOC,GACL,OAAOV,KAAKC,KAAKF,OAAOW,OAtEI,GAA6B3C,GAyE1DF,EAAO8C,QAAU,QAAS7C","file":"static/js/8.959d6a7c.chunk.js","sourcesContent":["\"use strict\";\n\nconst {\n ProviderViews\n} = require('@uppy/provider-views');\n\nmodule.exports = class DriveProviderViews extends ProviderViews {\n toggleCheckbox(e, file) {\n e.stopPropagation();\n e.preventDefault(); // Shared Drives aren't selectable; for all else, defer to the base ProviderView.\n\n if (!file.custom.isSharedDrive) {\n super.toggleCheckbox(e, file);\n }\n }\n\n};","\"use strict\";\n\nvar _class, _temp;\n\nconst {\n UIPlugin\n} = require('@uppy/core');\n\nconst {\n Provider\n} = require('@uppy/companion-client');\n\nconst {\n h\n} = require('preact');\n\nconst DriveProviderViews = require('./DriveProviderViews');\n\nmodule.exports = (_temp = _class = class GoogleDrive extends UIPlugin {\n constructor(uppy, opts) {\n super(uppy, opts);\n this.id = this.opts.id || 'GoogleDrive';\n this.title = this.opts.title || 'Google Drive';\n Provider.initPlugin(this, opts);\n this.title = this.opts.title || 'Google Drive';\n\n this.icon = () => h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n width: \"32\",\n height: \"32\",\n viewBox: \"0 0 32 32\"\n }, h(\"g\", {\n fill: \"none\",\n fillRule: \"evenodd\"\n }, h(\"rect\", {\n className: \"uppy-ProviderIconBg\",\n fill: \"#4285F4\",\n width: \"32\",\n height: \"32\",\n rx: \"16\"\n }), h(\"path\", {\n d: \"M25.216 17.736L19.043 7h-6.086l6.175 10.736h6.084zm-11.275.896L10.9 24h11.723l3.04-5.368H13.942zm-1.789-10.29l-5.816 10.29L9.38 24l5.905-10.29-3.132-5.369z\",\n fill: \"#FFF\"\n })));\n\n this.provider = new Provider(uppy, {\n companionUrl: this.opts.companionUrl,\n companionHeaders: this.opts.companionHeaders,\n companionKeysParams: this.opts.companionKeysParams,\n companionCookiesRule: this.opts.companionCookiesRule,\n provider: 'drive',\n pluginId: this.id\n });\n this.defaultLocale = {\n strings: {\n pluginNameGoogleDrive: 'Google Drive'\n }\n };\n this.i18nInit();\n this.title = this.i18n('pluginNameGoogleDrive');\n this.onFirstRender = this.onFirstRender.bind(this);\n this.render = this.render.bind(this);\n }\n\n install() {\n this.view = new DriveProviderViews(this, {\n provider: this.provider\n });\n const {\n target\n } = this.opts;\n\n if (target) {\n this.mount(target, this);\n }\n }\n\n uninstall() {\n this.view.tearDown();\n this.unmount();\n }\n\n onFirstRender() {\n return Promise.all([this.provider.fetchPreAuthToken(), this.view.getFolder('root', '/')]);\n }\n\n render(state) {\n return this.view.render(state);\n }\n\n}, _class.VERSION = \"2.0.4\", _temp);"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- (this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[9],{499:function(e,t,o){"use strict";var r=o(20),n=o(21);function a(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var s=0;function i(e){return"__private_"+s+++"_"+e}var p=i("aliveTimer"),u=i("isDone"),d=i("onTimedOut"),l=i("timeout"),c=function(){function e(t,o){r(this,e),Object.defineProperty(this,p,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:!1}),Object.defineProperty(this,d,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),a(this,l)[l]=t,a(this,d)[d]=o}return n(e,[{key:"progress",value:function(){a(this,u)[u]||a(this,l)[l]>0&&(clearTimeout(a(this,p)[p]),a(this,p)[p]=setTimeout(a(this,d)[d],a(this,l)[l]))}},{key:"done",value:function(){a(this,u)[u]||(clearTimeout(a(this,p)[p]),a(this,p)[p]=null,a(this,u)[u]=!0)}}]),e}();e.exports=c},534:function(e,t,o){"use strict";var r,n,a=o(29),s=o(20),i=o(21),p=o(56),u=o(24),d=o(25),l=o(150),c=o(112).nanoid,h=o(450),f=h.Provider,m=h.RequestClient,v=h.Socket,y=o(468),g=o(469),b=o(470),E=o(471),w=o(499),U=o(473),R=U.RateLimitedQueue,O=U.internalRateLimitedQueue,T=o(452),k=o(472);function F(e,t){var o=t;return o||(o=new Error("Upload error")),"string"===typeof o&&(o=new Error(o)),o instanceof Error||(o=Object.assign(new Error("Upload error"),{data:o})),k(e)?o=new T(o,e):(o.request=e,o)}function x(e){return e.data.slice(0,e.data.size,e.meta.type)}e.exports=(n=r=function(e){u(o,e);var t=d(o);function o(e,r){var n;s(this,o),(n=t.call(this,e,r)).type="uploader",n.id=n.opts.id||"XHRUpload",n.title="XHRUpload",n.defaultLocale={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}};var i={formData:!0,fieldName:r.bundle?"files[]":"file",method:"post",metaFields:null,responseUrlFieldName:"url",bundle:!1,headers:{},timeout:3e4,limit:5,withCredentials:!1,responseType:"",getResponseData:function(t){var o={};try{o=JSON.parse(t)}catch(r){e.log(r)}return o},getResponseError:function(e,t){var o=new Error("Upload error");return k(t)&&(o=new T(o,t)),o},validateStatus:function(e){return e>=200&&e<300}};if(n.opts=a(a({},i),r),n.i18nInit(),n.handleUpload=n.handleUpload.bind(p(n)),O in n.opts?n.requests=n.opts[O]:n.requests=new R(n.opts.limit),n.opts.bundle&&!n.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");return n.uploaderEvents=Object.create(null),n}return i(o,[{key:"getOptions",value:function(e){var t=this.uppy.getState().xhrUpload,o=this.opts.headers,r=a(a(a(a({},this.opts),t||{}),e.xhrUpload||{}),{},{headers:{}});return"function"===typeof o?r.headers=o(e):Object.assign(r.headers,this.opts.headers),t&&Object.assign(r.headers,t.headers),e.xhrUpload&&Object.assign(r.headers,e.xhrUpload.headers),r}},{key:"addMetadata",value:function(e,t,o){(Array.isArray(o.metaFields)?o.metaFields:Object.keys(t)).forEach((function(o){e.append(o,t[o])}))}},{key:"createFormDataUpload",value:function(e,t){var o=new FormData;this.addMetadata(o,e.meta,t);var r=x(e);return e.name?o.append(t.fieldName,r,e.meta.name):o.append(t.fieldName,r),o}},{key:"createBundledUpload",value:function(e,t){var o=this,r=new FormData,n=this.uppy.getState().meta;return this.addMetadata(r,n,t),e.forEach((function(e){var t=o.getOptions(e),n=x(e);e.name?r.append(t.fieldName,n,e.name):r.append(t.fieldName,n)})),r}},{key:"upload",value:function(e,t,o){var r=this,n=this.getOptions(e);return this.uppy.log("uploading ".concat(t," of ").concat(o)),new Promise((function(t,o){r.uppy.emit("upload-started",e);var a=n.formData?r.createFormDataUpload(e,n):e.data,s=new XMLHttpRequest;r.uploaderEvents[e.id]=new E(r.uppy);var i=new w(n.timeout,(function(){s.abort(),u.done();var t=new Error(r.i18n("timedOut",{seconds:Math.ceil(n.timeout/1e3)}));r.uppy.emit("upload-error",e,t),o(t)})),p=c();s.upload.addEventListener("loadstart",(function(){r.uppy.log("[XHRUpload] ".concat(p," started"))})),s.upload.addEventListener("progress",(function(t){r.uppy.log("[XHRUpload] ".concat(p," progress: ").concat(t.loaded," / ").concat(t.total)),i.progress(),t.lengthComputable&&r.uppy.emit("upload-progress",e,{uploader:r,bytesUploaded:t.loaded,bytesTotal:t.total})})),s.addEventListener("load",(function(a){if(r.uppy.log("[XHRUpload] ".concat(p," finished")),i.done(),u.done(),r.uploaderEvents[e.id]&&(r.uploaderEvents[e.id].remove(),r.uploaderEvents[e.id]=null),n.validateStatus(a.target.status,s.responseText,s)){var d=n.getResponseData(s.responseText,s),l=d[n.responseUrlFieldName],c={status:a.target.status,body:d,uploadURL:l};return r.uppy.emit("upload-success",e,c),l&&r.uppy.log("Download ".concat(e.name," from ").concat(l)),t(e)}var h=n.getResponseData(s.responseText,s),f=F(s,n.getResponseError(s.responseText,s)),m={status:a.target.status,body:h};return r.uppy.emit("upload-error",e,f,m),o(f)})),s.addEventListener("error",(function(){r.uppy.log("[XHRUpload] ".concat(p," errored")),i.done(),u.done(),r.uploaderEvents[e.id]&&(r.uploaderEvents[e.id].remove(),r.uploaderEvents[e.id]=null);var t=F(s,n.getResponseError(s.responseText,s));return r.uppy.emit("upload-error",e,t),o(t)})),s.open(n.method.toUpperCase(),n.endpoint,!0),s.withCredentials=n.withCredentials,""!==n.responseType&&(s.responseType=n.responseType);var u=r.requests.run((function(){r.uppy.emit("upload-started",e);var t=r.getOptions(e);return Object.keys(t.headers).forEach((function(e){s.setRequestHeader(e,t.headers[e])})),s.send(a),function(){i.done(),s.abort()}}));r.onFileRemove(e.id,(function(){u.abort(),o(new Error("File removed"))})),r.onCancelAll(e.id,(function(){u.abort(),o(new Error("Upload cancelled"))}))}))}},{key:"uploadRemote",value:function(e){var t=this,o=this.getOptions(e);return new Promise((function(r,n){var s={};(Array.isArray(o.metaFields)?o.metaFields:Object.keys(e.meta)).forEach((function(t){s[t]=e.meta[t]})),new(e.remote.providerOptions.provider?f:m)(t.uppy,e.remote.providerOptions).post(e.remote.url,a(a({},e.remote.body),{},{endpoint:o.endpoint,size:e.data.size,fieldname:o.fieldName,metadata:s,httpMethod:o.method,useFormData:o.formData,headers:o.headers})).then((function(a){var s=a.token,i=g(e.remote.companionUrl),p=new v({target:"".concat(i,"/api/").concat(s),autoOpen:!1});t.uploaderEvents[e.id]=new E(t.uppy),t.onFileRemove(e.id,(function(){p.send("pause",{}),u.abort(),r("upload ".concat(e.id," was removed"))})),t.onCancelAll(e.id,(function(){p.send("pause",{}),u.abort(),r("upload ".concat(e.id," was canceled"))})),t.onRetry(e.id,(function(){p.send("pause",{}),p.send("resume",{})})),t.onRetryAll(e.id,(function(){p.send("pause",{}),p.send("resume",{})})),p.on("progress",(function(o){return y(t,o,e)})),p.on("success",(function(n){var a=o.getResponseData(n.response.responseText,n.response),s=a[o.responseUrlFieldName],i={status:n.response.status,body:a,uploadURL:s};return t.uppy.emit("upload-success",e,i),u.done(),t.uploaderEvents[e.id]&&(t.uploaderEvents[e.id].remove(),t.uploaderEvents[e.id]=null),r()})),p.on("error",(function(r){var a=r.response,s=a?o.getResponseError(a.responseText,a):Object.assign(new Error(r.error.message),{cause:r.error});t.uppy.emit("upload-error",e,s),u.done(),t.uploaderEvents[e.id]&&(t.uploaderEvents[e.id].remove(),t.uploaderEvents[e.id]=null),n(s)}));var u=t.requests.run((function(){return p.open(),e.isPaused&&p.send("pause",{}),function(){return p.close()}}))})).catch((function(o){t.uppy.emit("upload-error",e,o),n(o)}))}))}},{key:"uploadBundle",value:function(e){var t=this;return new Promise((function(o,r){var n=t.opts.endpoint,s=t.opts.method,i=t.uppy.getState().xhrUpload,p=t.createBundledUpload(e,a(a({},t.opts),i||{})),u=new XMLHttpRequest,d=new w(t.opts.timeout,(function(){u.abort();var e=new Error(t.i18n("timedOut",{seconds:Math.ceil(t.opts.timeout/1e3)}));l(e),r(e)})),l=function(o){e.forEach((function(e){t.uppy.emit("upload-error",e,o)}))};u.upload.addEventListener("loadstart",(function(){t.uppy.log("[XHRUpload] started uploading bundle"),d.progress()})),u.upload.addEventListener("progress",(function(o){d.progress(),o.lengthComputable&&e.forEach((function(e){t.uppy.emit("upload-progress",e,{uploader:t,bytesUploaded:o.loaded/o.total*e.size,bytesTotal:e.size})}))})),u.addEventListener("load",(function(n){if(d.done(),t.opts.validateStatus(n.target.status,u.responseText,u)){var a=t.opts.getResponseData(u.responseText,u),s={status:n.target.status,body:a};return e.forEach((function(e){t.uppy.emit("upload-success",e,s)})),o()}var i=t.opts.getResponseError(u.responseText,u)||new Error("Upload error");return i.request=u,l(i),r(i)})),u.addEventListener("error",(function(){d.done();var e=t.opts.getResponseError(u.responseText,u)||new Error("Upload error");return l(e),r(e)})),t.uppy.on("cancel-all",(function(){d.done(),u.abort()})),u.open(s.toUpperCase(),n,!0),u.withCredentials=t.opts.withCredentials,""!==t.opts.responseType&&(u.responseType=t.opts.responseType),Object.keys(t.opts.headers).forEach((function(e){u.setRequestHeader(e,t.opts.headers[e])})),u.send(p),e.forEach((function(e){t.uppy.emit("upload-started",e)}))}))}},{key:"uploadFiles",value:function(e){var t=this,o=e.map((function(o,r){var n=parseInt(r,10)+1,a=e.length;return o.error?Promise.reject(new Error(o.error)):o.isRemote?t.uploadRemote(o,n,a):t.upload(o,n,a)}));return b(o)}},{key:"onFileRemove",value:function(e,t){this.uploaderEvents[e].on("file-removed",(function(o){e===o.id&&t(o.id)}))}},{key:"onRetry",value:function(e,t){this.uploaderEvents[e].on("upload-retry",(function(o){e===o&&t()}))}},{key:"onRetryAll",value:function(e,t){var o=this;this.uploaderEvents[e].on("retry-all",(function(){o.uppy.getFile(e)&&t()}))}},{key:"onCancelAll",value:function(e,t){var o=this;this.uploaderEvents[e].on("cancel-all",(function(){o.uppy.getFile(e)&&t()}))}},{key:"handleUpload",value:function(e){var t=this;if(0===e.length)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();0!==this.opts.limit||this.opts[O]||this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");var o=e.map((function(e){return t.uppy.getFile(e)}));if(this.opts.bundle){if(o.some((function(e){return e.isRemote})))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if("function"===typeof this.opts.headers)throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");return this.uploadBundle(o)}return this.uploadFiles(o).then((function(){return null}))}},{key:"install",value:function(){if(this.opts.bundle){var e=this.uppy.getState().capabilities;this.uppy.setState({capabilities:a(a({},e),{},{individualCancellation:!1})})}this.uppy.addUploader(this.handleUpload)}},{key:"uninstall",value:function(){if(this.opts.bundle){var e=this.uppy.getState().capabilities;this.uppy.setState({capabilities:a(a({},e),{},{individualCancellation:!0})})}this.uppy.removeUploader(this.handleUpload)}}]),o}(l),r.VERSION="2.0.5",n)}}]);
2
- //# sourceMappingURL=9.13fb035e.chunk.js.map
1
+ (this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[9],{499:function(e,t,o){"use strict";var r=o(19),n=o(20);function a(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var s=0;function i(e){return"__private_"+s+++"_"+e}var p=i("aliveTimer"),u=i("isDone"),d=i("onTimedOut"),l=i("timeout"),c=function(){function e(t,o){r(this,e),Object.defineProperty(this,p,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:!1}),Object.defineProperty(this,d,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),a(this,l)[l]=t,a(this,d)[d]=o}return n(e,[{key:"progress",value:function(){a(this,u)[u]||a(this,l)[l]>0&&(clearTimeout(a(this,p)[p]),a(this,p)[p]=setTimeout(a(this,d)[d],a(this,l)[l]))}},{key:"done",value:function(){a(this,u)[u]||(clearTimeout(a(this,p)[p]),a(this,p)[p]=null,a(this,u)[u]=!0)}}]),e}();e.exports=c},534:function(e,t,o){"use strict";var r,n,a=o(29),s=o(19),i=o(20),p=o(56),u=o(24),d=o(25),l=o(150),c=o(111).nanoid,h=o(450),f=h.Provider,m=h.RequestClient,v=h.Socket,y=o(468),g=o(469),b=o(470),E=o(471),w=o(499),U=o(473),R=U.RateLimitedQueue,O=U.internalRateLimitedQueue,T=o(452),k=o(472);function F(e,t){var o=t;return o||(o=new Error("Upload error")),"string"===typeof o&&(o=new Error(o)),o instanceof Error||(o=Object.assign(new Error("Upload error"),{data:o})),k(e)?o=new T(o,e):(o.request=e,o)}function x(e){return e.data.slice(0,e.data.size,e.meta.type)}e.exports=(n=r=function(e){u(o,e);var t=d(o);function o(e,r){var n;s(this,o),(n=t.call(this,e,r)).type="uploader",n.id=n.opts.id||"XHRUpload",n.title="XHRUpload",n.defaultLocale={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}};var i={formData:!0,fieldName:r.bundle?"files[]":"file",method:"post",metaFields:null,responseUrlFieldName:"url",bundle:!1,headers:{},timeout:3e4,limit:5,withCredentials:!1,responseType:"",getResponseData:function(t){var o={};try{o=JSON.parse(t)}catch(r){e.log(r)}return o},getResponseError:function(e,t){var o=new Error("Upload error");return k(t)&&(o=new T(o,t)),o},validateStatus:function(e){return e>=200&&e<300}};if(n.opts=a(a({},i),r),n.i18nInit(),n.handleUpload=n.handleUpload.bind(p(n)),O in n.opts?n.requests=n.opts[O]:n.requests=new R(n.opts.limit),n.opts.bundle&&!n.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");return n.uploaderEvents=Object.create(null),n}return i(o,[{key:"getOptions",value:function(e){var t=this.uppy.getState().xhrUpload,o=this.opts.headers,r=a(a(a(a({},this.opts),t||{}),e.xhrUpload||{}),{},{headers:{}});return"function"===typeof o?r.headers=o(e):Object.assign(r.headers,this.opts.headers),t&&Object.assign(r.headers,t.headers),e.xhrUpload&&Object.assign(r.headers,e.xhrUpload.headers),r}},{key:"addMetadata",value:function(e,t,o){(Array.isArray(o.metaFields)?o.metaFields:Object.keys(t)).forEach((function(o){e.append(o,t[o])}))}},{key:"createFormDataUpload",value:function(e,t){var o=new FormData;this.addMetadata(o,e.meta,t);var r=x(e);return e.name?o.append(t.fieldName,r,e.meta.name):o.append(t.fieldName,r),o}},{key:"createBundledUpload",value:function(e,t){var o=this,r=new FormData,n=this.uppy.getState().meta;return this.addMetadata(r,n,t),e.forEach((function(e){var t=o.getOptions(e),n=x(e);e.name?r.append(t.fieldName,n,e.name):r.append(t.fieldName,n)})),r}},{key:"upload",value:function(e,t,o){var r=this,n=this.getOptions(e);return this.uppy.log("uploading ".concat(t," of ").concat(o)),new Promise((function(t,o){r.uppy.emit("upload-started",e);var a=n.formData?r.createFormDataUpload(e,n):e.data,s=new XMLHttpRequest;r.uploaderEvents[e.id]=new E(r.uppy);var i=new w(n.timeout,(function(){s.abort(),u.done();var t=new Error(r.i18n("timedOut",{seconds:Math.ceil(n.timeout/1e3)}));r.uppy.emit("upload-error",e,t),o(t)})),p=c();s.upload.addEventListener("loadstart",(function(){r.uppy.log("[XHRUpload] ".concat(p," started"))})),s.upload.addEventListener("progress",(function(t){r.uppy.log("[XHRUpload] ".concat(p," progress: ").concat(t.loaded," / ").concat(t.total)),i.progress(),t.lengthComputable&&r.uppy.emit("upload-progress",e,{uploader:r,bytesUploaded:t.loaded,bytesTotal:t.total})})),s.addEventListener("load",(function(a){if(r.uppy.log("[XHRUpload] ".concat(p," finished")),i.done(),u.done(),r.uploaderEvents[e.id]&&(r.uploaderEvents[e.id].remove(),r.uploaderEvents[e.id]=null),n.validateStatus(a.target.status,s.responseText,s)){var d=n.getResponseData(s.responseText,s),l=d[n.responseUrlFieldName],c={status:a.target.status,body:d,uploadURL:l};return r.uppy.emit("upload-success",e,c),l&&r.uppy.log("Download ".concat(e.name," from ").concat(l)),t(e)}var h=n.getResponseData(s.responseText,s),f=F(s,n.getResponseError(s.responseText,s)),m={status:a.target.status,body:h};return r.uppy.emit("upload-error",e,f,m),o(f)})),s.addEventListener("error",(function(){r.uppy.log("[XHRUpload] ".concat(p," errored")),i.done(),u.done(),r.uploaderEvents[e.id]&&(r.uploaderEvents[e.id].remove(),r.uploaderEvents[e.id]=null);var t=F(s,n.getResponseError(s.responseText,s));return r.uppy.emit("upload-error",e,t),o(t)})),s.open(n.method.toUpperCase(),n.endpoint,!0),s.withCredentials=n.withCredentials,""!==n.responseType&&(s.responseType=n.responseType);var u=r.requests.run((function(){r.uppy.emit("upload-started",e);var t=r.getOptions(e);return Object.keys(t.headers).forEach((function(e){s.setRequestHeader(e,t.headers[e])})),s.send(a),function(){i.done(),s.abort()}}));r.onFileRemove(e.id,(function(){u.abort(),o(new Error("File removed"))})),r.onCancelAll(e.id,(function(){u.abort(),o(new Error("Upload cancelled"))}))}))}},{key:"uploadRemote",value:function(e){var t=this,o=this.getOptions(e);return new Promise((function(r,n){var s={};(Array.isArray(o.metaFields)?o.metaFields:Object.keys(e.meta)).forEach((function(t){s[t]=e.meta[t]})),new(e.remote.providerOptions.provider?f:m)(t.uppy,e.remote.providerOptions).post(e.remote.url,a(a({},e.remote.body),{},{endpoint:o.endpoint,size:e.data.size,fieldname:o.fieldName,metadata:s,httpMethod:o.method,useFormData:o.formData,headers:o.headers})).then((function(a){var s=a.token,i=g(e.remote.companionUrl),p=new v({target:"".concat(i,"/api/").concat(s),autoOpen:!1});t.uploaderEvents[e.id]=new E(t.uppy),t.onFileRemove(e.id,(function(){p.send("pause",{}),u.abort(),r("upload ".concat(e.id," was removed"))})),t.onCancelAll(e.id,(function(){p.send("pause",{}),u.abort(),r("upload ".concat(e.id," was canceled"))})),t.onRetry(e.id,(function(){p.send("pause",{}),p.send("resume",{})})),t.onRetryAll(e.id,(function(){p.send("pause",{}),p.send("resume",{})})),p.on("progress",(function(o){return y(t,o,e)})),p.on("success",(function(n){var a=o.getResponseData(n.response.responseText,n.response),s=a[o.responseUrlFieldName],i={status:n.response.status,body:a,uploadURL:s};return t.uppy.emit("upload-success",e,i),u.done(),t.uploaderEvents[e.id]&&(t.uploaderEvents[e.id].remove(),t.uploaderEvents[e.id]=null),r()})),p.on("error",(function(r){var a=r.response,s=a?o.getResponseError(a.responseText,a):Object.assign(new Error(r.error.message),{cause:r.error});t.uppy.emit("upload-error",e,s),u.done(),t.uploaderEvents[e.id]&&(t.uploaderEvents[e.id].remove(),t.uploaderEvents[e.id]=null),n(s)}));var u=t.requests.run((function(){return p.open(),e.isPaused&&p.send("pause",{}),function(){return p.close()}}))})).catch((function(o){t.uppy.emit("upload-error",e,o),n(o)}))}))}},{key:"uploadBundle",value:function(e){var t=this;return new Promise((function(o,r){var n=t.opts.endpoint,s=t.opts.method,i=t.uppy.getState().xhrUpload,p=t.createBundledUpload(e,a(a({},t.opts),i||{})),u=new XMLHttpRequest,d=new w(t.opts.timeout,(function(){u.abort();var e=new Error(t.i18n("timedOut",{seconds:Math.ceil(t.opts.timeout/1e3)}));l(e),r(e)})),l=function(o){e.forEach((function(e){t.uppy.emit("upload-error",e,o)}))};u.upload.addEventListener("loadstart",(function(){t.uppy.log("[XHRUpload] started uploading bundle"),d.progress()})),u.upload.addEventListener("progress",(function(o){d.progress(),o.lengthComputable&&e.forEach((function(e){t.uppy.emit("upload-progress",e,{uploader:t,bytesUploaded:o.loaded/o.total*e.size,bytesTotal:e.size})}))})),u.addEventListener("load",(function(n){if(d.done(),t.opts.validateStatus(n.target.status,u.responseText,u)){var a=t.opts.getResponseData(u.responseText,u),s={status:n.target.status,body:a};return e.forEach((function(e){t.uppy.emit("upload-success",e,s)})),o()}var i=t.opts.getResponseError(u.responseText,u)||new Error("Upload error");return i.request=u,l(i),r(i)})),u.addEventListener("error",(function(){d.done();var e=t.opts.getResponseError(u.responseText,u)||new Error("Upload error");return l(e),r(e)})),t.uppy.on("cancel-all",(function(){d.done(),u.abort()})),u.open(s.toUpperCase(),n,!0),u.withCredentials=t.opts.withCredentials,""!==t.opts.responseType&&(u.responseType=t.opts.responseType),Object.keys(t.opts.headers).forEach((function(e){u.setRequestHeader(e,t.opts.headers[e])})),u.send(p),e.forEach((function(e){t.uppy.emit("upload-started",e)}))}))}},{key:"uploadFiles",value:function(e){var t=this,o=e.map((function(o,r){var n=parseInt(r,10)+1,a=e.length;return o.error?Promise.reject(new Error(o.error)):o.isRemote?t.uploadRemote(o,n,a):t.upload(o,n,a)}));return b(o)}},{key:"onFileRemove",value:function(e,t){this.uploaderEvents[e].on("file-removed",(function(o){e===o.id&&t(o.id)}))}},{key:"onRetry",value:function(e,t){this.uploaderEvents[e].on("upload-retry",(function(o){e===o&&t()}))}},{key:"onRetryAll",value:function(e,t){var o=this;this.uploaderEvents[e].on("retry-all",(function(){o.uppy.getFile(e)&&t()}))}},{key:"onCancelAll",value:function(e,t){var o=this;this.uploaderEvents[e].on("cancel-all",(function(){o.uppy.getFile(e)&&t()}))}},{key:"handleUpload",value:function(e){var t=this;if(0===e.length)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();0!==this.opts.limit||this.opts[O]||this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");var o=e.map((function(e){return t.uppy.getFile(e)}));if(this.opts.bundle){if(o.some((function(e){return e.isRemote})))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if("function"===typeof this.opts.headers)throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");return this.uploadBundle(o)}return this.uploadFiles(o).then((function(){return null}))}},{key:"install",value:function(){if(this.opts.bundle){var e=this.uppy.getState().capabilities;this.uppy.setState({capabilities:a(a({},e),{},{individualCancellation:!1})})}this.uppy.addUploader(this.handleUpload)}},{key:"uninstall",value:function(){if(this.opts.bundle){var e=this.uppy.getState().capabilities;this.uppy.setState({capabilities:a(a({},e),{},{individualCancellation:!0})})}this.uppy.removeUploader(this.handleUpload)}}]),o}(l),r.VERSION="2.0.5",n)}}]);
2
+ //# sourceMappingURL=9.13a28a70.chunk.js.map