text: (window.webpackJsonp=window.webpackJsonp||[]).push([[8],{1002:function(e,t,n){"use strict";n.r(t);var r=n(0),i=n.n(r),a=n(91),o=n(138),s=n(1030),u=n(1),c=n.n(u),l=n(258),p=n(1099),d=n(1047),f=(n(1083),n(35));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)},1030:function(e,t,n){"use strict";var r=n(61),i=n(0),a=n.n(i),o=n(1),s=n.n(o),u=n(17),c=n.n(u),l=n(13),p=n(16),d=n(248),f=n(615),m=n(6),y=n.n(m),v=n(1046),h=n(35),b=(n(1031),n(258)),g=n(7),S=n.n(g),w=n(38),I=n.n(w),D=(0,S.a.import)("util/scrollToIndex"),O=p.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)}}}}))(l.c),P=p.a.redux.actions,x=P.setLayout,T=P.setViewportActive,j=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(x(p))}}}),(function(e,t){var n=t.onChange,r=e.currentLayout,i=e.activeViewportIndex;return{onChange:function(e){return n(e,r,i)}}}))(l.m),R=n(80);function k(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 C(e){return(C="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 V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(e,t){return(_=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 M=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=V(t).call(this,e),n=!i||"object"!==C(i)&&"function"!=typeof i?A(r):i,N(A(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(A(n));return n.state={toolbarButtons:a,activeButtons:[]},n.seriesPerStudyCount=[],n._handleBuiltIn=Y.bind(A(n)),n._onDerivedDisplaySetsLoadedAndCached=n._onDerivedDisplaySetsLoadedAndCached.bind(A(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&&_(e,t)}(t,e),n=t,(r=[{key:"updateButtonGroups",value:function(){var e=this,t=b.c.modules[f.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(l.v,{options:this.buttonGroups.left,value:this.props.selectedLeftSidePanel||"",onValueChanged:r})),t,a.a.createElement(j,null),a.a.createElement("div",{className:"pull-right m-t-1 rm-x-1",style:{marginLeft:"auto"}},this.buttonGroups.right.length&&a.a.createElement(l.v,{options:this.buttonGroups.right,value:this.props.selectedRightSidePanel||"",onValueChanged:i}))))}}])&&U(n.prototype,r),i&&U(n,i),t}(i.Component);function L(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 q(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(l.i,{key:e.id,label:e.label,icon:e.icon,buttons:i,activeCommand:n})}function F(e,t){return a.a.createElement(l.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?L.call(n,e,t):i?q.call(n,e,t):F.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(k(a),[e])})}else"builtIn"===e.type&&this._handleBuiltIn(e)}function W(){var e=this,t=b.c.modules[f.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:k(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(k(t.activeButtons),[e])}}))}"DOWNLOAD_SCREEN_SHOT"===o.behavior&&b.a.runCommand("showDownloadViewportModal",{title:r("Download High Quality Image")})}N(M,"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(M,"defaultProps",{studies:[]});var J=Object(h.d)(["Common","ViewportDownloadForm"])(Object(l.U)(Object(l.T)(Object(R.e)(M))));p.a.utils.studyMetadataManager;var H=p.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("SEG"===i&&b.e){var a=b.e.services,o=a.LoggerService,s=a.UINotificationService,u=r.getSourceDisplaySet(t.studyMetadata,!0,(function(e){o.error({error:e,message:e.message}),s.show({title:"DICOM Segmentation Loader",message:e.message,type:"error",autoClose:!0})}));r=u.referencedDisplaySet,u.activatedLabelmapPromise.then((function(e){var t=new CustomEvent("extensiondicomsegmentationsegselected",{detail:{activatedLabelmapIndex:e}});document.dispatchEvent(t)}))}else r=r.getSourceDisplaySet(t.studyMetadata);if(!r)throw new Error("Referenced series for ".concat(i," dataset not present."));if(!r)throw new Error("Source data not present")}e(H(r))}}}))(l.B),Q=(n(1032),n(1033),n(138)),K=n(197);n(1034);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(1035),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,p=e.setViewportData,d=e.studies,f=e.viewportData,m=e.children,y=e.isStudyLoaded,v=100/s,h=100/u;if(!f||!f.length)return null;var b=Object(l.S)(),g=Object(l.Q)();Object(i.useEffect)((function(){y&&f.forEach((function(e){ne(e,d,g,b)}))}),[d,f,y,b]);var S=a.a.useMemo((function(){return o.viewports.map((function(e,i){var o=f[i];if(!o)return null;var s={displaySet:o,studies:d},u=!e.plugin&&o&&o.plugin?o.plugin:e.plugin,l=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:p,viewportIndex:i,className:c()("viewport-container",{active:t===i}),key:i},l)}))}),[o,f,d,m,n,r,p,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(640),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[f.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(1049),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("SEG"===o&&b.e){var s=b.e.services,u=s.LoggerService,c=s.UINotificationService,l=a.getSourceDisplaySet(n.props.studies,!0,(function(e){u.error({error:e,message:e.message}),c.show({title:"DICOM Segmentation Loader",message:e.message,type:"error",autoClose:!0})}));a=l.referencedDisplaySet}else a=a.getSourceDisplaySet(n.props.studies);if(!a)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=p.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(1036),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(1037);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 xe=b.e.services.UIModalService,Te=function(e){var t=e.context,n=e.children;return a.a.createElement(l.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){xe.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(l.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 je=Te,Re=n(86),ke=(n(30),n(214)),Ce=n(259);n(1038),n(1050),n(57);function Ue(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 Ve(e){return(Ve="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 Ae(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 Ne(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Me(e,t){return(Me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Le(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qe=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=_e(t).call(this,e),n=!i||"object"!==Ve(i)&&"function"!=typeof i?Ne(r):i,Le(Ne(n),"state",{isLeftSidePanelOpen:!0,isRightSidePanelOpen:!1,selectedRightSidePanel:"",selectedLeftSidePanel:"studies",thumbnails:[]}),Le(Ne(n),"retrieveTimepoints",(function(e){p.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}])})),Le(Ne(n),"storeTimepoints",(function(e){return p.a.log.info("storeTimepoints"),Promise.resolve()})),Le(Ne(n),"updateTimepoint",(function(e,t){return p.a.log.info("updateTimepoint"),Promise.resolve()})),Le(Ne(n),"removeTimepoint",(function(e){return p.a.log.info("removeTimepoint"),Promise.resolve()})),Le(Ne(n),"disassociateStudy",(function(e,t){return p.a.log.info("disassociateStudy"),Promise.resolve()})),Le(Ne(n),"onTimepointsUpdated",(function(e){n.props.onTimepointsUpdated&&n.props.onTimepointsUpdated(e)})),Le(Ne(n),"onMeasurementsUpdated",(function(e){n.props.onMeasurementsUpdated&&n.props.onMeasurementsUpdated(e)}));var a=n.props.activeServer,o=Object.assign({},a);return p.a.measurements.MeasurementApi.setConfiguration({dataExchange:{retrieve:d.a.retrieveMeasurements,store:d.a.storeMeasurements},server:o}),p.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&&Me(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=p.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"]);var c=this.props.viewports[this.props.activeViewportIndex],l=c?c.displaySetInstanceUID:void 0;this.setState({thumbnails:Ge(t,l)})}}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.studies,r=t.isStudyLoaded,i=t.activeViewportIndex,a=t.viewports[i],o=a?a.displaySetInstanceUID:void 0,s=e.viewports[e.activeViewportIndex],u=s?s.displaySetInstanceUID:void 0;if(n===e.studies&&i===e.activeViewportIndex&&o===u||this.setState({thumbnails:Ge(n,o)}),r&&r!==e.isStudyLoaded){var c=n[0]&&n[0].PatientID,l=this.currentTimepointId;this.timepointApi.retrieveTimepoints({PatientID:c}),this.measurementApi.retrieveMeasurements(c,[l])}}},{key:"_getActiveViewport",value:function(){return this.props.viewports[this.props.activeViewportIndex]}},{key:"render",value:function(){var e,t,n=this;return b.c.modules[f.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(ke.a.Consumer,null,(function(e){return a.a.createElement(Ce.a.Consumer,null,(function(t){return a.a.createElement(R.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(je,{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(je,{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(je,{context:"ViewerMain"},a.a.createElement(De,{studies:this.props.studies,isStudyLoaded:this.props.isStudyLoaded}))),a.a.createElement(je,{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})))))}}])&&Ae(n.prototype,r),i&&Ae(n,i),t}(i.Component);Le(qe,"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 Fe=Object(l.T)(qe),Be=function(){var e,t=(e=regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,u,c,l,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.inconsistencyWarnings){e.next=2;break}return e.abrupt("return",t.inconsistencyWarnings);case 2:if(r=[],"SEG"===t.Modality){e.next=8;break}t.reconstructionIssues&&0!==t.reconstructionIssues.length&&(t.reconstructionIssues.forEach((function(e){switch(e){case Re.a.DATASET_4D:r.push("The dataset is 4D.");break;case Re.a.VARYING_IMAGESDIMENSIONS:r.push("The dataset frames have different dimensions (rows, columns).");break;case Re.a.VARYING_IMAGESCOMPONENTS:r.push("The dataset frames have different components (Sample per pixel).");break;case Re.a.VARYING_IMAGESORIENTATION:r.push("The dataset frames have different orientation.");break;case Re.a.IRREGULAR_SPACING:r.push("The dataset frames have different pixel spacing.");break;case Re.a.MULTIFFRAMES:r.push("The dataset is a multiframes.")}})),r.push("The datasets is not a reconstructable 3D volume. MPR mode is not available.")),t.missingFrames&&(!t.reconstructionIssues||t.reconstructionIssues&&!t.reconstructionIssues.find((function(e){return e===Re.a.DATASET_4D})))&&r.push("The datasets is missing frames: "+t.missingFrames+"."),e.next=33;break;case 8:if(i=t.metadata){e.next=12;break}return t.inconsistencyWarnings=r,e.abrupt("return",r);case 12:if(a=t.getSourceDisplaySet(n,!1),o=a.referencedDisplaySet){e.next=16;break}return t.inconsistencyWarnings=r,e.abrupt("return",r);case 16:if((s=o.images.map((function(e){return e.getImageId()})))&&0!==s.length){e.next=20;break}return t.inconsistencyWarnings=r,e.abrupt("return",r);case 20:u=function(e,t){var n=i.PerFrameFunctionalGroupsSequence[e];if(!n)return"continue";var a=void 0;if(i.SourceImageSequence?a=i.SourceImageSequence[e]:n.DerivationImageSequence&&(a=n.DerivationImageSequence.SourceImageSequence),!a)return 0===r.length&&r.push("The segmentation has frames out of plane respect to the source images."),"continue";var o=a.ReferencedSOPInstanceUID,u=s.find((function(e){var t=cornerstone.metaData.get("sopCommonModule",e);if(t)return t.sopInstanceUID===o}));if(!u)return"continue";var c=cornerstone.metaData.get("instance",u);return i.Rows!==c.Rows||i.Columns!==c.Columns?(r.push("The segmentation has frames with different geometry dimensions (Rows and Columns) respect to the source images."),"break"):void 0},c=0,l=i.PerFrameFunctionalGroupsSequence.length;case 22:if(!(c<l)){e.next=32;break}p=u(c,l),e.t0=p,e.next="continue"===e.t0?27:"break"===e.t0?28:29;break;case 27:return e.abrupt("continue",29);case 28:return e.abrupt("break",32);case 29:++c,e.next=22;break;case 32:0!==r.length&&r.push("The segmentation format is not supported yet. The segmentation data (segments) could not be loaded.");case 33:return t.inconsistencyWarnings=r,e.abrupt("return",r);case 35: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){Ue(a,r,i,o,s,"next",e)}function s(e){Ue(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(e,n){return t.apply(this,arguments)}}(),Ge=function(e,t){return e.map((function(n){return{StudyInstanceUID:n.StudyInstanceUID,thumbnails:n.displaySets.map((function(n){var r,i,a=n.displaySetInstanceUID,o=n.SeriesDescription,s=n.InstanceNumber,u=n.numImageFrames,c=n.SeriesNumber;if(n.Modality&&"SEG"===n.Modality)i="SEG";else if(n.images&&n.images.length){var l=Math.floor(n.images.length/2);r=n.images[l].getImageId()}else i=n.Modality?n.Modality:"UN";var p=Be(n,e);return{active:function(e,t,n){var r=!1,i=e.displaySetInstanceUID;if("SEG"!==e.Modality&&"RTSTRUCT"!==e.Modality&&"RTDOSE"!==e.Modality)r=n===i;else if(e.getSourceDisplaySet)if("SEG"===e.Modality){var a=e.getSourceDisplaySet(t,!1).referencedDisplaySet;r=!!a&&n===a.displaySetInstanceUID}else{var o=e.getSourceDisplaySet(t,!1);r=!!o&&n===o.displaySetInstanceUID}return r}(n,e,t),imageId:r,altImageText:i,displaySetInstanceUID:a,SeriesDescription:o,InstanceNumber:s,numImageFrames:u,SeriesNumber:c,hasWarnings:p}}))}}))},We=p.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))}}}))(Fe);t.a=ze},1031:function(e,t,n){},1032:function(e,t,n){},1033:function(e,t,n){},1034:function(e,t,n){},1035:function(e,t){},1036:function(e,t,n){},1037:function(e,t,n){},1038:function(e,t,n){},1047:function(e,t,n){"use strict";var r=n(57),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(30);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 x(e,t){return(x=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 j=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&&x(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 R(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 k(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){R(a,r,i,o,s,"next",e)}function s(e){R(a,r,i,o,s,"throw",e)}o(void 0)}))}}n.d(t,"a",(function(){return U}));var C=function(){var e=k(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 j(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 U(e){return V.apply(this,arguments)}function V(){return(V=k(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(C),e.next=3,Promise.all(n);case 3:return r=e.sent,e.abrupt("return",j.groupSeries(r.flat()));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},1054:function(e,t){},1055:function(e,t){},1083:function(e,t,n){}}]);
  //# sourceMappingURL=ViewerLocalFileData.bundle.9d0ebc24779a9fd02142.js.map