Plugin Directory

Changeset 2270886


Ignore:
Timestamp:
03/30/2020 02:49:04 PM (6 years ago)
Author:
cloudflare
Message:

BUG FIX: issue with uploading large files fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cloudflare-stream/trunk/dist/blocks.build.js

    r2120848 r2270886  
    1 !function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};t.m=e,t.c=r,t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";function o(e,t){if(a)return localStorage.setItem(e,t)}function n(e){if(a)return localStorage.getItem(e)}function i(e){if(a)return localStorage.removeItem(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.setItem=o,t.getItem=n,t.removeItem=i;var a=!1;try{a="localStorage"in window;var s="tusSupport";localStorage.setItem(s,localStorage.getItem(s))}catch(e){if(e.code!==e.SECURITY_ERR&&e.code!==e.QUOTA_EXCEEDED_ERR)throw e;a=!1}t.canStoreURLs=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(3),n=(r.n(o),r(4)),i=(r.n(n),r(5)),a=(r.n(i),r(6),r(25));r.n(a)},function(e,t){cloudflareStream.media.model.Attachments=wp.media.model.Attachments.extend({initialize:function(){wp.media.model.Attachments.prototype.initialize.apply(this,arguments)},_requery:function(e){var t=void 0;this.props.get("query")&&(t=this.props.toJSON(),t.cache=!0!==e,this.mirror(cloudflareStream.media.model.Query.get(this.props.toJSON())))}})},function(e,t){cloudflareStream.media.model.Query=wp.media.model.Query.extend({initialize:function(e,t){t=t||{},wp.media.model.Query.prototype.initialize.apply(this,arguments),this.args=t.args||{},this.args.posts_per_page=cloudflareStream.api.posts_per_page},sync:function(e,t,r){if("read"===e){r=r||{},r.context=this,r.data=_.extend(r.data||{},{action:"query-cloudflare-stream-attachments",post_id:wp.media.model.settings.post.id,nonce:cloudflareStream.nonce});var o="";cloudflareStream.media.model.Attachments.all.models.length>0&&(o="&end="+cloudflareStream.media.model.Attachments.all.models[cloudflareStream.media.model.Attachments.all.models.length-1].attributes.modified.toISOString());var n=_.clone(this.args);return-1!==n.posts_per_page&&(n.paged=Math.floor(this.length/n.posts_per_page)+1),r.data.query="asc=false"+o,wp.media.ajax(r)}return(wp.media.model.Attachments.prototype.sync?wp.media.model.Attachments.prototype:Backbone).sync.apply(this,arguments)}},{get:function(){var e=[];return function(t,r){var o={},n=cloudflareStream.media.model.Query.orderby,i=cloudflareStream.media.model.Query.defaultProps,a=void 0;return delete t.query,delete t.remotefilters,delete t.uioptions,_.defaults(t,i),t.order=t.order.toUpperCase(),"DESC"!==t.order&&"ASC"!==t.order&&(t.order=i.order.toUpperCase()),_.contains(n.allowed,t.orderby)||(t.orderby=i.orderby),_.each(t,function(e,t){_.isNull(e)||(o[cloudflareStream.media.model.Query.propmap[t]||t]=e)}),_.defaults(o,cloudflareStream.media.model.Query.defaultArgs),o.orderby=n.valuemap[t.orderby]||t.orderby,a=_.find(e,function(e){return _.isEqual(e.args,o)}),a||(a=new cloudflareStream.media.model.Query([],_.extend(r||{},{props:t,args:o})),e.push(a)),a}}()})},function(e,t){var r=wp.media.view.MediaFrame.Post,o=wp.media.controller.Library,n=wp.media.view.l10n;cloudflareStream.media.view.MediaFrame=r.extend({initialize:function(e){this.select=e,_.defaults(this.options,{id:"cloudflare-stream",className:"cloudflare-stream-media-frame",title:"Cloudflare Stream Library",multiple:!1,editing:!1,state:"insert",metadata:{}}),r.prototype.initialize.apply(this,arguments)},createStates:function(){var e=this.options;this.states.add([new o({id:"insert",title:e.title,priority:20,toolbar:"main-insert",menu:!1,filterable:!1,searchable:!1,date:!1,library:new cloudflareStream.media.model.Query(_.defaults(null,{type:"video"},e.library)),multiple:!!e.multiple&&"reset",editable:!0,allowLocalEdits:!0,displaySettings:!1,displayUserSettings:!1})])},bindHandlers:function(){var e=void 0,t=void 0;r.prototype.bindHandlers.apply(this,arguments),this.on("activate",this.activate,this),t=_.find(this.counts,function(e){return 0===e.count}),"undefined"!==typeof t&&this.listenTo(wp.media.model.Attachments.all,"change:type",this.mediaTypeCounts),this.on("toolbar:create:main-insert",this.createToolbar,this),this.on("selection:toggle",this.bindSidebarItems,this),e={toolbar:{"main-insert":"mainInsertToolbar"}},_.each(e,function(e,t){_.each(e,function(e,r){this.on(t+":render:"+r,this[e],this)},this)},this)},bindSidebarItems:function(){jQuery(".delete-attachment").on("click",this,this.deleteAttachment),jQuery('label[data-setting="title"] input').on("change",this,this.updateAttachment)},deleteAttachment:function(e){e.preventDefault(),e.stopPropagation();var t=e.data;if(window.confirm(n.warnDelete)){var r=t.state(),o=r.get("selection"),i=o.first().toJSON();o.remove(i),r.trigger("delete",i).reset()}},updateAttachment:function(e){e.preventDefault(),e.stopPropagation();var t=e.data,r=t.state(),o=r.get("selection"),n=o.first().toJSON(),i=jQuery('label[data-setting="title"] input').val(),a={uid:n.uid,meta:{name:i,upload:n.cloudflare.meta.upload}};jQuery(".media-sidebar .spinner").css("visibility","visible"),jQuery.ajax({url:"https://api.cloudflare.com/client/v4/accounts/"+cloudflareStream.api.account+"/media/"+n.uid,method:"POST",contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(a),headers:{"X-Auth-Email":cloudflareStream.api.email,"X-Auth-Key":cloudflareStream.api.key},success:function(){o.models[0].set("filename",i),jQuery(".media-sidebar .spinner").css("visibility","hidden")},error:function(e,t){console.error("Error: "+t)}})},browseRouter:function(e){e.set({browse:{text:this.options.title,priority:40}})},mainInsertToolbar:function(e){var t=this;e.set("insert",{style:"primary",priority:80,text:"Select",requires:{selection:!0},click:function(){var e=t.state(),r=e.get("selection"),o=r.first().toJSON();t.select(o),t.close(),e.trigger("insert",r).reset()}})}})},function(e,t,r){"use strict";var o=r(7),n=(r.n(o),r(8)),i=(r.n(n),r(9)),a=wp.i18n.__,s=wp.blocks.registerBlockType;cloudflareStream.icon=wp.element.createElement("svg",{width:20,height:20,viewBox:"0 0 68.66 49.14",className:"cls-1 dashicon"},wp.element.createElement("path",{d:"M61.05,42.28H1.75A.76.76,0,0,1,1,41.52V1.73A.75.75,0,0,1,1.75,1h59.3a.75.75,0,0,1,.76.75V41.52A.76.76,0,0,1,61.05,42.28ZM2.51,40.77H60.3V2.49H2.51Z"}),wp.element.createElement("path",{d:"M45.6,26.09,31.44,17.91a1.17,1.17,0,0,0-1.19-.09,1.19,1.19,0,0,0-.51,1.07V35.25a1.17,1.17,0,0,0,.51,1.06.91.91,0,0,0,.48.13,1.41,1.41,0,0,0,.71-.21L45.6,28.05a1.05,1.05,0,0,0,0-2ZM65.13,48.14H7.86a2.52,2.52,0,0,1-2.52-2.52V7.86A2.52,2.52,0,0,1,7.86,5.34H65.13a2.52,2.52,0,0,1,2.53,2.52V45.62A2.52,2.52,0,0,1,65.13,48.14Zm-56.77-3H64.63V8.36H8.36Z"})),s("cloudflare-stream/block-video",{title:a("Cloudflare Stream Video"),icon:cloudflareStream.icon,render_callback:"cloudflare_stream_render_block",category:"embed",keywords:[a("Cloudflare"),a("Stream"),a("video")],attributes:{alignment:{type:"string"},uid:{type:"string",default:!1},fingerprint:{type:"string",default:!1},thumbnail:{type:"string",default:!1},autoplay:{type:"boolean",source:"attribute",selector:"stream",attribute:"autoplay",default:!1},loop:{type:"boolean",source:"attribute",selector:"stream",attribute:"loop",default:!1},muted:{type:"boolean",source:"attribute",selector:"stream",attribute:"muted",default:!1},controls:{type:"boolean",source:"attribute",selector:"stream",attribute:"controls",default:!0},transform:{type:"boolean",source:"attribute",selector:"stream",attribute:"transform",default:!1}},supports:{align:!0},edit:i.a,save:function(e){var t=e.attributes,r=t.uid,o=t.controls,n=t.autoplay,i=t.loop,a=t.muted,s=t.className;return!1!==r?wp.element.createElement("figure",{className:s,key:r},[wp.element.createElement("stream",{src:r,controls:o,autoplay:n,loop:i,muted:a}),wp.element.createElement("div",{className:"target"}),wp.element.createElement("script",{"data-cfasync":!1,defer:!0,type:"text/javascript",src:"https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video="+r})]):wp.element.createElement("figure",{className:s})}})},function(e,t){},function(e,t){},function(e,t,r){"use strict";function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function a(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=r(10),l=r.n(s),u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),c=wp.i18n.__,d=wp.components,f=d.Disabled,p=d.IconButton,h=d.PanelBody,m=d.Toolbar,b=d.ToggleControl,y=d.withNotices,_=d.Placeholder,g=d.FormFileUpload,v=wp.editor,w=v.BlockControls,E=v.InspectorControls,S=v.MediaUpload,C=wp.element,A=C.Fragment,j=C.Component,P=C.createRef,k=function(e){function t(e){n(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.state={editing:!r.props.attributes.uid,uploading:!1,encoding:r.props.attributes.uid&&!r.props.attributes.thumbnail,resume:!0},r.instanceId=e.clientId,r.controller=r,r.streamPlayer=P(),r.toggleAttribute=r.toggleAttribute.bind(r),r.open=r.open.bind(r),r.select=r.select.bind(r),r.mediaFrame=new cloudflareStream.media.view.MediaFrame(r.select),r.encodingPoller=!1,r}return a(t,e),u(t,[{key:"componentDidMount",value:function(){var e=this.props.attributes;!1!==e.uid&&!1===e.thumbnail?this.switchToEncoding():this.reload()}},{key:"componentDidUpdate",value:function(){var e=this.props.attributes,t=this.streamPlayer.current;null!==t&&null!==t.play&&(t.autoPlay=e.autoplay,t.controls=e.controls,t.mute=e.mute,t.loop=e.loop,t.controls=e.controls,e.autoplay&&"function"===typeof t.play?t.play():"function"===typeof t.pause&&t.pause()),!1!==e.uid&&(jQuery("#block-"+this.instanceId+" .editor-media-placeholder__cancel-button").show(),this.reload())}},{key:"toggleAttribute",value:function(e){var t=this.props.setAttributes;return function(r){t(o({},e,r))}}},{key:"open",value:function(){var e=this;this.mediaFrame.open(),this.mediaFrame.on("delete",function(t){e.delete(t)}),this.mediaFrame.on("select",function(){e.select()})}},{key:"select",value:function(e){(0,this.props.setAttributes)({uid:e.uid,thumbnail:e.thumb.src}),this.setState({editing:!1,uploading:!1,encoding:!1}),cloudflareStream.analytics.logEvent("Stream WP Plugin - Added to blog post"),this.reload()}},{key:"delete",value:function(e){jQuery.ajax({url:ajaxurl+"?action=cloudflare-stream-delete",data:{nonce:cloudflareStream.nonce,uid:e.uid},success:function(){jQuery('li[data-id="'+e.id+'"]').hide()},error:function(e,t){console.error("Error: "+t),cloudflareStream.analytics.logEvent("Stream WP Plugin - Error")}})}},{key:"update",value:function(e){jQuery(".settings-save-status .media-frame .spinner").css("visibility","visible"),jQuery.ajax({url:ajaxurl+"?action=cloudflare-stream-update",method:"POST",data:{nonce:cloudflareStream.nonce,uid:e.uid,title:e.title},success:function(){jQuery('li[data-id="'+e.id+'"]').hide()},error:function(e,t){console.error("Error: "+t),cloudflareStream.analytics.logEvent("Stream WP Plugin - Error")}})}},{key:"reload",value:function(){var e=this.props.attributes,t="https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video="+e.uid;jQuery.getScript(t).fail(function(e,t,r){console.error("Exception:"+r)})}},{key:"uploadFromFiles",value:function(e){var t=this,r=this.props.setAttributes,o=jQuery("#progressbar-"+this.instanceId),n=jQuery(".progress-label-"+this.instanceId),i=o.progressbar("value")||0;o.progressbar("value",i);var a="https://api.cloudflare.com/client/v4/accounts/"+cloudflareStream.api.account+"/media";cloudflareStream.analytics.logEvent("Stream WP Plugin - Started uploading a video");var s=new l.a.Upload(e,{resume:t.state.resume,removeFingerprintOnSuccess:!0,endpoint:a,retryDelays:[0,1e3,3e3,5e3],headers:{"X-Auth-Email":cloudflareStream.api.email,"X-Auth-Key":cloudflareStream.api.key},metadata:{name:e.name,type:e.type},onError:function(e){console.error("Error: "+e),o.hide(),jQuery(".editor-media-placeholder .components-placeholder__instructions").html("Upload Error: See the console for details."),jQuery(".editor-media-placeholder__retry-button").show(),cloudflareStream.analytics.logEvent("Stream WP Plugin - Error")},onProgress:function(e,t){var r=parseInt(e/t*100);n.text(r+"%"),o.progressbar("option","value",r)},onSuccess:function(){var e=s.url.split("/"),o=e[e.length-1];r({uid:o,fingerprint:s.options.fingerprint(s.file,s.options)}),cloudflareStream.analytics.logEvent("Stream WP Plugin - Finished uploading a video"),t.switchToEncoding()}});s.start()}},{key:"switchToEncoding",value:function(){var e=this,t=this;t.setState({editing:!0,uploading:!1,encoding:!0},function(){var r=jQuery("#progressbar-"+e.instanceId),o=jQuery(".progress-label-"+e.instanceId);jQuery(".editor-media-placeholder .components-placeholder__instructions").html("Upload Complete. Processing video."),o.text(""),r.progressbar({value:!1}),t.encode()})}},{key:"encode",value:function(){var e=this.props,t=e.attributes,r=e.setAttributes,o=this,n=jQuery("#progressbar-"+this.instanceId),i=jQuery(".progress-label-"+this.instanceId),a=this.props.attributes.file;jQuery.ajax({url:ajaxurl+"?action=cloudflare-stream-check-upload",data:{nonce:cloudflareStream.nonce,uid:t.uid},success:function(e){if(e.success){if("undefined"!==typeof e.data){if(!0===e.data.readyToStream&&"undefined"!==typeof e.data.thumbnail?(clearTimeout(o.encodingPoller),r({thumbnail:e.data.thumbnail}),o.setState({editing:!1,uploading:!1,encoding:!1})):o.encodingPoller=setTimeout(function(){o.encode()},5e3),"queued"===e.data.status.state)i.text(""),n.progressbar({value:!1});else if("inprogress"===e.data.status.state){var t=Math.round(e.data.status.pctComplete);i.text(t+"%"),n.progressbar({value:t})}o.reload()}}else console.error("Error: "+e.data),!0===o.state.resume?(o.setState({resume:!1}),jQuery(".editor-media-placeholder .components-placeholder__instructions").html("Uploading your video."),o.uploadFromFiles(a)):(n.hide(),jQuery(".editor-media-placeholder .components-placeholder__instructions").html("Processing Error: "+e.data),jQuery(".editor-media-placeholder__retry-button").show())},error:function(e,t){console.error("Error: "+t)}})}},{key:"render",value:function(){var e=this,t=this.props.attributes,r=t.uid,o=t.autoplay,n=t.controls,i=t.loop,a=t.muted,s=this.props.className,l=this.state,u=l.editing,d=l.uploading,y=l.encoding,v=function(){e.setState({editing:!0}),e.setState({uploading:!1}),e.setState({encoding:!1})},C=function(){e.setState({editing:!1}),e.setState({uploading:!1}),e.setState({encoding:!1})},j=function(){var t=e.props.setAttributes;jQuery(".editor-media-placeholder .components-placeholder__instructions").html("Processing your video");var r=jQuery(".components-form-file-upload :input[type='file']")[0].files[0];t({file:r});var o=e;o.setState({editing:!0,uploading:!0,encoding:!1},function(){jQuery("#progressbar-"+e.instanceId).progressbar({value:!1}),o.uploadFromFiles(r)})};if(u){if(d){var P={width:"100%"};return wp.element.createElement(_,{icon:cloudflareStream.icon,label:"Cloudflare Stream",instructions:"Uploading your video.",className:"editor-media-placeholder"},wp.element.createElement("div",{id:"progressbar-"+this.instanceId,style:P},wp.element.createElement("div",{className:"progress-label progress-label-"+this.instanceId},"Connecting...")),wp.element.createElement(p,{isDefault:!0,isLarge:!0,icon:"update",label:c("Retry"),onClick:v,style:{display:"none"},className:"editor-media-placeholder__retry-button"},c("Retry")))}if(y){var k={width:"100%"};return wp.element.createElement(_,{icon:cloudflareStream.icon,label:"Cloudflare Stream",instructions:"Processing your video.",className:"editor-media-placeholder"},wp.element.createElement("div",{id:"progressbar-"+this.instanceId,style:k},wp.element.createElement("div",{className:"progress-label progress-label-"+this.instanceId},"Connecting...")),wp.element.createElement(p,{isDefault:!0,isLarge:!0,icon:"update",label:c("Retry"),onClick:v,style:{display:"none"},className:"editor-media-placeholder__retry-button"},c("Retry")))}return cloudflareStream.api.key&&""!==cloudflareStream.api.key?wp.element.createElement(_,{icon:cloudflareStream.icon,label:"Cloudflare Stream",instructions:"Select a file from your library."},wp.element.createElement(g,{isLarge:!0,multiple:!0,className:"editor-media-placeholder__upload-button",onChange:j,accept:"video/*"},c("Upload")),wp.element.createElement(S,{type:"video",className:s,value:this.props.attributes,render:function(){return wp.element.createElement(p,{isLarge:!0,label:c("Stream Library"),onClick:e.open,className:"editor-media-placeholder__browse-button"},c("Stream Library"))}}),wp.element.createElement(p,{isDefault:!0,isLarge:!0,icon:"cancel",label:c("Cancel"),onClick:C,style:{display:"none"},className:"editor-media-placeholder__cancel-button"},c("Cancel"))):wp.element.createElement(_,{icon:cloudflareStream.icon,label:"Cloudflare Stream",instructions:"Select a file from your library."},wp.element.createElement(S,{type:"video",className:s,value:this.props.attributes,render:function(){return wp.element.createElement(p,{isLarge:!0,label:c("Stream Library"),onClick:e.open,className:"editor-media-placeholder__browse-button"},c("Stream Library"))}}),wp.element.createElement(p,{isDefault:!0,isLarge:!0,icon:"cancel",label:c("Cancel"),onClick:C,style:{display:"none"},className:"editor-media-placeholder__cancel-button"},c("Cancel")))}return wp.element.createElement(A,null,wp.element.createElement(w,null,wp.element.createElement(m,null,wp.element.createElement(p,{className:"components-icon-button components-toolbar__control",label:c("Edit video"),onClick:v,icon:"edit"}))),wp.element.createElement(E,null,wp.element.createElement(h,{title:c("Video Settings")},wp.element.createElement(b,{label:c("Autoplay"),onChange:this.toggleAttribute("autoplay"),checked:o}),wp.element.createElement(b,{label:c("Loop"),onChange:this.toggleAttribute("loop"),checked:i}),wp.element.createElement(b,{label:c("Muted"),onChange:this.toggleAttribute("muted"),checked:a}),wp.element.createElement(b,{label:c("Playback Controls"),onChange:this.toggleAttribute("controls"),checked:n}))),wp.element.createElement("figure",{className:s},wp.element.createElement(f,null,wp.element.createElement("stream",{src:r,controls:n,autoPlay:o,loop:i,muted:a,ref:this.streamPlayer}))))}}]),t}(j);t.a=y(k)},function(e,t,r){"use strict";var o=r(11),n=function(e){return e&&e.__esModule?e:{default:e}}(o),i=r(1),a=n.default.defaultOptions,s=void 0;if("undefined"!==typeof window){var l=window,u=l.XMLHttpRequest,c=l.Blob;s=u&&c&&"function"===typeof c.prototype.slice}else s=!0;e.exports={Upload:n.default,isSupported:s,canStoreURLs:i.canStoreURLs,defaultOptions:a}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){var t=[];for(var r in e)t.push(r+" "+h.Base64.encode(e[r]));return t.join(",")}function a(e,t){return e>=t&&e<t+100}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(12),u=o(l),c=r(13),d=o(c),f=r(14),p=o(f),h=r(15),m=r(16),b=r(20),y=r(1),_=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(y),g={endpoint:null,fingerprint:u.default,resume:!0,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,headers:{},chunkSize:1/0,withCredentials:!1,uploadUrl:null,uploadSize:null,overridePatchMethod:!1,retryDelays:null,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1},v=function(){function e(t,r){n(this,e),this.options=(0,p.default)(!0,{},g,r),this.file=t,this.url=null,this._xhr=null,this._fingerprint=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0}return s(e,[{key:"start",value:function(){var e=this,t=this.file;return t?this.options.endpoint||this.options.uploadUrl?void(this._source?this._start(this._source):(0,b.getSource)(t,this.options.chunkSize,function(t,r){if(t)return void e._emitError(t);e._source=r,e._start(r)})):void this._emitError(new Error("tus: neither an endpoint or an upload URL is provided")):void this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_start",value:function(e){var t=this,r=this.file;if(this.options.uploadLengthDeferred)this._size=null;else if(null!=this.options.uploadSize){if(this._size=+this.options.uploadSize,isNaN(this._size))return void this._emitError(new Error("tus: cannot convert `uploadSize` option into a number"))}else if(this._size=e.size,null==this._size)return void this._emitError(new Error("tus: cannot automatically derive upload's size from input and must be specified manually using the `uploadSize` option"));var o=this.options.retryDelays;if(null!=o){if("[object Array]"!==Object.prototype.toString.call(o))return void this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));var n=this.options.onError;this.options.onError=function(e){t.options.onError=n,null!=t._offset&&t._offset>t._offsetBeforeRetry&&(t._retryAttempt=0);var r=!0;"undefined"!==typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(r=!1);var i=e.originalRequest?e.originalRequest.status:0,s=!a(i,400)||409===i||423===i;if(!(t._retryAttempt<o.length&&null!=e.originalRequest&&s&&r))return void t._emitError(e);var l=o[t._retryAttempt++];t._offsetBeforeRetry=t._offset,t.options.uploadUrl=t.url,t._retryTimeout=setTimeout(function(){t.start()},l)}}if(this._aborted=!1,null!=this.url)return void this._resumeUpload();if(null!=this.options.uploadUrl)return this.url=this.options.uploadUrl,void this._resumeUpload();if(this.options.resume){this._fingerprint=this.options.fingerprint(r,this.options);var i=_.getItem(this._fingerprint);if(null!=i)return this.url=i,void this._resumeUpload()}this._createUpload()}},{key:"abort",value:function(){null!==this._xhr&&(this._xhr.abort(),this._source.close(),this._aborted=!0),null!=this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=null)}},{key:"_emitXhrError",value:function(e,t,r){this._emitError(new d.default(t,r,e))}},{key:"_emitError",value:function(e){if("function"!==typeof this.options.onError)throw e;this.options.onError(e)}},{key:"_emitSuccess",value:function(){"function"===typeof this.options.onSuccess&&this.options.onSuccess()}},{key:"_emitProgress",value:function(e,t){"function"===typeof this.options.onProgress&&this.options.onProgress(e,t)}},{key:"_emitChunkComplete",value:function(e,t,r){"function"===typeof this.options.onChunkComplete&&this.options.onChunkComplete(e,t,r)}},{key:"_setupXHR",value:function(e){this._xhr=e,e.setRequestHeader("Tus-Resumable","1.0.0");var t=this.options.headers;for(var r in t)e.setRequestHeader(r,t[r]);e.withCredentials=this.options.withCredentials}},{key:"_createUpload",value:function(){var e=this;if(!this.options.endpoint)return void this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));var t=(0,m.newRequest)();t.open("POST",this.options.endpoint,!0),t.onload=function(){if(!a(t.status,200))return void e._emitXhrError(t,new Error("tus: unexpected response while creating upload"));var r=t.getResponseHeader("Location");return null==r?void e._emitXhrError(t,new Error("tus: invalid or missing Location header")):(e.url=(0,m.resolveUrl)(e.options.endpoint,r),0===e._size?(e._emitSuccess(),void e._source.close()):(e.options.resume&&_.setItem(e._fingerprint,e.url),e._offset=0,void e._startUpload()))},t.onerror=function(r){e._emitXhrError(t,new Error("tus: failed to create upload"),r)},this._setupXHR(t),this.options.uploadLengthDeferred?t.setRequestHeader("Upload-Defer-Length",1):t.setRequestHeader("Upload-Length",this._size);var r=i(this.options.metadata);""!==r&&t.setRequestHeader("Upload-Metadata",r),t.send(null)}},{key:"_resumeUpload",value:function(){var e=this,t=(0,m.newRequest)();t.open("HEAD",this.url,!0),t.onload=function(){if(!a(t.status,200))return e.options.resume&&a(t.status,400)&&_.removeItem(e._fingerprint),423===t.status?void e._emitXhrError(t,new Error("tus: upload is currently locked; retry later")):e.options.endpoint?(e.url=null,void e._createUpload()):void e._emitXhrError(t,new Error("tus: unable to resume upload (new upload cannot be created without an endpoint)"));var r=parseInt(t.getResponseHeader("Upload-Offset"),10);if(isNaN(r))return void e._emitXhrError(t,new Error("tus: invalid or missing offset value"));var o=parseInt(t.getResponseHeader("Upload-Length"),10);return isNaN(o)&&!e.options.uploadLengthDeferred?void e._emitXhrError(t,new Error("tus: invalid or missing length value")):r===o?(e._emitProgress(o,o),void e._emitSuccess()):(e._offset=r,void e._startUpload())},t.onerror=function(r){e._emitXhrError(t,new Error("tus: failed to resume upload"),r)},this._setupXHR(t),t.send(null)}},{key:"_startUpload",value:function(){var e=this;if(!this._aborted){var t=(0,m.newRequest)();this.options.overridePatchMethod?(t.open("POST",this.url,!0),t.setRequestHeader("X-HTTP-Method-Override","PATCH")):t.open("PATCH",this.url,!0),t.onload=function(){if(!a(t.status,200))return void e._emitXhrError(t,new Error("tus: unexpected response while uploading chunk"));var r=parseInt(t.getResponseHeader("Upload-Offset"),10);return isNaN(r)?void e._emitXhrError(t,new Error("tus: invalid or missing offset value")):(e._emitProgress(r,e._size),e._emitChunkComplete(r-e._offset,r,e._size),e._offset=r,r==e._size?(e.options.removeFingerprintOnSuccess&&e.options.resume&&_.removeItem(e._fingerprint),e._emitSuccess(),void e._source.close()):void e._startUpload())},t.onerror=function(r){e._aborted||e._emitXhrError(t,new Error("tus: failed to upload chunk at offset "+e._offset),r)},"upload"in t&&(t.upload.onprogress=function(t){t.lengthComputable&&e._emitProgress(r+t.loaded,e._size)}),this._setupXHR(t),t.setRequestHeader("Upload-Offset",this._offset),t.setRequestHeader("Content-Type","application/offset+octet-stream");var r=this._offset,o=this._offset+this.options.chunkSize;(o===1/0||o>this._size)&&!this.options.uploadLengthDeferred&&(o=this._size),this._source.slice(r,o,function(r,o,n){if(r)return void e._emitError(r);e.options.uploadLengthDeferred&&n&&(e._size=e._offset+(o&&o.size?o.size:0),t.setRequestHeader("Upload-Length",e._size)),null===o?t.send():(t.send(o),e._emitProgress(e._offset,e._size))})}}}]),e}();v.defaultOptions=g,t.default=v},function(e,t,r){"use strict";function o(e,t){return["tus",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o},function(e,t,r){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function i(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;o(this,t);var a=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e.message));a.originalRequest=i,a.causingError=r;var s=e.message;return null!=r&&(s+=", caused by "+r.toString()),null!=i&&(s+=", originated from request (response code: "+i.status+", response text: "+i.responseText+")"),a.message=s,a}return i(t,e),t}(Error);t.default=a},function(e,t,r){"use strict";var o=Object.prototype.hasOwnProperty,n=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(e){return"function"===typeof Array.isArray?Array.isArray(e):"[object Array]"===n.call(e)},l=function(e){if(!e||"[object Object]"!==n.call(e))return!1;var t=o.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&o.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!t&&!r)return!1;var i;for(i in e);return"undefined"===typeof i||o.call(e,i)},u=function(e,t){i&&"__proto__"===t.name?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!o.call(e,t))return;if(a)return a(e,t).value}return e[t]};e.exports=function e(){var t,r,o,n,i,a,d=arguments[0],f=1,p=arguments.length,h=!1;for("boolean"===typeof d&&(h=d,d=arguments[1]||{},f=2),(null==d||"object"!==typeof d&&"function"!==typeof d)&&(d={});f<p;++f)if(null!=(t=arguments[f]))for(r in t)o=c(d,r),n=c(t,r),d!==n&&(h&&n&&(l(n)||(i=s(n)))?(i?(i=!1,a=o&&s(o)?o:[]):a=o&&l(o)?o:{},u(d,{name:r,newValue:e(h,a,n)})):"undefined"!==typeof n&&u(d,{name:r,newValue:n}));return d}},function(module,exports,__webpack_require__){(function(global){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;!function(e,t){module.exports=t(e)}("undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof global?global:this,function(global){"use strict";global=global||{};var _Base64=global.Base64,version="2.5.1",buffer;if("undefined"!==typeof module&&module.exports)try{buffer=eval("require('buffer').Buffer")}catch(e){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(e){for(var t={},r=0,o=e.length;r<o;r++)t[e.charAt(r)]=r;return t}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(e){if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?fromCharCode(192|t>>>6)+fromCharCode(128|63&t):fromCharCode(224|t>>>12&15)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t)}var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return fromCharCode(240|t>>>18&7)+fromCharCode(128|t>>>12&63)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(e){return e.replace(re_utob,cb_utob)},cb_encode=function(e){var t=[0,2,1][e.length%3],r=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[b64chars.charAt(r>>>18),b64chars.charAt(r>>>12&63),t>=2?"=":b64chars.charAt(r>>>6&63),t>=1?"=":b64chars.charAt(63&r)].join("")},btoa=global.btoa?function(e){return global.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e)).toString("base64")}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e)).toString("base64")}:function(e){return btoa(utob(e))},encode=function(e,t){return t?_encode(String(e)).replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,""):_encode(String(e))},encodeURI=function(e){return encode(e,!0)},re_btou=new RegExp(["[\xc0-\xdf][\x80-\xbf]","[\xe0-\xef][\x80-\xbf]{2}","[\xf0-\xf7][\x80-\xbf]{3}"].join("|"),"g"),cb_btou=function(e){switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return fromCharCode(55296+(r>>>10))+fromCharCode(56320+(1023&r));case 3:return fromCharCode((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return fromCharCode((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},btou=function(e){return e.replace(re_btou,cb_btou)},cb_decode=function(e){var t=e.length,r=t%4,o=(t>0?b64tab[e.charAt(0)]<<18:0)|(t>1?b64tab[e.charAt(1)]<<12:0)|(t>2?b64tab[e.charAt(2)]<<6:0)|(t>3?b64tab[e.charAt(3)]:0),n=[fromCharCode(o>>>16),fromCharCode(o>>>8&255),fromCharCode(255&o)];return n.length-=[0,0,2,1][r],n.join("")},_atob=global.atob?function(e){return global.atob(e)}:function(e){return e.replace(/\S{1,4}/g,cb_decode)},atob=function(e){return _atob(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e,"base64")).toString()}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e,"base64")).toString()}:function(e){return btou(_atob(e))},decode=function(e){return _decode(String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var e=global.Base64;return global.Base64=_Base64,e};if(global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,__buffer__:buffer},"function"===typeof Object.defineProperty){var noEnum=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)})),Object.defineProperty(String.prototype,"toBase64",noEnum(function(e){return encode(this,e)})),Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,!0)}))}}return global.Meteor&&(Base64=global.Base64),"undefined"!==typeof module&&module.exports?module.exports.Base64=global.Base64:(__WEBPACK_AMD_DEFINE_ARRAY__=[],void 0!==(__WEBPACK_AMD_DEFINE_RESULT__=function(){return global.Base64}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__))&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)),{Base64:global.Base64}})}).call(exports,__webpack_require__(0))},function(e,t,r){"use strict";function o(){return new window.XMLHttpRequest}function n(e,t){return new a.default(t,e).toString()}Object.defineProperty(t,"__esModule",{value:!0}),t.newRequest=o,t.resolveUrl=n;var i=r(17),a=function(e){return e&&e.__esModule?e:{default:e}}(i)},function(e,t,r){"use strict";(function(t){function o(e){return(e||"").toString().replace(h,"")}function n(e){var r;r="undefined"!==typeof window?window:"undefined"!==typeof t?t:"undefined"!==typeof self?self:{};var o=r.location||{};e=e||o;var n,i={},a=typeof e;if("blob:"===e.protocol)i=new s(unescape(e.pathname),{});else if("string"===a){i=new s(e,{});for(n in b)delete i[n]}else if("object"===a){for(n in e)n in b||(i[n]=e[n]);void 0===i.slashes&&(i.slashes=f.test(e.href))}return i}function i(e){e=o(e);var t=p.exec(e);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!t[2],rest:t[3]}}function a(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),o=r.length,n=r[o-1],i=!1,a=0;o--;)"."===r[o]?r.splice(o,1):".."===r[o]?(r.splice(o,1),a++):a&&(0===o&&(i=!0),r.splice(o,1),a--);return i&&r.unshift(""),"."!==n&&".."!==n||r.push(""),r.join("/")}function s(e,t,r){if(e=o(e),!(this instanceof s))return new s(e,t,r);var l,u,f,p,h,b,y=m.slice(),_=typeof t,g=this,v=0;for("object"!==_&&"string"!==_&&(r=t,t=null),r&&"function"!==typeof r&&(r=d.parse),t=n(t),u=i(e||""),l=!u.protocol&&!u.slashes,g.slashes=u.slashes||l&&t.slashes,g.protocol=u.protocol||t.protocol||"",e=u.rest,u.slashes||(y[3]=[/(.*)/,"pathname"]);v<y.length;v++)p=y[v],"function"!==typeof p?(f=p[0],b=p[1],f!==f?g[b]=e:"string"===typeof f?~(h=e.indexOf(f))&&("number"===typeof p[2]?(g[b]=e.slice(0,h),e=e.slice(h+p[2])):(g[b]=e.slice(h),e=e.slice(0,h))):(h=f.exec(e))&&(g[b]=h[1],e=e.slice(0,h.index)),g[b]=g[b]||(l&&p[3]?t[b]||"":""),p[4]&&(g[b]=g[b].toLowerCase())):e=p(e);r&&(g.query=r(g.query)),l&&t.slashes&&"/"!==g.pathname.charAt(0)&&(""!==g.pathname||""!==t.pathname)&&(g.pathname=a(g.pathname,t.pathname)),c(g.port,g.protocol)||(g.host=g.hostname,g.port=""),g.username=g.password="",g.auth&&(p=g.auth.split(":"),g.username=p[0]||"",g.password=p[1]||""),g.origin=g.protocol&&g.host&&"file:"!==g.protocol?g.protocol+"//"+g.host:"null",g.href=g.toString()}function l(e,t,r){var o=this;switch(e){case"query":"string"===typeof t&&t.length&&(t=(r||d.parse)(t)),o[e]=t;break;case"port":o[e]=t,c(t,o.protocol)?t&&(o.host=o.hostname+":"+t):(o.host=o.hostname,o[e]="");break;case"hostname":o[e]=t,o.port&&(t+=":"+o.port),o.host=t;break;case"host":o[e]=t,/:\d+$/.test(t)?(t=t.split(":"),o.port=t.pop(),o.hostname=t.join(":")):(o.hostname=t,o.port="");break;case"protocol":o.protocol=t.toLowerCase(),o.slashes=!r;break;case"pathname":case"hash":if(t){var n="pathname"===e?"/":"#";o[e]=t.charAt(0)!==n?n+t:t}else o[e]=t;break;default:o[e]=t}for(var i=0;i<m.length;i++){var a=m[i];a[4]&&(o[a[1]]=o[a[1]].toLowerCase())}return o.origin=o.protocol&&o.host&&"file:"!==o.protocol?o.protocol+"//"+o.host:"null",o.href=o.toString(),o}function u(e){e&&"function"===typeof e||(e=d.stringify);var t,r=this,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var n=o+(r.slashes?"//":"");return r.username&&(n+=r.username,r.password&&(n+=":"+r.password),n+="@"),n+=r.host+r.pathname,t="object"===typeof r.query?e(r.query):r.query,t&&(n+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(n+=r.hash),n}var c=r(18),d=r(19),f=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,p=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,h=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+"),m=[["#","hash"],["?","query"],function(e){return e.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],b={hash:1,query:1};s.prototype={set:l,toString:u},s.extractProtocol=i,s.location=n,s.trimLeft=o,s.qs=d,e.exports=s}).call(t,r(0))},function(e,t,r){"use strict";e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},function(e,t,r){"use strict";function o(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function n(e){for(var t,r=/([^=?&]+)=?([^&]*)/g,n={};t=r.exec(e);){var i=o(t[1]),a=o(t[2]);null===i||null===a||i in n||(n[i]=a)}return n}function i(e,t){t=t||"";var r,o,n=[];"string"!==typeof t&&(t="?");for(o in e)if(s.call(e,o)){if(r=e[o],r||null!==r&&r!==a&&!isNaN(r)||(r=""),o=encodeURIComponent(o),r=encodeURIComponent(r),null===o||null===r)continue;n.push(o+"="+r)}return n.length?t+n.join("&"):""}var a,s=Object.prototype.hasOwnProperty;t.stringify=i,t.parse=n},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return void 0===e?0:void 0!==e.size?e.size:e.length}function a(e,t){if(e.concat)return e.concat(t);if(e instanceof Blob)return new Blob([e,t],{type:e.type});if(e.set){var r=new e.constructor(e.length+t.length);return r.set(e),r.set(t,e.length),r}throw new Error("Unknown data type")}function s(e,t,r){return(c.default||window.__tus__forceReactNative)&&e&&"undefined"!==typeof e.uri?void(0,f.default)(e.uri,function(e,t){if(e)return r(new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. "+e));r(null,new y(t))}):"function"===typeof e.slice&&"undefined"!==typeof e.size?void r(null,new y(e)):"function"===typeof e.read?(t=+t,isFinite(t)?void r(null,new _(e,t)):void r(new Error("cannot create source for stream without a finite value for the `chunkSize` option"))):void r(new Error("source object may only be an instance of File, Blob, or Reader in this environment"))}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}();t.getSource=s;var u=r(21),c=o(u),d=r(22),f=o(d),p=r(23),h=o(p),m=r(24),b=o(m),y=function(){function e(t){n(this,e),this._file=t,this.size=t.size}return l(e,[{key:"slice",value:function(e,t,r){if((0,h.default)())return void(0,b.default)(this._file.slice(e,t),function(e,t){if(e)return r(e);r(null,t)});r(null,this._file.slice(e,t))}},{key:"close",value:function(){}}]),e}(),_=function(){function e(t,r){n(this,e),this._chunkSize=r,this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=!1}return l(e,[{key:"slice",value:function(e,t,r){return e<this._bufferOffset?void r(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(e,t,r)}},{key:"_readUntilEnoughDataOrDone",value:function(e,t,r){var o=this,n=t<=this._bufferOffset+i(this._buffer);if(this._done||n){var s=this._getDataFromBuffer(e,t);return void r(null,s,null==s&&this._done)}this._reader.read().then(function(n){var i=n.value;n.done?o._done=!0:void 0===o._buffer?o._buffer=i:o._buffer=a(o._buffer,i),o._readUntilEnoughDataOrDone(e,t,r)}).catch(function(e){r(new Error("Error during read: "+e))})}},{key:"_getDataFromBuffer",value:function(e,t){e>this._bufferOffset&&(this._buffer=this._buffer.slice(e-this._bufferOffset),this._bufferOffset=e);var r=0===i(this._buffer);return this._done&&r?null:this._buffer.slice(0,t-e)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}]),e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o="undefined"!==typeof navigator&&"string"===typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();t.default=o},function(e,t,r){"use strict";function o(e,t){var r=new XMLHttpRequest;r.responseType="blob",r.onload=function(){var e=r.response;t(null,e)},r.onerror=function(e){t(e)},r.open("GET",e),r.send()}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){return"undefined"!=typeof window&&("undefined"!=typeof window.PhoneGap||"undefined"!=typeof window.Cordova||"undefined"!=typeof window.cordova)};t.default=o},function(e,t,r){"use strict";function o(e,t){var r=new FileReader;r.onload=function(){t(null,new Uint8Array(r.result))},r.onerror=function(e){t(e)},r.readAsArrayBuffer(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o},function(e,t){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),n=function(){function e(){r(this,e),jQuery("#submit").on("click",function(){cloudflareStream.analytics.logEvent("Stream WP Plugin - Settings Saved")})}return o(e,[{key:"logEvent",value:function(e){cloudflareStream.options.heap||(console.error("Event: "+e),jQuery.ajax({url:ajaxurl+"?action=cloudflare-stream-analytics",method:"POST",data:{nonce:cloudflareStream.nonce,event:e},error:function(e,t){console.error("Error: "+t)}}))}}]),e}();cloudflareStream.analytics=new n}]);
     1! function(e) {
     2    function t(o) {
     3        if (r[o]) return r[o].exports;
     4        var n = r[o] = {
     5            i: o,
     6            l: !1,
     7            exports: {}
     8        };
     9        return e[o].call(n.exports, n, n.exports, t), n.l = !0, n.exports
     10    }
     11    var r = {};
     12    t.m = e, t.c = r, t.d = function(e, r, o) {
     13        t.o(e, r) || Object.defineProperty(e, r, {
     14            configurable: !1,
     15            enumerable: !0,
     16            get: o
     17        })
     18    }, t.n = function(e) {
     19        var r = e && e.__esModule ? function() {
     20            return e.default
     21        } : function() {
     22            return e
     23        };
     24        return t.d(r, "a", r), r
     25    }, t.o = function(e, t) {
     26        return Object.prototype.hasOwnProperty.call(e, t)
     27    }, t.p = "", t(t.s = 2)
     28}([function(e, t) {
     29    var r;
     30    r = function() {
     31        return this
     32    }();
     33    try {
     34        r = r || Function("return this")() || (0, eval)("this")
     35    } catch (e) {
     36        "object" === typeof window && (r = window)
     37    }
     38    e.exports = r
     39}, function(e, t, r) {
     40    "use strict";
     41
     42    function o(e, t) {
     43        if (a) return localStorage.setItem(e, t)
     44    }
     45
     46    function n(e) {
     47        if (a) return localStorage.getItem(e)
     48    }
     49
     50    function i(e) {
     51        if (a) return localStorage.removeItem(e)
     52    }
     53    Object.defineProperty(t, "__esModule", {
     54        value: !0
     55    }), t.setItem = o, t.getItem = n, t.removeItem = i;
     56    var a = !1;
     57    try {
     58        a = "localStorage" in window;
     59        var s = "tusSupport";
     60        localStorage.setItem(s, localStorage.getItem(s))
     61    } catch (e) {
     62        if (e.code !== e.SECURITY_ERR && e.code !== e.QUOTA_EXCEEDED_ERR) throw e;
     63        a = !1
     64    }
     65    t.canStoreURLs = a
     66}, function(e, t, r) {
     67    "use strict";
     68    Object.defineProperty(t, "__esModule", {
     69        value: !0
     70    });
     71    var o = r(3),
     72        n = (r.n(o), r(4)),
     73        i = (r.n(n), r(5)),
     74        a = (r.n(i), r(6), r(25));
     75    r.n(a)
     76}, function(e, t) {
     77    cloudflareStream.media.model.Attachments = wp.media.model.Attachments.extend({
     78        initialize: function() {
     79            wp.media.model.Attachments.prototype.initialize.apply(this, arguments)
     80        },
     81        _requery: function(e) {
     82            var t = void 0;
     83            this.props.get("query") && (t = this.props.toJSON(), t.cache = !0 !== e, this.mirror(cloudflareStream.media.model.Query.get(this.props.toJSON())))
     84        }
     85    })
     86}, function(e, t) {
     87    cloudflareStream.media.model.Query = wp.media.model.Query.extend({
     88        initialize: function(e, t) {
     89            t = t || {}, wp.media.model.Query.prototype.initialize.apply(this, arguments), this.args = t.args || {}, this.args.posts_per_page = cloudflareStream.api.posts_per_page
     90        },
     91        sync: function(e, t, r) {
     92            if ("read" === e) {
     93                r = r || {}, r.context = this, r.data = _.extend(r.data || {}, {
     94                    action: "query-cloudflare-stream-attachments",
     95                    post_id: wp.media.model.settings.post.id,
     96                    nonce: cloudflareStream.nonce
     97                });
     98                var o = "";
     99                cloudflareStream.media.model.Attachments.all.models.length > 0 && (o = "&end=" + cloudflareStream.media.model.Attachments.all.models[cloudflareStream.media.model.Attachments.all.models.length - 1].attributes.modified.toISOString());
     100                var n = _.clone(this.args);
     101                return -1 !== n.posts_per_page && (n.paged = Math.floor(this.length / n.posts_per_page) + 1), r.data.query = "asc=false" + o, wp.media.ajax(r)
     102            }
     103            return (wp.media.model.Attachments.prototype.sync ? wp.media.model.Attachments.prototype : Backbone).sync.apply(this, arguments)
     104        }
     105    }, {
     106        get: function() {
     107            var e = [];
     108            return function(t, r) {
     109                var o = {},
     110                    n = cloudflareStream.media.model.Query.orderby,
     111                    i = cloudflareStream.media.model.Query.defaultProps,
     112                    a = void 0;
     113                return delete t.query, delete t.remotefilters, delete t.uioptions, _.defaults(t, i), t.order = t.order.toUpperCase(), "DESC" !== t.order && "ASC" !== t.order && (t.order = i.order.toUpperCase()), _.contains(n.allowed, t.orderby) || (t.orderby = i.orderby), _.each(t, function(e, t) {
     114                    _.isNull(e) || (o[cloudflareStream.media.model.Query.propmap[t] || t] = e)
     115                }), _.defaults(o, cloudflareStream.media.model.Query.defaultArgs), o.orderby = n.valuemap[t.orderby] || t.orderby, a = _.find(e, function(e) {
     116                    return _.isEqual(e.args, o)
     117                }), a || (a = new cloudflareStream.media.model.Query([], _.extend(r || {}, {
     118                    props: t,
     119                    args: o
     120                })), e.push(a)), a
     121            }
     122        }()
     123    })
     124}, function(e, t) {
     125    var r = wp.media.view.MediaFrame.Post,
     126        o = wp.media.controller.Library,
     127        n = wp.media.view.l10n;
     128    cloudflareStream.media.view.MediaFrame = r.extend({
     129        initialize: function(e) {
     130            this.select = e, _.defaults(this.options, {
     131                id: "cloudflare-stream",
     132                className: "cloudflare-stream-media-frame",
     133                title: "Cloudflare Stream Library",
     134                multiple: !1,
     135                editing: !1,
     136                state: "insert",
     137                metadata: {}
     138            }), r.prototype.initialize.apply(this, arguments)
     139        },
     140        createStates: function() {
     141            var e = this.options;
     142            this.states.add([new o({
     143                id: "insert",
     144                title: e.title,
     145                priority: 20,
     146                toolbar: "main-insert",
     147                menu: !1,
     148                filterable: !1,
     149                searchable: !1,
     150                date: !1,
     151                library: new cloudflareStream.media.model.Query(_.defaults(null, {
     152                    type: "video"
     153                }, e.library)),
     154                multiple: !!e.multiple && "reset",
     155                editable: !0,
     156                allowLocalEdits: !0,
     157                displaySettings: !1,
     158                displayUserSettings: !1
     159            })])
     160        },
     161        bindHandlers: function() {
     162            var e = void 0,
     163                t = void 0;
     164            r.prototype.bindHandlers.apply(this, arguments), this.on("activate", this.activate, this), t = _.find(this.counts, function(e) {
     165                return 0 === e.count
     166            }), "undefined" !== typeof t && this.listenTo(wp.media.model.Attachments.all, "change:type", this.mediaTypeCounts), this.on("toolbar:create:main-insert", this.createToolbar, this), this.on("selection:toggle", this.bindSidebarItems, this), e = {
     167                toolbar: {
     168                    "main-insert": "mainInsertToolbar"
     169                }
     170            }, _.each(e, function(e, t) {
     171                _.each(e, function(e, r) {
     172                    this.on(t + ":render:" + r, this[e], this)
     173                }, this)
     174            }, this)
     175        },
     176        bindSidebarItems: function() {
     177            jQuery(".delete-attachment").on("click", this, this.deleteAttachment), jQuery('label[data-setting="title"] input').on("change", this, this.updateAttachment)
     178        },
     179        deleteAttachment: function(e) {
     180            e.preventDefault(), e.stopPropagation();
     181            var t = e.data;
     182            if (window.confirm(n.warnDelete)) {
     183                var r = t.state(),
     184                    o = r.get("selection"),
     185                    i = o.first().toJSON();
     186                o.remove(i), r.trigger("delete", i).reset()
     187            }
     188        },
     189        updateAttachment: function(e) {
     190            e.preventDefault(), e.stopPropagation();
     191            var t = e.data,
     192                r = t.state(),
     193                o = r.get("selection"),
     194                n = o.first().toJSON(),
     195                i = jQuery('label[data-setting="title"] input').val(),
     196                a = {
     197                    uid: n.uid,
     198                    meta: {
     199                        name: i,
     200                        upload: n.cloudflare.meta.upload
     201                    }
     202                };
     203            jQuery(".media-sidebar .spinner").css("visibility", "visible"), jQuery.ajax({
     204                url: "https://api.cloudflare.com/client/v4/accounts/" + cloudflareStream.api.account + "/media/" + n.uid,
     205                method: "POST",
     206                contentType: "application/json; charset=utf-8",
     207                dataType: "json",
     208                data: JSON.stringify(a),
     209                headers: {
     210                    "X-Auth-Email": cloudflareStream.api.email,
     211                    "X-Auth-Key": cloudflareStream.api.key
     212                },
     213                success: function() {
     214                    o.models[0].set("filename", i), jQuery(".media-sidebar .spinner").css("visibility", "hidden")
     215                },
     216                error: function(e, t) {
     217                    console.error("Error: " + t)
     218                }
     219            })
     220        },
     221        browseRouter: function(e) {
     222            e.set({
     223                browse: {
     224                    text: this.options.title,
     225                    priority: 40
     226                }
     227            })
     228        },
     229        mainInsertToolbar: function(e) {
     230            var t = this;
     231            e.set("insert", {
     232                style: "primary",
     233                priority: 80,
     234                text: "Select",
     235                requires: {
     236                    selection: !0
     237                },
     238                click: function() {
     239                    var e = t.state(),
     240                        r = e.get("selection"),
     241                        o = r.first().toJSON();
     242                    t.select(o), t.close(), e.trigger("insert", r).reset()
     243                }
     244            })
     245        }
     246    })
     247}, function(e, t, r) {
     248    "use strict";
     249    var o = r(7),
     250        n = (r.n(o), r(8)),
     251        i = (r.n(n), r(9)),
     252        a = wp.i18n.__,
     253        s = wp.blocks.registerBlockType;
     254    cloudflareStream.icon = wp.element.createElement("svg", {
     255        width: 20,
     256        height: 20,
     257        viewBox: "0 0 68.66 49.14",
     258        className: "cls-1 dashicon"
     259    }, wp.element.createElement("path", {
     260        d: "M61.05,42.28H1.75A.76.76,0,0,1,1,41.52V1.73A.75.75,0,0,1,1.75,1h59.3a.75.75,0,0,1,.76.75V41.52A.76.76,0,0,1,61.05,42.28ZM2.51,40.77H60.3V2.49H2.51Z"
     261    }), wp.element.createElement("path", {
     262        d: "M45.6,26.09,31.44,17.91a1.17,1.17,0,0,0-1.19-.09,1.19,1.19,0,0,0-.51,1.07V35.25a1.17,1.17,0,0,0,.51,1.06.91.91,0,0,0,.48.13,1.41,1.41,0,0,0,.71-.21L45.6,28.05a1.05,1.05,0,0,0,0-2ZM65.13,48.14H7.86a2.52,2.52,0,0,1-2.52-2.52V7.86A2.52,2.52,0,0,1,7.86,5.34H65.13a2.52,2.52,0,0,1,2.53,2.52V45.62A2.52,2.52,0,0,1,65.13,48.14Zm-56.77-3H64.63V8.36H8.36Z"
     263    })), s("cloudflare-stream/block-video", {
     264        title: a("Cloudflare Stream Video"),
     265        icon: cloudflareStream.icon,
     266        render_callback: "cloudflare_stream_render_block",
     267        category: "embed",
     268        keywords: [a("Cloudflare"), a("Stream"), a("video")],
     269        attributes: {
     270            alignment: {
     271                type: "string"
     272            },
     273            uid: {
     274                type: "string",
     275                default: !1
     276            },
     277            fingerprint: {
     278                type: "string",
     279                default: !1
     280            },
     281            thumbnail: {
     282                type: "string",
     283                default: !1
     284            },
     285            autoplay: {
     286                type: "boolean",
     287                source: "attribute",
     288                selector: "stream",
     289                attribute: "autoplay",
     290                default: !1
     291            },
     292            loop: {
     293                type: "boolean",
     294                source: "attribute",
     295                selector: "stream",
     296                attribute: "loop",
     297                default: !1
     298            },
     299            muted: {
     300                type: "boolean",
     301                source: "attribute",
     302                selector: "stream",
     303                attribute: "muted",
     304                default: !1
     305            },
     306            controls: {
     307                type: "boolean",
     308                source: "attribute",
     309                selector: "stream",
     310                attribute: "controls",
     311                default: !0
     312            },
     313            transform: {
     314                type: "boolean",
     315                source: "attribute",
     316                selector: "stream",
     317                attribute: "transform",
     318                default: !1
     319            }
     320        },
     321        supports: {
     322            align: !0
     323        },
     324        edit: i.a,
     325        save: function(e) {
     326            var t = e.attributes,
     327                r = t.uid,
     328                o = t.controls,
     329                n = t.autoplay,
     330                i = t.loop,
     331                a = t.muted,
     332                s = t.className;
     333            return !1 !== r ? wp.element.createElement("figure", {
     334                className: s,
     335                key: r
     336            }, [wp.element.createElement("stream", {
     337                src: r,
     338                controls: o,
     339                autoplay: n,
     340                loop: i,
     341                muted: a
     342            }), wp.element.createElement("div", {
     343                className: "target"
     344            }), wp.element.createElement("script", {
     345                "data-cfasync": !1,
     346                defer: !0,
     347                type: "text/javascript",
     348                src: "https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video=" + r
     349            })]) : wp.element.createElement("figure", {
     350                className: s
     351            })
     352        }
     353    })
     354}, function(e, t) {}, function(e, t) {}, function(e, t, r) {
     355    "use strict";
     356
     357    function o(e, t, r) {
     358        return t in e ? Object.defineProperty(e, t, {
     359            value: r,
     360            enumerable: !0,
     361            configurable: !0,
     362            writable: !0
     363        }) : e[t] = r, e
     364    }
     365
     366    function n(e, t) {
     367        if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
     368    }
     369
     370    function i(e, t) {
     371        if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
     372        return !t || "object" !== typeof t && "function" !== typeof t ? e : t
     373    }
     374
     375    function a(e, t) {
     376        if ("function" !== typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t);
     377        e.prototype = Object.create(t && t.prototype, {
     378            constructor: {
     379                value: e,
     380                enumerable: !1,
     381                writable: !0,
     382                configurable: !0
     383            }
     384        }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
     385    }
     386    var s = r(10),
     387        l = r.n(s),
     388        u = function() {
     389            function e(e, t) {
     390                for (var r = 0; r < t.length; r++) {
     391                    var o = t[r];
     392                    o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
     393                }
     394            }
     395            return function(t, r, o) {
     396                return r && e(t.prototype, r), o && e(t, o), t
     397            }
     398        }(),
     399        c = wp.i18n.__,
     400        d = wp.components,
     401        f = d.Disabled,
     402        p = d.IconButton,
     403        h = d.PanelBody,
     404        m = d.Toolbar,
     405        b = d.ToggleControl,
     406        y = d.withNotices,
     407        _ = d.Placeholder,
     408        g = d.FormFileUpload,
     409        v = wp.editor,
     410        w = v.BlockControls,
     411        E = v.InspectorControls,
     412        S = v.MediaUpload,
     413        C = wp.element,
     414        A = C.Fragment,
     415        j = C.Component,
     416        P = C.createRef,
     417        k = function(e) {
     418            function t(e) {
     419                n(this, t);
     420                var r = i(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments));
     421                return r.state = {
     422                    editing: !r.props.attributes.uid,
     423                    uploading: !1,
     424                    encoding: r.props.attributes.uid && !r.props.attributes.thumbnail,
     425                    resume: !0
     426                }, r.instanceId = e.clientId, r.controller = r, r.streamPlayer = P(), r.toggleAttribute = r.toggleAttribute.bind(r), r.open = r.open.bind(r), r.select = r.select.bind(r), r.mediaFrame = new cloudflareStream.media.view.MediaFrame(r.select), r.encodingPoller = !1, r
     427            }
     428            return a(t, e), u(t, [{
     429                key: "componentDidMount",
     430                value: function() {
     431                    var e = this.props.attributes;
     432                    !1 !== e.uid && !1 === e.thumbnail ? this.switchToEncoding() : this.reload()
     433                }
     434            }, {
     435                key: "componentDidUpdate",
     436                value: function() {
     437                    var e = this.props.attributes,
     438                        t = this.streamPlayer.current;
     439                    null !== t && null !== t.play && (t.autoPlay = e.autoplay, t.controls = e.controls, t.mute = e.mute, t.loop = e.loop, t.controls = e.controls, e.autoplay && "function" === typeof t.play ? t.play() : "function" === typeof t.pause && t.pause()), !1 !== e.uid && (jQuery("#block-" + this.instanceId + " .editor-media-placeholder__cancel-button").show(), this.reload())
     440                }
     441            }, {
     442                key: "toggleAttribute",
     443                value: function(e) {
     444                    var t = this.props.setAttributes;
     445                    return function(r) {
     446                        t(o({}, e, r))
     447                    }
     448                }
     449            }, {
     450                key: "open",
     451                value: function() {
     452                    var e = this;
     453                    this.mediaFrame.open(), this.mediaFrame.on("delete", function(t) {
     454                        e.delete(t)
     455                    }), this.mediaFrame.on("select", function() {
     456                        e.select()
     457                    })
     458                }
     459            }, {
     460                key: "select",
     461                value: function(e) {
     462                    (0, this.props.setAttributes)({
     463                        uid: e.uid,
     464                        thumbnail: e.thumb.src
     465                    }), this.setState({
     466                        editing: !1,
     467                        uploading: !1,
     468                        encoding: !1
     469                    }), cloudflareStream.analytics.logEvent("Stream WP Plugin - Added to blog post"), this.reload()
     470                }
     471            }, {
     472                key: "delete",
     473                value: function(e) {
     474                    jQuery.ajax({
     475                        url: ajaxurl + "?action=cloudflare-stream-delete",
     476                        data: {
     477                            nonce: cloudflareStream.nonce,
     478                            uid: e.uid
     479                        },
     480                        success: function() {
     481                            jQuery('li[data-id="' + e.id + '"]').hide()
     482                        },
     483                        error: function(e, t) {
     484                            console.error("Error: " + t), cloudflareStream.analytics.logEvent("Stream WP Plugin - Error")
     485                        }
     486                    })
     487                }
     488            }, {
     489                key: "update",
     490                value: function(e) {
     491                    jQuery(".settings-save-status .media-frame .spinner").css("visibility", "visible"), jQuery.ajax({
     492                        url: ajaxurl + "?action=cloudflare-stream-update",
     493                        method: "POST",
     494                        data: {
     495                            nonce: cloudflareStream.nonce,
     496                            uid: e.uid,
     497                            title: e.title
     498                        },
     499                        success: function() {
     500                            jQuery('li[data-id="' + e.id + '"]').hide()
     501                        },
     502                        error: function(e, t) {
     503                            console.error("Error: " + t), cloudflareStream.analytics.logEvent("Stream WP Plugin - Error")
     504                        }
     505                    })
     506                }
     507            }, {
     508                key: "reload",
     509                value: function() {
     510                    var e = this.props.attributes,
     511                        t = "https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video=" + e.uid;
     512                    jQuery.getScript(t).fail(function(e, t, r) {
     513                        console.error("Exception:" + r)
     514                    })
     515                }
     516            }, {
     517                key: "uploadFromFiles",
     518                value: function(e) {
     519                    var t = this,
     520                        r = this.props.setAttributes,
     521                        o = jQuery("#progressbar-" + this.instanceId),
     522                        n = jQuery(".progress-label-" + this.instanceId),
     523                        i = o.progressbar("value") || 0;
     524                    o.progressbar("value", i);
     525                    var a = "https://api.cloudflare.com/client/v4/accounts/" + cloudflareStream.api.account + "/media";
     526                    cloudflareStream.analytics.logEvent("Stream WP Plugin - Started uploading a video");
     527                    var s = new l.a.Upload(e, {
     528                        resume: t.state.resume,
     529                        removeFingerprintOnSuccess: !0,
     530                        endpoint: a,
     531                        retryDelays: [0, 1e3, 3e3, 5e3],
     532                        headers: {
     533                            "X-Auth-Email": cloudflareStream.api.email,
     534                            "X-Auth-Key": cloudflareStream.api.key
     535                        },
     536                        chunkSize: 10485760,
     537                        metadata: {
     538                            name: e.name,
     539                            type: e.type
     540                        },
     541                        onError: function(e) {
     542                            console.error("Error: " + e), o.hide(), jQuery(".editor-media-placeholder .components-placeholder__instructions").html("Upload Error: See the console for details."), jQuery(".editor-media-placeholder__retry-button").show(), cloudflareStream.analytics.logEvent("Stream WP Plugin - Error")
     543                        },
     544                        onProgress: function(e, t) {
     545                            var r = parseInt(e / t * 100);
     546                            n.text(r + "%"), o.progressbar("option", "value", r)
     547                        },
     548                        onSuccess: function() {
     549                            var e = s.url.split("/"),
     550                                o = e[e.length - 1];
     551                            r({
     552                                uid: o,
     553                                fingerprint: s.options.fingerprint(s.file, s.options)
     554                            }), cloudflareStream.analytics.logEvent("Stream WP Plugin - Finished uploading a video"), t.switchToEncoding()
     555                        }
     556                    });
     557                    s.start()
     558                }
     559            }, {
     560                key: "switchToEncoding",
     561                value: function() {
     562                    var e = this,
     563                        t = this;
     564                    t.setState({
     565                        editing: !0,
     566                        uploading: !1,
     567                        encoding: !0
     568                    }, function() {
     569                        var r = jQuery("#progressbar-" + e.instanceId),
     570                            o = jQuery(".progress-label-" + e.instanceId);
     571                        jQuery(".editor-media-placeholder .components-placeholder__instructions").html("Upload Complete. Processing video."), o.text(""), r.progressbar({
     572                            value: !1
     573                        }), t.encode()
     574                    })
     575                }
     576            }, {
     577                key: "encode",
     578                value: function() {
     579                    var e = this.props,
     580                        t = e.attributes,
     581                        r = e.setAttributes,
     582                        o = this,
     583                        n = jQuery("#progressbar-" + this.instanceId),
     584                        i = jQuery(".progress-label-" + this.instanceId),
     585                        a = this.props.attributes.file;
     586                    jQuery.ajax({
     587                        url: ajaxurl + "?action=cloudflare-stream-check-upload",
     588                        data: {
     589                            nonce: cloudflareStream.nonce,
     590                            uid: t.uid
     591                        },
     592                        success: function(e) {
     593                            if (e.success) {
     594                                if ("undefined" !== typeof e.data) {
     595                                    if (!0 === e.data.readyToStream && "undefined" !== typeof e.data.thumbnail ? (clearTimeout(o.encodingPoller), r({
     596                                            thumbnail: e.data.thumbnail
     597                                        }), o.setState({
     598                                            editing: !1,
     599                                            uploading: !1,
     600                                            encoding: !1
     601                                        })) : o.encodingPoller = setTimeout(function() {
     602                                            o.encode()
     603                                        }, 5e3), "queued" === e.data.status.state) i.text(""), n.progressbar({
     604                                        value: !1
     605                                    });
     606                                    else if ("inprogress" === e.data.status.state) {
     607                                        var t = Math.round(e.data.status.pctComplete);
     608                                        i.text(t + "%"), n.progressbar({
     609                                            value: t
     610                                        })
     611                                    }
     612                                    o.reload()
     613                                }
     614                            } else console.error("Error: " + e.data), !0 === o.state.resume ? (o.setState({
     615                                resume: !1
     616                            }), jQuery(".editor-media-placeholder .components-placeholder__instructions").html("Uploading your video."), o.uploadFromFiles(a)) : (n.hide(), jQuery(".editor-media-placeholder .components-placeholder__instructions").html("Processing Error: " + e.data), jQuery(".editor-media-placeholder__retry-button").show())
     617                        },
     618                        error: function(e, t) {
     619                            console.error("Error: " + t)
     620                        }
     621                    })
     622                }
     623            }, {
     624                key: "render",
     625                value: function() {
     626                    var e = this,
     627                        t = this.props.attributes,
     628                        r = t.uid,
     629                        o = t.autoplay,
     630                        n = t.controls,
     631                        i = t.loop,
     632                        a = t.muted,
     633                        s = this.props.className,
     634                        l = this.state,
     635                        u = l.editing,
     636                        d = l.uploading,
     637                        y = l.encoding,
     638                        v = function() {
     639                            e.setState({
     640                                editing: !0
     641                            }), e.setState({
     642                                uploading: !1
     643                            }), e.setState({
     644                                encoding: !1
     645                            })
     646                        },
     647                        C = function() {
     648                            e.setState({
     649                                editing: !1
     650                            }), e.setState({
     651                                uploading: !1
     652                            }), e.setState({
     653                                encoding: !1
     654                            })
     655                        },
     656                        j = function() {
     657                            var t = e.props.setAttributes;
     658                            jQuery(".editor-media-placeholder .components-placeholder__instructions").html("Processing your video");
     659                            var r = jQuery(".components-form-file-upload :input[type='file']")[0].files[0];
     660                            t({
     661                                file: r
     662                            });
     663                            var o = e;
     664                            o.setState({
     665                                editing: !0,
     666                                uploading: !0,
     667                                encoding: !1
     668                            }, function() {
     669                                jQuery("#progressbar-" + e.instanceId).progressbar({
     670                                    value: !1
     671                                }), o.uploadFromFiles(r)
     672                            })
     673                        };
     674                    if (u) {
     675                        if (d) {
     676                            var P = {
     677                                width: "100%"
     678                            };
     679                            return wp.element.createElement(_, {
     680                                icon: cloudflareStream.icon,
     681                                label: "Cloudflare Stream",
     682                                instructions: "Uploading your video.",
     683                                className: "editor-media-placeholder"
     684                            }, wp.element.createElement("div", {
     685                                id: "progressbar-" + this.instanceId,
     686                                style: P
     687                            }, wp.element.createElement("div", {
     688                                className: "progress-label progress-label-" + this.instanceId
     689                            }, "Connecting...")), wp.element.createElement(p, {
     690                                isDefault: !0,
     691                                isLarge: !0,
     692                                icon: "update",
     693                                label: c("Retry"),
     694                                onClick: v,
     695                                style: {
     696                                    display: "none"
     697                                },
     698                                className: "editor-media-placeholder__retry-button"
     699                            }, c("Retry")))
     700                        }
     701                        if (y) {
     702                            var k = {
     703                                width: "100%"
     704                            };
     705                            return wp.element.createElement(_, {
     706                                icon: cloudflareStream.icon,
     707                                label: "Cloudflare Stream",
     708                                instructions: "Processing your video.",
     709                                className: "editor-media-placeholder"
     710                            }, wp.element.createElement("div", {
     711                                id: "progressbar-" + this.instanceId,
     712                                style: k
     713                            }, wp.element.createElement("div", {
     714                                className: "progress-label progress-label-" + this.instanceId
     715                            }, "Connecting...")), wp.element.createElement(p, {
     716                                isDefault: !0,
     717                                isLarge: !0,
     718                                icon: "update",
     719                                label: c("Retry"),
     720                                onClick: v,
     721                                style: {
     722                                    display: "none"
     723                                },
     724                                className: "editor-media-placeholder__retry-button"
     725                            }, c("Retry")))
     726                        }
     727                        return cloudflareStream.api.key && "" !== cloudflareStream.api.key ? wp.element.createElement(_, {
     728                            icon: cloudflareStream.icon,
     729                            label: "Cloudflare Stream",
     730                            instructions: "Select a file from your library."
     731                        }, wp.element.createElement(g, {
     732                            isLarge: !0,
     733                            multiple: !0,
     734                            className: "editor-media-placeholder__upload-button",
     735                            onChange: j,
     736                            accept: "video/*"
     737                        }, c("Upload")), wp.element.createElement(S, {
     738                            type: "video",
     739                            className: s,
     740                            value: this.props.attributes,
     741                            render: function() {
     742                                return wp.element.createElement(p, {
     743                                    isLarge: !0,
     744                                    label: c("Stream Library"),
     745                                    onClick: e.open,
     746                                    className: "editor-media-placeholder__browse-button"
     747                                }, c("Stream Library"))
     748                            }
     749                        }), wp.element.createElement(p, {
     750                            isDefault: !0,
     751                            isLarge: !0,
     752                            icon: "cancel",
     753                            label: c("Cancel"),
     754                            onClick: C,
     755                            style: {
     756                                display: "none"
     757                            },
     758                            className: "editor-media-placeholder__cancel-button"
     759                        }, c("Cancel"))) : wp.element.createElement(_, {
     760                            icon: cloudflareStream.icon,
     761                            label: "Cloudflare Stream",
     762                            instructions: "Select a file from your library."
     763                        }, wp.element.createElement(S, {
     764                            type: "video",
     765                            className: s,
     766                            value: this.props.attributes,
     767                            render: function() {
     768                                return wp.element.createElement(p, {
     769                                    isLarge: !0,
     770                                    label: c("Stream Library"),
     771                                    onClick: e.open,
     772                                    className: "editor-media-placeholder__browse-button"
     773                                }, c("Stream Library"))
     774                            }
     775                        }), wp.element.createElement(p, {
     776                            isDefault: !0,
     777                            isLarge: !0,
     778                            icon: "cancel",
     779                            label: c("Cancel"),
     780                            onClick: C,
     781                            style: {
     782                                display: "none"
     783                            },
     784                            className: "editor-media-placeholder__cancel-button"
     785                        }, c("Cancel")))
     786                    }
     787                    return wp.element.createElement(A, null, wp.element.createElement(w, null, wp.element.createElement(m, null, wp.element.createElement(p, {
     788                        className: "components-icon-button components-toolbar__control",
     789                        label: c("Edit video"),
     790                        onClick: v,
     791                        icon: "edit"
     792                    }))), wp.element.createElement(E, null, wp.element.createElement(h, {
     793                        title: c("Video Settings")
     794                    }, wp.element.createElement(b, {
     795                        label: c("Autoplay"),
     796                        onChange: this.toggleAttribute("autoplay"),
     797                        checked: o
     798                    }), wp.element.createElement(b, {
     799                        label: c("Loop"),
     800                        onChange: this.toggleAttribute("loop"),
     801                        checked: i
     802                    }), wp.element.createElement(b, {
     803                        label: c("Muted"),
     804                        onChange: this.toggleAttribute("muted"),
     805                        checked: a
     806                    }), wp.element.createElement(b, {
     807                        label: c("Playback Controls"),
     808                        onChange: this.toggleAttribute("controls"),
     809                        checked: n
     810                    }))), wp.element.createElement("figure", {
     811                        className: s
     812                    }, wp.element.createElement(f, null, wp.element.createElement("stream", {
     813                        src: r,
     814                        controls: n,
     815                        autoPlay: o,
     816                        loop: i,
     817                        muted: a,
     818                        ref: this.streamPlayer
     819                    }))))
     820                }
     821            }]), t
     822        }(j);
     823    t.a = y(k)
     824}, function(e, t, r) {
     825    "use strict";
     826    var o = r(11),
     827        n = function(e) {
     828            return e && e.__esModule ? e : {
     829                default: e
     830            }
     831        }(o),
     832        i = r(1),
     833        a = n.default.defaultOptions,
     834        s = void 0;
     835    if ("undefined" !== typeof window) {
     836        var l = window,
     837            u = l.XMLHttpRequest,
     838            c = l.Blob;
     839        s = u && c && "function" === typeof c.prototype.slice
     840    } else s = !0;
     841    e.exports = {
     842        Upload: n.default,
     843        isSupported: s,
     844        canStoreURLs: i.canStoreURLs,
     845        defaultOptions: a
     846    }
     847}, function(e, t, r) {
     848    "use strict";
     849
     850    function o(e) {
     851        return e && e.__esModule ? e : {
     852            default: e
     853        }
     854    }
     855
     856    function n(e, t) {
     857        if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
     858    }
     859
     860    function i(e) {
     861        var t = [];
     862        for (var r in e) t.push(r + " " + h.Base64.encode(e[r]));
     863        return t.join(",")
     864    }
     865
     866    function a(e, t) {
     867        return e >= t && e < t + 100
     868    }
     869    Object.defineProperty(t, "__esModule", {
     870        value: !0
     871    });
     872    var s = function() {
     873            function e(e, t) {
     874                for (var r = 0; r < t.length; r++) {
     875                    var o = t[r];
     876                    o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
     877                }
     878            }
     879            return function(t, r, o) {
     880                return r && e(t.prototype, r), o && e(t, o), t
     881            }
     882        }(),
     883        l = r(12),
     884        u = o(l),
     885        c = r(13),
     886        d = o(c),
     887        f = r(14),
     888        p = o(f),
     889        h = r(15),
     890        m = r(16),
     891        b = r(20),
     892        y = r(1),
     893        _ = function(e) {
     894            if (e && e.__esModule) return e;
     895            var t = {};
     896            if (null != e)
     897                for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
     898            return t.default = e, t
     899        }(y),
     900        g = {
     901            endpoint: null,
     902            fingerprint: u.default,
     903            resume: !0,
     904            onProgress: null,
     905            onChunkComplete: null,
     906            onSuccess: null,
     907            onError: null,
     908            headers: {},
     909            chunkSize: 1 / 0,
     910            withCredentials: !1,
     911            uploadUrl: null,
     912            uploadSize: null,
     913            overridePatchMethod: !1,
     914            retryDelays: null,
     915            removeFingerprintOnSuccess: !1,
     916            uploadLengthDeferred: !1
     917        },
     918        v = function() {
     919            function e(t, r) {
     920                n(this, e), this.options = (0, p.default)(!0, {}, g, r), this.file = t, this.url = null, this._xhr = null, this._fingerprint = null, this._offset = null, this._aborted = !1, this._size = null, this._source = null, this._retryAttempt = 0, this._retryTimeout = null, this._offsetBeforeRetry = 0
     921            }
     922            return s(e, [{
     923                key: "start",
     924                value: function() {
     925                    var e = this,
     926                        t = this.file;
     927                    return t ? this.options.endpoint || this.options.uploadUrl ? void(this._source ? this._start(this._source) : (0, b.getSource)(t, this.options.chunkSize, function(t, r) {
     928                        if (t) return void e._emitError(t);
     929                        e._source = r, e._start(r)
     930                    })) : void this._emitError(new Error("tus: neither an endpoint or an upload URL is provided")) : void this._emitError(new Error("tus: no file or stream to upload provided"))
     931                }
     932            }, {
     933                key: "_start",
     934                value: function(e) {
     935                    var t = this,
     936                        r = this.file;
     937                    if (this.options.uploadLengthDeferred) this._size = null;
     938                    else if (null != this.options.uploadSize) {
     939                        if (this._size = +this.options.uploadSize, isNaN(this._size)) return void this._emitError(new Error("tus: cannot convert `uploadSize` option into a number"))
     940                    } else if (this._size = e.size, null == this._size) return void this._emitError(new Error("tus: cannot automatically derive upload's size from input and must be specified manually using the `uploadSize` option"));
     941                    var o = this.options.retryDelays;
     942                    if (null != o) {
     943                        if ("[object Array]" !== Object.prototype.toString.call(o)) return void this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));
     944                        var n = this.options.onError;
     945                        this.options.onError = function(e) {
     946                            t.options.onError = n, null != t._offset && t._offset > t._offsetBeforeRetry && (t._retryAttempt = 0);
     947                            var r = !0;
     948                            "undefined" !== typeof window && "navigator" in window && !1 === window.navigator.onLine && (r = !1);
     949                            var i = e.originalRequest ? e.originalRequest.status : 0,
     950                                s = !a(i, 400) || 409 === i || 423 === i;
     951                            if (!(t._retryAttempt < o.length && null != e.originalRequest && s && r)) return void t._emitError(e);
     952                            var l = o[t._retryAttempt++];
     953                            t._offsetBeforeRetry = t._offset, t.options.uploadUrl = t.url, t._retryTimeout = setTimeout(function() {
     954                                t.start()
     955                            }, l)
     956                        }
     957                    }
     958                    if (this._aborted = !1, null != this.url) return void this._resumeUpload();
     959                    if (null != this.options.uploadUrl) return this.url = this.options.uploadUrl, void this._resumeUpload();
     960                    if (this.options.resume) {
     961                        this._fingerprint = this.options.fingerprint(r, this.options);
     962                        var i = _.getItem(this._fingerprint);
     963                        if (null != i) return this.url = i, void this._resumeUpload()
     964                    }
     965                    this._createUpload()
     966                }
     967            }, {
     968                key: "abort",
     969                value: function() {
     970                    null !== this._xhr && (this._xhr.abort(), this._source.close(), this._aborted = !0), null != this._retryTimeout && (clearTimeout(this._retryTimeout), this._retryTimeout = null)
     971                }
     972            }, {
     973                key: "_emitXhrError",
     974                value: function(e, t, r) {
     975                    this._emitError(new d.default(t, r, e))
     976                }
     977            }, {
     978                key: "_emitError",
     979                value: function(e) {
     980                    if ("function" !== typeof this.options.onError) throw e;
     981                    this.options.onError(e)
     982                }
     983            }, {
     984                key: "_emitSuccess",
     985                value: function() {
     986                    "function" === typeof this.options.onSuccess && this.options.onSuccess()
     987                }
     988            }, {
     989                key: "_emitProgress",
     990                value: function(e, t) {
     991                    "function" === typeof this.options.onProgress && this.options.onProgress(e, t)
     992                }
     993            }, {
     994                key: "_emitChunkComplete",
     995                value: function(e, t, r) {
     996                    "function" === typeof this.options.onChunkComplete && this.options.onChunkComplete(e, t, r)
     997                }
     998            }, {
     999                key: "_setupXHR",
     1000                value: function(e) {
     1001                    this._xhr = e, e.setRequestHeader("Tus-Resumable", "1.0.0");
     1002                    var t = this.options.headers;
     1003                    for (var r in t) e.setRequestHeader(r, t[r]);
     1004                    e.withCredentials = this.options.withCredentials
     1005                }
     1006            }, {
     1007                key: "_createUpload",
     1008                value: function() {
     1009                    var e = this;
     1010                    if (!this.options.endpoint) return void this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));
     1011                    var t = (0, m.newRequest)();
     1012                    t.open("POST", this.options.endpoint, !0), t.onload = function() {
     1013                        if (!a(t.status, 200)) return void e._emitXhrError(t, new Error("tus: unexpected response while creating upload"));
     1014                        var r = t.getResponseHeader("Location");
     1015                        return null == r ? void e._emitXhrError(t, new Error("tus: invalid or missing Location header")) : (e.url = (0, m.resolveUrl)(e.options.endpoint, r), 0 === e._size ? (e._emitSuccess(), void e._source.close()) : (e.options.resume && _.setItem(e._fingerprint, e.url), e._offset = 0, void e._startUpload()))
     1016                    }, t.onerror = function(r) {
     1017                        e._emitXhrError(t, new Error("tus: failed to create upload"), r)
     1018                    }, this._setupXHR(t), this.options.uploadLengthDeferred ? t.setRequestHeader("Upload-Defer-Length", 1) : t.setRequestHeader("Upload-Length", this._size);
     1019                    var r = i(this.options.metadata);
     1020                    "" !== r && t.setRequestHeader("Upload-Metadata", r), t.send(null)
     1021                }
     1022            }, {
     1023                key: "_resumeUpload",
     1024                value: function() {
     1025                    var e = this,
     1026                        t = (0, m.newRequest)();
     1027                    t.open("HEAD", this.url, !0), t.onload = function() {
     1028                        if (!a(t.status, 200)) return e.options.resume && a(t.status, 400) && _.removeItem(e._fingerprint), 423 === t.status ? void e._emitXhrError(t, new Error("tus: upload is currently locked; retry later")) : e.options.endpoint ? (e.url = null, void e._createUpload()) : void e._emitXhrError(t, new Error("tus: unable to resume upload (new upload cannot be created without an endpoint)"));
     1029                        var r = parseInt(t.getResponseHeader("Upload-Offset"), 10);
     1030                        if (isNaN(r)) return void e._emitXhrError(t, new Error("tus: invalid or missing offset value"));
     1031                        var o = parseInt(t.getResponseHeader("Upload-Length"), 10);
     1032                        return isNaN(o) && !e.options.uploadLengthDeferred ? void e._emitXhrError(t, new Error("tus: invalid or missing length value")) : r === o ? (e._emitProgress(o, o), void e._emitSuccess()) : (e._offset = r, void e._startUpload())
     1033                    }, t.onerror = function(r) {
     1034                        e._emitXhrError(t, new Error("tus: failed to resume upload"), r)
     1035                    }, this._setupXHR(t), t.send(null)
     1036                }
     1037            }, {
     1038                key: "_startUpload",
     1039                value: function() {
     1040                    var e = this;
     1041                    if (!this._aborted) {
     1042                        var t = (0, m.newRequest)();
     1043                        this.options.overridePatchMethod ? (t.open("POST", this.url, !0), t.setRequestHeader("X-HTTP-Method-Override", "PATCH")) : t.open("PATCH", this.url, !0), t.onload = function() {
     1044                            if (!a(t.status, 200)) return void e._emitXhrError(t, new Error("tus: unexpected response while uploading chunk"));
     1045                            var r = parseInt(t.getResponseHeader("Upload-Offset"), 10);
     1046                            return isNaN(r) ? void e._emitXhrError(t, new Error("tus: invalid or missing offset value")) : (e._emitProgress(r, e._size), e._emitChunkComplete(r - e._offset, r, e._size), e._offset = r, r == e._size ? (e.options.removeFingerprintOnSuccess && e.options.resume && _.removeItem(e._fingerprint), e._emitSuccess(), void e._source.close()) : void e._startUpload())
     1047                        }, t.onerror = function(r) {
     1048                            e._aborted || e._emitXhrError(t, new Error("tus: failed to upload chunk at offset " + e._offset), r)
     1049                        }, "upload" in t && (t.upload.onprogress = function(t) {
     1050                            t.lengthComputable && e._emitProgress(r + t.loaded, e._size)
     1051                        }), this._setupXHR(t), t.setRequestHeader("Upload-Offset", this._offset), t.setRequestHeader("Content-Type", "application/offset+octet-stream");
     1052                        var r = this._offset,
     1053                            o = this._offset + this.options.chunkSize;
     1054                        (o === 1 / 0 || o > this._size) && !this.options.uploadLengthDeferred && (o = this._size), this._source.slice(r, o, function(r, o, n) {
     1055                            if (r) return void e._emitError(r);
     1056                            e.options.uploadLengthDeferred && n && (e._size = e._offset + (o && o.size ? o.size : 0), t.setRequestHeader("Upload-Length", e._size)), null === o ? t.send() : (t.send(o), e._emitProgress(e._offset, e._size))
     1057                        })
     1058                    }
     1059                }
     1060            }]), e
     1061        }();
     1062    v.defaultOptions = g, t.default = v
     1063}, function(e, t, r) {
     1064    "use strict";
     1065
     1066    function o(e, t) {
     1067        return ["tus", e.name, e.type, e.size, e.lastModified, t.endpoint].join("-")
     1068    }
     1069    Object.defineProperty(t, "__esModule", {
     1070        value: !0
     1071    }), t.default = o
     1072}, function(e, t, r) {
     1073    "use strict";
     1074
     1075    function o(e, t) {
     1076        if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
     1077    }
     1078
     1079    function n(e, t) {
     1080        if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
     1081        return !t || "object" !== typeof t && "function" !== typeof t ? e : t
     1082    }
     1083
     1084    function i(e, t) {
     1085        if ("function" !== typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t);
     1086        e.prototype = Object.create(t && t.prototype, {
     1087            constructor: {
     1088                value: e,
     1089                enumerable: !1,
     1090                writable: !0,
     1091                configurable: !0
     1092            }
     1093        }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
     1094    }
     1095    Object.defineProperty(t, "__esModule", {
     1096        value: !0
     1097    });
     1098    var a = function(e) {
     1099        function t(e) {
     1100            var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null,
     1101                i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
     1102            o(this, t);
     1103            var a = n(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e.message));
     1104            a.originalRequest = i, a.causingError = r;
     1105            var s = e.message;
     1106            return null != r && (s += ", caused by " + r.toString()), null != i && (s += ", originated from request (response code: " + i.status + ", response text: " + i.responseText + ")"), a.message = s, a
     1107        }
     1108        return i(t, e), t
     1109    }(Error);
     1110    t.default = a
     1111}, function(e, t, r) {
     1112    "use strict";
     1113    var o = Object.prototype.hasOwnProperty,
     1114        n = Object.prototype.toString,
     1115        i = Object.defineProperty,
     1116        a = Object.getOwnPropertyDescriptor,
     1117        s = function(e) {
     1118            return "function" === typeof Array.isArray ? Array.isArray(e) : "[object Array]" === n.call(e)
     1119        },
     1120        l = function(e) {
     1121            if (!e || "[object Object]" !== n.call(e)) return !1;
     1122            var t = o.call(e, "constructor"),
     1123                r = e.constructor && e.constructor.prototype && o.call(e.constructor.prototype, "isPrototypeOf");
     1124            if (e.constructor && !t && !r) return !1;
     1125            var i;
     1126            for (i in e);
     1127            return "undefined" === typeof i || o.call(e, i)
     1128        },
     1129        u = function(e, t) {
     1130            i && "__proto__" === t.name ? i(e, t.name, {
     1131                enumerable: !0,
     1132                configurable: !0,
     1133                value: t.newValue,
     1134                writable: !0
     1135            }) : e[t.name] = t.newValue
     1136        },
     1137        c = function(e, t) {
     1138            if ("__proto__" === t) {
     1139                if (!o.call(e, t)) return;
     1140                if (a) return a(e, t).value
     1141            }
     1142            return e[t]
     1143        };
     1144    e.exports = function e() {
     1145        var t, r, o, n, i, a, d = arguments[0],
     1146            f = 1,
     1147            p = arguments.length,
     1148            h = !1;
     1149        for ("boolean" === typeof d && (h = d, d = arguments[1] || {}, f = 2), (null == d || "object" !== typeof d && "function" !== typeof d) && (d = {}); f < p; ++f)
     1150            if (null != (t = arguments[f]))
     1151                for (r in t) o = c(d, r), n = c(t, r), d !== n && (h && n && (l(n) || (i = s(n))) ? (i ? (i = !1, a = o && s(o) ? o : []) : a = o && l(o) ? o : {}, u(d, {
     1152                    name: r,
     1153                    newValue: e(h, a, n)
     1154                })) : "undefined" !== typeof n && u(d, {
     1155                    name: r,
     1156                    newValue: n
     1157                }));
     1158        return d
     1159    }
     1160}, function(module, exports, __webpack_require__) {
     1161    (function(global) {
     1162        var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
     1163        ! function(e, t) {
     1164            module.exports = t(e)
     1165        }("undefined" !== typeof self ? self : "undefined" !== typeof window ? window : "undefined" !== typeof global ? global : this, function(global) {
     1166            "use strict";
     1167            global = global || {};
     1168            var _Base64 = global.Base64,
     1169                version = "2.5.1",
     1170                buffer;
     1171            if ("undefined" !== typeof module && module.exports) try {
     1172                buffer = eval("require('buffer').Buffer")
     1173            } catch (e) {
     1174                buffer = void 0
     1175            }
     1176            var b64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
     1177                b64tab = function(e) {
     1178                    for (var t = {}, r = 0, o = e.length; r < o; r++) t[e.charAt(r)] = r;
     1179                    return t
     1180                }(b64chars),
     1181                fromCharCode = String.fromCharCode,
     1182                cb_utob = function(e) {
     1183                    if (e.length < 2) {
     1184                        var t = e.charCodeAt(0);
     1185                        return t < 128 ? e : t < 2048 ? fromCharCode(192 | t >>> 6) + fromCharCode(128 | 63 & t) : fromCharCode(224 | t >>> 12 & 15) + fromCharCode(128 | t >>> 6 & 63) + fromCharCode(128 | 63 & t)
     1186                    }
     1187                    var t = 65536 + 1024 * (e.charCodeAt(0) - 55296) + (e.charCodeAt(1) - 56320);
     1188                    return fromCharCode(240 | t >>> 18 & 7) + fromCharCode(128 | t >>> 12 & 63) + fromCharCode(128 | t >>> 6 & 63) + fromCharCode(128 | 63 & t)
     1189                },
     1190                re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,
     1191                utob = function(e) {
     1192                    return e.replace(re_utob, cb_utob)
     1193                },
     1194                cb_encode = function(e) {
     1195                    var t = [0, 2, 1][e.length % 3],
     1196                        r = e.charCodeAt(0) << 16 | (e.length > 1 ? e.charCodeAt(1) : 0) << 8 | (e.length > 2 ? e.charCodeAt(2) : 0);
     1197                    return [b64chars.charAt(r >>> 18), b64chars.charAt(r >>> 12 & 63), t >= 2 ? "=" : b64chars.charAt(r >>> 6 & 63), t >= 1 ? "=" : b64chars.charAt(63 & r)].join("")
     1198                },
     1199                btoa = global.btoa ? function(e) {
     1200                    return global.btoa(e)
     1201                } : function(e) {
     1202                    return e.replace(/[\s\S]{1,3}/g, cb_encode)
     1203                },
     1204                _encode = buffer ? buffer.from && Uint8Array && buffer.from !== Uint8Array.from ? function(e) {
     1205                    return (e.constructor === buffer.constructor ? e : buffer.from(e)).toString("base64")
     1206                } : function(e) {
     1207                    return (e.constructor === buffer.constructor ? e : new buffer(e)).toString("base64")
     1208                } : function(e) {
     1209                    return btoa(utob(e))
     1210                },
     1211                encode = function(e, t) {
     1212                    return t ? _encode(String(e)).replace(/[+\/]/g, function(e) {
     1213                        return "+" == e ? "-" : "_"
     1214                    }).replace(/=/g, "") : _encode(String(e))
     1215                },
     1216                encodeURI = function(e) {
     1217                    return encode(e, !0)
     1218                },
     1219                re_btou = new RegExp(["[\xc0-\xdf][\x80-\xbf]", "[\xe0-\xef][\x80-\xbf]{2}", "[\xf0-\xf7][\x80-\xbf]{3}"].join("|"), "g"),
     1220                cb_btou = function(e) {
     1221                    switch (e.length) {
     1222                        case 4:
     1223                            var t = (7 & e.charCodeAt(0)) << 18 | (63 & e.charCodeAt(1)) << 12 | (63 & e.charCodeAt(2)) << 6 | 63 & e.charCodeAt(3),
     1224                                r = t - 65536;
     1225                            return fromCharCode(55296 + (r >>> 10)) + fromCharCode(56320 + (1023 & r));
     1226                        case 3:
     1227                            return fromCharCode((15 & e.charCodeAt(0)) << 12 | (63 & e.charCodeAt(1)) << 6 | 63 & e.charCodeAt(2));
     1228                        default:
     1229                            return fromCharCode((31 & e.charCodeAt(0)) << 6 | 63 & e.charCodeAt(1))
     1230                    }
     1231                },
     1232                btou = function(e) {
     1233                    return e.replace(re_btou, cb_btou)
     1234                },
     1235                cb_decode = function(e) {
     1236                    var t = e.length,
     1237                        r = t % 4,
     1238                        o = (t > 0 ? b64tab[e.charAt(0)] << 18 : 0) | (t > 1 ? b64tab[e.charAt(1)] << 12 : 0) | (t > 2 ? b64tab[e.charAt(2)] << 6 : 0) | (t > 3 ? b64tab[e.charAt(3)] : 0),
     1239                        n = [fromCharCode(o >>> 16), fromCharCode(o >>> 8 & 255), fromCharCode(255 & o)];
     1240                    return n.length -= [0, 0, 2, 1][r], n.join("")
     1241                },
     1242                _atob = global.atob ? function(e) {
     1243                    return global.atob(e)
     1244                } : function(e) {
     1245                    return e.replace(/\S{1,4}/g, cb_decode)
     1246                },
     1247                atob = function(e) {
     1248                    return _atob(String(e).replace(/[^A-Za-z0-9\+\/]/g, ""))
     1249                },
     1250                _decode = buffer ? buffer.from && Uint8Array && buffer.from !== Uint8Array.from ? function(e) {
     1251                    return (e.constructor === buffer.constructor ? e : buffer.from(e, "base64")).toString()
     1252                } : function(e) {
     1253                    return (e.constructor === buffer.constructor ? e : new buffer(e, "base64")).toString()
     1254                } : function(e) {
     1255                    return btou(_atob(e))
     1256                },
     1257                decode = function(e) {
     1258                    return _decode(String(e).replace(/[-_]/g, function(e) {
     1259                        return "-" == e ? "+" : "/"
     1260                    }).replace(/[^A-Za-z0-9\+\/]/g, ""))
     1261                },
     1262                noConflict = function() {
     1263                    var e = global.Base64;
     1264                    return global.Base64 = _Base64, e
     1265                };
     1266            if (global.Base64 = {
     1267                    VERSION: version,
     1268                    atob: atob,
     1269                    btoa: btoa,
     1270                    fromBase64: decode,
     1271                    toBase64: encode,
     1272                    utob: utob,
     1273                    encode: encode,
     1274                    encodeURI: encodeURI,
     1275                    btou: btou,
     1276                    decode: decode,
     1277                    noConflict: noConflict,
     1278                    __buffer__: buffer
     1279                }, "function" === typeof Object.defineProperty) {
     1280                var noEnum = function(e) {
     1281                    return {
     1282                        value: e,
     1283                        enumerable: !1,
     1284                        writable: !0,
     1285                        configurable: !0
     1286                    }
     1287                };
     1288                global.Base64.extendString = function() {
     1289                    Object.defineProperty(String.prototype, "fromBase64", noEnum(function() {
     1290                        return decode(this)
     1291                    })), Object.defineProperty(String.prototype, "toBase64", noEnum(function(e) {
     1292                        return encode(this, e)
     1293                    })), Object.defineProperty(String.prototype, "toBase64URI", noEnum(function() {
     1294                        return encode(this, !0)
     1295                    }))
     1296                }
     1297            }
     1298            return global.Meteor && (Base64 = global.Base64), "undefined" !== typeof module && module.exports ? module.exports.Base64 = global.Base64 : (__WEBPACK_AMD_DEFINE_ARRAY__ = [], void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = function() {
     1299                return global.Base64
     1300            }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)), {
     1301                Base64: global.Base64
     1302            }
     1303        })
     1304    }).call(exports, __webpack_require__(0))
     1305}, function(e, t, r) {
     1306    "use strict";
     1307
     1308    function o() {
     1309        return new window.XMLHttpRequest
     1310    }
     1311
     1312    function n(e, t) {
     1313        return new a.default(t, e).toString()
     1314    }
     1315    Object.defineProperty(t, "__esModule", {
     1316        value: !0
     1317    }), t.newRequest = o, t.resolveUrl = n;
     1318    var i = r(17),
     1319        a = function(e) {
     1320            return e && e.__esModule ? e : {
     1321                default: e
     1322            }
     1323        }(i)
     1324}, function(e, t, r) {
     1325    "use strict";
     1326    (function(t) {
     1327        function o(e) {
     1328            return (e || "").toString().replace(h, "")
     1329        }
     1330
     1331        function n(e) {
     1332            var r;
     1333            r = "undefined" !== typeof window ? window : "undefined" !== typeof t ? t : "undefined" !== typeof self ? self : {};
     1334            var o = r.location || {};
     1335            e = e || o;
     1336            var n, i = {},
     1337                a = typeof e;
     1338            if ("blob:" === e.protocol) i = new s(unescape(e.pathname), {});
     1339            else if ("string" === a) {
     1340                i = new s(e, {});
     1341                for (n in b) delete i[n]
     1342            } else if ("object" === a) {
     1343                for (n in e) n in b || (i[n] = e[n]);
     1344                void 0 === i.slashes && (i.slashes = f.test(e.href))
     1345            }
     1346            return i
     1347        }
     1348
     1349        function i(e) {
     1350            e = o(e);
     1351            var t = p.exec(e);
     1352            return {
     1353                protocol: t[1] ? t[1].toLowerCase() : "",
     1354                slashes: !!t[2],
     1355                rest: t[3]
     1356            }
     1357        }
     1358
     1359        function a(e, t) {
     1360            if ("" === e) return t;
     1361            for (var r = (t || "/").split("/").slice(0, -1).concat(e.split("/")), o = r.length, n = r[o - 1], i = !1, a = 0; o--;) "." === r[o] ? r.splice(o, 1) : ".." === r[o] ? (r.splice(o, 1), a++) : a && (0 === o && (i = !0), r.splice(o, 1), a--);
     1362            return i && r.unshift(""), "." !== n && ".." !== n || r.push(""), r.join("/")
     1363        }
     1364
     1365        function s(e, t, r) {
     1366            if (e = o(e), !(this instanceof s)) return new s(e, t, r);
     1367            var l, u, f, p, h, b, y = m.slice(),
     1368                _ = typeof t,
     1369                g = this,
     1370                v = 0;
     1371            for ("object" !== _ && "string" !== _ && (r = t, t = null), r && "function" !== typeof r && (r = d.parse), t = n(t), u = i(e || ""), l = !u.protocol && !u.slashes, g.slashes = u.slashes || l && t.slashes, g.protocol = u.protocol || t.protocol || "", e = u.rest, u.slashes || (y[3] = [/(.*)/, "pathname"]); v < y.length; v++) p = y[v], "function" !== typeof p ? (f = p[0], b = p[1], f !== f ? g[b] = e : "string" === typeof f ? ~(h = e.indexOf(f)) && ("number" === typeof p[2] ? (g[b] = e.slice(0, h), e = e.slice(h + p[2])) : (g[b] = e.slice(h), e = e.slice(0, h))) : (h = f.exec(e)) && (g[b] = h[1], e = e.slice(0, h.index)), g[b] = g[b] || (l && p[3] ? t[b] || "" : ""), p[4] && (g[b] = g[b].toLowerCase())) : e = p(e);
     1372            r && (g.query = r(g.query)), l && t.slashes && "/" !== g.pathname.charAt(0) && ("" !== g.pathname || "" !== t.pathname) && (g.pathname = a(g.pathname, t.pathname)), c(g.port, g.protocol) || (g.host = g.hostname, g.port = ""), g.username = g.password = "", g.auth && (p = g.auth.split(":"), g.username = p[0] || "", g.password = p[1] || ""), g.origin = g.protocol && g.host && "file:" !== g.protocol ? g.protocol + "//" + g.host : "null", g.href = g.toString()
     1373        }
     1374
     1375        function l(e, t, r) {
     1376            var o = this;
     1377            switch (e) {
     1378                case "query":
     1379                    "string" === typeof t && t.length && (t = (r || d.parse)(t)), o[e] = t;
     1380                    break;
     1381                case "port":
     1382                    o[e] = t, c(t, o.protocol) ? t && (o.host = o.hostname + ":" + t) : (o.host = o.hostname, o[e] = "");
     1383                    break;
     1384                case "hostname":
     1385                    o[e] = t, o.port && (t += ":" + o.port), o.host = t;
     1386                    break;
     1387                case "host":
     1388                    o[e] = t, /:\d+$/.test(t) ? (t = t.split(":"), o.port = t.pop(), o.hostname = t.join(":")) : (o.hostname = t, o.port = "");
     1389                    break;
     1390                case "protocol":
     1391                    o.protocol = t.toLowerCase(), o.slashes = !r;
     1392                    break;
     1393                case "pathname":
     1394                case "hash":
     1395                    if (t) {
     1396                        var n = "pathname" === e ? "/" : "#";
     1397                        o[e] = t.charAt(0) !== n ? n + t : t
     1398                    } else o[e] = t;
     1399                    break;
     1400                default:
     1401                    o[e] = t
     1402            }
     1403            for (var i = 0; i < m.length; i++) {
     1404                var a = m[i];
     1405                a[4] && (o[a[1]] = o[a[1]].toLowerCase())
     1406            }
     1407            return o.origin = o.protocol && o.host && "file:" !== o.protocol ? o.protocol + "//" + o.host : "null", o.href = o.toString(), o
     1408        }
     1409
     1410        function u(e) {
     1411            e && "function" === typeof e || (e = d.stringify);
     1412            var t, r = this,
     1413                o = r.protocol;
     1414            o && ":" !== o.charAt(o.length - 1) && (o += ":");
     1415            var n = o + (r.slashes ? "//" : "");
     1416            return r.username && (n += r.username, r.password && (n += ":" + r.password), n += "@"), n += r.host + r.pathname, t = "object" === typeof r.query ? e(r.query) : r.query, t && (n += "?" !== t.charAt(0) ? "?" + t : t), r.hash && (n += r.hash), n
     1417        }
     1418        var c = r(18),
     1419            d = r(19),
     1420            f = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//,
     1421            p = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,
     1422            h = new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+"),
     1423            m = [
     1424                ["#", "hash"],
     1425                ["?", "query"],
     1426                function(e) {
     1427                    return e.replace("\\", "/")
     1428                },
     1429                ["/", "pathname"],
     1430                ["@", "auth", 1],
     1431                [NaN, "host", void 0, 1, 1],
     1432                [/:(\d+)$/, "port", void 0, 1],
     1433                [NaN, "hostname", void 0, 1, 1]
     1434            ],
     1435            b = {
     1436                hash: 1,
     1437                query: 1
     1438            };
     1439        s.prototype = {
     1440            set: l,
     1441            toString: u
     1442        }, s.extractProtocol = i, s.location = n, s.trimLeft = o, s.qs = d, e.exports = s
     1443    }).call(t, r(0))
     1444}, function(e, t, r) {
     1445    "use strict";
     1446    e.exports = function(e, t) {
     1447        if (t = t.split(":")[0], !(e = +e)) return !1;
     1448        switch (t) {
     1449            case "http":
     1450            case "ws":
     1451                return 80 !== e;
     1452            case "https":
     1453            case "wss":
     1454                return 443 !== e;
     1455            case "ftp":
     1456                return 21 !== e;
     1457            case "gopher":
     1458                return 70 !== e;
     1459            case "file":
     1460                return !1
     1461        }
     1462        return 0 !== e
     1463    }
     1464}, function(e, t, r) {
     1465    "use strict";
     1466
     1467    function o(e) {
     1468        try {
     1469            return decodeURIComponent(e.replace(/\+/g, " "))
     1470        } catch (e) {
     1471            return null
     1472        }
     1473    }
     1474
     1475    function n(e) {
     1476        for (var t, r = /([^=?&]+)=?([^&]*)/g, n = {}; t = r.exec(e);) {
     1477            var i = o(t[1]),
     1478                a = o(t[2]);
     1479            null === i || null === a || i in n || (n[i] = a)
     1480        }
     1481        return n
     1482    }
     1483
     1484    function i(e, t) {
     1485        t = t || "";
     1486        var r, o, n = [];
     1487        "string" !== typeof t && (t = "?");
     1488        for (o in e)
     1489            if (s.call(e, o)) {
     1490                if (r = e[o], r || null !== r && r !== a && !isNaN(r) || (r = ""), o = encodeURIComponent(o), r = encodeURIComponent(r), null === o || null === r) continue;
     1491                n.push(o + "=" + r)
     1492            }
     1493        return n.length ? t + n.join("&") : ""
     1494    }
     1495    var a, s = Object.prototype.hasOwnProperty;
     1496    t.stringify = i, t.parse = n
     1497}, function(e, t, r) {
     1498    "use strict";
     1499
     1500    function o(e) {
     1501        return e && e.__esModule ? e : {
     1502            default: e
     1503        }
     1504    }
     1505
     1506    function n(e, t) {
     1507        if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
     1508    }
     1509
     1510    function i(e) {
     1511        return void 0 === e ? 0 : void 0 !== e.size ? e.size : e.length
     1512    }
     1513
     1514    function a(e, t) {
     1515        if (e.concat) return e.concat(t);
     1516        if (e instanceof Blob) return new Blob([e, t], {
     1517            type: e.type
     1518        });
     1519        if (e.set) {
     1520            var r = new e.constructor(e.length + t.length);
     1521            return r.set(e), r.set(t, e.length), r
     1522        }
     1523        throw new Error("Unknown data type")
     1524    }
     1525
     1526    function s(e, t, r) {
     1527        return (c.default || window.__tus__forceReactNative) && e && "undefined" !== typeof e.uri ? void(0, f.default)(e.uri, function(e, t) {
     1528            if (e) return r(new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. " + e));
     1529            r(null, new y(t))
     1530        }) : "function" === typeof e.slice && "undefined" !== typeof e.size ? void r(null, new y(e)) : "function" === typeof e.read ? (t = +t, isFinite(t) ? void r(null, new _(e, t)) : void r(new Error("cannot create source for stream without a finite value for the `chunkSize` option"))) : void r(new Error("source object may only be an instance of File, Blob, or Reader in this environment"))
     1531    }
     1532    Object.defineProperty(t, "__esModule", {
     1533        value: !0
     1534    });
     1535    var l = function() {
     1536        function e(e, t) {
     1537            for (var r = 0; r < t.length; r++) {
     1538                var o = t[r];
     1539                o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
     1540            }
     1541        }
     1542        return function(t, r, o) {
     1543            return r && e(t.prototype, r), o && e(t, o), t
     1544        }
     1545    }();
     1546    t.getSource = s;
     1547    var u = r(21),
     1548        c = o(u),
     1549        d = r(22),
     1550        f = o(d),
     1551        p = r(23),
     1552        h = o(p),
     1553        m = r(24),
     1554        b = o(m),
     1555        y = function() {
     1556            function e(t) {
     1557                n(this, e), this._file = t, this.size = t.size
     1558            }
     1559            return l(e, [{
     1560                key: "slice",
     1561                value: function(e, t, r) {
     1562                    if ((0, h.default)()) return void(0, b.default)(this._file.slice(e, t), function(e, t) {
     1563                        if (e) return r(e);
     1564                        r(null, t)
     1565                    });
     1566                    r(null, this._file.slice(e, t))
     1567                }
     1568            }, {
     1569                key: "close",
     1570                value: function() {}
     1571            }]), e
     1572        }(),
     1573        _ = function() {
     1574            function e(t, r) {
     1575                n(this, e), this._chunkSize = r, this._buffer = void 0, this._bufferOffset = 0, this._reader = t, this._done = !1
     1576            }
     1577            return l(e, [{
     1578                key: "slice",
     1579                value: function(e, t, r) {
     1580                    return e < this._bufferOffset ? void r(new Error("Requested data is before the reader's current offset")) : this._readUntilEnoughDataOrDone(e, t, r)
     1581                }
     1582            }, {
     1583                key: "_readUntilEnoughDataOrDone",
     1584                value: function(e, t, r) {
     1585                    var o = this,
     1586                        n = t <= this._bufferOffset + i(this._buffer);
     1587                    if (this._done || n) {
     1588                        var s = this._getDataFromBuffer(e, t);
     1589                        return void r(null, s, null == s && this._done)
     1590                    }
     1591                    this._reader.read().then(function(n) {
     1592                        var i = n.value;
     1593                        n.done ? o._done = !0 : void 0 === o._buffer ? o._buffer = i : o._buffer = a(o._buffer, i), o._readUntilEnoughDataOrDone(e, t, r)
     1594                    }).catch(function(e) {
     1595                        r(new Error("Error during read: " + e))
     1596                    })
     1597                }
     1598            }, {
     1599                key: "_getDataFromBuffer",
     1600                value: function(e, t) {
     1601                    e > this._bufferOffset && (this._buffer = this._buffer.slice(e - this._bufferOffset), this._bufferOffset = e);
     1602                    var r = 0 === i(this._buffer);
     1603                    return this._done && r ? null : this._buffer.slice(0, t - e)
     1604                }
     1605            }, {
     1606                key: "close",
     1607                value: function() {
     1608                    this._reader.cancel && this._reader.cancel()
     1609                }
     1610            }]), e
     1611        }()
     1612}, function(e, t, r) {
     1613    "use strict";
     1614    Object.defineProperty(t, "__esModule", {
     1615        value: !0
     1616    });
     1617    var o = "undefined" !== typeof navigator && "string" === typeof navigator.product && "reactnative" === navigator.product.toLowerCase();
     1618    t.default = o
     1619}, function(e, t, r) {
     1620    "use strict";
     1621
     1622    function o(e, t) {
     1623        var r = new XMLHttpRequest;
     1624        r.responseType = "blob", r.onload = function() {
     1625            var e = r.response;
     1626            t(null, e)
     1627        }, r.onerror = function(e) {
     1628            t(e)
     1629        }, r.open("GET", e), r.send()
     1630    }
     1631    Object.defineProperty(t, "__esModule", {
     1632        value: !0
     1633    }), t.default = o
     1634}, function(e, t, r) {
     1635    "use strict";
     1636    Object.defineProperty(t, "__esModule", {
     1637        value: !0
     1638    });
     1639    var o = function() {
     1640        return "undefined" != typeof window && ("undefined" != typeof window.PhoneGap || "undefined" != typeof window.Cordova || "undefined" != typeof window.cordova)
     1641    };
     1642    t.default = o
     1643}, function(e, t, r) {
     1644    "use strict";
     1645
     1646    function o(e, t) {
     1647        var r = new FileReader;
     1648        r.onload = function() {
     1649            t(null, new Uint8Array(r.result))
     1650        }, r.onerror = function(e) {
     1651            t(e)
     1652        }, r.readAsArrayBuffer(e)
     1653    }
     1654    Object.defineProperty(t, "__esModule", {
     1655        value: !0
     1656    }), t.default = o
     1657}, function(e, t) {
     1658    function r(e, t) {
     1659        if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
     1660    }
     1661    var o = function() {
     1662            function e(e, t) {
     1663                for (var r = 0; r < t.length; r++) {
     1664                    var o = t[r];
     1665                    o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
     1666                }
     1667            }
     1668            return function(t, r, o) {
     1669                return r && e(t.prototype, r), o && e(t, o), t
     1670            }
     1671        }(),
     1672        n = function() {
     1673            function e() {
     1674                r(this, e), jQuery("#submit").on("click", function() {
     1675                    cloudflareStream.analytics.logEvent("Stream WP Plugin - Settings Saved")
     1676                })
     1677            }
     1678            return o(e, [{
     1679                key: "logEvent",
     1680                value: function(e) {
     1681                    cloudflareStream.options.heap || (console.error("Event: " + e), jQuery.ajax({
     1682                        url: ajaxurl + "?action=cloudflare-stream-analytics",
     1683                        method: "POST",
     1684                        data: {
     1685                            nonce: cloudflareStream.nonce,
     1686                            event: e
     1687                        },
     1688                        error: function(e, t) {
     1689                            console.error("Error: " + t)
     1690                        }
     1691                    }))
     1692                }
     1693            }]), e
     1694        }();
     1695    cloudflareStream.analytics = new n
     1696}]);
Note: See TracChangeset for help on using the changeset viewer.