-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewerLocalFileData.bundle.ee5ee9351a4db3e8d0b3.js
2 lines (2 loc) · 43.9 KB
/
ViewerLocalFileData.bundle.ee5ee9351a4db3e8d0b3.js
1
2
(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{1020:function(e,t,n){"use strict";var r=n(58),i=n(0),a=n.n(i),o=n(1),s=n.n(o),u=n(17),c=n.n(u),l=n(16),p=n(244),d=n(612),f=n(13),m=n(6),y=n.n(m),v=n(1031),h=n(33),b=(n(1021),n(256)),g=n(7),S=n.n(g),w=n(35),I=n.n(w),D=(0,S.a.import)("util/scrollToIndex"),O=l.a.redux.actions.setViewportSpecificData,E=Object(r.b)((function(e){var t=e.viewports,n=(t.viewportSpecificData[t.activeViewportIndex]||{}).cine;return{activeEnabledElement:b.a.runCommand("getActiveViewportEnabledElement"),activeViewportCineData:n||{isPlaying:!1,cineFrameRate:24},activeViewportIndex:e.viewports.activeViewportIndex}}),(function(e){return{dispatchSetViewportSpecificData:function(t,n){e(O(t,n))}}}),(function(e,t,n){var r=e.activeEnabledElement,i=e.activeViewportCineData,a=e.activeViewportIndex;return{cineFrameRate:i.cineFrameRate,isPlaying:i.isPlaying,onPlayPauseChanged:function(e){var n=I()(i);n.isPlaying=!n.isPlaying,t.dispatchSetViewportSpecificData(a,{cine:n})},onFrameRateChanged:function(e){var n=I()(i);n.cineFrameRate=e,t.dispatchSetViewportSpecificData(a,{cine:n})},onClickNextButton:function(){var e=S.a.getToolState(r,"stack");if(e&&e.data&&e.data.length){var t=e.data[0],n=t.currentImageIdIndex;n>=t.imageIds.length-1||D(r,n+1)}},onClickBackButton:function(){var e=S.a.getToolState(r,"stack");if(e&&e.data&&e.data.length){var t=e.data[0].currentImageIdIndex;0!==t&&D(r,t-1)}},onClickSkipToStart:function(){var e=S.a.getToolState(r,"stack");e&&e.data&&e.data.length&&D(r,0)},onClickSkipToEnd:function(){var e=S.a.getToolState(r,"stack");if(e&&e.data&&e.data.length){var t=e.data[0].imageIds.length-1;D(r,t)}}}}))(f.c),P=l.a.redux.actions,j=P.setLayout,T=P.setViewportActive,R=Object(r.b)((function(e){return{currentLayout:e.viewports.layout,activeViewportIndex:e.viewports.activeViewportIndex}}),(function(e){return{onChange:function(t,n,r){for(var i=[],a=t.row+1,o=t.col+1,s=a*o,u=0;u<s;u++){var c=n.viewports[u],l=c&&c.plugin;c&&c.vtk&&(l="cornerstone"),i.push({plugin:l})}var p={numRows:a,numColumns:o,viewports:i};r>s-1&&e(T(0)),e(j(p))}}}),(function(e,t){var n=t.onChange,r=e.currentLayout,i=e.activeViewportIndex;return{onChange:function(e){return n(e,r,i)}}}))(f.m),x=n(76);function C(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function A(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var L=function(e){function t(e){var n,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,i=_(t).call(this,e),n=!i||"object"!==k(i)&&"function"!=typeof i?V(r):i,N(V(n),"closeCineDialogIfNotApplicable",(function(){var e=n.props.dialog,t=n.state,r=t.dialogId,i=t.activeButtons,a=t.toolbarButtons;r&&(a.find((function(e){return e.options&&"CINE"===e.options.behavior}))||(e.dismiss({id:r}),i=i.filter((function(e){return e.options&&"CINE"!==e.options.behavior})),n.setState({dialogId:null,activeButtons:i})))}));var a=W.call(V(n));return n.state={toolbarButtons:a,activeButtons:[]},n.seriesPerStudyCount=[],n._handleBuiltIn=Y.bind(V(n)),n._onDerivedDisplaySetsLoadedAndCached=n._onDerivedDisplaySetsLoadedAndCached.bind(V(n)),n.updateButtonGroups(),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&U(e,t)}(t,e),n=t,(r=[{key:"updateButtonGroups",value:function(){var e=this,t=b.c.modules[d.a.PANEL];this.buttonGroups={left:[],right:[]},t.forEach((function(t){var n=t.module,r=Array.from(n.defaultContext);n.menuOptions.forEach((function(t){var n=Array.from(t.context||r),i=e.props.activeContexts.some((function(e){return n.includes(e)})),a="function"==typeof t.isDisabled&&t.isDisabled(e.props.studies,e.props.activeViewport);if(i&&!a){var o={value:t.target,icon:t.icon,bottomLabel:t.label},s=t.from||"right";e.buttonGroups[s].push(o)}}))})),this.buttonGroups.left.unshift({value:"studies",icon:"th-large",bottomLabel:this.props.t("Series")})}},{key:"componentDidMount",value:function(){document.addEventListener("deriveddisplaysetsloadedandcached",this._onDerivedDisplaySetsLoadedAndCached)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("deriveddisplaysetsloadedandcached",this._onDerivedDisplaySetsLoadedAndCached)}},{key:"_onDerivedDisplaySetsLoadedAndCached",value:function(){this.updateButtonGroups(),this.setState({toolbarButtons:W.call(this)})}},{key:"componentDidUpdate",value:function(e){var t=e.activeContexts!==this.props.activeContexts,n=e.studies,r=e.activeViewport,i=this.props.activeViewport,a=this.props.studies,o=this.seriesPerStudyCount,s=!1;if(n.length!==a.length||r!==i)s=!0;else for(var u=0;u<a.length;u++)if(a[u].series.length!==o[u]){o[u]=a[u].series.length,s=!0;break}s&&this.updateButtonGroups(),t&&this.setState({toolbarButtons:W.call(this)},this.closeCineDialogIfNotApplicable)}},{key:"render",value:function(){var e=this,t=B.call(this,this.state.toolbarButtons,this.state.activeButtons),n=function(t,n){e.props.handleSidePanelChange(t,n)},r=n.bind(this,"left"),i=n.bind(this,"right");return a.a.createElement(a.a.Fragment,null,a.a.createElement("div",{className:"ToolbarRow"},a.a.createElement("div",{className:"pull-left m-t-1 p-y-1",style:{padding:"10px"}},a.a.createElement(f.v,{options:this.buttonGroups.left,value:this.props.selectedLeftSidePanel||"",onValueChanged:r})),t,a.a.createElement(R,null),a.a.createElement("div",{className:"pull-right m-t-1 rm-x-1",style:{marginLeft:"auto"}},this.buttonGroups.right.length&&a.a.createElement(f.v,{options:this.buttonGroups.right,value:this.props.selectedRightSidePanel||"",onValueChanged:i}))))}}])&&A(n.prototype,r),i&&A(n,i),t}(i.Component);function M(e,t){var n=e.CustomComponent;if("function"==typeof n){var r=t.map((function(e){return e.id})),i=r.includes(e.id);return a.a.createElement(n,{parentContext:this,toolbarClickCallback:G.bind(this),button:e,key:e.id,activeButtons:r,isActive:i})}}function F(e,t){var n,r=this,i=e.buttons.map((function(e){return e.onClick=G.bind(r,e),t.map((function(e){return e.id})).indexOf(e.id)>-1&&(n=e.id),e}));return a.a.createElement(f.i,{key:e.id,label:e.label,icon:e.icon,buttons:i,activeCommand:n})}function q(e,t){return a.a.createElement(f.J,{key:e.id,label:e.label,icon:e.icon,onClick:G.bind(this,e),isActive:t.map((function(e){return e.id})).includes(e.id)})}function B(e,t){var n=this;return e.map((function(e){var r=e.CustomComponent,i=e.buttons&&e.buttons.length;return r?M.call(n,e,t):i?F.call(n,e,t):q.call(n,e,t)}))}function G(e,t,n){var r=this.state.activeButtons;if(e.commandName){var i=Object.assign({evt:t},e.commandOptions);b.a.runCommand(e.commandName,i)}if("setToolActive"===e.type){var a=r.filter((function(e){var t=e.options;return t&&!t.togglable}));this.setState({activeButtons:[].concat(C(a),[e])})}else"builtIn"===e.type&&this._handleBuiltIn(e)}function W(){var e=this,t=b.c.modules[d.a.TOOLBAR],n=[];return t.forEach((function(t){var r=t.module,i=r.definitions,a=r.defaultContext;i.forEach((function(t){var r=t.context||a;e.props.activeContexts.includes(r)&&n.push(t)}))})),n}function Y(e){var t=this.props,n=t.dialog,r=t.t,i=this.state.dialogId,a=e.id,o=e.options;if("CINE"===o.behavior)if(i)n.dismiss({id:i}),this.setState((function(e){return{dialogId:null,activeButtons:C(e.activeButtons.filter((function(e){return e.id!==a})))}}));else{var s=document.querySelector(".ViewerMain").getBoundingClientRect(),u=s.x,c=s.y,l=n.create({content:E,defaultPosition:{x:u+20||0,y:c+20||0}});this.setState((function(t){return{dialogId:l,activeButtons:[].concat(C(t.activeButtons),[e])}}))}"DOWNLOAD_SCREEN_SHOT"===o.behavior&&b.a.runCommand("showDownloadViewportModal",{title:r("Download High Quality Image")})}N(L,"propTypes",{isLeftSidePanelOpen:s.a.bool.isRequired,isRightSidePanelOpen:s.a.bool.isRequired,selectedLeftSidePanel:s.a.string.isRequired,selectedRightSidePanel:s.a.string.isRequired,handleSidePanelChange:s.a.func.isRequired,activeContexts:s.a.arrayOf(s.a.string).isRequired,studies:s.a.array,t:s.a.func.isRequired,dialog:s.a.any,modal:s.a.any}),N(L,"defaultProps",{studies:[]});var J=Object(h.d)(["Common","ViewportDownloadForm"])(Object(f.U)(Object(f.T)(Object(x.e)(L))));l.a.utils.studyMetadataManager;var H=l.a.redux.actions.setActiveViewportSpecificData,z=Object(r.b)((function(e,t){var n=e.loading.progress,r=I()(t.studies);return r.forEach((function(e){e.thumbnails.forEach((function(e){var t=e.displaySetInstanceUID,r="StackProgress:".concat(t),i=n[r],a=0;i&&(a=i.percentComplete),e.stackPercentComplete=a}))})),{studies:r}}),(function(e,t){return{onThumbnailClick:function(n){var r=function(e,t){return Array.isArray(e)&&e.reduce((function(e,t){var n=[];return t&&Array.isArray(t.displaySets)&&(n=t.displaySets),e.concat(n)}),[]).find((function(e){return e.displaySetInstanceUID===t}))||null}(t.studyMetadata,n);if(r.isDerived){var i=r.Modality;if(!(r=r.getSourceDisplaySet(t.studyMetadata)))throw new Error("Referenced series for ".concat(i," dataset not present."));if(!r)throw new Error("Source data not present")}e(H(r))}}}))(f.B),Q=(n(1022),n(1023),n(134)),K=n(176);n(1024);function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Z=function(e){var t=e.children,n=e.onDrop,r=e.viewportIndex,i=e.className,o=X(Object(K.d)({accept:"thumbnail",drop:function(e,t){var i=t.canDrop(),a=t.isOver();if(i&&a&&n){var o=e.StudyInstanceUID,s=e.displaySetInstanceUID;n({viewportIndex:r,StudyInstanceUID:o,displaySetInstanceUID:s})}},collect:function(e){return{highlighted:e.canDrop(),hovered:e.isOver()}}}),2),s=o[0],u=s.hovered,l=s.highlighted,p=o[1];return a.a.createElement("div",{className:c()("viewport-drop-target",{hovered:u},{highlighted:l},i),ref:p,"data-cy":"viewport-container-".concat(r)},t)};Z.propTypes={children:s.a.node.isRequired,viewportIndex:s.a.number.isRequired,onDrop:s.a.func.isRequired,className:s.a.string};var $=Z;var ee=n(1025),te=n.n(ee),ne=Q.a.loadAndCacheDerivedDisplaySets,re=function(e){var t=e.activeViewportIndex,n=e.availablePlugins,r=e.defaultPlugin,o=e.layout,s=e.numRows,u=e.numColumns,l=e.setViewportData,p=e.studies,d=e.viewportData,m=e.children,y=e.isStudyLoaded,v=100/s,h=100/u;if(!d||!d.length)return null;var b=Object(f.S)(),g=Object(f.Q)();Object(i.useEffect)((function(){y&&d.forEach((function(e){ne(e,p).forEach((function(e){e.catch((function(e){g.error({error:e,message:e.message}),b.show({title:"Error loading derived display set:",message:e.message,type:"error",error:e,autoClose:!1})}))}))}))}),[p,d,y,b]);var S=a.a.useMemo((function(){return o.viewports.map((function(e,i){var o=d[i];if(!o)return null;var s={displaySet:o,studies:p},u=!e.plugin&&o&&o.plugin?o.plugin:e.plugin,f=function(e,t,n,r,i,o){if(e.displaySet){var s=r[i=i||o];if(!s)throw new Error("No Viewport Component available for name ".concat(i,".\n Available plugins: ").concat(JSON.stringify(r)));return a.a.createElement(s,{viewportData:e,viewportIndex:t,children:[n]})}return a.a.createElement(te.a,null)}(s,i,m,n,u,r);return a.a.createElement($,{onDrop:l,viewportIndex:i,className:c()("viewport-container",{active:t===i}),key:i},f)}))}),[o,d,p,m,n,r,l,t]);return a.a.createElement("div",{"data-cy":"viewprt-grid",style:{display:"grid",gridTemplateRows:"repeat(".concat(s,", ").concat(v,"%)"),gridTemplateColumns:"repeat(".concat(u,", ").concat(h,"%)"),height:"100%",width:"100%"}},S)};re.propTypes={viewportData:s.a.array.isRequired,supportsDrop:s.a.bool.isRequired,activeViewportIndex:s.a.number.isRequired,layout:s.a.object.isRequired,availablePlugins:s.a.object.isRequired,setViewportData:s.a.func.isRequired,studies:s.a.array,children:s.a.node,defaultPlugin:s.a.string,numRows:s.a.number.isRequired,numColumns:s.a.number.isRequired},re.defaultProps={viewportData:[],numRows:1,numColumns:1,layout:{viewports:[{}]},activeViewportIndex:0,supportsDrop:!0,availablePlugins:{DefaultViewport:function(e){return React.createElement("div",null,JSON.stringify(e))}},defaultPlugin:"defaultViewportPlugin"};var ie=re,ae=n(637),oe=n.n(ae),se=oe()((function(e){var t={};return e.forEach((function(e){t[e.extensionId]=e.module})),t})),ue=Object(r.b)((function(e){var t,n=b.c.modules[d.a.VIEWPORT],r=se(n);n.length&&(t=n[0].extensionId);var i=e.viewports;return{numRows:i.numRows,numColumns:i.numColumns,layout:i.layout,activeViewportIndex:i.activeViewportIndex,availablePlugins:r,defaultPlugin:t}}),null)(ie),ce=n(1042),le=n.n(ce);function pe(e){return(pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fe(e){return(fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function me(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ye(e,t){return(ye=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var he=oe()(le.a),be=function(e){function t(e){var n,r,i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,i=fe(t).call(this,e),n=!i||"object"!==pe(i)&&"function"!=typeof i?me(r):i,ve(me(n),"fillEmptyViewportPanes",(function(){var e=[],t=n.props,r=t.layout,i=t.viewportSpecificData,a=n.state.displaySets;if(a&&a.length){for(var o=0;o<r.viewports.length;o++){var s=i[o];if(s&&s.StudyInstanceUID&&s.displaySetInstanceUID)e.push({StudyInstanceUID:s.StudyInstanceUID,displaySetInstanceUID:s.displaySetInstanceUID});else{var u=a.find((function(t){return!e.some((function(e){return e.displaySetInstanceUID===t.displaySetInstanceUID}))}))||a[a.length-1];e.push(u)}}e.forEach((function(e,t){e&&e.StudyInstanceUID&&n.setViewportData({viewportIndex:t,StudyInstanceUID:e.StudyInstanceUID,displaySetInstanceUID:e.displaySetInstanceUID})}))}})),ve(me(n),"setViewportData",(function(e){var t=e.viewportIndex,r=e.StudyInstanceUID,i=e.displaySetInstanceUID,a=n.findDisplaySet(n.props.studies,r,i);if(a.isDerived){var o=a.Modality;if(!(a=a.getSourceDisplaySet(n.props.studies)))throw new Error("Referenced series for ".concat(o," dataset not present."))}n.props.setViewportSpecificData(t,a)})),n.state={displaySets:[]},n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ye(e,t)}(t,e),n=t,(r=[{key:"getDisplaySets",value:function(e){var t=[];return e.forEach((function(e){e.displaySets.forEach((function(e){e.plugin||(e.plugin="cornerstone"),t.push(e)}))})),t}},{key:"findDisplaySet",value:function(e,t,n){var r=e.find((function(e){return e.StudyInstanceUID===t}));if(r)return r.displaySets.find((function(e){return e.displaySetInstanceUID===n}))}},{key:"componentDidMount",value:function(){if(this.props.studies){var e=this.getDisplaySets(this.props.studies);this.setState({displaySets:e},this.fillEmptyViewportPanes)}}},{key:"componentDidUpdate",value:function(e){var t=e.layout.viewports.length,n=this.props.layout.viewports.length,r=this.props.layout.viewports.some((function(e){return!!e.vtk}));if(this.props.studies!==e.studies||n!==t&&!r){var i=this.getDisplaySets(this.props.studies);this.setState({displaySets:i},this.fillEmptyViewportPanes)}}},{key:"render",value:function(){var e=this.props.viewportSpecificData,t=he(e);return a.a.createElement("div",{className:"ViewerMain"},this.state.displaySets.length&&a.a.createElement(ue,{isStudyLoaded:this.props.isStudyLoaded,studies:this.props.studies,viewportData:t,setViewportData:this.setViewportData}))}},{key:"componentWillUnmount",value:function(){var e=this,t=this.props.viewportSpecificData;Object.keys(t).forEach((function(t){e.props.clearViewportSpecificData(t)}))}}])&&de(n.prototype,r),i&&de(n,i),t}(i.Component);ve(be,"propTypes",{activeViewportIndex:s.a.number.isRequired,studies:s.a.array,viewportSpecificData:s.a.object.isRequired,layout:s.a.object.isRequired,setViewportSpecificData:s.a.func.isRequired,clearViewportSpecificData:s.a.func.isRequired});var ge=be,Se=l.a.redux.actions,we=Se.setViewportSpecificData,Ie=Se.clearViewportSpecificData,De=Object(r.b)((function(e){var t=e.viewports;return{activeViewportIndex:t.activeViewportIndex,layout:t.layout,viewportSpecificData:t.viewportSpecificData,viewports:e.viewports}}),(function(e){return{setViewportSpecificData:function(t,n){e(we(t,n))},clearViewportSpecificData:function(){e(Ie())}}}))(ge),Oe=(n(1026),function(e){var t=e.from,n=e.isOpen,r=e.children,i=e.width,o="right"===t?"from-right":"from-left",s=i?{maxWidth:i,marginRight:n?"0":-1*Number.parseInt(i)}:{};return a.a.createElement("section",{style:s,className:c()("sidepanel",o,{"is-open":n})},r)});Oe.propTypes={from:s.a.string.isRequired,isOpen:s.a.bool.isRequired,children:s.a.node,width:s.a.string};var Ee=Oe;n(1027);function Pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var je=b.e.services.UIModalService,Te=function(e){var t=e.context,n=e.children;return a.a.createElement(f.g,{fallbackComponent:function(){return a.a.createElement("div",{className:"ErrorFallback",role:"alert"},a.a.createElement("p",null,"Error rendering ",t,". ",a.a.createElement("br",null)," Check the browser console for more details."))},context:t,onError:function(e,n){je.show({content:function(){var r=Pe(Object(i.useState)(!1),2),o=r[0],s=r[1];return a.a.createElement("div",{className:"ErrorFallback",role:"alert"},a.a.createElement("div",{className:"ErrorBoundaryDialog"},a.a.createElement("h3",{className:"ErrorBoundaryDialogTitle"},t,": ",a.a.createElement("span",null,e.message))),a.a.createElement("button",{className:"btn btn-primary btn-sm ErrorBoundaryDialogButton",onClick:function(){return s((function(e){return!e}))}},a.a.createElement(f.k,{name:"chevron-down",className:c()("ErrorBoundaryDialogIcon",{opened:o})}),"Stack Trace"),o&&a.a.createElement("pre",null,n))},title:"Something went wrong in ".concat(t)})}},n)};Te.propTypes={context:s.a.string.isRequired,children:s.a.node.isRequired};var Re=Te,xe=n(80),Ce=n(210),ke=n(257);n(1028),n(1043);function Ae(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function _e(e){return(_e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ue(e){return(Ue=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ne(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Le(e,t){return(Le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fe=function(e){function t(e){var n,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,i=Ue(t).call(this,e),n=!i||"object"!==_e(i)&&"function"!=typeof i?Ne(r):i,Me(Ne(n),"state",{isLeftSidePanelOpen:!0,isRightSidePanelOpen:!1,selectedRightSidePanel:"",selectedLeftSidePanel:"studies",thumbnails:[]}),Me(Ne(n),"retrieveTimepoints",(function(e){l.a.log.info("retrieveTimepoints");var t=(new Date).toISOString(),r=(new Date).toISOString();return n.props.studies&&(r=new Date("1000-01-01").toISOString(),n.props.studies.forEach((function(e){var n=y()(e.StudyDate,"YYYYMMDD").toISOString();n<t&&(t=n),n>r&&(r=n)}))),Promise.resolve([{timepointType:"baseline",timepointId:"TimepointId",studyInstanceUIDs:n.props.studyInstanceUIDs,PatientID:e.PatientID,earliestDate:t,latestDate:r,isLocked:!1}])})),Me(Ne(n),"storeTimepoints",(function(e){return l.a.log.info("storeTimepoints"),Promise.resolve()})),Me(Ne(n),"updateTimepoint",(function(e,t){return l.a.log.info("updateTimepoint"),Promise.resolve()})),Me(Ne(n),"removeTimepoint",(function(e){return l.a.log.info("removeTimepoint"),Promise.resolve()})),Me(Ne(n),"disassociateStudy",(function(e,t){return l.a.log.info("disassociateStudy"),Promise.resolve()})),Me(Ne(n),"onTimepointsUpdated",(function(e){n.props.onTimepointsUpdated&&n.props.onTimepointsUpdated(e)})),Me(Ne(n),"onMeasurementsUpdated",(function(e){n.props.onMeasurementsUpdated&&n.props.onMeasurementsUpdated(e)}));var a=n.props.activeServer,o=Object.assign({},a);return l.a.measurements.MeasurementApi.setConfiguration({dataExchange:{retrieve:p.a.retrieveMeasurements,store:p.a.storeMeasurements},server:o}),l.a.measurements.TimepointApi.setConfiguration({dataExchange:{retrieve:n.retrieveTimepoints,store:n.storeTimepoints,remove:n.removeTimepoint,update:n.updateTimepoint,disassociate:n.disassociateStudy}}),n._getActiveViewport=n._getActiveViewport.bind(Ne(n)),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Le(e,t)}(t,e),n=t,(r=[{key:"componentWillUnmount",value:function(){this.props.dialog&&this.props.dialog.dismissAll()}},{key:"componentDidMount",value:function(){var e=this.props,t=e.studies,n=e.isStudyLoaded,r=l.a.measurements,i=r.TimepointApi,a=r.MeasurementApi,o=new i("TimepointId",{onTimepointsUpdated:this.onTimepointsUpdated}),s=new a(o,{onMeasurementsUpdated:this.onMeasurementsUpdated});if(this.currentTimepointId="TimepointId",this.timepointApi=o,this.measurementApi=s,t){var u=t[0]&&t[0].PatientID;o.retrieveTimepoints({PatientID:u}),n&&this.measurementApi.retrieveMeasurements(u,["TimepointId"]),this.setState({thumbnails:Ge(t)})}}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.studies,r=t.isStudyLoaded;if(n!==e.studies&&this.setState({thumbnails:Ge(n)}),r&&r!==e.isStudyLoaded){var i=n[0]&&n[0].PatientID,a=this.currentTimepointId;this.timepointApi.retrieveTimepoints({PatientID:i}),this.measurementApi.retrieveMeasurements(i,[a])}}},{key:"_getActiveViewport",value:function(){return this.props.viewports[this.props.activeViewportIndex]}},{key:"render",value:function(){var e,t,n=this;return b.c.modules[d.a.PANEL].forEach((function(r){r.module.components.forEach((function(r){r.id===n.state.selectedRightSidePanel?t=r.component:r.id===n.state.selectedLeftSidePanel&&(e=r.component)}))})),a.a.createElement(a.a.Fragment,null,a.a.createElement(Ce.a.Consumer,null,(function(e){return a.a.createElement(ke.a.Consumer,null,(function(t){return a.a.createElement(x.c.Consumer,null,(function(n){return a.a.createElement(v.a,{linkText:n.appConfig.showStudyList?"Study List":void 0,linkPath:n.appConfig.showStudyList?"/":void 0,userManager:t},e&&e.createLogoComponentFn&&e.createLogoComponentFn(a.a))}))}))})),a.a.createElement(Re,{context:"ToolbarRow"},a.a.createElement(J,{activeViewport:this.props.viewports[this.props.activeViewportIndex],isDerivedDisplaySetsLoaded:this.props.isDerivedDisplaySetsLoaded,isLeftSidePanelOpen:this.state.isLeftSidePanelOpen,isRightSidePanelOpen:this.state.isRightSidePanelOpen,selectedLeftSidePanel:this.state.isLeftSidePanelOpen?this.state.selectedLeftSidePanel:"",selectedRightSidePanel:this.state.isRightSidePanelOpen?this.state.selectedRightSidePanel:"",handleSidePanelChange:function(e,t){var r=e&&e[0].toUpperCase()+e.slice(1),i="is".concat(r,"SidePanelOpen"),a="selected".concat(r,"SidePanel"),o=Object.assign({},n.state),s=o[i],u=o[a],c=u===t||null===t;o[a]=t||u,(!s||c)&&(o[i]=!o[i]),n.setState(o)},studies:this.props.studies})),a.a.createElement("div",{className:"FlexboxLayout"},a.a.createElement(Re,{context:"LeftSidePanel"},a.a.createElement(Ee,{from:"left",isOpen:this.state.isLeftSidePanelOpen},e?a.a.createElement(e,{viewports:this.props.viewports,studies:this.props.studies,activeIndex:this.props.activeViewportIndex}):a.a.createElement(z,{studies:this.state.thumbnails,studyMetadata:this.props.studies}))),a.a.createElement("div",{className:c()("main-content")},a.a.createElement(Re,{context:"ViewerMain"},a.a.createElement(De,{studies:this.props.studies,isStudyLoaded:this.props.isStudyLoaded}))),a.a.createElement(Re,{context:"RightSidePanel"},a.a.createElement(Ee,{from:"right",isOpen:this.state.isRightSidePanelOpen},t&&a.a.createElement(t,{isOpen:this.state.isRightSidePanelOpen,viewports:this.props.viewports,studies:this.props.studies,activeIndex:this.props.activeViewportIndex,activeViewport:this.props.viewports[this.props.activeViewportIndex],getActiveViewport:this._getActiveViewport})))))}}])&&Ve(n.prototype,r),i&&Ve(n,i),t}(i.Component);Me(Fe,"propTypes",{studies:s.a.arrayOf(s.a.shape({StudyInstanceUID:s.a.string.isRequired,StudyDate:s.a.string,PatientID:s.a.string,displaySets:s.a.arrayOf(s.a.shape({displaySetInstanceUID:s.a.string.isRequired,SeriesDescription:s.a.string,SeriesNumber:s.a.number,InstanceNumber:s.a.number,numImageFrames:s.a.number,Modality:s.a.string.isRequired,images:s.a.arrayOf(s.a.shape({getImageId:s.a.func.isRequired}))}))})),studyInstanceUIDs:s.a.array,activeServer:s.a.shape({type:s.a.string,wadoRoot:s.a.string}),onTimepointsUpdated:s.a.func,onMeasurementsUpdated:s.a.func,viewports:s.a.object.isRequired,activeViewportIndex:s.a.number.isRequired,isStudyLoaded:s.a.bool,dialog:s.a.object});var qe=Object(f.T)(Fe),Be=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[],t.warningIssues&&0!==t.warningIssues.length&&(t.warningIssues.forEach((function(e){switch(e){case xe.a.DATASET_4D:n.push("The dataset is 4D.");break;case xe.a.VARYING_IMAGESDIMENSIONS:n.push("The dataset frames have different dimensions (rows, columns).");break;case xe.a.VARYING_IMAGESCOMPONENTS:n.push("The dataset frames have different components (Sample per pixel).");break;case xe.a.VARYING_IMAGESORIENTATION:n.push("The dataset frames have different orientation.");break;case xe.a.IRREGULAR_SPACING:n.push("The dataset frames have different pixel spacing.");break;case xe.a.MULTIFFRAMES:n.push("The dataset is a multiframes.")}})),n.push("The datasets is not a reconstructable 3D volume. MPR mode is not available.")),t.missingFrames&&(!t.warningIssues||t.warningIssues&&!t.warningIssues.find((function(e){return e===xe.a.DATASET_4D})))&&n.push("The datasets is missing frames: "+t.missingFrames+"."),e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Ae(a,r,i,o,s,"next",e)}function s(e){Ae(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(e){return t.apply(this,arguments)}}(),Ge=function(e){return e.map((function(e){return{StudyInstanceUID:e.StudyInstanceUID,thumbnails:e.displaySets.map((function(e){var t,n,r=e.displaySetInstanceUID,i=e.SeriesDescription,a=e.InstanceNumber,o=e.numImageFrames,s=e.SeriesNumber;if(e.Modality&&"SEG"===e.Modality)n="SEG";else if(e.images&&e.images.length){var u=Math.floor(e.images.length/2);t=e.images[u].getImageId()}else n=e.Modality?e.Modality:"UN";return{imageId:t,altImageText:n,displaySetInstanceUID:r,SeriesDescription:i,InstanceNumber:a,numImageFrames:o,SeriesNumber:s,hasWarnings:Be(e)}}))}}))},We=l.a.redux.actions,Ye=We.setTimepoints,Je=We.setMeasurements,He=function(e){return e.servers.find((function(e){return!0===e.active}))},ze=Object(r.b)((function(e){var t=e.viewports,n=e.servers;return{viewports:t.viewportSpecificData,activeViewportIndex:t.activeViewportIndex,activeServer:He(n)}}),(function(e){return{onTimepointsUpdated:function(t){e(Ye(t))},onMeasurementsUpdated:function(t){e(Je(t))}}}))(qe);t.a=ze},1021:function(e,t,n){},1022:function(e,t,n){},1023:function(e,t,n){},1024:function(e,t,n){},1025:function(e,t){},1026:function(e,t,n){},1027:function(e,t,n){},1028:function(e,t,n){},1032:function(e,t,n){"use strict";var r=n(54),i=n.n(r);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){function e(){var t,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r=void 0,(n="fileType")in(t=this)?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r}var t,n,r;return t=e,(n=[{key:"loadFile",value:function(e,t){}},{key:"getDataset",value:function(e,t){}},{key:"getStudies",value:function(e,t){}}])&&a(t.prototype,n),r&&a(t,r),e}();function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var d=new(function(e){function t(){var e,n,r,i,a,o,u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var p=arguments.length,d=new Array(p),f=0;f<p;f++)d[f]=arguments[f];return r=this,n=!(i=(e=c(t)).call.apply(e,[this].concat(d)))||"object"!==s(i)&&"function"!=typeof i?l(r):i,a=l(n),u="application/pdf",(o="fileType")in a?Object.defineProperty(a,o,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[o]=u,n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(t,e),n=t,(r=[{key:"loadFile",value:function(e,t){return i.a.wadouri.loadFileRequest(t)}},{key:"getDataset",value:function(e,t){var n={};return n.imageId=e.imageId||t,n}},{key:"getStudies",value:function(e,t){return this.getDefaultStudy(t)}},{key:"getDefaultStudy",value:function(e){return{StudyInstanceUID:"",StudyDate:"",StudyTime:"",AccessionNumber:"",ReferringPhysicianName:"",PatientName:"",PatientID:"",PatientBirthdate:"",PatientSex:"",StudyId:"",StudyDescription:"",series:[{SeriesInstanceUID:"",SeriesDescription:"",SeriesNumber:"",instances:[{metadata:{SOPInstanceUID:"",SOPClassUID:"1.2.840.10008.5.1.4.1.1.104.1",Rows:"",Columns:"",NumberOfFrames:0,InstanceNumber:1},getImageId:function(){return e},isLocalFile:!0}]}]}}}])&&u(n.prototype,r),a&&u(n,a),t}(o)),f=n(28);function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var g=n(16).a.cornerstone.metadataProvider,S=new(function(e){function t(){var e,n,r,i,a,o,s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var u=arguments.length,c=new Array(u),l=0;l<u;l++)c[l]=arguments[l];return r=this,n=!(i=(e=v(t)).call.apply(e,[this].concat(c)))||"object"!==m(i)&&"function"!=typeof i?h(r):i,a=h(n),s="application/dicom",(o="fileType")in a?Object.defineProperty(a,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):a[o]=s,n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(t,e),n=t,(r=[{key:"loadFile",value:function(e,t){return i.a.wadouri.loadFileRequest(t)}},{key:"getDataset",value:function(e,t){var n={};try{var r=f.a.data.DicomMessage.readFile(e);n=f.a.data.DicomMetaDictionary.naturalizeDataset(r.dict),g.addInstance(n),n._meta=f.a.data.DicomMetaDictionary.namifyDataset(r.meta)}catch(e){console.error("Error reading dicom file",e)}return n.imageId=t,n}},{key:"getStudies",value:function(e,t){return this.getStudyFromDataset(e)}},{key:"getStudyFromDataset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.StudyInstanceUID,n=e.StudyDate,r=e.StudyTime,i=e.AccessionNumber,a=e.ReferringPhysicianName,o=e.PatientName,s=e.PatientID,u=e.PatientBirthDate,c=e.PatientSex,l=e.StudyID,p=e.StudyDescription,d=e.SeriesInstanceUID,f=e.SeriesDescription,m=e.SeriesNumber,y=e.imageId,v={metadata:e,url:y},h={SeriesInstanceUID:d,SeriesDescription:f,SeriesNumber:m,instances:[v]},b={StudyInstanceUID:t,StudyDate:n,StudyTime:r,AccessionNumber:i,ReferringPhysicianName:a,PatientName:o,PatientID:s,PatientBirthDate:u,PatientSex:c,StudyID:l,StudyDescription:p,series:[h]};return b}}])&&y(n.prototype,r),a&&y(n,a),t}(o));function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var R=function(e){function t(e){var n,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,n=!(i=E(t).call(this))||"object"!==w(i)&&"function"!=typeof i?P(r):i,T(P(n),"fileType",void 0),T(P(n),"loader",void 0);var a=e&&e.type;return n.loader=n.getLoader(a),n.fileType=n.loader.fileType,n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&j(e,t)}(t,e),n=t,a=[{key:"groupSeries",value:function(e){var t=function(e,t,n){var r=1;return e.reduce((function(e,i){var a,o=i[t],s=i[n];return e[o=o||""+r++]||(e[o]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(n,!0).forEach((function(t){T(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},i),e[o][n]=[]),(a=e[o][n]).push.apply(a,I(s)),e}),{})};return Object.values(t(e,"StudyInstanceUID","series")).map((function(e){var n=t(e.series,"SeriesInstanceUID","instances");return e.series=Object.values(n),e}))}}],(r=[{key:"addFile",value:function(e){return i.a.wadouri.fileManager.add(e)}},{key:"loadFile",value:function(e,t){return this.loader.loadFile(e,t)}},{key:"getDataset",value:function(e,t){return this.loader.getDataset(e,t)}},{key:"getStudies",value:function(e,t){return this.loader.getStudies(e,t)}},{key:"getLoader",value:function(e){return"application/pdf"===e?d:S}}])&&O(n.prototype,r),a&&O(n,a),t}(o);function x(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function C(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){x(a,r,i,o,s,"next",e)}function s(e){x(a,r,i,o,s,"throw",e)}o(void 0)}))}}n.d(t,"a",(function(){return A}));var k=function(){var e=C(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=new R(t),r=n.addFile(t),e.next=5,n.loadFile(t,r);case 5:return i=e.sent,e.next=8,n.getDataset(i,r);case 8:return a=e.sent,e.next=11,n.getStudies(a,r);case 11:return o=e.sent,e.abrupt("return",o);case 15:e.prev=15,e.t0=e.catch(0),console.log(e.t0.name,":Error when trying to load and process local files:",e.t0.message);case 18:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(t){return e.apply(this,arguments)}}();function A(e){return _.apply(this,arguments)}function _(){return(_=C(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.map(k),e.next=3,Promise.all(n);case 3:return r=e.sent,e.abrupt("return",R.groupSeries(r.flat()));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},1046:function(e,t){},1047:function(e,t){},1053:function(e,t,n){},997:function(e,t,n){"use strict";n.r(t);var r=n(0),i=n.n(r),a=n(86),o=n(134),s=n(1020),u=n(1),c=n.n(u),l=n(256),p=n(1064),d=n(1032),f=(n(1053),n(33));function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(){return(w=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var I=a.a.OHIFStudyMetadata,D=o.a.studyMetadataManager,O=function(e,t,n){return i.a.createElement(p.a,{onDrop:e,noDrag:!0},(function(e){var r=e.getRootProps,a=e.getInputProps;return i.a.createElement("span",w({},r(),{className:"link-dialog"}),n?i.a.createElement("span",null,t("Load folders"),i.a.createElement("input",w({},a(),{webkitdirectory:"true",mozdirectory:"true"}))):i.a.createElement("span",null,t("Load files"),i.a.createElement("input",a())))}))},E=function(e){function t(){var e,n,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];return r=this,i=(e=h(t)).call.apply(e,[this].concat(o)),n=!i||"object"!==m(i)&&"function"!=typeof i?b(r):i,S(b(n),"state",{studies:null,loading:!1,error:null}),S(b(n),"updateStudies",(function(e){D.purge();var t=e.map((function(e){var t=new I(e,e.StudyInstanceUID),n=l.c.modules.sopClassHandlerModule;return e.displaySets=e.displaySets||t.createDisplaySets(n),t.forEachDisplaySet((function(e){e.localFile=!0})),D.add(t),e}));n.setState({studies:t})})),n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){var e=this,t=function(){var t,n=(t=regeneratorRuntime.mark((function t(n){var r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.setState({loading:!0}),t.next=3,Object(d.a)(n);case 3:if(r=t.sent,i=e.updateStudies(r)){t.next=7;break}return t.abrupt("return");case 7:e.setState({studies:i,loading:!1});case 8:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){y(a,r,i,o,s,"next",e)}function s(e){y(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(e){return n.apply(this,arguments)}}();return this.state.error?i.a.createElement("div",null,"Error: ",JSON.stringify(this.state.error)):i.a.createElement(p.a,{onDrop:t,noClick:!0},(function(n){var r=n.getRootProps;return n.getInputProps,i.a.createElement("div",w({},r(),{style:{width:"100%",height:"100%"}}),e.state.studies?i.a.createElement(s.a,{studies:e.state.studies,studyInstanceUIDs:e.state.studies&&e.state.studies.map((function(e){return e.StudyInstanceUID}))}):i.a.createElement("div",{className:"drag-drop-instructions"},i.a.createElement("div",{className:"drag-drop-contents"},e.state.loading?i.a.createElement("h3",null,e.props.t("Loading...")):i.a.createElement(i.a.Fragment,null,i.a.createElement("h3",null,e.props.t("Drag and Drop DICOM files here to load them in the Viewer")),i.a.createElement("h4",null,function(e,t){return i.a.createElement(i.a.Fragment,null,t("Or click to "),O(e,t),t(" or "),O(e,t,!0),t(" from dialog"))}(t,e.props.t))))))}))}}])&&v(n.prototype,r),a&&v(n,a),t}(r.Component);S(E,"propTypes",{studies:c.a.array}),t.default=Object(f.d)("Common")(E)}}]);
//# sourceMappingURL=ViewerLocalFileData.bundle.ee5ee9351a4db3e8d0b3.js.map