webpackJsonp([10],{1131:function(e,t,r){"use strict";var a=r(0),n=r.n(a),i=r(322),o=r.n(i),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},c=function(e){switch(e.target.error.code){case e.target.error.MEDIA_ERR_NETWORK:return"A network error caused the media download to fail";case e.target.error.MEDIA_ERR_DECODE:return"The media playback was aborted due to a corruption problem or because the media used features your browser did not support";case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:return"The media could not be loaded, either because the file was not found, network failed or because the format is not supported by your browser";default:return"An unknown media error occurred"}};t.a=function(e){return n.a.createClass({displayName:"MediaFileDecorator",getInitialState:function(){return{error:null}},componentWillUpdate:function(e,t){e.item!==this.props.item&&this.state.error&&this.setState({error:null})},componentDidUpdate:function(e,t){e.item!==this.props.item&&this.media&&this.media.load()},onMediaError:function(e){this.setState({error:c(e)})},setMediaRef:function(e){this.media=e},render:function(){var t=this.props.item;if(this.state.error)return n.a.createElement("div",null,this.state.error);var r=o.a.duration(o()().diff(o.a.unix(t.time_opened))),a=r.asMinutes()<=1,i={onError:this.onMediaError,autoPlay:a,controls:!0,src:this.props.url};return n.a.createElement(e,s({},this.props,{mediaRef:this.setMediaRef,mediaProps:i}))}})}},1424:function(e,t,r){"use strict";var a=r(0),n=r.n(a),i=r(1131),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},s=n.a.createClass({displayName:"AudioFile",render:function(){var e=this;return n.a.createElement("audio",o({ref:function(t){return e.props.mediaRef(t)}},this.props.mediaProps))}});t.a=r.i(i.a)(s)},1425:function(e,t,r){"use strict";var a=r(0),n=r.n(a),i=r(336),o=r(50),s=r(861),c=r(31),u=function(e){var t=e.item;if(c.a.useMobileLayout())return null;var r=t.download_state;return n.a.createElement(s.a,null,n.a.createElement(s.b,{label:r?"Downloaded":"Opened",text:o.a.formatRelativeTime(r?r.time_finished:t.time_opened)}))};t.a=r.i(i.a)(u)},1426:function(e,t,r){"use strict";var a=r(0),n=r.n(a),i=function(e){var t=(e.item,e.url);return n.a.createElement("img",{src:t})};t.a=i},1427:function(e,t,r){"use strict";(function(e){var a=r(0),n=r.n(a),i=r(58),o=r(126),s=r(331),c=n.a.createClass({displayName:"TextFile",componentWillMount:function(){this.props.item.content_ready&&this.fetchText(this.props.url)},componentWillReceiveProps:function(e){if(e.item.content_ready){var t=e.item.id!==this.props.item.id;t&&this.setState(this.getInitialState()),!t&&this.props.item.content_ready||this.fetchText(e.url)}},getInitialState:function(){return{text:null,error:null}},fetchText:function(t){e.get(t,this.onTextReceived,"text").fail(this.onTextFailed)},onTextFailed:function(e){this.setState({error:e.responseText})},onTextReceived:function(e){this.setState({text:e})},render:function(){var e=this.props.item,t=this.state,r=t.text,a=t.error;return e.content_ready&&!r?a?n.a.createElement(o.a,{title:"Failed to fetch content",description:a}):n.a.createElement(i.a,{text:"Preparing view"}):n.a.createElement("pre",null,n.a.createElement(s.a,{text:r}))}});t.a=c}).call(t,r(17))},1428:function(e,t,r){"use strict";var a=r(0),n=r.n(a),i=r(1131),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},s=n.a.createClass({displayName:"VideoFile",render:function(){var e=this;return n.a.createElement("video",o({ref:function(t){return e.props.mediaRef(t)}},this.props.mediaProps))}});t.a=r.i(i.a)(s)},895:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),n=r.n(a),i=r(16),o=r(58),s=r(126),c=r(26),u=r(1424),l=r(1426),d=r(1427),p=r(1428),f=r(860),m=r(1425),h=function(e){if(e.text)return d.a;switch(e.type.content_type){case"audio":return u.a;case"picture":return l.a;case"video":return p.a}return null},v=function(e){return getBasePath()+"view/"+e+"?auth_token="+c.a.authToken},y=n.a.createClass({displayName:"FileSession",render:function(){var e=this.props.session;if(!e.content_ready)return"download_failed"===e.download_state.id?n.a.createElement(s.a,{icon:i.a.ERROR,title:"Download failed",description:e.download_state.str}):n.a.createElement(o.a,{text:e.download_state.str});var t=h(e),r=void 0;return r=t?n.a.createElement(t,{item:e,url:v(e.tth),type:e.mime_type,extension:e.type.str}):"Unsupported format",n.a.createElement("div",{className:"file session "+e.type.str+" "+e.type.content_type},n.a.createElement("div",{className:"content"},r),n.a.createElement(m.a,{item:e}))}});t.default=r.i(f.a)(y)}});
//# sourceMappingURL=file-children.da1dbef37f087369ae49.chunk.js.map