text: /*! cornerstone-wado-image-loader - 2.2.4 - 2019-09-05 | (c) 2016 Chris Hafey | https://github.com/cornerstonejs/cornerstoneWADOImageLoader */
  !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cornerstoneWADOImageLoader",[],t):"object"==typeof exports?exports.cornerstoneWADOImageLoader=t():e.cornerstoneWADOImageLoader=t()}(this,function(){return function(r){var a={};function n(e){if(a[e])return a[e].exports;var t=a[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}return n.m=r,n.c=a,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(e,t,r){"use strict";t.a=function(e){for(var t,r=e[0],a=e[0],n=e.length,o=1;o<n;o++)t=e[o],r=Math.min(r,t),a=Math.max(a,t);return{min:r,max:a}}},function(e,t,r){"use strict";var m;function a(){if("undefined"==typeof CharLS)throw new Error("No JPEG-LS decoder loaded");if(!(m||(m=CharLS())&&m._jpegls_decode))throw new Error("JPEG-LS failed to initialize")}r.d(t,"b",function(){return a}),t.a=function(e,t){a();var r=function(e,t){var r=m._malloc(e.length);m.writeArrayToMemory(e,r);var a=m._malloc(4),n=m._malloc(4),o=m._malloc(4),i=m._malloc(4),l=m._malloc(4),s=m._malloc(4),u=m._malloc(4),c=m._malloc(4),f=m._malloc(4),d={result:m.ccall("jpegls_decode","number",["number","number","number","number","number","number","number","number","number","number","number"],[r,e.length,a,n,o,i,l,s,c,u,f]),width:m.getValue(o,"i32"),height:m.getValue(i,"i32"),bitsPerSample:m.getValue(l,"i32"),stride:m.getValue(s,"i32"),components:m.getValue(c,"i32"),allowedLossyError:m.getValue(u,"i32"),interleaveMode:m.getValue(f,"i32"),pixelData:void 0},p=m.getValue(a,"*");return d.bitsPerSample<=8?(d.pixelData=new Uint8Array(d.width*d.height*d.components),d.pixelData.set(new Uint8Array(m.HEAP8.buffer,p,d.pixelData.length))):t?(d.pixelData=new Int16Array(d.width*d.height*d.components),d.pixelData.set(new Int16Array(m.HEAP16.buffer,p,d.pixelData.length))):(d.pixelData=new Uint16Array(d.width*d.height*d.components),d.pixelData.set(new Uint16Array(m.HEAP16.buffer,p,d.pixelData.length))),m._free(r),m._free(p),m._free(a),m._free(n),m._free(o),m._free(i),m._free(l),m._free(s),m._free(c),m._free(f),d}(t,1===e.pixelRepresentation);if(0!==r.result&&6!==r.result)throw new Error("JPEG-LS decoder failed to decode frame (error code ".concat(r.result,")"));return e.columns=r.width,e.rows=r.height,e.pixelData=r.pixelData,e}},function(e,t,r){"use strict";var h;function n(e,t){var r=function(e,t,r){var a=h._malloc(e.length);h.writeArrayToMemory(e,a);var n=h._malloc(4),o=h._malloc(4),i=h._malloc(4),l=h._malloc(4),s=h._malloc(4),u=(new Date).getTime();if(0!==h.ccall("jp2_decode","number",["number","number","number","number","number","number","number"],[a,e.length,n,o,i,l,s]))return console.log("[opj_decode] decoding failed!"),h._free(a),h._free(h.getValue(n,"*")),h._free(i),h._free(l),h._free(o),void h._free(s);var c=h.getValue(n,"*"),f={length:h.getValue(o,"i32"),sx:h.getValue(i,"i32"),sy:h.getValue(l,"i32"),nbChannels:h.getValue(s,"i32"),perf_timetodecode:void 0,pixelData:void 0},d=f.sx*f.sy*f.nbChannels,p=new Int32Array(h.HEAP32.buffer,c,d);if(1===t)if(Uint8Array.from)f.pixelData=Uint8Array.from(p);else{f.pixelData=new Uint8Array(d);for(var m=0;m<d;m++)f.pixelData[m]=p[m]}else if(r)if(Int16Array.from)f.pixelData=Int16Array.from(p);else{f.pixelData=new Int16Array(d);for(var g=0;g<d;g++)f.pixelData[g]=p[g]}else if(Uint16Array.from)f.pixelData=Uint16Array.from(p);else{f.pixelData=new Uint16Array(d);for(var v=0;v<d;v++)f.pixelData[v]=p[v]}var x=(new Date).getTime();return f.perf_timetodecode=x-u,h._free(a),h._free(n),h._free(c),h._free(o),h._free(i),h._free(l),h._free(s),f}(t,e.bitsAllocated<=8?1:2,1===e.pixelRepresentation);return e.columns=r.sx,e.rows=r.sy,e.pixelData=r.pixelData,1<r.nbChannels&&(e.photometricInterpretation="RGB"),e}function o(e){if(!e.usePDFJS&&"undefined"==typeof OpenJPEG)throw new Error("OpenJPEG decoder not loaded");if(!(h||(h=OpenJPEG())&&h._jp2_decode))throw new Error("OpenJPEG failed to initialize")}r.d(t,"b",function(){return o}),t.a=function(e,t,r){var a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};return o(r),a.usePDFJS||r.usePDFJS?function(e,t){var r=new JpxImage;r.parse(t);var a=r.tiles.length;if(1!==a)throw new Error("JPEG2000 decoder returned a tileCount of ".concat(a,", when 1 is expected"));return e.columns=r.width,e.rows=r.height,e.pixelData=r.tiles[0].items,e}(e,t):n(e,t)}},function(e,t,r){"use strict";t.a="2.2.4"},function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n=r(0);function a(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=Object(n.a)(e.pixelData),a=!(o(e.smallestPixelValue)&&o(e.largestPixelValue));!0!==t||a?(e.smallestPixelValue=r.min,e.largestPixelValue=r.max):(e.smallestPixelValue!==r.min&&console.warn("Image smallestPixelValue tag is incorrect. Rendering performance will suffer considerably."),e.largestPixelValue!==r.max&&console.warn("Image largestPixelValue tag is incorrect. Rendering performance will suffer considerably."))}function o(e){return"number"==typeof e}},function(e,t,r){"use strict";var c=function(e,t){var r=t.buffer,a=t.byteOffset,n=t.length;return 16===e.bitsAllocated?(a%2&&(r=r.slice(a),a=0),0===e.pixelRepresentation?e.pixelData=new Uint16Array(r,a,n/2):e.pixelData=new Int16Array(r,a,n/2)):8===e.bitsAllocated||1===e.bitsAllocated?e.pixelData=t:32===e.bitsAllocated&&(a%2&&(r=r.slice(a),a=0),e.pixelData=new Float32Array(r,a,n/4)),e};var f=function(e,t){if(16===e.bitsAllocated){var r=t.buffer,a=t.byteOffset,n=t.length;a%2&&(r=r.slice(a),a=0),0===e.pixelRepresentation?e.pixelData=new Uint16Array(r,a,n/2):e.pixelData=new Int16Array(r,a,n/2);for(var o=0;o<e.pixelData.length;o++)e.pixelData[o]=(255&(i=e.pixelData[o]))<<8|i>>8&255}else 8===e.bitsAllocated&&(e.pixelData=t);var i;return e};var d=function(e,t){if(8===e.bitsAllocated)return e.planarConfiguration?function(e,t){for(var r=t,a=e.rows*e.columns,n=new ArrayBuffer(a*e.samplesPerPixel),o=new DataView(r.buffer,r.byteOffset),i=new Int8Array(r.buffer,r.byteOffset),l=new Int8Array(n),s=0,u=o.getInt32(0,!0),c=0;c<u;++c){s=c*a;var f=o.getInt32(4*(c+1),!0),d=o.getInt32(4*(c+2),!0);0===d&&(d=r.length);for(var p=a*u;f<d;){var m=i[f++];if(0<=m&&m<=127)for(var g=0;g<m+1&&s<p;++g)l[s]=i[f++],s++;else if(m<=-1&&-127<=m)for(var v=i[f++],x=0;x<1-m&&s<p;++x)l[s]=v,s++}}return e.pixelData=new Uint8Array(n),e}(e,t):function(e,t){for(var r=t,a=e.rows*e.columns,n=new ArrayBuffer(a*e.samplesPerPixel),o=new DataView(r.buffer,r.byteOffset),i=new Int8Array(r.buffer,r.byteOffset),l=new Int8Array(n),s=0,u=o.getInt32(0,!0),c=0;c<u;++c){s=c;var f=o.getInt32(4*(c+1),!0),d=o.getInt32(4*(c+2),!0);0===d&&(d=r.length);for(var p=a*u;f<d;){var m=i[f++];if(0<=m&&m<=127)for(var g=0;g<m+1&&s<p;++g)l[s]=i[f++],s+=e.samplesPerPixel;else if(m<=-1&&-127<=m)for(var v=i[f++],x=0;x<1-m&&s<p;++x)l[s]=v,s+=e.samplesPerPixel}}return e.pixelData=new Uint8Array(n),e}(e,t);if(16===e.bitsAllocated)return function(e,t){for(var r=t,a=e.rows*e.columns,n=new ArrayBuffer(a*e.samplesPerPixel*2),o=new DataView(r.buffer,r.byteOffset),i=new Int8Array(r.buffer,r.byteOffset),l=new Int8Array(n),s=o.getInt32(0,!0),u=0;u<s;++u){var c=0,f=0===u?1:0,d=o.getInt32(4*(u+1),!0),p=o.getInt32(4*(u+2),!0);for(0===p&&(p=r.length);d<p;){var m=i[d++];if(0<=m&&m<=127)for(var g=0;g<m+1&&c<a;++g)l[2*c+f]=i[d++],c++;else if(m<=-1&&-127<=m)for(var v=i[d++],x=0;x<1-m&&c<a;++x)l[2*c+f]=v,c++}}return 0===e.pixelRepresentation?e.pixelData=new Uint16Array(n):e.pixelData=new Int16Array(n),e}(e,t);throw new Error("unsupported pixel format for RLE")};var p=function(e,t){if("undefined"==typeof JpegImage)throw new Error("No JPEG Baseline decoder loaded");var r=new JpegImage;return r.parse(t),r.colorTransform=!1,8===e.bitsAllocated?(e.pixelData=r.getData(e.columns,e.rows),e):16===e.bitsAllocated?(e.pixelData=r.getData16(e.columns,e.rows),e):void 0};var m=function(e,t){if("undefined"==typeof jpeg||void 0===jpeg.lossless||void 0===jpeg.lossless.Decoder)throw new Error("No JPEG Lossless decoder loaded");var r=e.bitsAllocated<=8?1:2,a=t.buffer,n=(new jpeg.lossless.Decoder).decode(a,t.byteOffset,t.length,r);return 0===e.pixelRepresentation?16===e.bitsAllocated?e.pixelData=new Uint16Array(n.buffer):e.pixelData=new Uint8Array(n.buffer):e.pixelData=new Int16Array(n.buffer),e},g=r(1),v=r(2);t.a=function(e,t,r,a,n){var o=(new Date).getTime();if("1.2.840.10008.1.2"===t)e=c(e,r);else if("1.2.840.10008.1.2.1"===t)e=c(e,r);else if("1.2.840.10008.1.2.2"===t)e=f(e,r);else if("1.2.840.10008.1.2.1.99"===t)e=c(e,r);else if("1.2.840.10008.1.2.5"===t)e=d(e,r);else if("1.2.840.10008.1.2.4.50"===t)e=p(e,r);else if("1.2.840.10008.1.2.4.51"===t)e=p(e,r);else if("1.2.840.10008.1.2.4.57"===t)e=m(e,r);else if("1.2.840.10008.1.2.4.70"===t)e=m(e,r);else if("1.2.840.10008.1.2.4.80"===t)e=Object(g.a)(e,r);else if("1.2.840.10008.1.2.4.81"===t)e=Object(g.a)(e,r);else if("1.2.840.10008.1.2.4.90"===t)e=Object(v.a)(e,r,a,n);else{if("1.2.840.10008.1.2.4.91"!==t)throw new Error("no decoder for transfer syntax ".concat(t));e=Object(v.a)(e,r,a,n)}var i=void 0!==e.pixelRepresentation&&1===e.pixelRepresentation,l=i&&void 0!==e.bitsStored?32-e.bitsStored:void 0;if(i&&void 0!==l)for(var s=0;s<e.pixelData.length;s++)e.pixelData[s]=e.pixelData[s]<<l>>l;var u=(new Date).getTime();return e.decodeTimeInMS=u-o,e}},function(e,t,r){"use strict";r.r(t);var a=function(e,t){if(void 0===e)throw new Error("decodeRGB: rgbBuffer must not be undefined");if(e.length%3!=0)throw new Error("decodeRGB: rgbBuffer length must be divisible by 3");for(var r=e.length/3,a=0,n=0,o=0;o<r;o++)t[n++]=e[a++],t[n++]=e[a++],t[n++]=e[a++],t[n++]=255},n=function(e,t){if(void 0===e)throw new Error("decodeRGB: rgbBuffer must not be undefined");if(e.length%3!=0)throw new Error("decodeRGB: rgbBuffer length must be divisible by 3");for(var r=e.length/3,a=0,n=0,o=r,i=2*r,l=0;l<r;l++)t[a++]=e[n++],t[a++]=e[o++],t[a++]=e[i++],t[a++]=255},o=function(e,t){if(void 0===e)throw new Error("decodeRGB: ybrBuffer must not be undefined");if(e.length%3!=0)throw new Error("decodeRGB: ybrBuffer length must be divisble by 3");for(var r=e.length/3,a=0,n=0,o=0;o<r;o++){var i=e[a++],l=e[a++],s=e[a++];t[n++]=i+1.402*(s-128),t[n++]=i-.34414*(l-128)-.71414*(s-128),t[n++]=i+1.772*(l-128),t[n++]=255}},i=function(e,t){if(void 0===e)throw new Error("decodeRGB: ybrBuffer must not be undefined");if(e.length%3!=0)throw new Error("decodeRGB: ybrBuffer length must be divisble by 3");for(var r=e.length/3,a=0,n=0,o=r,i=2*r,l=0;l<r;l++){var s=e[n++],u=e[o++],c=e[i++];t[a++]=s+1.402*(c-128),t[a++]=s-.34414*(u-128)-.71414*(c-128),t[a++]=s+1.772*(u-128),t[a++]=255}};function x(e,t){for(var r=e.length,a=new Uint8ClampedArray(r),n=0;n<r;++n)a[n]=e[n]>>t;return a}var l=function(e,t){for(var r=e.columns*e.rows,a=e.pixelData,n=e.redPaletteColorLookupTableData,o=e.greenPaletteColorLookupTableData,i=e.bluePaletteColorLookupTableData,l=e.redPaletteColorLookupTableData.length,s=0,u=0,c=e.redPaletteColorLookupTableDescriptor[1],f=8===e.redPaletteColorLookupTableDescriptor[2]?0:8,d=x(n,f),p=x(o,f),m=x(i,f),g=0;g<r;++g){var v=a[s++];v<c?v=0:c+l-1<v?v=l-1:v-=c,t[u++]=d[v],t[u++]=p[v],t[u++]=m[v],t[u++]=255}};function s(e,t){if(e.elements[t]&&6===e.elements[t].length)return[e.uint16(t,0),e.uint16(t,1),e.uint16(t,2)]}function u(e,t,r){for(var a=[],n=e.elements[t],o=0;o<r[0];o++)16===r[2]?a[o]=e.uint16(t,o):a[o]=e.byteArray[o+n.dataOffset];return a}var g=function(e){var t,r,a,n={samplesPerPixel:e.uint16("x00280002"),photometricInterpretation:e.string("x00280004"),rows:e.uint16("x00280010"),columns:e.uint16("x00280011"),bitsAllocated:e.uint16("x00280100"),bitsStored:e.uint16("x00280101"),highBit:e.uint16("x00280102"),pixelRepresentation:e.uint16("x00280103"),planarConfiguration:e.uint16("x00280006"),pixelAspectRatio:e.string("x00280034")};return r=n,a=(t=e).uint16("x00280103"),r.largestPixelValue=0===a?(r.smallestPixelValue=t.uint16("x00280106"),t.uint16("x00280107")):(r.smallestPixelValue=t.int16("x00280106"),t.int16("x00280107")),"PALETTE COLOR"===n.photometricInterpretation&&e.elements.x00281101&&function(e,t){t.redPaletteColorLookupTableDescriptor=s(e,"x00281101"),t.greenPaletteColorLookupTableDescriptor=s(e,"x00281102"),t.bluePaletteColorLookupTableDescriptor=s(e,"x00281103"),0===t.redPaletteColorLookupTableDescriptor[0]&&(t.redPaletteColorLookupTableDescriptor[0]=65536,t.greenPaletteColorLookupTableDescriptor[0]=65536,t.bluePaletteColorLookupTableDescriptor[0]=65536);var r=t.redPaletteColorLookupTableDescriptor[0],a=e.elements.x00281201.length===r?8:16;t.redPaletteColorLookupTableDescriptor[2]!==a&&(t.redPaletteColorLookupTableDescriptor[2]=a,t.greenPaletteColorLookupTableDescriptor[2]=a,t.bluePaletteColorLookupTableDescriptor[2]=a),t.redPaletteColorLookupTableData=u(e,"x00281201",t.redPaletteColorLookupTableDescriptor),t.greenPaletteColorLookupTableData=u(e,"x00281202",t.greenPaletteColorLookupTableDescriptor),t.bluePaletteColorLookupTableData=u(e,"x00281203",t.bluePaletteColorLookupTableDescriptor)}(e,n),n};function c(e,t){var r=t.uint16("x00283002",0);0===r&&(r=65535);for(var a={id:"1",firstValueMapped:0===e?t.uint16("x00283002",1):t.int16("x00283002",1),numBitsPerEntry:t.uint16("x00283002",2),lut:[]},n=0;n<r;n++)a.lut[n]=0===e?t.uint16("x00283006",n):t.int16("x00283006",n);return a}var v=function(e,t){if(t&&t.items.length){for(var r=[],a=0;a<t.items.length;a++){var n=c(e,t.items[a].dataSet);n&&r.push(n)}return r}};var h=function(e){var t=e.string("x00080016");if("1.2.840.10008.5.1.4.1.1.2"===t||"1.2.840.10008.5.1.4.1.1.2.1"===t)return 1;var r,a,n,o=e.floatString("x00281052"),i=e.floatString("x00281053");return void 0===o||void 0===i?e.elements.x00283000&&0<e.elements.x00283000.length?0:e.uint16("x00280103"):(a=(r=e).uint16("x00280103"),n=r.uint16("x00280101"),(0===a?0:-1<<n-1)*i+o<0?1:0)};var w=function(e,t,r){var a=[],n=e.string(t);if(n){var o=n.split("\\");if(!(r&&o.length<r)){for(var i=0;i<o.length;i++)a.push(parseFloat(o[i]));return a}}};var d=function(e,t,r){return t=t||0,e&&e.Value?e.Value.length<=t?r:e.Value[t]:r};var f=function(e,t,r){var a=d(e,t,r);if(void 0!==a)return parseFloat(a)};var p=function(e,t){var r=d(e,t);if(void 0!==r)return parseFloat(r)};var m=function(e,t){if(e&&e.Value&&!(t&&e.Value.length<t)){for(var r=[],a=0;a<e.Value.length;a++)r.push(parseFloat(e.Value[a]));return r}},b=[];var y={add:function(e,t){b[e]=t},get:function(e){return b[e]},remove:function(e){b[e]=void 0},purge:function(){b=[]}};var P=function(e,t){var r=fe.dicomParser,a=y.get(t);if(a){if("generalSeriesModule"===e)return{modality:d(a["00080060"]),seriesInstanceUID:d(a["0020000e"]),seriesNumber:p(a["00200011"]),studyInstanceUID:d(a["0020000d"]),seriesDate:r.parseDA(d(a["00080021"])),seriesTime:r.parseTM(d(a["00080031"],0,""))};if("patientStudyModule"===e)return{patientAge:p(a["00101010"]),patientSize:p(a["00101020"]),patientWeight:p(a["00101030"])};if("imagePlaneModule"===e){var n=m(a["00200037"],6),o=m(a["00200032"],3),i=m(a["00280030"],2),l=null,s=null;i&&(s=i[0],l=i[1]);var u=null,c=null;return n&&(u=[parseFloat(n[0]),parseFloat(n[1]),parseFloat(n[2])],c=[parseFloat(n[3]),parseFloat(n[4]),parseFloat(n[5])]),{frameOfReferenceUID:d(a["00200052"]),rows:p(a["00280010"]),columns:p(a["00280011"]),imageOrientationPatient:n,rowCosines:u,columnCosines:c,imagePositionPatient:o,sliceThickness:p(a["00180050"]),sliceLocation:p(a["00201041"]),pixelSpacing:i,rowPixelSpacing:s,columnPixelSpacing:l}}if("imagePixelModule"===e)return{samplesPerPixel:p(a["00280002"]),photometricInterpretation:d(a["00280004"]),rows:p(a["00280010"]),columns:p(a["00280011"]),bitsAllocated:p(a["00280100"]),bitsStored:p(a["00280101"]),highBit:d(a["00280102"]),pixelRepresentation:p(a["00280103"]),planarConfiguration:p(a["00280006"]),pixelAspectRatio:d(a["00280034"]),smallestPixelValue:p(a["00280106"]),largestPixelValue:p(a["00280107"]),redPaletteColorLookupTableDescriptor:m(a["00281101"]),greenPaletteColorLookupTableDescriptor:m(a["00281102"]),bluePaletteColorLookupTableDescriptor:m(a["00281103"]),redPaletteColorLookupTableData:m(a["00281201"]),greenPaletteColorLookupTableData:m(a["00281202"]),bluePaletteColorLookupTableData:m(a["00281203"])};if("voiLutModule"===e)return{windowCenter:m(a["00281050"],1),windowWidth:m(a["00281051"],1)};if("modalityLutModule"===e)return{rescaleIntercept:p(a["00281052"]),rescaleSlope:p(a["00281053"]),rescaleType:d(a["00281054"])};if("sopCommonModule"===e)return{sopClassUID:d(a["00080016"]),sopInstanceUID:d(a["00080018"])};if("petIsotopeModule"===e){var f=d(a["00540016"]);if(void 0===f)return;return{radiopharmaceuticalInfo:{radiopharmaceuticalStartTime:r.parseTM(d(f["00181072"],0,"")),radionuclideTotalDose:p(f["00181074"]),radionuclideHalfLife:p(f["00181075"])}}}}};function D(e,t,r){if(r+e.length>t.length)return!1;for(var a=r,n=0;n<e.length;n++)if(e[n]!==t[a++])return!1;return!0}var I=function(e,t,r){r=r||0;for(var a=function(e){for(var t=new Uint8Array(e.length),r=0,a=e.length;r<a;r++)t[r]=e.charCodeAt(r);return t}(t),n=r;n<e.length;n++)if(a[0]===e[n]&&D(a,e,n))return n;return-1},T={beforeSend:function(){},imageCreated:function(){},strict:!1,useWebWorkers:!0,decodeConfig:{usePDFJS:!1}};function C(e){T=Object.assign(T,e)}function k(){return T}var A=function(o,i){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},l=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},s=fe.cornerstone,u=k();return new Promise(function(t,r){var a=new XMLHttpRequest;a.open("get",o,!0),a.responseType="arraybuffer",u.beforeSend(a,i,n,l),Object.keys(n).forEach(function(e){a.setRequestHeader(e,n[e])}),l.deferred={resolve:t,reject:r},l.url=o,l.imageId=i,a.onloadstart=function(e){u.onloadstart&&u.onloadstart(e,l);var t={url:o,imageId:i};s.triggerEvent(s.events,"cornerstoneimageloadstart",t)},a.onloadend=function(e){u.onloadend&&u.onloadend(e,l);var t={url:o,imageId:i};s.triggerEvent(s.events,"cornerstoneimageloadend",t)},a.onreadystatechange=function(e){u.onreadystatechange?u.onreadystatechange(e,l):4===a.readyState&&(200===a.status?t(a.response,a):r(a))},a.onprogress=function(e){var t,r,a=e.loaded;e.lengthComputable&&(t=e.total,r=Math.round(a/t*100)),u.onprogress&&u.onprogress(e,l);var n={url:o,imageId:i,loaded:a,total:t,percentComplete:r};s.triggerEvent(s.events,"cornerstoneimageloadprogress",n)},a.onerror=function(){r(a)},a.onabort=function(){r(a)},a.send()})},L={xhrRequest:A,setOptions:C,getOptions:k};var S=function(e,t){var r={accept:2<arguments.length&&void 0!==arguments[2]?arguments[2]:"application/octet-stream"};return new Promise(function(s,u){A(e,t,r).then(function(e){var t=new Uint8Array(e),r=I(t,"\r\n\r\n");-1===r&&u(new Error("invalid response - no multipart mime header"));var a=function(e,t,r){t=t||0,r=r||e.length-t;for(var a="",n=t;n<t+r;n++)a+=String.fromCharCode(e[n]);return a}(t,0,r).split("\r\n"),n=function(e){for(var t=0;t<e.length;t++)if("--"===e[t].substr(0,2))return e[t]}(a);n||u(new Error("invalid response - no boundary marker"));var o=r+4,i=I(t,n,o);-1===i&&u(new Error("invalid response - terminating boundary not found"));var l=i-o-2;s({contentType:function(e){for(var t=0;t<e.length;t++)if("Content-Type:"===e[t].substr(0,13))return e[t].substr(13).trim()}(a),imageFrame:{pixelData:new Uint8Array(e,o,l)}})},u)})};var E,O=function(e){var t=fe.cornerstone.metaData.get("imagePixelModule",e);return{samplesPerPixel:t.samplesPerPixel,photometricInterpretation:t.photometricInterpretation,planarConfiguration:t.planarConfiguration,rows:t.rows,columns:t.columns,bitsAllocated:t.bitsAllocated,bitsStored:t.bitsStored,pixelRepresentation:t.pixelRepresentation,smallestPixelValue:t.smallestPixelValue,largestPixelValue:t.largestPixelValue,redPaletteColorLookupTableDescriptor:t.redPaletteColorLookupTableDescriptor,greenPaletteColorLookupTableDescriptor:t.greenPaletteColorLookupTableDescriptor,bluePaletteColorLookupTableDescriptor:t.bluePaletteColorLookupTableDescriptor,redPaletteColorLookupTableData:t.redPaletteColorLookupTableData,greenPaletteColorLookupTableData:t.greenPaletteColorLookupTableData,bluePaletteColorLookupTableData:t.bluePaletteColorLookupTableData,pixelData:void 0}},M=0,B=[],R=[],_=k(),W={maxWebWorkers:navigator.hardwareConcurrency||1,startWebWorkersOnDemand:!0,webWorkerPath:"../../dist/cornerstoneWADOImageLoaderWebWorker.js",webWorkerTaskPaths:[],taskConfiguration:{decodeTask:{loadCodecsOnStartup:!0,initializeCodecsOnStartup:!1,codecsPath:"../dist/cornerstoneWADOImageLoaderCodecs.js",usePDFJS:!1,strict:_.strict}}},U={maxWebWorkers:0,numWebWorkers:0,numTasksQueued:0,numTasksExecuting:0,numTasksCompleted:0,totalTaskTimeInMS:0,totalTimeDelayedInMS:0};function V(){if(B.length){for(var e=0;e<R.length;e++)if("ready"===R[e].status){R[e].status="busy";var t=B.shift();t.start=(new Date).getTime();var r=(new Date).getTime();return U.totalTimeDelayedInMS+=r-t.added,R[e].task=t,R[e].worker.postMessage({taskType:t.taskType,workerIndex:e,data:t.data},t.transferList),void U.numTasksExecuting++}R.length<E.maxWebWorkers&&j()}}function F(e){if("initialize"===e.data.taskType)R[e.data.workerIndex].status="ready",V();else{var t=R[e.data.workerIndex].task.start;R[e.data.workerIndex].task.deferred.resolve(e.data.result),R[e.data.workerIndex].task=void 0,U.numTasksExecuting--,R[e.data.workerIndex].status="ready",U.numTasksCompleted++;var r=(new Date).getTime();U.totalTaskTimeInMS+=r-t,V()}}function j(){if(!(R.length>=E.maxWebWorkers)){var e=new Worker(E.webWorkerPath);R.push({worker:e,status:"initializing"}),e.addEventListener("message",F),e.postMessage({taskType:"initialize",workerIndex:R.length-1,config:E})}}function G(e){if(e=e||W,E)throw new Error("WebWorkerManager already initialized");if((E=e).maxWebWorkers=E.maxWebWorkers||navigator.hardwareConcurrency||1,!E.startWebWorkersOnDemand)for(var t=0;t<E.maxWebWorkers;t++)j()}var J={initialize:G,loadWebWorkerTask:function(e,t){E.webWorkerTaskPaths.push(e),t&&(E.taskConfiguration=Object.assign(E.taskConfiguration,t));for(var r=0;r<R.length;r++)R[r].worker.postMessage({taskType:"loadWebWorkerTask",workerIndex:R.length-1,sourcePath:e,config:E})},addTask:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,a=3<arguments.length?arguments[3]:void 0;E||G();var n,o={},i=new Promise(function(e,t){o={resolve:e,reject:t}});for(n=0;n<B.length&&!(B[n].priority<r);n++);var l=M++;return B.splice(n,0,{taskId:l,taskType:e,status:"ready",added:(new Date).getTime(),data:t,deferred:o,priority:r,transferList:a}),V(),{taskId:l,promise:i}},getStatistics:function(){return U.maxWebWorkers=E.maxWebWorkers,U.numWebWorkers=R.length,U.numTasksQueued=B.length,U},setTaskPriority:function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=0;r<B.length;r++)if(B[r].taskId===e){var a=B.splice(r,1)[0];for(a.priority=t,r=0;r<B.length&&!(B[r].priority<t);r++);return B.splice(r,0,a),!0}return!1},cancelTask:function(e,t){for(var r=0;r<B.length;r++)if(B[r].taskId===e)return B.splice(r,1).deferred.reject(t),!0;return!1}},z=r(0);function q(e){return function(t){var r;try{return decodeURIComponent(escape(t))}catch(e){if((r=e)instanceof URIError)return t;throw r}}(String.fromCharCode.apply(null,Array.prototype.slice.apply(new Uint8Array(e))))}var Y=function(i,e,l){var s=(new Date).getTime(),r=new Blob([e],{type:"image/jpeg"});return new Promise(function(o,t){var e=new FileReader;void 0===e.readAsBinaryString?e.readAsArrayBuffer(r):e.readAsBinaryString(r),e.onload=function(){var n=new Image;n.onload=function(){l.height=n.height,l.width=n.width,i.rows=n.height,i.columns=n.width;var e=l.getContext("2d");e.drawImage(this,0,0);var t=e.getImageData(0,0,n.width,n.height),r=(new Date).getTime();i.pixelData=t.data,i.imageData=t,i.decodeTimeInMS=r-s;var a=Object(z.a)(i.pixelData);i.smallestPixelValue=a.min,i.largestPixelValue=a.max,o(i)},n.onerror=function(e){t(e)},void 0===e.readAsBinaryString?n.src="data:image/jpeg;base64,".concat(window.btoa(q(e.result))):n.src="data:image/jpeg;base64,".concat(window.btoa(e.result))},e.onerror=function(e){t(e)}})},N=r(5),H=r(4),K=r(2),Q=r(1),X=!1;function Z(n,o,i,l){var e=l.priority||void 0,t=l.transferPixelData?[i.buffer]:void 0,r=k(),s=r.strict,u=r.decodeConfig;return!1===r.useWebWorkers?(!1===X&&(Object(K.b)(u),Object(Q.b)(u),X=!0),new Promise(function(e,t){try{var r=[n,o,i,u,l],a=N.a.apply(void 0,r);Object(H.a)(a,s),e(a)}catch(e){t(e)}})):J.addTask("decodeTask",{imageFrame:n,transferSyntax:o,pixelData:i,options:l},e,t).promise}var $=function(e,r,t,a){var n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{};return"1.2.840.10008.1.2"===r?Z(e,r,t,n):"1.2.840.10008.1.2.1"===r?Z(e,r,t,n):"1.2.840.10008.1.2.2"===r?Z(e,r,t,n):"1.2.840.10008.1.2.1.99"===r?Z(e,r,t,n):"1.2.840.10008.1.2.5"===r?Z(e,r,t,n):"1.2.840.10008.1.2.4.50"===r?8!==e.bitsAllocated||3!==e.samplesPerPixel&&4!==e.samplesPerPixel?Z(e,r,t,n):Y(e,t,a):"1.2.840.10008.1.2.4.51"===r?Z(e,r,t,n):"1.2.840.10008.1.2.4.57"===r?Z(e,r,t,n):"1.2.840.10008.1.2.4.70"===r?Z(e,r,t,n):"1.2.840.10008.1.2.4.80"===r?Z(e,r,t,n):"1.2.840.10008.1.2.4.81"===r?Z(e,r,t,n):"1.2.840.10008.1.2.4.90"===r?Z(e,r,t,n):"1.2.840.10008.1.2.4.91"===r?Z(e,r,t,n):new Promise(function(e,t){t(new Error("No decoder for transfer syntax ".concat(r)))})},ee=function(e){return"RGB"===e||"PALETTE COLOR"===e||"YBR_FULL"===e||"YBR_FULL_422"===e||"YBR_PARTIAL_422"===e||"YBR_PARTIAL_420"===e||"YBR_RCT"===e||"YBR_ICT"===e};function te(e,t){0===e.planarConfiguration?a(e.pixelData,t):n(e.pixelData,t)}function re(e,t){var r,a,n=t.data;if("RGB"===e.photometricInterpretation)te(e,n);else if("YBR_RCT"===e.photometricInterpretation)te(e,n);else if("YBR_ICT"===e.photometricInterpretation)te(e,n);else if("PALETTE COLOR"===e.photometricInterpretation)l(e,n);else if("YBR_FULL_422"===e.photometricInterpretation)te(e,n);else{if("YBR_FULL"!==e.photometricInterpretation)throw new Error("No color space conversion for photometric interpretation ".concat(e.photometricInterpretation));a=n,0===(r=e).planarConfiguration?o(r.pixelData,a):i(r.pixelData,a)}}var ae=function(e,t){if(t=t||e.transferSyntax,8===e.bitsAllocated&&"1.2.840.10008.1.2.4.50"===t&&(3===e.samplesPerPixel||4===e.samplesPerPixel))return!0},ne="";var oe=function(v,e,x,t){if(!e||!e.length)return Promise.reject(new Error("The file does not contain image data."));var h=fe.cornerstone,w=document.createElement("canvas"),r=O(v),a=$(r,x,e,w,t);return new Promise(function(g,e){a.then(function(e){var t,r=h.metaData.get("imagePlaneModule",v)||{},a=h.metaData.get("voiLutModule",v)||{},n=h.metaData.get("modalityLutModule",v)||{},o=h.metaData.get("sopCommonModule",v)||{},i=ee(e.photometricInterpretation);if(!ae(e,x)&&(32===(t=e).bitsAllocated?t.pixelData=new Float32Array(t.pixelData):16===t.bitsAllocated?0===t.pixelRepresentation?t.pixelData=new Uint16Array(t.pixelData):t.pixelData=new Int16Array(t.pixelData):t.pixelData=new Uint8Array(t.pixelData),i)){w.height=e.rows,w.width=e.columns;var l=w.getContext("2d").createImageData(e.columns,e.rows);re(e,l),e.imageData=l,e.pixelData=l.data;var s=Object(z.a)(e.pixelData);e.smallestPixelValue=s.min,e.largestPixelValue=s.max}var u,c={imageId:v,color:i,columnPixelSpacing:r.columnPixelSpacing,columns:e.columns,height:e.rows,intercept:n.rescaleIntercept?n.rescaleIntercept:0,invert:"MONOCHROME1"===e.photometricInterpretation,minPixelValue:e.smallestPixelValue,maxPixelValue:e.largestPixelValue,rowPixelSpacing:r.rowPixelSpacing,rows:e.rows,sizeInBytes:e.pixelData.length,slope:n.rescaleSlope?n.rescaleSlope:1,width:e.columns,windowCenter:a.windowCenter?a.windowCenter[0]:void 0,windowWidth:a.windowWidth?a.windowWidth[0]:void 0,decodeTimeInMS:e.decodeTimeInMS,floatPixelData:void 0};if(e.pixelData instanceof Float32Array){var f=e.pixelData,d=function(e){for(var t=Object(z.a)(e),r=Math.abs(t.max-t.min)/65535,a=t.min,n=e.length,o=new Uint16Array(n),i=65535,l=0,s=0;s<n;s++){var u=Math.floor((e[s]-a)/r);o[s]=u,i=Math.min(i,u),l=Math.max(l,u)}return{min:i,max:l,intPixelData:o,slope:r,intercept:a}}(f);c.minPixelValue=d.min,c.maxPixelValue=d.max,c.slope=d.slope,c.intercept=d.intercept,c.floatPixelData=f,c.getPixelData=function(){return d.intPixelData}}else c.getPixelData=function(){return e.pixelData};if(c.color&&(c.getCanvas=function(){return ne===v||(w.height=c.rows,w.width=c.columns,w.getContext("2d").putImageData(e.imageData,0,0),ne=v),w}),n.modalityLUTSequence&&0<n.modalityLUTSequence.length&&"1.2.840.10008.5.1.4.1.1.12.1"!==(u=o.sopClassUID)&&"1.2.840.10008.5.1.4.1.1.12.2.1"!==u&&(c.modalityLUT=n.modalityLUTSequence[0]),a.voiLUTSequence&&0<a.voiLUTSequence.length&&(c.voiLUT=a.voiLUTSequence[0]),c.color&&(c.windowWidth=255,c.windowCenter=127),void 0===c.windowCenter||void 0===c.windowWidth){var p=c.maxPixelValue*c.slope+c.intercept,m=c.minPixelValue*c.slope+c.intercept;c.windowWidth=p-m,c.windowCenter=(p+m)/2}g(c)},e)})};var ie=function(o,i){var l=(new Date).getTime(),t=o.substring(7);return{promise:new Promise(function(a,n){if(void 0===y.get(o)){var e=new Error("no metadata for imageId ".concat(o));return n(e)}S(t,o,'multipart/related; type="application/octet-stream"').then(function(e){var t=function(e){var t="1.2.840.10008.1.2";if(!e)return t;var r=e.split(";"),a={};r.forEach(function(e){var t=e.split("=");if(2===t.length){var r=t[1].trim().replace(/"/g,"");a[t[0].trim()]=r}});var n={"image/jpeg":"1.2.840.10008.1.2.4.70","image/x-dicom-rle":"1.2.840.10008.1.2.5","image/x-jls":"1.2.840.10008.1.2.4.80","image/jp2":"1.2.840.10008.1.2.4.90","image/jpx":"1.2.840.10008.1.2.4.92"};return a["transfer-syntax"]?a["transfer-syntax"]:e&&!Object.keys(a).length&&n[e]?n[e]:a.type&&n[a.type]?n[a.type]:t}(e.contentType),r=e.imageFrame.pixelData;oe(o,r,t,i).then(function(e){var t=(new Date).getTime();e.loadTimeInMS=t-l,a(e)},n)},n).catch(function(e){n(e)})}),cancelFn:void 0}},le={metaData:{getNumberString:f,getNumberValue:p,getNumberValues:m,getValue:d,metaDataProvider:P},findIndexOfString:I,getPixelData:S,loadImage:ie,metaDataManager:y,register:function(e){e.registerImageLoader("wadors",ie),e.metaData.addProvider(P)}};var se,ue,ce=function(e){le.register(e),Le.register(e)},fe={set cornerstone(e){ce(se=e)},get cornerstone(){if(!se){if(!window||!window.cornerstone)throw new Error("cornerstoneWADOImageLoader requires a copy of Cornerstone to work properly. Please add cornerstoneWADOImageLoader.external.cornerstone = cornerstone; to your application.");se=window.cornerstone,ce(se)}return se},set dicomParser(e){ue=e},get dicomParser(){if(!ue){if(!window||!window.dicomParser)throw new Error("cornerstoneWADOImageLoader requires a copy of dicomParser to work properly. Please add cornerstoneWADOImageLoader.external.dicomParser = dicomParser; to your application.");ue=window.dicomParser}return ue}};var de=function(e){var t,r=e.indexOf(":"),a=e.substring(r+1),n=a.indexOf("frame=");if(-1!==n){var o=a.substr(n+6);t=parseInt(o,10),a=a.substr(0,n-1)}return{scheme:e.substr(0,r),url:a,frame:t}},pe=0,me={},ge={};function ve(){return{cacheSizeInBytes:pe,numberOfDataSetsCached:Object.keys(me).length}}var xe={isLoaded:function(e){return void 0!==me[e]},load:function(o){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:A,t=2<arguments.length?arguments[2]:void 0,i=fe.cornerstone,l=fe.dicomParser;if(me[o])return new Promise(function(e){me[o].cacheCount++,e(me[o].dataSet)});if(ge[o])return ge[o].cacheCount++,ge[o];var r=e(o,t),s=new Promise(function(a,n){r.then(function(e){var t,r=new Uint8Array(e);try{t=l.parseDicom(r)}catch(e){return n(e)}me[o]={dataSet:t,cacheCount:s.cacheCount},pe+=t.byteArray.length,a(t),i.triggerEvent(i.events,"datasetscachechanged",{uri:o,action:"loaded",cacheInfo:ve()})},n).then(function(){delete ge[o]},function(){delete ge[o]})});return s.cacheCount=1,ge[o]=s},unload:function(e){var t=fe.cornerstone;me[e]&&(me[e].cacheCount--,0===me[e].cacheCount&&(pe-=me[e].dataSet.byteArray.length,delete me[e],t.triggerEvent(t.events,"datasetscachechanged",{uri:e,action:"unloaded",cacheInfo:ve()})))},getInfo:ve,purge:function(){me={},ge={}},get:function(e){if(me[e])return me[e].dataSet}};var he=function(e,t){var r=fe.dicomParser,a=de(t),n=xe.get(a.url);if(n){if("generalSeriesModule"===e)return{modality:n.string("x00080060"),seriesInstanceUID:n.string("x0020000e"),seriesNumber:n.intString("x00200011"),studyInstanceUID:n.string("x0020000d"),seriesDate:r.parseDA(n.string("x00080021")),seriesTime:r.parseTM(n.string("x00080031")||"")};if("patientStudyModule"===e)return{patientAge:n.intString("x00101010"),patientSize:n.floatString("x00101020"),patientWeight:n.floatString("x00101030")};if("imagePlaneModule"===e){var o=w(n,"x00200037",6),i=w(n,"x00200032",3),l=w(n,"x00280030",2),s=null,u=null;l&&(u=l[0],s=l[1]);var c=null,f=null;return o&&(c=[parseFloat(o[0]),parseFloat(o[1]),parseFloat(o[2])],f=[parseFloat(o[3]),parseFloat(o[4]),parseFloat(o[5])]),{frameOfReferenceUID:n.string("x00200052"),rows:n.uint16("x00280010"),columns:n.uint16("x00280011"),imageOrientationPatient:o,rowCosines:c,columnCosines:f,imagePositionPatient:i,sliceThickness:n.floatString("x00180050"),sliceLocation:n.floatString("x00201041"),pixelSpacing:l,rowPixelSpacing:u,columnPixelSpacing:s}}if("imagePixelModule"===e)return g(n);if("modalityLutModule"===e)return{rescaleIntercept:n.floatString("x00281052"),rescaleSlope:n.floatString("x00281053"),rescaleType:n.string("x00281054"),modalityLUTSequence:v(n.uint16("x00280103"),n.elements.x00283000)};if("voiLutModule"===e){var d=h(n);return{windowCenter:w(n,"x00281050",1),windowWidth:w(n,"x00281051",1),voiLUTSequence:v(d,n.elements.x00283010)}}if("sopCommonModule"===e)return{sopClassUID:n.string("x00080016"),sopInstanceUID:n.string("x00080018")};if("petIsotopeModule"===e){var p=n.elements.x00540016;if(void 0===p)return;var m=p.items[0].dataSet;return{radiopharmaceuticalInfo:{radiopharmaceuticalStartTime:r.parseTM(m.string("x00181072")||""),radionuclideTotalDose:m.floatString("x00181074"),radionuclideHalfLife:m.floatString("x00181075")}}}}},we=[];var be={add:function(e){var t=we.push(e);return"dicomfile:".concat(t-1)},get:function(e){return we[e]},remove:function(e){we[e]=void 0},purge:function(){we=[]}};function ye(e,t){var r,a=fe.dicomParser;if(e.elements.x7fe00010&&e.elements.x7fe00010.basicOffsetTable.length)return a.readEncapsulatedImageFrame(e,e.elements.x7fe00010,t);if((r=e).intString("x00280008")===r.elements.x7fe00010.fragments.length)return a.readEncapsulatedPixelDataFromFragments(e,e.elements.x7fe00010,t);var n=a.createJPEGBasicOffsetTable(e,e.elements.x7fe00010);return a.readEncapsulatedImageFrame(e,e.elements.x7fe00010,t,n)}var Pe=function(e,t,r){for(var a=new Uint8Array(r),n=0;n<r;n++){var o=e[Math.floor(n/8)+t],i=n%8;a[n]=o&1<<i?1:0}return a};var De=function(e,t){var r,a=e.elements.x7fe00010||e.elements.x7fe00008,n=e.uint16("x00280100"),o=e.uint16("x00280010"),i=e.uint16("x00280011"),l=e.uint16("x00280002"),s=a.dataOffset,u=o*i*l;if(8===n){if((r=s+t*u)>=e.byteArray.length)throw new Error("frame exceeds size of pixelData");return new Uint8Array(e.byteArray.buffer,r,u)}if(16===n){if((r=s+t*u*2)>=e.byteArray.length)throw new Error("frame exceeds size of pixelData");return new Uint8Array(e.byteArray.buffer,r,2*u)}if(1===n){if((r=s+t*u*.125)>=e.byteArray.length)throw new Error("frame exceeds size of pixelData");return Pe(e.byteArray,r,u)}if(32!==n)throw new Error("unsupported pixel format");if((r=s+t*u*4)>=e.byteArray.length)throw new Error("frame exceeds size of pixelData");return new Uint8Array(e.byteArray.buffer,r,4*u)};var Ie=function(e){var t=de(e),r=parseInt(t.url,10),a=be.get(r);return new Promise(function(r,e){var t=new FileReader;t.onload=function(e){var t=e.target.result;r(t)},t.onerror=e,t.readAsArrayBuffer(a)})};var Te=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=e.elements.x7fe00010||e.elements.x7fe00008;return r?r.encapsulatedPixelData?ye(e,t):De(e,t):null};function Ce(e,s){var u=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,c=3<arguments.length?arguments[3]:void 0,f=4<arguments.length?arguments[4]:void 0,d=5<arguments.length?arguments[5]:void 0,p=(new Date).getTime(),m={cancelFn:void 0};return m.promise=new Promise(function(i,l){e.then(function(r){var t,e=Te(r,u),a=r.string("x00020010"),n=(new Date).getTime(),o=oe(s,e,a,f);t=s,m.decache=function(){var e=de(t);xe.unload(e.url)},o.then(function(e){e.data=r,e.sharedCacheKey=c;var t=(new Date).getTime();e.loadTimeInMS=n-p,e.totalTimeInMS=t-p,void 0!==d&&void 0!==d.imageDoneCallback&&d.imageDoneCallback(e),i(e)},function(e){l({error:e,dataSet:r})})},function(e){l({error:e})})}),m}function ke(e){return"dicomweb"===e||"wadouri"===e?A:"dicomfile"===e?Ie:void 0}function Ae(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=de(e),a=(t=Object.assign({},t)).loader;return void 0===a?a=ke(r.scheme):delete t.loader,xe.isLoaded(r.url)?function(i,l){var s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,u=3<arguments.length?arguments[3]:void 0,c=4<arguments.length?arguments[4]:void 0,f=(new Date).getTime();return{promise:new Promise(function(r,t){var e,a=(new Date).getTime();try{var n=Te(i,s),o=i.string("x00020010");e=oe(l,n,o,c)}catch(e){return void t({error:e,dataSet:i})}e.then(function(e){e.data=i,e.sharedCacheKey=u;var t=(new Date).getTime();e.loadTimeInMS=a-f,e.totalTimeInMS=t-f,r(e)},t)}),cancelFn:void 0}}(xe.get(r.url,a,e),e,r.frame,r.url,t):Ce(xe.load(r.url,a,e),e,r.frame,r.url,t)}var Le={metaData:{getImagePixelModule:g,getLUTs:v,getModalityLUTOutputPixelRepresentation:h,getNumberValues:w,metaDataProvider:he},dataSetCacheManager:xe,fileManager:be,getEncapsulatedImageFrame:ye,getUncompressedImageFrame:De,loadFileRequest:Ie,loadImageFromPromise:Ce,getLoaderForScheme:ke,loadImage:Ae,parseImageId:de,unpackBinaryFrame:Pe,register:function(e){e.registerImageLoader("dicomweb",Ae),e.registerImageLoader("wadouri",Ae),e.registerImageLoader("dicomfile",Ae),e.metaData.addProvider(he)}};var Se=function(e){C(e)},Ee=r(3);r.d(t,"convertRGBColorByPixel",function(){return a}),r.d(t,"convertRGBColorByPlane",function(){return n}),r.d(t,"convertYBRFullByPixel",function(){return o}),r.d(t,"convertYBRFullByPlane",function(){return i}),r.d(t,"convertPALETTECOLOR",function(){return l}),r.d(t,"wadouri",function(){return Le}),r.d(t,"wadors",function(){return le}),r.d(t,"configure",function(){return Se}),r.d(t,"convertColorSpace",function(){return re}),r.d(t,"createImage",function(){return oe}),r.d(t,"decodeImageFrame",function(){return $}),r.d(t,"decodeJPEGBaseline8BitColor",function(){return Y}),r.d(t,"getImageFrame",function(){return O}),r.d(t,"getMinMax",function(){return z.a}),r.d(t,"isColorImage",function(){return ee}),r.d(t,"isJPEGBaseline8BitColor",function(){return ae}),r.d(t,"webWorkerManager",function(){return J}),r.d(t,"version",function(){return Ee.a}),r.d(t,"internal",function(){return L}),r.d(t,"external",function(){return fe});var Oe={convertRGBColorByPixel:a,convertRGBColorByPlane:n,convertYBRFullByPixel:o,convertYBRFullByPlane:i,convertPALETTECOLOR:l,wadouri:Le,wadors:le,configure:Se,convertColorSpace:re,createImage:oe,decodeImageFrame:$,decodeJPEGBaseline8BitColor:Y,getImageFrame:O,getMinMax:z.a,isColorImage:ee,isJPEGBaseline8BitColor:ae,webWorkerManager:J,version:Ee.a,internal:L,external:fe};t.default=Oe}])});
  //# sourceMappingURL=cornerstoneWADOImageLoader.min.js.map