@ohif/core 3.13.0-beta.99 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ohif-core.umd.js +2 -2
- package/package.json +8 -8
package/dist/ohif-core.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("dcmjs"),require("@cornerstonejs/core"),require("gl-matrix")):"function"==typeof define&&define.amd?define(["dcmjs","@cornerstonejs/core","gl-matrix"],t):"object"==typeof exports?exports["ohif-core"]=t(require("dcmjs"),require("@cornerstonejs/core"),require("gl-matrix")):e["ohif-core"]=t(e.dcmjs,e["@cornerstonejs/core"],e["gl-matrix"])}(globalThis,(e,t,r)=>(()=>{var n={28(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,a=l(e),o=a[0],s=a[1],u=new i((o+s)*3/4-s),c=0,d=s>0?o-4:o;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,s=n-i;o<s;o+=16383)a.push(function(e,t,n){for(var i,a=[],o=t;o<n;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}(e,o,o+16383>s?s:o+16383));return 1===i?a.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&a.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),a.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o<s;++o)r[o]=a[o],n[a.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},429(e,t,r){"use strict";var n=r(28),i=r(801),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!s.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|p(n,i),l=o(a),u=l.write(n,i);return u!==a&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e)){var c=e;if(P(c,Uint8Array)){var g=new Uint8Array(c);return f(g.buffer,g.byteOffset,g.byteLength)}return d(c)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(P(e,ArrayBuffer)||e&&P(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(P(e,SharedArrayBuffer)||e&&P(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var m=e.valueOf&&e.valueOf();if(null!=m&&m!==e)return s.from(m,t,r);var y=function(e){if(s.isBuffer(e)){var t=0|h(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(y)return y;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),o(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),s.prototype),n}function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||P(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return A(e).length;default:if(i)return n?-1:M(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var i,a,o,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=O[e[a]];return i}(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,a=t,o=r,0===a&&o===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(a,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length-1;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,t,r);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){var a;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r*=1)!=a&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return v(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var a,o=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,s/=2,l/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=r;a<s;a++)if(u(e,a)===u(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===l)return c*o}else -1!==c&&(a-=a-c),c=-1}else for(r+l>s&&(r=s-l),a=r;a>=0;a--){for(var d=!0,f=0;f<l;f++)if(u(e,a+f)!==u(t,f)){d=!1;break}if(d)return a}return -1}function S(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:(192&(a=e[i+1]))==128&&(l=(31&u)<<6|63&a)>127&&(c=l);break;case 3:a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(l=(15&u)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(l=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}var f=n,h=f.length;if(h<=4096)return String.fromCharCode.apply(String,f);for(var p="",g=0;g<h;)p+=String.fromCharCode.apply(String,f.slice(g,g+=4096));return p}function b(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function w(e,t,r,n,i,a){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function _(e,t,r,n,i,a){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function E(e,t,r,n,a){return t*=1,r>>>=0,a||_(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function I(e,t,r,n,a){return t*=1,r>>>=0,a||_(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.hp=s,t.IS=50,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!s.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(u(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(P(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),P(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(P(a,Uint8Array))i+a.length>n.length?s.from(a).copy(n,i):Uint8Array.prototype.set.call(n,a,i);else if(s.isBuffer(a))a.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=a.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?S(this,0,e):g.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a&&(s.prototype[a]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(P(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,o=r-t,l=Math.min(a,o),u=this.slice(n,i),c=e.slice(t,r),d=0;d<l;++d)if(u[d]!==c[d]){a=u[d],o=c[d];break}return a<o?-1:+(o<a)},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,o,s,l,u,c,d,f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var h=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s,l=parseInt(t.substr(2*o,2),16);if((s=l)!=s)break;e[r+o]=l}return o}(this,e,t,r);case"utf8":case"utf-8":return i=t,a=r,x(M(e,this.length-i),this,i,a);case"ascii":case"latin1":case"binary":return o=t,s=r,x(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,o,s);case"base64":return l=t,u=r,x(A(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=r,x(function(e,t){for(var r,n,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,d);default:if(h)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),h=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var a=1,o=0;for(this[t]=255&e;++o<r&&(a*=256);)this[t+o]=e/a&255;return t+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var a=r-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return E(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return E(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var o=s.isBuffer(e)?e:s.from(e,n),l=o.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%l]}return this};var D=/[^+/0-9A-Za-z-_]/g;function M(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function A(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function x(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function P(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var O=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},956(e){"use strict";var t="%[a-f0-9]{2}",r=RegExp("("+t+")|([^%]+?)","gi"),n=RegExp("("+t+")+","gi");e.exports=function(e){if("string"!=typeof e)throw TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},i=n.exec(e);i;){try{t[i[0]]=decodeURIComponent(i[0])}catch(e){var a=function(e){try{return decodeURIComponent(e)}catch(i){for(var t=e.match(r)||[],n=1;n<t.length;n++)t=(e=(function e(t,r){try{return[decodeURIComponent(t.join(""))]}catch(e){}if(1===t.length)return t;r=r||1;var n=t.slice(0,r),i=t.slice(r);return Array.prototype.concat.call([],e(n),e(i))})(t,n).join("")).match(r)||[];return e}}(i[0]);a!==i[0]&&(t[i[0]]=a)}i=n.exec(e)}t["%C2"]="�";for(var o=Object.keys(t),s=0;s<o.length;s++){var l=o[s];e=e.replace(RegExp(l,"g"),t[l])}return e}(e)}}},313(e,t,r){var n=r(429).hp;e.exports=function(e){var t,r;return r={},i.m=t=[function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t),r.d(t,"isStringVr",function(){return a}),r.d(t,"isPrivateTag",function(){return o}),r.d(t,"parsePN",function(){return s}),r.d(t,"parseTM",function(){return l}),r.d(t,"parseDA",function(){return u}),r.d(t,"explicitElementToString",function(){return c}),r.d(t,"explicitDataSetToJS",function(){return d}),r.d(t,"createJPEGBasicOffsetTable",function(){return h}),r.d(t,"parseDicomDataSetExplicit",function(){return P}),r.d(t,"parseDicomDataSetImplicit",function(){return O}),r.d(t,"readFixedString",function(){return y}),r.d(t,"alloc",function(){return T}),r.d(t,"version",function(){return k}),r.d(t,"bigEndianByteArrayParser",function(){return N}),r.d(t,"ByteStream",function(){return R}),r.d(t,"sharedCopy",function(){return C}),r.d(t,"DataSet",function(){return b}),r.d(t,"findAndSetUNElementLength",function(){return m}),r.d(t,"findEndOfEncapsulatedElement",function(){return g}),r.d(t,"findItemDelimitationItemAndSetElementLength",function(){return w}),r.d(t,"littleEndianByteArrayParser",function(){return L}),r.d(t,"parseDicom",function(){return j}),r.d(t,"readDicomElementExplicit",function(){return x}),r.d(t,"readDicomElementImplicit",function(){return _}),r.d(t,"readEncapsulatedImageFrame",function(){return H}),r.d(t,"readEncapsulatedPixelData",function(){return G}),r.d(t,"readEncapsulatedPixelDataFromFragments",function(){return B}),r.d(t,"readPart10Header",function(){return V}),r.d(t,"readSequenceItemsExplicit",function(){return A}),r.d(t,"readSequenceItemsImplicit",function(){return D}),r.d(t,"readSequenceItem",function(){return E}),r.d(t,"readTag",function(){return p});var i={AE:!0,AS:!0,AT:!1,CS:!0,DA:!0,DS:!0,DT:!0,FL:!1,FD:!1,IS:!0,LO:!0,LT:!0,OB:!1,OD:!1,OF:!1,OW:!1,PN:!0,SH:!0,SL:!1,SQ:!1,SS:!1,ST:!0,TM:!0,UI:!0,UL:!1,UN:void 0,UR:!0,US:!1,UT:!0},a=function(e){return i[e]},o=function(e){if(isNaN(e=parseInt(e[4],16)))throw"dicomParser.isPrivateTag: cannot parse last character of group";return e%2==1},s=function(e){if(void 0!==e)return{familyName:(e=e.split("^"))[0],givenName:e[1],middleName:e[2],prefix:e[3],suffix:e[4]}};function l(e,t){if(2<=e.length){var r=parseInt(e.substring(0,2),10),n=4<=e.length?parseInt(e.substring(2,4),10):void 0,i=6<=e.length?parseInt(e.substring(4,6),10):void 0,a=8<=e.length?e.substring(7,13):void 0,a=a?parseInt(a,10)*Math.pow(10,6-a.length):void 0;if(t&&(isNaN(r)||void 0!==n&&isNaN(n)||void 0!==i&&isNaN(i)||void 0!==a&&isNaN(a)||r<0||23<r||n&&(n<0||59<n)||i&&(i<0||59<i)||a&&(a<0||999999<a)))throw"invalid TM '".concat(e,"'");return{hours:r,minutes:n,seconds:i,fractionalSeconds:a}}if(t)throw"invalid TM '".concat(e,"'")}function u(e,t){if(e&&8===e.length){var r=parseInt(e.substring(0,4),10),n=parseInt(e.substring(4,6),10),i=parseInt(e.substring(6,8),10);if(t&&!0!=(!isNaN(r)&&0<n&&n<=12&&0<i&&i<=function(e,t){switch(e){case 2:return t%4==0&&t%100||t%400==0?29:28;case 9:case 4:case 6:case 11:return 30;default:return 31}}(n,r)))throw"invalid DA '".concat(e,"'");return{year:r,month:n,day:i}}if(t)throw"invalid DA '".concat(e,"'")}function c(e,t){if(void 0===e||void 0===t)throw"dicomParser.explicitElementToString: missing required parameters";if(void 0===t.vr)throw"dicomParser.explicitElementToString: cannot convert implicit element to string";var r,n=t.vr,i=t.tag;function o(t,r){for(var n="",a=0;a<t;a++)0!==a&&(n+="/"),n+=r.call(e,i,a).toString();return n}if(!0===a(n))r=e.string(i);else{if("AT"===n){var s=e.uint32(i);return void 0===s?void 0:"x".concat((s=s<0?0xffffffff+s+1:s).toString(16).toUpperCase())}"US"===n?r=o(t.length/2,e.uint16):"SS"===n?r=o(t.length/2,e.int16):"UL"===n?r=o(t.length/4,e.uint32):"SL"===n?r=o(t.length/4,e.int32):"FD"===n?r=o(t.length/8,e.double):"FL"===n&&(r=o(t.length/4,e.float))}return r}function d(e,t){if(void 0===e)throw"dicomParser.explicitDataSetToJS: missing required parameter dataSet";t=t||{omitPrivateAttibutes:!0,maxElementLength:128};var r,n={};for(r in e.elements){var i=e.elements[r];if(!0!==t.omitPrivateAttibutes||!o(r))if(i.items){for(var a=[],s=0;s<i.items.length;s++)a.push(d(i.items[s].dataSet,t));n[r]=a}else{var l=void 0;i.length<t.maxElementLength&&(l=c(e,i)),n[r]=void 0!==l?l:{dataOffset:i.dataOffset,length:i.length}}}return n}function f(e,t){return 255===e.byteArray[t]&&217===e.byteArray[t+1]}function h(e,t,r){if(void 0===e)throw"dicomParser.createJPEGBasicOffsetTable: missing required parameter dataSet";if(void 0===t)throw"dicomParser.createJPEGBasicOffsetTable: missing required parameter pixelDataElement";if("x7fe00010"!==t.tag)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010'";if(!0!==t.encapsulatedPixelData||!0!==t.hadUndefinedLength||void 0===t.basicOffsetTable||void 0===t.fragments||t.fragments.length<=0)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(r&&r.length<=0)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'fragments' must not be zero length";r=r||t.fragments;for(var n=[],i=0;;){n.push(t.fragments[i].offset);var a=function(e,t,r){for(var n,i=r;i<t.fragments.length;i++)if(n=i,!(!f(e,(n=t.fragments[n]).position+n.length-2)&&!f(e,n.position+n.length-3)))return i}(e,t,i);if(void 0===a||a===t.fragments.length-1)return n;i=a+1}}function p(e){if(void 0===e)throw"dicomParser.readTag: missing required parameter 'byteStream'";var t=256*e.readUint16()*256,e=e.readUint16();return"x".concat("00000000".concat((t+e).toString(16)).substr(-8))}function g(e,t,r){if(void 0===e)throw"dicomParser.findEndOfEncapsulatedElement: missing required parameter 'byteStream'";if(void 0===t)throw"dicomParser.findEndOfEncapsulatedElement: missing required parameter 'element'";if(t.encapsulatedPixelData=!0,t.basicOffsetTable=[],t.fragments=[],"xfffee000"!==p(e))throw"dicomParser.findEndOfEncapsulatedElement: basic offset table not found";for(var n=e.readUint32()/4,i=0;i<n;i++){var a=e.readUint32();t.basicOffsetTable.push(a)}for(var o=e.position;e.position<e.byteArray.length;){var s=p(e),l=e.readUint32();if("xfffee0dd"===s)return e.seek(l),void(t.length=e.position-t.dataOffset);if("xfffee000"!==s)return r&&r.push("unexpected tag ".concat(s," while searching for end of pixel data element with undefined length")),l>e.byteArray.length-e.position&&(l=e.byteArray.length-e.position),t.fragments.push({offset:e.position-o-8,position:e.position,length:l}),e.seek(l),void(t.length=e.position-t.dataOffset);t.fragments.push({offset:e.position-o-8,position:e.position,length:l}),e.seek(l)}r&&r.push("pixel data element ".concat(t.tag," missing sequence delimiter tag xfffee0dd"))}function m(e,t){if(void 0===e)throw"dicomParser.findAndSetUNElementLength: missing required parameter 'byteStream'";for(var r=e.byteArray.length-8;e.position<=r;)if(65534===e.readUint16()&&57565===e.readUint16())return 0!==e.readUint32()&&e.warnings("encountered non zero length following item delimiter at position ".concat(e.position-4," while reading element of undefined length with tag ").concat(t.tag)),void(t.length=e.position-t.dataOffset);t.length=e.byteArray.length-t.dataOffset,e.seek(e.byteArray.length-e.position)}function y(e,t,r){if(r<0)throw"dicomParser.readFixedString - length cannot be less than 0";if(t+r>e.length)throw"dicomParser.readFixedString: attempt to read past end of buffer";for(var n,i="",a=0;a<r;a++){if(0===(n=e[t+a]))return t+=r,i;i+=String.fromCharCode(n)}return i}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function S(e,t){return void 0!==e.parser?e.parser:t}var b=function(){var e,t;function r(e,t,n){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),this.byteArrayParser=e,this.byteArray=t,this.elements=n}return e=[{key:"uint16",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return S(e,this.byteArrayParser).readUint16(this.byteArray,e.dataOffset+2*t)}},{key:"int16",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return S(e,this.byteArrayParser).readInt16(this.byteArray,e.dataOffset+2*t)}},{key:"uint32",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return S(e,this.byteArrayParser).readUint32(this.byteArray,e.dataOffset+4*t)}},{key:"int32",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return S(e,this.byteArrayParser).readInt32(this.byteArray,e.dataOffset+4*t)}},{key:"float",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return S(e,this.byteArrayParser).readFloat(this.byteArray,e.dataOffset+4*t)}},{key:"double",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return S(e,this.byteArrayParser).readDouble(this.byteArray,e.dataOffset+8*t)}},{key:"numStringValues",value:function(e){if((e=this.elements[e])&&0<e.length)return null===(e=y(this.byteArray,e.dataOffset,e.length).match(/\\/g))?1:e.length+1}},{key:"string",value:function(e,t){return(e=this.elements[e])&&e.Value?e.Value:e&&0<e.length?(e=y(this.byteArray,e.dataOffset,e.length),0<=t?e.split("\\")[t].trim():e.trim()):void 0}},{key:"text",value:function(e,t){if((e=this.elements[e])&&0<e.length)return e=y(this.byteArray,e.dataOffset,e.length),0<=t?e.split("\\")[t].replace(/ +$/,""):e.replace(/ +$/,"")}},{key:"floatString",value:function(e,t){var r=this.elements[e];if(r&&0<r.length&&void 0!==(t=this.string(e,t=void 0!==t?t:0)))return parseFloat(t)}},{key:"intString",value:function(e,t){var r=this.elements[e];if(r&&0<r.length&&void 0!==(t=this.string(e,t=void 0!==t?t:0)))return parseInt(t)}},{key:"attributeTag",value:function(e){var t=this.elements[e];if(t&&4===t.length){var r=S(t,this.byteArrayParser).readUint16,e=this.byteArray,t=t.dataOffset;return"x".concat("00000000".concat((256*r(e,t)*256+r(e,t+2)).toString(16)).substr(-8))}}}],v(r.prototype,e),t&&v(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}();function w(e,t){if(void 0===e)throw"dicomParser.readDicomElementImplicit: missing required parameter 'byteStream'";for(var r=e.byteArray.length-8;e.position<=r;)if(65534===e.readUint16()&&57357===e.readUint16())return 0!==e.readUint32()&&e.warnings("encountered non zero length following item delimiter at position ".concat(e.position-4," while reading element of undefined length with tag ").concat(t.tag)),void(t.length=e.position-t.dataOffset);t.length=e.byteArray.length-t.dataOffset,e.seek(e.byteArray.length-e.position)}function _(e,t,r){if(void 0===e)throw"dicomParser.readDicomElementImplicit: missing required parameter 'byteStream'";var n,i=p(e),i={tag:i,vr:void 0!==r?r(i):void 0,length:e.readUint32(),dataOffset:e.position};return 0xffffffff===i.length&&(i.hadUndefinedLength=!0),i.tag===t||((void 0!==(n=i).vr?"SQ"!==n.vr:e.position+4<=e.byteArray.length?(n=p(e),e.seek(-4),"xfffee000"!==n&&"xfffee0dd"!==n):(e.warnings.push("eof encountered before finding sequence item tag or sequence delimiter tag in peeking to determine VR"),!0))||o(i.tag)&&!i.hadUndefinedLength?i.hadUndefinedLength?w(e,i):e.seek(i.length):(D(e,i,r),o(i.tag)&&(i.items=void 0))),i}function E(e){if(void 0===e)throw"dicomParser.readSequenceItem: missing required parameter 'byteStream'";var t={tag:p(e),length:e.readUint32(),dataOffset:e.position};if("xfffee000"!==t.tag)throw"dicomParser.readSequenceItem: item tag (FFFE,E000) not found at offset ".concat(e.position);return t}function I(e,t){var r=E(e);return 0xffffffff===r.length?(r.hadUndefinedLength=!0,r.dataSet=function(e,t){for(var r={};e.position<e.byteArray.length;){var n=_(e,void 0,t);if("xfffee00d"===(r[n.tag]=n).tag)return new b(e.byteArrayParser,e.byteArray,r)}return e.warnings.push("eof encountered before finding sequence item delimiter in sequence item of undefined length"),new b(e.byteArrayParser,e.byteArray,r)}(e,t),r.length=e.position-r.dataOffset):(r.dataSet=new b(e.byteArrayParser,e.byteArray,{}),O(r.dataSet,e,e.position+r.length,{vrCallback:t})),r}function D(e,t,r){if(void 0===e)throw"dicomParser.readSequenceItemsImplicit: missing required parameter 'byteStream'";if(void 0===t)throw"dicomParser.readSequenceItemsImplicit: missing required parameter 'element'";t.items=[],(0xffffffff===t.length?function(e,t,r){for(;e.position+4<=e.byteArray.length;){var n=p(e);if(e.seek(-4),"xfffee0dd"===n)return t.length=e.position-t.dataOffset,e.seek(8);n=I(e,r),t.items.push(n)}e.warnings.push("eof encountered before finding sequence delimiter in sequence of undefined length"),t.length=e.byteArray.length-t.dataOffset}:function(e,t,r){for(var n=t.dataOffset+t.length;e.position<n;){var i=I(e,r);t.items.push(i)}})(e,t,r)}function M(e,t){var r=E(e);return 0xffffffff===r.length?(r.hadUndefinedLength=!0,r.dataSet=function(e,t){for(var r={};e.position<e.byteArray.length;){var n=x(e,t);if("xfffee00d"===(r[n.tag]=n).tag)return new b(e.byteArrayParser,e.byteArray,r)}return t.push("eof encountered before finding item delimiter tag while reading sequence item of undefined length"),new b(e.byteArrayParser,e.byteArray,r)}(e,t),r.length=e.position-r.dataOffset):(r.dataSet=new b(e.byteArrayParser,e.byteArray,{}),P(r.dataSet,e,e.position+r.length)),r}function A(e,t,r){if(void 0===e)throw"dicomParser.readSequenceItemsExplicit: missing required parameter 'byteStream'";if(void 0===t)throw"dicomParser.readSequenceItemsExplicit: missing required parameter 'element'";t.items=[],(0xffffffff===t.length?function(e,t,r){for(;e.position+4<=e.byteArray.length;){var n=p(e);if(e.seek(-4),"xfffee0dd"===n)return t.length=e.position-t.dataOffset,e.seek(8);n=M(e,r),t.items.push(n)}r.push("eof encountered before finding sequence delimitation tag while reading sequence of undefined length"),t.length=e.position-t.dataOffset}:function(e,t,r){for(var n=t.dataOffset+t.length;e.position<n;){var i=M(e,r);t.items.push(i)}})(e,t,r)}function x(e,t,r){if(void 0===e)throw"dicomParser.readDicomElementExplicit: missing required parameter 'byteStream'";var n,i={tag:p(e),vr:e.readFixedString(2)};return 2==("OB"===(n=i.vr)||"OD"===n||"OL"===n||"OW"===n||"SQ"===n||"OF"===n||"UC"===n||"UR"===n||"UT"===n||"UN"===n?4:2)?i.length=e.readUint16():(e.seek(2),i.length=e.readUint32()),i.dataOffset=e.position,0xffffffff===i.length&&(i.hadUndefinedLength=!0),i.tag===r||("SQ"===i.vr?A(e,i,t):0xffffffff===i.length?"x7fe00010"===i.tag?g(e,i,t):("UN"===i.vr?D:w)(e,i):e.seek(i.length)),i}function P(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};if(r=void 0===r?t.byteArray.length:r,void 0===t)throw"dicomParser.parseDicomDataSetExplicit: missing required parameter 'byteStream'";if(r<t.position||r>t.byteArray.length)throw"dicomParser.parseDicomDataSetExplicit: invalid value for parameter 'maxP osition'";for(var i=e.elements;t.position<r;){var a=x(t,e.warnings,n.untilTag);if((i[a.tag]=a).tag===n.untilTag)return}if(t.position>r)throw"dicomParser:parseDicomDataSetExplicit: buffer overrun"}function O(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};if(r=void 0===r?e.byteArray.length:r,void 0===t)throw"dicomParser.parseDicomDataSetImplicit: missing required parameter 'byteStream'";if(r<t.position||r>t.byteArray.length)throw"dicomParser.parseDicomDataSetImplicit: invalid value for parameter 'maxPosition'";for(var i=e.elements;t.position<r;){var a=_(t,n.untilTag,n.vrCallback);if((i[a.tag]=a).tag===n.untilTag)return}}function T(e,t){if(void 0!==n&&e instanceof n)return n.alloc(t);if(e instanceof Uint8Array)return new Uint8Array(t);throw"dicomParser.alloc: unknown type for byteArray"}var k="1.8.12",N={readUint16:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readUint16: position cannot be less than 0";if(t+2>e.length)throw"bigEndianByteArrayParser.readUint16: attempt to read past end of buffer";return(e[t]<<8)+e[t+1]},readInt16:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readInt16: position cannot be less than 0";if(t+2>e.length)throw"bigEndianByteArrayParser.readInt16: attempt to read past end of buffer";return 32768&(t=(e[t]<<8)+e[t+1])?t-65535-1:t},readUint32:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readUint32: position cannot be less than 0";if(t+4>e.length)throw"bigEndianByteArrayParser.readUint32: attempt to read past end of buffer";return 256*(256*(256*e[t]+e[t+1])+e[t+2])+e[t+3]},readInt32:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readInt32: position cannot be less than 0";if(t+4>e.length)throw"bigEndianByteArrayParser.readInt32: attempt to read past end of buffer";return(e[t]<<24)+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]},readFloat:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readFloat: position cannot be less than 0";if(t+4>e.length)throw"bigEndianByteArrayParser.readFloat: attempt to read past end of buffer";var r=new Uint8Array(4);return r[3]=e[t],r[2]=e[t+1],r[1]=e[t+2],r[0]=e[t+3],new Float32Array(r.buffer)[0]},readDouble:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readDouble: position cannot be less than 0";if(t+8>e.length)throw"bigEndianByteArrayParser.readDouble: attempt to read past end of buffer";var r=new Uint8Array(8);return r[7]=e[t],r[6]=e[t+1],r[5]=e[t+2],r[4]=e[t+3],r[3]=e[t+4],r[2]=e[t+5],r[1]=e[t+6],r[0]=e[t+7],new Float64Array(r.buffer)[0]}};function C(e,t,r){if(void 0!==n&&e instanceof n)return e.slice(t,t+r);if(e instanceof Uint8Array)return new Uint8Array(e.buffer,e.byteOffset+t,r);throw"dicomParser.from: unknown type for byteArray"}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var R=function(){var e,t;function r(e,t,i){if(!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),void 0===e)throw"dicomParser.ByteStream: missing required parameter 'byteArrayParser'";if(void 0===t)throw"dicomParser.ByteStream: missing required parameter 'byteArray'";if(t instanceof Uint8Array==!1&&(void 0===n||t instanceof n==!1))throw"dicomParser.ByteStream: parameter byteArray is not of type Uint8Array or Buffer";if(i<0)throw"dicomParser.ByteStream: parameter 'position' cannot be less than 0";if(i>=t.length)throw"dicomParser.ByteStream: parameter 'position' cannot be greater than or equal to 'byteArray' length";this.byteArrayParser=e,this.byteArray=t,this.position=i||0,this.warnings=[]}return e=[{key:"seek",value:function(e){if(this.position+e<0)throw"dicomParser.ByteStream.prototype.seek: cannot seek to position < 0";this.position+=e}},{key:"readByteStream",value:function(e){if(this.position+e>this.byteArray.length)throw"dicomParser.ByteStream.prototype.readByteStream: readByteStream - buffer overread";var t=C(this.byteArray,this.position,e);return this.position+=e,new r(this.byteArrayParser,t)}},{key:"getSize",value:function(){return this.byteArray.length}},{key:"readUint16",value:function(){var e=this.byteArrayParser.readUint16(this.byteArray,this.position);return this.position+=2,e}},{key:"readUint32",value:function(){var e=this.byteArrayParser.readUint32(this.byteArray,this.position);return this.position+=4,e}},{key:"readFixedString",value:function(e){var t=y(this.byteArray,this.position,e);return this.position+=e,t}}],U(r.prototype,e),t&&U(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}(),L={readUint16:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readUint16: position cannot be less than 0";if(t+2>e.length)throw"littleEndianByteArrayParser.readUint16: attempt to read past end of buffer";return e[t]+256*e[t+1]},readInt16:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readInt16: position cannot be less than 0";if(t+2>e.length)throw"littleEndianByteArrayParser.readInt16: attempt to read past end of buffer";return 32768&(t=e[t]+(e[t+1]<<8))?t-65535-1:t},readUint32:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readUint32: position cannot be less than 0";if(t+4>e.length)throw"littleEndianByteArrayParser.readUint32: attempt to read past end of buffer";return e[t]+256*e[t+1]+256*e[t+2]*256+256*e[t+3]*65536},readInt32:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readInt32: position cannot be less than 0";if(t+4>e.length)throw"littleEndianByteArrayParser.readInt32: attempt to read past end of buffer";return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24)},readFloat:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readFloat: position cannot be less than 0";if(t+4>e.length)throw"littleEndianByteArrayParser.readFloat: attempt to read past end of buffer";var r=new Uint8Array(4);return r[0]=e[t],r[1]=e[t+1],r[2]=e[t+2],r[3]=e[t+3],new Float32Array(r.buffer)[0]},readDouble:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readDouble: position cannot be less than 0";if(t+8>e.length)throw"littleEndianByteArrayParser.readDouble: attempt to read past end of buffer";var r=new Uint8Array(8);return r[0]=e[t],r[1]=e[t+1],r[2]=e[t+2],r[3]=e[t+3],r[4]=e[t+4],r[5]=e[t+5],r[6]=e[t+6],r[7]=e[t+7],new Float64Array(r.buffer)[0]}};function V(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw"dicomParser.readPart10Header: missing required parameter 'byteArray'";var r=t.TransferSyntaxUID,n=new R(L,e);return function(){var e=function(){if(132>=n.getSize()&&r)return!1;if(n.seek(128),"DICM"===n.readFixedString(4))return!0;if(!(t||{}).TransferSyntaxUID)throw"dicomParser.readPart10Header: DICM prefix not found at location 132 - this is not a valid DICOM P10 file.";return n.seek(0),!1}(),i=[],a={};if(!e)return n.position=0,{elements:{x00020010:{tag:"x00020010",vr:"UI",Value:r}},warnings:i};for(;n.position<n.byteArray.length;){var o=n.position,s=x(n,i);if("x0002ffff"<s.tag){n.position=o;break}s.parser=L,a[s.tag]=s}return(e=new b(n.byteArrayParser,n.byteArray,a)).warnings=n.warnings,e.position=n.position,e}()}function j(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw Error("dicomParser.parseDicom: missing required parameter 'byteArray'");var n,i=function(t){if(void 0===t.elements.x00020010)throw Error("dicomParser.parseDicom: missing required meta header attribute 0002,0010");return(t=t.elements.x00020010)&&t.Value||y(e,t.dataOffset,t.length)},a=n=V(e,t),o=function(n){var a=i(n),o="1.2.840.10008.1.2"!==a,a=function(n,i){var a="[object process]"===Object.prototype.toString.call("u">typeof process?process:0);if("1.2.840.10008.1.2.1.99"!==n)return new R("1.2.840.10008.1.2.2"===n?N:L,e,i);if(t&&t.inflater)return new R(L,n=t.inflater(e,i),0);if(!0==a){var o=r(0),s=C(e,i,e.length-i),o=o.inflateRawSync(s),s=T(e,o.length+i);return e.copy(s,0,0,i),o.copy(s,i),new R(L,s,0)}if("u"<typeof pako)throw"dicomParser.parseDicom: no inflater available to handle deflate transfer syntax";return o=e.slice(i),(o=T(e,(s=pako.inflateRaw(o)).length+i)).set(e.slice(0,i),0),o.set(s,i),new R(L,o,0)}(a,n.position),n=new b(a.byteArrayParser,a.byteArray,{});n.warnings=a.warnings;try{(o?P:O)(n,a,a.byteArray.length,t)}catch(e){throw{exception:e,dataSet:n}}return n}(n);for(var s in a.elements)a.elements.hasOwnProperty(s)&&(o.elements[s]=a.elements[s]);return void 0!==a.warnings&&(o.warnings=a.warnings.concat(o.warnings)),o}var F=function(e,t,r){for(var n=0,i=t;i<t+r;i++)n+=e[i].length;return n};function B(e,t,r,n,i){if(i=i||t.fragments,void 0===e)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'dataSet'";if(void 0===t)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'pixelDataElement'";if(void 0===r)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'startFragmentIndex'";if(void 0===(n=n||1))throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'numFragments'";if("x7fe00010"!==t.tag)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010";if(!0!==t.encapsulatedPixelData||!0!==t.hadUndefinedLength||void 0===t.basicOffsetTable||void 0===t.fragments||t.fragments.length<=0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(r<0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragmentIndex' must be >= 0";if(r>=t.fragments.length)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragmentIndex' must be < number of fragments";if(n<1)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'numFragments' must be > 0";if(r+n>t.fragments.length)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragment' + 'numFragments' < number of fragments";var a=new R(e.byteArrayParser,e.byteArray,t.dataOffset),t=E(a);if("xfffee000"!==t.tag)throw"dicomParser.readEncapsulatedPixelData: missing basic offset table xfffee000";a.seek(t.length);var o=a.position;if(1===n)return C(a.byteArray,o+i[r].offset+8,i[r].length);for(var t=F(i,r,n),s=T(a.byteArray,t),l=0,u=r;u<r+n;u++)for(var c=o+i[u].offset+8,d=0;d<i[u].length;d++)s[l++]=a.byteArray[c++];return s}var Y=function(e,t){for(var r=0;r<e.length;r++)if(e[r].offset===t)return r},$=function(e,t,r,n){if(e===t.length-1)return r.length-n;for(var i=t[e+1],a=n+1;a<r.length;a++)if(r[a].offset===i)return a-n;throw"dicomParser.calculateNumberOfFragmentsForFrame: could not find fragment with offset matching basic offset table"};function H(e,t,r,n,i){if(n=n||t.basicOffsetTable,i=i||t.fragments,void 0===e)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'dataSet'";if(void 0===t)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'pixelDataElement'";if(void 0===r)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'frameIndex'";if(void 0===n)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' does not have basicOffsetTable";if("x7fe00010"!==t.tag)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010)";if(!0!==t.encapsulatedPixelData)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(!0!==t.hadUndefinedLength)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have undefined length";if(void 0===t.fragments)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have fragments";if(0===n.length)throw"dicomParser.readEncapsulatedImageFrame: basicOffsetTable has zero entries";if(r<0)throw"dicomParser.readEncapsulatedImageFrame: parameter 'frameIndex' must be >= 0";if(r>=n.length)throw"dicomParser.readEncapsulatedImageFrame: parameter 'frameIndex' must be < basicOffsetTable.length";var a=n[r],a=Y(i,a);if(void 0===a)throw"dicomParser.readEncapsulatedImageFrame: unable to find fragment that matches basic offset table entry";return B(e,t,a,$(r,n,i,a),i)}var W=!1;function G(e,t,r){if(W||(W=!0,console&&console.log&&console.log("WARNING: dicomParser.readEncapsulatedPixelData() has been deprecated")),void 0===e)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'dataSet'";if(void 0===t)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'element'";if(void 0===r)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'frame'";if("x7fe00010"!==t.tag)throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to non pixel data tag (expected tag = x7fe00010)";if(!0!==t.encapsulatedPixelData||!0!==t.hadUndefinedLength||void 0===t.basicOffsetTable||void 0===t.fragments)throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to pixel data element that does not have encapsulated pixel data";if(r<0)throw"dicomParser.readEncapsulatedPixelData: parameter 'frame' must be >= 0";return 0!==t.basicOffsetTable.length?H(e,t,r):B(e,t,0,t.fragments.length)}t.default={isStringVr:a,isPrivateTag:o,parsePN:s,parseTM:l,parseDA:u,explicitElementToString:c,explicitDataSetToJS:d,createJPEGBasicOffsetTable:h,parseDicomDataSetExplicit:P,parseDicomDataSetImplicit:O,readFixedString:y,alloc:T,version:k,bigEndianByteArrayParser:N,ByteStream:R,sharedCopy:C,DataSet:b,findAndSetUNElementLength:m,findEndOfEncapsulatedElement:g,findItemDelimitationItemAndSetElementLength:w,littleEndianByteArrayParser:L,parseDicom:j,readDicomElementExplicit:x,readDicomElementImplicit:_,readEncapsulatedImageFrame:H,readEncapsulatedPixelData:G,readEncapsulatedPixelDataFromFragments:B,readPart10Header:V,readSequenceItemsExplicit:A,readSequenceItemsImplicit:D,readSequenceItem:E,readTag:p,LEI:"1.2.840.10008.1.2",LEE:"1.2.840.10008.1.2.1"}}],i.c=r,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t||4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,(function(t){return e[t]}).bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1);function i(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,i),n.l=!0,n.exports}}(r(534))},913(e){"use strict";e.exports=function(e,t){for(var r={},n=Object.keys(e),i=Array.isArray(t),a=0;a<n.length;a++){var o=n[a],s=e[o];(i?-1!==t.indexOf(o):t(o,s,e))&&(r[o]=s)}return r}},801(e,t){t.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,d=r?i-1:0,f=r?-1:1,h=e[t+d];for(d+=f,a=h&(1<<-c)-1,h>>=-c,c+=s;c>0;a=256*a+e[t+d],d+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+e[t+d],d+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),a-=u}return(h?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<<u)-1,d=c>>1,f=5960464477539062e-23*(23===i),h=n?0:a-1,p=n?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=f/l:t+=f*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=c?(s=0,o=c):o+d>=1?(s=(t*l-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+h]=255&s,h+=p,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+h]=255&o,h+=p,o/=256,u-=8);e[r+h-p]|=128*g}},752(e,t){"use strict";function r(e){return"object"!=typeof e||"toString"in e?e:Object.prototype.toString.call(e).slice(8,-1)}Object.defineProperty(t,"__esModule",{value:!0});var n="object"==typeof process;function i(e,t){if(!e){if(n)throw Error("Invariant failed");throw Error(t())}}t.invariant=i;var a=Object.prototype.hasOwnProperty,o=Array.prototype.splice,s=Object.prototype.toString;function l(e){return s.call(e).slice(8,-1)}var u=Object.assign||function(e,t){return c(t).forEach(function(r){a.call(t,r)&&(e[r]=t[r])}),e},c="function"==typeof Object.getOwnPropertySymbols?function(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.keys(e)};function d(e){return Array.isArray(e)?u(e.constructor(e.length),e):"Map"===l(e)?new Map(e):"Set"===l(e)?new Set(e):e&&"object"==typeof e?u(Object.create(Object.getPrototypeOf(e)),e):e}var f=function(){function e(){this.commands=u({},h),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(e,t){return e===t},this.update.newContext=function(){return new e().update}}return Object.defineProperty(e.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(e){this.update.isEquals=e},enumerable:!0,configurable:!0}),e.prototype.extend=function(e,t){this.commands[e]=t},e.prototype.update=function(e,t){var r=this,n="function"==typeof t?{$apply:t}:t;Array.isArray(e)&&Array.isArray(n)||i(!Array.isArray(n),function(){return"update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),i("object"==typeof n&&null!==n,function(){return"update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the following commands: "+Object.keys(r.commands).join(", ")+"."});var o=e;return c(n).forEach(function(t){if(a.call(r.commands,t)){var i=e===o;o=r.commands[t](n[t],o,n,e),i&&r.isEquals(o,e)&&(o=e)}else{var s="Map"===l(e)?r.update(e.get(t),n[t]):r.update(e[t],n[t]),u="Map"===l(o)?o.get(t):o[t];r.isEquals(s,u)&&(void 0!==s||a.call(e,t))||(o===e&&(o=d(e)),"Map"===l(o)?o.set(t,s):o[t]=s)}}),o},e}();t.Context=f;var h={$push:function(e,t,r){return g(t,r,"$push"),e.length?t.concat(e):t},$unshift:function(e,t,r){return g(t,r,"$unshift"),e.length?e.concat(t):t},$splice:function(e,t,n,a){var s,l;return s=t,l=n,i(Array.isArray(s),function(){return"Expected $splice target to be an array; got "+r(s)}),y(l.$splice),e.forEach(function(e){y(e),t===a&&e.length&&(t=d(a)),o.apply(t,e)}),t},$set:function(e,t,r){return i(1===Object.keys(r).length,function(){return"Cannot have more than one key in an object with $set"}),e},$toggle:function(e,t){m(e,"$toggle");var r=e.length?d(t):t;return e.forEach(function(e){r[e]=!t[e]}),r},$unset:function(e,t,r,n){return m(e,"$unset"),e.forEach(function(e){Object.hasOwnProperty.call(t,e)&&(t===n&&(t=d(n)),delete t[e])}),t},$add:function(e,t,r,n){return v(t,"$add"),m(e,"$add"),"Map"===l(t)?e.forEach(function(e){var r=e[0],i=e[1];t===n&&t.get(r)!==i&&(t=d(n)),t.set(r,i)}):e.forEach(function(e){t!==n||t.has(e)||(t=d(n)),t.add(e)}),t},$remove:function(e,t,r,n){return v(t,"$remove"),m(e,"$remove"),e.forEach(function(e){t===n&&t.has(e)&&(t=d(n)),t.delete(e)}),t},$merge:function(e,t,n,a){var o,s;return o=t,i((s=e)&&"object"==typeof s,function(){return"update(): $merge expects a spec of type 'object'; got "+r(s)}),i(o&&"object"==typeof o,function(){return"update(): $merge expects a target of type 'object'; got "+r(o)}),c(e).forEach(function(r){e[r]!==t[r]&&(t===a&&(t=d(a)),t[r]=e[r])}),t},$apply:function(e,t){var n;return i("function"==typeof(n=e),function(){return"update(): expected spec of $apply to be a function; got "+r(n)+"."}),e(t)}},p=new f;function g(e,t,n){i(Array.isArray(e),function(){return"update(): expected target of "+r(n)+" to be an array; got "+r(e)+"."}),m(t[n],n)}function m(e,t){i(Array.isArray(e),function(){return"update(): expected spec of "+r(t)+" to be an array; got "+r(e)+". Did you forget to wrap your parameter in an array?"})}function y(e){i(Array.isArray(e),function(){return"update(): expected spec of $splice to be an array of arrays; got "+r(e)+". Did you forget to wrap your parameters in an array?"})}function v(e,t){var n=l(e);i("Map"===n||"Set"===n,function(){return"update(): "+r(t)+" expects a target of type Set or Map; got "+r(n)})}t.isEquals=p.update.isEquals,t.extend=p.extend,t.default=p.update,t.default.default=e.exports=u(t.default,t)},642(e,t){"use strict";self.atob.bind(self),self.btoa.bind(self)},359(e,t,r){e=r.nmd(e);var n,i="__lodash_hash_undefined__",a="[object Arguments]",o="[object Boolean]",s="[object Date]",l="[object Function]",u="[object GeneratorFunction]",c="[object Map]",d="[object Number]",f="[object Object]",h="[object Promise]",p="[object RegExp]",g="[object Set]",m="[object String]",y="[object Symbol]",v="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",_="[object Float64Array]",E="[object Int8Array]",I="[object Int16Array]",D="[object Int32Array]",M="[object Uint8Array]",A="[object Uint8ClampedArray]",x="[object Uint16Array]",P="[object Uint32Array]",O=/\w*$/,T=/^\[object .+?Constructor\]$/,k=/^(?:0|[1-9]\d*)$/,N={};N[a]=N["[object Array]"]=N[S]=N[b]=N[o]=N[s]=N[w]=N[_]=N[E]=N[I]=N[D]=N[c]=N[d]=N[f]=N[p]=N[g]=N[m]=N[y]=N[M]=N[A]=N[x]=N[P]=!0,N["[object Error]"]=N[l]=N[v]=!1;var C="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,U="object"==typeof self&&self&&self.Object===Object&&self,R=C||U||Function("return this")(),L=t&&!t.nodeType&&t,V=L&&e&&!e.nodeType&&e,j=V&&V.exports===L;function F(e,t){return e.set(t[0],t[1]),e}function B(e,t){return e.add(t),e}function Y(e,t,r,n){var i=-1,a=e?e.length:0;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function $(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function H(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function W(e,t){return function(r){return e(t(r))}}function G(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var q=Array.prototype,z=Function.prototype,X=Object.prototype,K=R["__core-js_shared__"],Z=(n=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",J=z.toString,Q=X.hasOwnProperty,ee=X.toString,et=RegExp("^"+J.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),er=j?R.Buffer:void 0,en=R.Symbol,ei=R.Uint8Array,ea=W(Object.getPrototypeOf,Object),eo=Object.create,es=X.propertyIsEnumerable,el=q.splice,eu=Object.getOwnPropertySymbols,ec=er?er.isBuffer:void 0,ed=W(Object.keys,Object),ef=eC(R,"DataView"),eh=eC(R,"Map"),ep=eC(R,"Promise"),eg=eC(R,"Set"),em=eC(R,"WeakMap"),ey=eC(Object,"create"),ev=eV(ef),eS=eV(eh),eb=eV(ep),ew=eV(eg),e_=eV(em),eE=en?en.prototype:void 0,eI=eE?eE.valueOf:void 0;function eD(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function eM(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function eA(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ex(e){this.__data__=new eM(e)}function eP(e,t,r){var n=e[t];Q.call(e,t)&&ej(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function eO(e,t){for(var r=e.length;r--;)if(ej(e[r][0],t))return r;return -1}function eT(e){var t=new e.constructor(e.byteLength);return new ei(t).set(new ei(e)),t}function ek(e,t,r,n){r||(r={});for(var i=-1,a=t.length;++i<a;){var o=t[i],s=n?n(r[o],e[o],o,r,e):void 0;eP(r,o,void 0===s?e[o]:s)}return r}function eN(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function eC(e,t){var r,n=null==e?void 0:e[t];return!(!eH(n)||(r=n,Z&&Z in r))&&(e$(n)||$(n)?et:T).test(eV(n))?n:void 0}eD.prototype.clear=function(){this.__data__=ey?ey(null):{}},eD.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},eD.prototype.get=function(e){var t=this.__data__;if(ey){var r=t[e];return r===i?void 0:r}return Q.call(t,e)?t[e]:void 0},eD.prototype.has=function(e){var t=this.__data__;return ey?void 0!==t[e]:Q.call(t,e)},eD.prototype.set=function(e,t){return this.__data__[e]=ey&&void 0===t?i:t,this},eM.prototype.clear=function(){this.__data__=[]},eM.prototype.delete=function(e){var t=this.__data__,r=eO(t,e);return!(r<0)&&(r==t.length-1?t.pop():el.call(t,r,1),!0)},eM.prototype.get=function(e){var t=this.__data__,r=eO(t,e);return r<0?void 0:t[r][1]},eM.prototype.has=function(e){return eO(this.__data__,e)>-1},eM.prototype.set=function(e,t){var r=this.__data__,n=eO(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},eA.prototype.clear=function(){this.__data__={hash:new eD,map:new(eh||eM),string:new eD}},eA.prototype.delete=function(e){return eN(this,e).delete(e)},eA.prototype.get=function(e){return eN(this,e).get(e)},eA.prototype.has=function(e){return eN(this,e).has(e)},eA.prototype.set=function(e,t){return eN(this,e).set(e,t),this},ex.prototype.clear=function(){this.__data__=new eM},ex.prototype.delete=function(e){return this.__data__.delete(e)},ex.prototype.get=function(e){return this.__data__.get(e)},ex.prototype.has=function(e){return this.__data__.has(e)},ex.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eM){var n=r.__data__;if(!eh||n.length<199)return n.push([e,t]),this;r=this.__data__=new eA(n)}return r.set(e,t),this};var eU=eu?W(eu,Object):function(){return[]},eR=function(e){return ee.call(e)};function eL(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function eV(e){if(null!=e){try{return J.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function ej(e,t){return e===t||e!=e&&t!=t}(ef&&eR(new ef(new ArrayBuffer(1)))!=b||eh&&eR(new eh)!=c||ep&&eR(ep.resolve())!=h||eg&&eR(new eg)!=g||em&&eR(new em)!=v)&&(eR=function(e){var t=ee.call(e),r=t==f?e.constructor:void 0,n=r?eV(r):void 0;if(n)switch(n){case ev:return b;case eS:return c;case eb:return h;case ew:return g;case e_:return v}return t});var eF=Array.isArray;function eB(e){var t;return null!=e&&"number"==typeof(t=e.length)&&t>-1&&t%1==0&&t<=0x1fffffffffffff&&!e$(e)}var eY=ec||function(){return!1};function e$(e){var t=eH(e)?ee.call(e):"";return t==l||t==u}function eH(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function eW(e){return eB(e)?function(e){var t,r,n,i,o,s=eF(e)||(n=r=t=e)&&"object"==typeof n&&eB(r)&&Q.call(t,"callee")&&(!es.call(t,"callee")||ee.call(t)==a)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],l=s.length,u=!!l;for(var c in e){Q.call(e,c)&&!(u&&("length"==c||(i=c,(o=null==(o=l)?0x1fffffffffffff:o)&&("number"==typeof i||k.test(i))&&i>-1&&i%1==0&&i<o)))&&s.push(c)}return s}(e):function(e){if(!eL(e))return ed(e);var t=[];for(var r in Object(e))Q.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return function e(t,r,n,i,h,v,T){if(i&&(k=v?i(t,h,v,T):i(t)),void 0!==k)return k;if(!eH(t))return t;var k,C=eF(t);if(C){if(R=(U=t).length,L=U.constructor(R),R&&"string"==typeof U[0]&&Q.call(U,"index")&&(L.index=U.index,L.input=U.input),k=L,!r){var U,R,L,V=t,j=k,W=-1,q=V.length;for(j||(j=Array(q));++W<q;)j[W]=V[W];return j}}else{var z,X,K,Z,J,ee=eR(t),et=ee==l||ee==u;if(eY(t)){var er=t,en=r;if(en)return er.slice();var ei=new er.constructor(er.length);return er.copy(ei),ei}if(ee==f||ee==a||et&&!v){if($(t))return v?t:{};if(k="function"!=typeof(z=et?{}:t).constructor||eL(z)?{}:eH(X=ea(z))?eo(X):{},!r){return K=t,Z=(J=k)&&ek(t,eW(t),J),ek(K,eU(K),Z)}}else{if(!N[ee])return v?t:{};k=function(e,t,r,n){var i,a,l,u=e.constructor;switch(t){case S:return eT(e);case o:case s:return new u(+e);case b:return i=n?eT(e.buffer):e.buffer,new e.constructor(i,e.byteOffset,e.byteLength);case w:case _:case E:case I:case D:case M:case A:case x:case P:return a=n?eT(e.buffer):e.buffer,new e.constructor(a,e.byteOffset,e.length);case c:return Y(n?r(H(e),!0):H(e),F,new e.constructor);case d:case m:return new u(e);case p:return(l=new e.constructor(e.source,O.exec(e))).lastIndex=e.lastIndex,l;case g:return Y(n?r(G(e),!0):G(e),B,new e.constructor);case y:return eI?Object(eI.call(e)):{}}}(t,ee,e,r)}}T||(T=new ex);var es=T.get(t);if(es)return es;if(T.set(t,k),!C)var el=n?function(e){var t;return t=eW(e),eF(e)?t:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(t,eU(e))}(t):eW(t);return!function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););}(el||t,function(a,o){el&&(a=t[o=a]),eP(k,o,e(a,r,n,i,o,t,T))}),k}(e,!0,!0)}},867(e,t,r){e=r.nmd(e),e.exports=function(){"use strict";function t(){return B.apply(null,arguments)}function n(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e){var t;if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(t in e)if(a(e,t))return!1;return!0}function s(e){return void 0===e}function l(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function u(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function c(e,t){var r,n=[],i=e.length;for(r=0;r<i;++r)n.push(t(e[r],r));return n}function d(e,t){for(var r in t)a(t,r)&&(e[r]=t[r]);return a(t,"toString")&&(e.toString=t.toString),a(t,"valueOf")&&(e.valueOf=t.valueOf),e}function f(e,t,r,n){return ta(e,t,r,n,!0).utc()}function h(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function p(e){var t=null,r=!1,n=e._d&&!isNaN(e._d.getTime());return(n&&(t=h(e),r=Y.call(t.parsedDateParts,function(e){return null!=e}),n=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&r),e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)),null!=Object.isFrozen&&Object.isFrozen(e))?n:(e._isValid=n,e._isValid)}function g(e){var t=f(NaN);return null!=e?d(h(t),e):h(t).userInvalidated=!0,t}Y=Array.prototype.some?Array.prototype.some:function(e){var t,r=Object(this),n=r.length>>>0;for(t=0;t<n;t++)if(t in r&&e.call(this,r[t],t,r))return!0;return!1};var m,y,v=t.momentProperties=[],S=!1;function b(e,t){var r,n,i,a=v.length;if(s(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),s(t._i)||(e._i=t._i),s(t._f)||(e._f=t._f),s(t._l)||(e._l=t._l),s(t._strict)||(e._strict=t._strict),s(t._tzm)||(e._tzm=t._tzm),s(t._isUTC)||(e._isUTC=t._isUTC),s(t._offset)||(e._offset=t._offset),s(t._pf)||(e._pf=h(t)),s(t._locale)||(e._locale=t._locale),a>0)for(r=0;r<a;r++)s(i=t[n=v[r]])||(e[n]=i);return e}function w(e){b(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===S&&(S=!0,t.updateOffset(this),S=!1)}function _(e){return e instanceof w||null!=e&&null!=e._isAMomentObject}function E(e){!1===t.suppressDeprecationWarnings&&"u">typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function I(e,r){var n=!0;return d(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),n){var i,o,s,l=[],u=arguments.length;for(o=0;o<u;o++){if(i="","object"==typeof arguments[o]){for(s in i+="\n["+o+"] ",arguments[0])a(arguments[0],s)&&(i+=s+": "+arguments[0][s]+", ");i=i.slice(0,-2)}else i=arguments[o];l.push(i)}E(e+"\nArguments: "+Array.prototype.slice.call(l).join("")+"\n"+Error().stack),n=!1}return r.apply(this,arguments)},r)}var D={};function M(e,r){null!=t.deprecationHandler&&t.deprecationHandler(e,r),D[e]||(E(r),D[e]=!0)}function A(e){return"u">typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e,t){var r,n=d({},e);for(r in t)a(t,r)&&(i(e[r])&&i(t[r])?(n[r]={},d(n[r],e[r]),d(n[r],t[r])):null!=t[r]?n[r]=t[r]:delete n[r]);for(r in e)a(e,r)&&!a(t,r)&&i(e[r])&&(n[r]=d({},n[r]));return n}function P(e){null!=e&&this.set(e)}function O(e,t,r){var n=""+Math.abs(e);return(e>=0?r?"+":"":"-")+Math.pow(10,Math.max(0,t-n.length)).toString().substr(1)+n}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var T=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,k=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,N={},C={};function U(e,t,r,n){var i=n;"string"==typeof n&&(i=function(){return this[n]()}),e&&(C[e]=i),t&&(C[t[0]]=function(){return O(i.apply(this,arguments),t[1],t[2])}),r&&(C[r]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function R(e,t){return e.isValid()?(N[t=L(t,e.localeData())]=N[t]||function(e){var t,r,n,i=e.match(T);for(r=0,n=i.length;r<n;r++)C[i[r]]?i[r]=C[i[r]]:i[r]=(t=i[r]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(t){var r,a="";for(r=0;r<n;r++)a+=A(i[r])?i[r].call(t,e):i[r];return a}}(t),N[t](e)):e.localeData().invalidDate()}function L(e,t){var r=5;function n(e){return t.longDateFormat(e)||e}for(k.lastIndex=0;r>=0&&k.test(e);)e=e.replace(k,n),k.lastIndex=0,r-=1;return e}var V={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function j(e){return"string"==typeof e?V[e]||V[e.toLowerCase()]:void 0}function F(e){var t,r,n={};for(r in e)a(e,r)&&(t=j(r))&&(n[t]=e[r]);return n}var B,Y,$,H={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1},W=Object.keys?Object.keys:function(e){var t,r=[];for(t in e)a(e,t)&&r.push(t);return r},G=/\d/,q=/\d\d/,z=/\d{3}/,X=/\d{4}/,K=/[+-]?\d{6}/,Z=/\d\d?/,J=/\d\d\d\d?/,Q=/\d\d\d\d\d\d?/,ee=/\d{1,3}/,et=/\d{1,4}/,er=/[+-]?\d{1,6}/,en=/\d+/,ei=/[+-]?\d+/,ea=/Z|[+-]\d\d:?\d\d/gi,eo=/Z|[+-]\d\d(?::?\d\d)?/gi,es=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,el=/^[1-9]\d?/,eu=/^([1-9]\d|\d)/;function ec(e,t,r){$[e]=A(t)?t:function(e,n){return e&&r?r:t}}function ed(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ef(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function eh(e){var t=+e,r=0;return 0!==t&&isFinite(t)&&(r=ef(t)),r}$={};var ep={};function eg(e,t){var r,n,i=t;for("string"==typeof e&&(e=[e]),l(t)&&(i=function(e,r){r[t]=eh(e)}),n=e.length,r=0;r<n;r++)ep[e[r]]=i}function em(e,t){eg(e,function(e,r,n,i){n._w=n._w||{},t(e,n._w,n,i)})}function ey(e){return e%4==0&&e%100!=0||e%400==0}function ev(e){return ey(e)?366:365}U("Y",0,0,function(){var e=this.year();return e<=9999?O(e,4):"+"+e}),U(0,["YY",2],0,function(){return this.year()%100}),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,!0],0,"year"),ec("Y",ei),ec("YY",Z,q),ec("YYYY",et,X),ec("YYYYY",er,K),ec("YYYYYY",er,K),eg(["YYYYY","YYYYYY"],0),eg("YYYY",function(e,r){r[0]=2===e.length?t.parseTwoDigitYear(e):eh(e)}),eg("YY",function(e,r){r[0]=t.parseTwoDigitYear(e)}),eg("Y",function(e,t){t[0]=parseInt(e,10)}),t.parseTwoDigitYear=function(e){return eh(e)+(eh(e)>68?1900:2e3)};var eS=eb("FullYear",!0);function eb(e,r){return function(n){return null!=n?(e_(this,e,n),t.updateOffset(this,r),this):ew(this,e)}}function ew(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function e_(e,t,r){var n,i,a,o;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,i=e._isUTC,t){case"Milliseconds":return void(i?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(i?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(i?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(i?n.setUTCHours(r):n.setHours(r));case"Date":return void(i?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}a=e.month(),o=29!==(o=e.date())||1!==a||ey(r)?o:28,i?n.setUTCFullYear(r,a,o):n.setFullYear(r,a,o)}}function eE(e,t){if(isNaN(e)||isNaN(t))return NaN;var r=(t%12+12)%12;return e+=(t-r)/12,1===r?ey(e)?29:28:31-r%7%2}e$=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return -1},U("M",["MM",2],"Mo",function(){return this.month()+1}),U("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),U("MMMM",0,0,function(e){return this.localeData().months(this,e)}),ec("M",Z,el),ec("MM",Z,q),ec("MMM",function(e,t){return t.monthsShortRegex(e)}),ec("MMMM",function(e,t){return t.monthsRegex(e)}),eg(["M","MM"],function(e,t){t[1]=eh(e)-1}),eg(["MMM","MMMM"],function(e,t,r,n){var i=r._locale.monthsParse(e,n,r._strict);null!=i?t[1]=i:h(r).invalidMonth=e});var eI="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),eD=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;function eM(e,t,r){var n,i,a,o=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],n=0;n<12;++n)a=f([2e3,n]),this._shortMonthsParse[n]=this.monthsShort(a,"").toLocaleLowerCase(),this._longMonthsParse[n]=this.months(a,"").toLocaleLowerCase();if(r)if("MMM"===t)return -1!==(i=e$.call(this._shortMonthsParse,o))?i:null;else return -1!==(i=e$.call(this._longMonthsParse,o))?i:null;return"MMM"===t?-1!==(i=e$.call(this._shortMonthsParse,o))||-1!==(i=e$.call(this._longMonthsParse,o))?i:null:-1!==(i=e$.call(this._longMonthsParse,o))||-1!==(i=e$.call(this._shortMonthsParse,o))?i:null}function eA(e,t){if(!e.isValid())return e;if("string"==typeof t){if(/^\d+$/.test(t))t=eh(t);else if(!l(t=e.localeData().monthsParse(t)))return e}var r=t,n=e.date();return n=n<29?n:Math.min(n,eE(e.year(),r)),e._isUTC?e._d.setUTCMonth(r,n):e._d.setMonth(r,n),e}function ex(e){return null!=e?(eA(this,e),t.updateOffset(this,!0),this):ew(this,"Month")}function eP(){function e(e,t){return t.length-e.length}var t,r,n,i,a=[],o=[],s=[];for(t=0;t<12;t++)r=f([2e3,t]),n=ed(this.monthsShort(r,"")),i=ed(this.months(r,"")),a.push(n),o.push(i),s.push(i),s.push(n);a.sort(e),o.sort(e),s.sort(e),this._monthsRegex=RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=RegExp("^("+o.join("|")+")","i"),this._monthsShortStrictRegex=RegExp("^("+a.join("|")+")","i")}function eO(e,t,r,n,i,a,o){var s;return e<100&&e>=0?isFinite((s=new Date(e+400,t,r,n,i,a,o)).getFullYear())&&s.setFullYear(e):s=new Date(e,t,r,n,i,a,o),s}function eT(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,isFinite((t=new Date(Date.UTC.apply(null,r))).getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function ek(e,t,r){var n=7+t-r;return-((7+eT(e,0,n).getUTCDay()-t)%7)+n-1}function eN(e,t,r,n,i){var a,o,s=1+7*(t-1)+(7+r-n)%7+ek(e,n,i);return s<=0?o=ev(a=e-1)+s:s>ev(e)?(a=e+1,o=s-ev(e)):(a=e,o=s),{year:a,dayOfYear:o}}function eC(e,t,r){var n,i,a=ek(e.year(),t,r),o=Math.floor((e.dayOfYear()-a-1)/7)+1;return o<1?n=o+eU(i=e.year()-1,t,r):o>eU(e.year(),t,r)?(n=o-eU(e.year(),t,r),i=e.year()+1):(i=e.year(),n=o),{week:n,year:i}}function eU(e,t,r){var n=ek(e,t,r),i=ek(e+1,t,r);return(ev(e)-n+i)/7}function eR(e,t){return e.slice(t,7).concat(e.slice(0,t))}U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),ec("w",Z,el),ec("ww",Z,q),ec("W",Z,el),ec("WW",Z,q),em(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=eh(e)}),U("d",0,"do","day"),U("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),U("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),U("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),ec("d",Z),ec("e",Z),ec("E",Z),ec("dd",function(e,t){return t.weekdaysMinRegex(e)}),ec("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ec("dddd",function(e,t){return t.weekdaysRegex(e)}),em(["dd","ddd","dddd"],function(e,t,r,n){var i=r._locale.weekdaysParse(e,n,r._strict);null!=i?t.d=i:h(r).invalidWeekday=e}),em(["d","e","E"],function(e,t,r,n){t[n]=eh(e)});var eL="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");function eV(e,t,r){var n,i,a,o=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)a=f([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(a,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(a,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(a,"").toLocaleLowerCase();if(r)if("dddd"===t)return -1!==(i=e$.call(this._weekdaysParse,o))?i:null;else if("ddd"===t)return -1!==(i=e$.call(this._shortWeekdaysParse,o))?i:null;else return -1!==(i=e$.call(this._minWeekdaysParse,o))?i:null;return"dddd"===t?-1!==(i=e$.call(this._weekdaysParse,o))||-1!==(i=e$.call(this._shortWeekdaysParse,o))||-1!==(i=e$.call(this._minWeekdaysParse,o))?i:null:"ddd"===t?-1!==(i=e$.call(this._shortWeekdaysParse,o))||-1!==(i=e$.call(this._weekdaysParse,o))||-1!==(i=e$.call(this._minWeekdaysParse,o))?i:null:-1!==(i=e$.call(this._minWeekdaysParse,o))||-1!==(i=e$.call(this._weekdaysParse,o))||-1!==(i=e$.call(this._shortWeekdaysParse,o))?i:null}function ej(){function e(e,t){return t.length-e.length}var t,r,n,i,a,o=[],s=[],l=[],u=[];for(t=0;t<7;t++)r=f([2e3,1]).day(t),n=ed(this.weekdaysMin(r,"")),i=ed(this.weekdaysShort(r,"")),a=ed(this.weekdays(r,"")),o.push(n),s.push(i),l.push(a),u.push(n),u.push(i),u.push(a);o.sort(e),s.sort(e),l.sort(e),u.sort(e),this._weekdaysRegex=RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=RegExp("^("+o.join("|")+")","i")}function eF(){return this.hours()%12||12}function eB(e,t){U(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function eY(e,t){return t._meridiemParse}U("H",["HH",2],0,"hour"),U("h",["hh",2],0,eF),U("k",["kk",2],0,function(){return this.hours()||24}),U("hmm",0,0,function(){return""+eF.apply(this)+O(this.minutes(),2)}),U("hmmss",0,0,function(){return""+eF.apply(this)+O(this.minutes(),2)+O(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+O(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+O(this.minutes(),2)+O(this.seconds(),2)}),eB("a",!0),eB("A",!1),ec("a",eY),ec("A",eY),ec("H",Z,eu),ec("h",Z,el),ec("k",Z,el),ec("HH",Z,q),ec("hh",Z,q),ec("kk",Z,q),ec("hmm",J),ec("hmmss",Q),ec("Hmm",J),ec("Hmmss",Q),eg(["H","HH"],3),eg(["k","kk"],function(e,t,r){var n=eh(e);t[3]=24===n?0:n}),eg(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e}),eg(["h","hh"],function(e,t,r){t[3]=eh(e),h(r).bigHour=!0}),eg("hmm",function(e,t,r){var n=e.length-2;t[3]=eh(e.substr(0,n)),t[4]=eh(e.substr(n)),h(r).bigHour=!0}),eg("hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=eh(e.substr(0,n)),t[4]=eh(e.substr(n,2)),t[5]=eh(e.substr(i)),h(r).bigHour=!0}),eg("Hmm",function(e,t,r){var n=e.length-2;t[3]=eh(e.substr(0,n)),t[4]=eh(e.substr(n))}),eg("Hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=eh(e.substr(0,n)),t[4]=eh(e.substr(n,2)),t[5]=eh(e.substr(i))});var e$,eH,eW=eb("Hours",!0),eG={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:eI,week:{dow:0,doy:6},weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysShort:eL,meridiemParse:/[ap]\.?m?\.?/i},eq={},ez={};function eX(e){return e?e.toLowerCase().replace("_","-"):e}function eK(t){var n=null;if(void 0===eq[t]&&e&&e.exports&&t&&t.match("^[^/\\\\]*$"))try{n=eH._abbr,r(118)("./locale/"+t),eZ(n)}catch(e){eq[t]=null}return eq[t]}function eZ(e,t){var r;return e&&((r=s(t)?eQ(e):eJ(e,t))?eH=r:"u">typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),eH._abbr}function eJ(e,t){if(null===t)return delete eq[e],null;var r,n=eG;if(t.abbr=e,null!=eq[e])M("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=eq[e]._config;else if(null!=t.parentLocale)if(null!=eq[t.parentLocale])n=eq[t.parentLocale]._config;else{if(null==(r=eK(t.parentLocale)))return ez[t.parentLocale]||(ez[t.parentLocale]=[]),ez[t.parentLocale].push({name:e,config:t}),null;n=r._config}return eq[e]=new P(x(n,t)),ez[e]&&ez[e].forEach(function(e){eJ(e.name,e.config)}),eZ(e),eq[e]}function eQ(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return eH;if(!n(e)){if(t=eK(e))return t;e=[e]}return function(e){for(var t,r,n,i,a=0;a<e.length;){for(t=(i=eX(e[a]).split("-")).length,r=(r=eX(e[a+1]))?r.split("-"):null;t>0;){if(n=eK(i.slice(0,t).join("-")))return n;if(r&&r.length>=t&&function(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r<n;r+=1)if(e[r]!==t[r])return r;return n}(i,r)>=t-1)break;t--}a++}return eH}(e)}function e0(e){var t,r=e._a;return r&&-2===h(e).overflow&&(t=r[1]<0||r[1]>11?1:r[2]<1||r[2]>eE(r[0],r[1])?2:r[3]<0||r[3]>24||24===r[3]&&(0!==r[4]||0!==r[5]||0!==r[6])?3:r[4]<0||r[4]>59?4:r[5]<0||r[5]>59?5:r[6]<0||r[6]>999?6:-1,h(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),h(e)._overflowWeeks&&-1===t&&(t=7),h(e)._overflowWeekday&&-1===t&&(t=8),h(e).overflow=t),e}var e1=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e2=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e8=/Z|[+-]\d\d(?::?\d\d)?/,e4=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],e3=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],e5=/^\/?Date\((-?\d+)/i,e6=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,e7={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function e9(e){var t,r,n,i,a,o,s=e._i,l=e1.exec(s)||e2.exec(s),u=e4.length,c=e3.length;if(l){for(h(e).iso=!0,t=0,r=u;t<r;t++)if(e4[t][1].exec(l[1])){i=e4[t][0],n=!1!==e4[t][2];break}if(null==i){e._isValid=!1;return}if(l[3]){for(t=0,r=c;t<r;t++)if(e3[t][1].exec(l[3])){a=(l[2]||" ")+e3[t][0];break}if(null==a){e._isValid=!1;return}}if(!n&&null!=a){e._isValid=!1;return}if(l[4])if(e8.exec(l[4]))o="Z";else{e._isValid=!1;return}e._f=i+(a||"")+(o||""),tn(e)}else e._isValid=!1}function te(e){var t,r,n,i,a,o,s,l,u,c,d,f=e6.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(f){if(a=f[4],o=f[3],s=f[2],l=f[5],u=f[6],c=f[7],d=[(t=parseInt(a,10))<=49?2e3+t:t<=999?1900+t:t,eI.indexOf(o),parseInt(s,10),parseInt(l,10),parseInt(u,10)],c&&d.push(parseInt(c,10)),r=f[1],n=d,i=e,r&&eL.indexOf(r)!==new Date(n[0],n[1],n[2]).getDay()&&(h(i).weekdayMismatch=!0,i._isValid=!1,1))return;e._a=d,e._tzm=function(e,t,r){if(e)return e7[e];if(t)return 0;var n=parseInt(r,10),i=n%100;return(n-i)/100*60+i}(f[8],f[9],f[10]),e._d=eT.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),h(e).rfc2822=!0}else e._isValid=!1}function tt(e,t,r){return null!=e?e:null!=t?t:r}function tr(e){var r,n,i,a,o,s,l,u,c,d,f,p,g,m,y,v,S=[];if(!e._d){for(f=new Date(t.now()),m=e._useUTC?[f.getUTCFullYear(),f.getUTCMonth(),f.getUTCDate()]:[f.getFullYear(),f.getMonth(),f.getDate()],e._w&&null==e._a[2]&&null==e._a[1]&&(null!=(n=(r=e)._w).GG||null!=n.W||null!=n.E?(s=1,l=4,i=tt(n.GG,r._a[0],eC(to(),1,4).year),a=tt(n.W,1),((o=tt(n.E,1))<1||o>7)&&(c=!0)):(s=r._locale._week.dow,l=r._locale._week.doy,d=eC(to(),s,l),i=tt(n.gg,r._a[0],d.year),a=tt(n.w,d.week),null!=n.d?((o=n.d)<0||o>6)&&(c=!0):null!=n.e?(o=n.e+s,(n.e<0||n.e>6)&&(c=!0)):o=s),a<1||a>eU(i,s,l)?h(r)._overflowWeeks=!0:null!=c?h(r)._overflowWeekday=!0:(u=eN(i,a,o,s,l),r._a[0]=u.year,r._dayOfYear=u.dayOfYear)),null!=e._dayOfYear&&(v=tt(e._a[0],m[0]),(e._dayOfYear>ev(v)||0===e._dayOfYear)&&(h(e)._overflowDayOfYear=!0),g=eT(v,0,e._dayOfYear),e._a[1]=g.getUTCMonth(),e._a[2]=g.getUTCDate()),p=0;p<3&&null==e._a[p];++p)e._a[p]=S[p]=m[p];for(;p<7;p++)e._a[p]=S[p]=null==e._a[p]?+(2===p):e._a[p];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?eT:eO).apply(null,S),y=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==y&&(h(e).weekdayMismatch=!0)}}function tn(e){if(e._f===t.ISO_8601)return void e9(e);if(e._f===t.RFC_2822)return void te(e);e._a=[],h(e).empty=!0;var r,n,i,o,s,l,u,c,d,f,p,g=""+e._i,m=g.length,y=0;for(p=(u=L(e._f,e._locale).match(T)||[]).length,s=0;s<p;s++)if(c=u[s],(l=(g.match(!a($,c)?new RegExp(ed(c.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,r,n,i){return t||r||n||i}))):$[c](e._strict,e._locale))||[])[0])&&((d=g.substr(0,g.indexOf(l))).length>0&&h(e).unusedInput.push(d),g=g.slice(g.indexOf(l)+l.length),y+=l.length),C[c])l?h(e).empty=!1:h(e).unusedTokens.push(c),null!=l&&a(ep,c)&&ep[c](l,e._a,e,c);else e._strict&&!l&&h(e).unusedTokens.push(c);h(e).charsLeftOver=m-y,g.length>0&&h(e).unusedInput.push(g),e._a[3]<=12&&!0===h(e).bigHour&&e._a[3]>0&&(h(e).bigHour=void 0),h(e).parsedDateParts=e._a.slice(0),h(e).meridiem=e._meridiem,e._a[3]=(r=e._locale,n=e._a[3],null==(i=e._meridiem)?n:null!=r.meridiemHour?r.meridiemHour(n,i):(null!=r.isPM&&((o=r.isPM(i))&&n<12&&(n+=12),o||12!==n||(n=0)),n)),null!==(f=h(e).era)&&(e._a[0]=e._locale.erasConvertYear(f,e._a[0])),tr(e),e0(e)}function ti(e){var r=e._i,a=e._f;return(e._locale=e._locale||eQ(e._l),null===r||void 0===a&&""===r)?g({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),_(r))?new w(e0(r)):(u(r)?e._d=r:n(a)?!function(e){var t,r,n,i,a,o,s=!1,l=e._f.length;if(0===l){h(e).invalidFormat=!0,e._d=new Date(NaN);return}for(i=0;i<l;i++)a=0,o=!1,t=b({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],tn(t),p(t)&&(o=!0),a+=h(t).charsLeftOver,a+=10*h(t).unusedTokens.length,h(t).score=a,s?a<n&&(n=a,r=t):(null==n||a<n||o)&&(n=a,r=t,o&&(s=!0));d(e,r||t)}(e):a?tn(e):function(e){var r=e._i;if(s(r))e._d=new Date(t.now());else if(u(r))e._d=new Date(r.valueOf());else if("string"==typeof r)!function(e){var r=e5.exec(e._i);if(null!==r){e._d=new Date(+r[1]);return}e9(e),!1!==e._isValid||(delete e._isValid,te(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:t.createFromInputFallback(e)))}(e);else if(n(r))e._a=c(r.slice(0),function(e){return parseInt(e,10)}),tr(e);else if(i(r)){if(!e._d){var a=F(e._i),o=void 0===a.day?a.date:a.day;e._a=c([a.year,a.month,o,a.hour,a.minute,a.second,a.millisecond],function(e){return e&&parseInt(e,10)}),tr(e)}}else l(r)?e._d=new Date(r):t.createFromInputFallback(e)}(e),p(e)||(e._d=null),e)}function ta(e,t,r,a,s){var l,u={};return(!0===t||!1===t)&&(a=t,t=void 0),(!0===r||!1===r)&&(a=r,r=void 0),(i(e)&&o(e)||n(e)&&0===e.length)&&(e=void 0),u._isAMomentObject=!0,u._useUTC=u._isUTC=s,u._l=r,u._i=e,u._f=t,u._strict=a,(l=new w(e0(ti(u))))._nextDay&&(l.add(1,"d"),l._nextDay=void 0),l}function to(e,t,r,n){return ta(e,t,r,n,!1)}t.createFromInputFallback=I("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),t.ISO_8601=function(){},t.RFC_2822=function(){};var ts=I("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=to.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:g()}),tl=I("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=to.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:g()});function tu(e,t){var r,i;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return to();for(r=t[0],i=1;i<t.length;++i)(!t[i].isValid()||t[i][e](r))&&(r=t[i]);return r}var tc=["year","quarter","month","week","day","hour","minute","second","millisecond"];function td(e){var t=F(e),r=t.year||0,n=t.quarter||0,i=t.month||0,o=t.week||t.isoWeek||0,s=t.day||0,l=t.hour||0,u=t.minute||0,c=t.second||0,d=t.millisecond||0;this._isValid=function(e){var t,r,n=!1,i=tc.length;for(t in e)if(a(e,t)&&!(-1!==e$.call(tc,t)&&(null==e[t]||!isNaN(e[t]))))return!1;for(r=0;r<i;++r)if(e[tc[r]]){if(n)return!1;parseFloat(e[tc[r]])!==eh(e[tc[r]])&&(n=!0)}return!0}(t),this._milliseconds=+d+1e3*c+6e4*u+1e3*l*3600,this._days=+s+7*o,this._months=+i+3*n+12*r,this._data={},this._locale=eQ(),this._bubble()}function tf(e){return e instanceof td}function th(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function tp(e,t){U(e,0,0,function(){var e=this.utcOffset(),r="+";return e<0&&(e=-e,r="-"),r+O(~~(e/60),2)+t+O(~~e%60,2)})}tp("Z",":"),tp("ZZ",""),ec("Z",eo),ec("ZZ",eo),eg(["Z","ZZ"],function(e,t,r){r._useUTC=!0,r._tzm=tm(eo,e)});var tg=/([\+\-]|\d\d)/gi;function tm(e,t){var r,n,i=(t||"").match(e);return null===i?null:0===(n=+(60*(r=((i[i.length-1]||[])+"").match(tg)||["-",0,0])[1])+eh(r[2]))?0:"+"===r[0]?n:-n}function ty(e,r){var n,i;return r._isUTC?(n=r.clone(),i=(_(e)||u(e)?e.valueOf():to(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),t.updateOffset(n,!1),n):to(e).local()}function tv(e){return-Math.round(e._d.getTimezoneOffset())}function tS(){return!!this.isValid()&&this._isUTC&&0===this._offset}t.updateOffset=function(){};var tb=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,tw=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function t_(e,t){var r,n,i,o,s,u,c=e,d=null;return tf(e)?c={ms:e._milliseconds,d:e._days,M:e._months}:l(e)||!isNaN(+e)?(c={},t?c[t]=+e:c.milliseconds=+e):(d=tb.exec(e))?(o="-"===d[1]?-1:1,c={y:0,d:eh(d[2])*o,h:eh(d[3])*o,m:eh(d[4])*o,s:eh(d[5])*o,ms:eh(th(1e3*d[6]))*o}):(d=tw.exec(e))?(o="-"===d[1]?-1:1,c={y:tE(d[2],o),M:tE(d[3],o),w:tE(d[4],o),d:tE(d[5],o),h:tE(d[6],o),m:tE(d[7],o),s:tE(d[8],o)}):null==c?c={}:"object"==typeof c&&("from"in c||"to"in c)&&(r=to(c.from),n=to(c.to),u=r.isValid()&&n.isValid()?(n=ty(n,r),r.isBefore(n)?i=tI(r,n):((i=tI(n,r)).milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0},(c={}).ms=u.milliseconds,c.M=u.months),s=new td(c),tf(e)&&a(e,"_locale")&&(s._locale=e._locale),tf(e)&&a(e,"_isValid")&&(s._isValid=e._isValid),s}function tE(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function tI(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=t-e.clone().add(r.months,"M"),r}function tD(e,t){return function(r,n){var i;return null===n||isNaN(+n)||(M(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=r,r=n,n=i),tM(this,t_(r,n),e),this}}function tM(e,r,n,i){var a=r._milliseconds,o=th(r._days),s=th(r._months);e.isValid()&&(i=null==i||i,s&&eA(e,ew(e,"Month")+s*n),o&&e_(e,"Date",ew(e,"Date")+o*n),a&&e._d.setTime(e._d.valueOf()+a*n),i&&t.updateOffset(e,o||s))}t_.fn=td.prototype,t_.invalid=function(){return t_(NaN)};var tA=tD(1,"add"),tx=tD(-1,"subtract");function tP(e){return"string"==typeof e||e instanceof String}function tO(e,t){if(e.date()<t.date())return-tO(t,e);var r,n=(t.year()-e.year())*12+(t.month()-e.month()),i=e.clone().add(n,"months");return r=t-i<0?(t-i)/(i-e.clone().add(n-1,"months")):(t-i)/(e.clone().add(n+1,"months")-i),-(n+r)||0}function tT(e){var t;return void 0===e?this._locale._abbr:(null!=(t=eQ(e))&&(this._locale=t),this)}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var tk=I("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function tN(){return this._locale}function tC(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-126227808e5:new Date(e,t,r).valueOf()}function tU(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-126227808e5:Date.UTC(e,t,r)}function tR(e,t){return t.erasAbbrRegex(e)}function tL(){var e,t,r,n,i,a=[],o=[],s=[],l=[],u=this.eras();for(e=0,t=u.length;e<t;++e)r=ed(u[e].name),n=ed(u[e].abbr),i=ed(u[e].narrow),o.push(r),a.push(n),s.push(i),l.push(r),l.push(n),l.push(i);this._erasRegex=RegExp("^("+l.join("|")+")","i"),this._erasNameRegex=RegExp("^("+o.join("|")+")","i"),this._erasAbbrRegex=RegExp("^("+a.join("|")+")","i"),this._erasNarrowRegex=RegExp("^("+s.join("|")+")","i")}function tV(e,t){U(0,[e,e.length],0,t)}function tj(e,t,r,n,i){var a;return null==e?eC(this,n,i).year:(t>(a=eU(e,n,i))&&(t=a),tF.call(this,e,t,r,n,i))}function tF(e,t,r,n,i){var a=eN(e,t,r,n,i),o=eT(a.year,0,a.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}U("N",0,0,"eraAbbr"),U("NN",0,0,"eraAbbr"),U("NNN",0,0,"eraAbbr"),U("NNNN",0,0,"eraName"),U("NNNNN",0,0,"eraNarrow"),U("y",["y",1],"yo","eraYear"),U("y",["yy",2],0,"eraYear"),U("y",["yyy",3],0,"eraYear"),U("y",["yyyy",4],0,"eraYear"),ec("N",tR),ec("NN",tR),ec("NNN",tR),ec("NNNN",function(e,t){return t.erasNameRegex(e)}),ec("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),eg(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var i=r._locale.erasParse(e,n,r._strict);i?h(r).era=i:h(r).invalidEra=e}),ec("y",en),ec("yy",en),ec("yyy",en),ec("yyyy",en),ec("yo",function(e,t){return t._eraYearOrdinalRegex||en}),eg(["y","yy","yyy","yyyy"],0),eg(["yo"],function(e,t,r,n){var i;r._locale._eraYearOrdinalRegex&&(i=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[0]=r._locale.eraYearOrdinalParse(e,i):t[0]=parseInt(e,10)}),U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100}),tV("gggg","weekYear"),tV("ggggg","weekYear"),tV("GGGG","isoWeekYear"),tV("GGGGG","isoWeekYear"),ec("G",ei),ec("g",ei),ec("GG",Z,q),ec("gg",Z,q),ec("GGGG",et,X),ec("gggg",et,X),ec("GGGGG",er,K),ec("ggggg",er,K),em(["gggg","ggggg","GGGG","GGGGG"],function(e,t,r,n){t[n.substr(0,2)]=eh(e)}),em(["gg","GG"],function(e,r,n,i){r[i]=t.parseTwoDigitYear(e)}),U("Q",0,"Qo","quarter"),ec("Q",G),eg("Q",function(e,t){t[1]=(eh(e)-1)*3}),U("D",["DD",2],"Do","date"),ec("D",Z,el),ec("DD",Z,q),ec("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),eg(["D","DD"],2),eg("Do",function(e,t){t[2]=eh(e.match(Z)[0])});var tB=eb("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),ec("DDD",ee),ec("DDDD",z),eg(["DDD","DDDD"],function(e,t,r){r._dayOfYear=eh(e)}),U("m",["mm",2],0,"minute"),ec("m",Z,eu),ec("mm",Z,q),eg(["m","mm"],4);var tY=eb("Minutes",!1);U("s",["ss",2],0,"second"),ec("s",Z,eu),ec("ss",Z,q),eg(["s","ss"],5);var t$=eb("Seconds",!1);for(U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return 10*this.millisecond()}),U(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),U(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),U(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),U(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),U(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),ec("S",ee,G),ec("SS",ee,q),ec("SSS",ee,z),m="SSSS";m.length<=9;m+="S")ec(m,en);function tH(e,t){t[6]=eh(("0."+e)*1e3)}for(m="S";m.length<=9;m+="S")eg(m,tH);y=eb("Milliseconds",!1),U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var tW=w.prototype;function tG(e){return e}tW.add=tA,tW.calendar=function(e,r){if(1==arguments.length)if(arguments[0]){var s,c,d,f;if(s=arguments[0],_(s)||u(s)||tP(s)||l(s)||(d=n(c=s),f=!1,d&&(f=0===c.filter(function(e){return!l(e)&&tP(c)}).length),d&&f)||function(e){var t,r,n=i(e)&&!o(e),s=!1,l=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],u=l.length;for(t=0;t<u;t+=1)r=l[t],s=s||a(e,r);return n&&s}(s)||null==s)e=arguments[0],r=void 0;else(function(e){var t,r,n=i(e)&&!o(e),s=!1,l=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<l.length;t+=1)r=l[t],s=s||a(e,r);return n&&s})(arguments[0])&&(r=arguments[0],e=void 0)}else e=void 0,r=void 0;var h=e||to(),p=ty(h,this).startOf("day"),g=t.calendarFormat(this,p)||"sameElse",m=r&&(A(r[g])?r[g].call(this,h):r[g]);return this.format(m||this.localeData().calendar(g,this,to(h)))},tW.clone=function(){return new w(this)},tW.diff=function(e,t,r){var n,i,a;if(!this.isValid()||!(n=ty(e,this)).isValid())return NaN;switch(i=(n.utcOffset()-this.utcOffset())*6e4,t=j(t)){case"year":a=tO(this,n)/12;break;case"month":a=tO(this,n);break;case"quarter":a=tO(this,n)/3;break;case"second":a=(this-n)/1e3;break;case"minute":a=(this-n)/6e4;break;case"hour":a=(this-n)/36e5;break;case"day":a=(this-n-i)/864e5;break;case"week":a=(this-n-i)/6048e5;break;default:a=this-n}return r?a:ef(a)},tW.endOf=function(e){var r,n;if(void 0===(e=j(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tU:tC,e){case"year":r=n(this.year()+1,0,1)-1;break;case"quarter":r=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":r=n(this.year(),this.month()+1,1)-1;break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":r=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":r=this._d.valueOf(),r+=36e5-((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5-1;break;case"minute":r=this._d.valueOf(),r+=6e4-(r%6e4+6e4)%6e4-1;break;case"second":r=this._d.valueOf(),r+=1e3-(r%1e3+1e3)%1e3-1}return this._d.setTime(r),t.updateOffset(this,!0),this},tW.format=function(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var r=R(this,e);return this.localeData().postformat(r)},tW.from=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||to(e).isValid())?t_({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tW.fromNow=function(e){return this.from(to(),e)},tW.to=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||to(e).isValid())?t_({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tW.toNow=function(e){return this.to(to(),e)},tW.get=function(e){return A(this[e=j(e)])?this[e]():this},tW.invalidAt=function(){return h(this).overflow},tW.isAfter=function(e,t){var r=_(e)?e:to(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=j(t)||"millisecond")?this.valueOf()>r.valueOf():r.valueOf()<this.clone().startOf(t).valueOf())},tW.isBefore=function(e,t){var r=_(e)?e:to(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=j(t)||"millisecond")?this.valueOf()<r.valueOf():this.clone().endOf(t).valueOf()<r.valueOf())},tW.isBetween=function(e,t,r,n){var i=_(e)?e:to(e),a=_(t)?t:to(t);return!!(this.isValid()&&i.isValid()&&a.isValid())&&("("===(n=n||"()")[0]?this.isAfter(i,r):!this.isBefore(i,r))&&(")"===n[1]?this.isBefore(a,r):!this.isAfter(a,r))},tW.isSame=function(e,t){var r,n=_(e)?e:to(e);return!!(this.isValid()&&n.isValid())&&("millisecond"===(t=j(t)||"millisecond")?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(t).valueOf()<=r&&r<=this.clone().endOf(t).valueOf()))},tW.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},tW.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},tW.isValid=function(){return p(this)},tW.lang=tk,tW.locale=tT,tW.localeData=tN,tW.max=tl,tW.min=ts,tW.parsingFlags=function(){return d({},h(this))},tW.set=function(e,t){if("object"==typeof e){var r,n=function(e){var t,r=[];for(t in e)a(e,t)&&r.push({unit:t,priority:H[t]});return r.sort(function(e,t){return e.priority-t.priority}),r}(e=F(e)),i=n.length;for(r=0;r<i;r++)this[n[r].unit](e[n[r].unit])}else if(A(this[e=j(e)]))return this[e](t);return this},tW.startOf=function(e){var r,n;if(void 0===(e=j(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tU:tC,e){case"year":r=n(this.year(),0,1);break;case"quarter":r=n(this.year(),this.month()-this.month()%3,1);break;case"month":r=n(this.year(),this.month(),1);break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":r=n(this.year(),this.month(),this.date());break;case"hour":r=this._d.valueOf(),r-=((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5;break;case"minute":r=this._d.valueOf(),r-=(r%6e4+6e4)%6e4;break;case"second":r=this._d.valueOf(),r-=(r%1e3+1e3)%1e3}return this._d.setTime(r),t.updateOffset(this,!0),this},tW.subtract=tx,tW.toArray=function(){return[this.year(),this.month(),this.date(),this.hour(),this.minute(),this.second(),this.millisecond()]},tW.toObject=function(){return{years:this.year(),months:this.month(),date:this.date(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()}},tW.toDate=function(){return new Date(this.valueOf())},tW.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,r=t?this.clone().utc():this;if(0>r.year()||r.year()>9999)return R(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ");if(A(Date.prototype.toISOString))if(t)return this.toDate().toISOString();else return new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",R(r,"Z"));return R(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},tW.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,r,n="moment",i="";return this.isLocal()||(n=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+n+'("]',t=0<=this.year()&&9999>=this.year()?"YYYY":"YYYYYY",r=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+r)},"u">typeof Symbol&&null!=Symbol.for&&(tW[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),tW.toJSON=function(){return this.isValid()?this.toISOString():null},tW.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},tW.unix=function(){return Math.floor(this.valueOf()/1e3)},tW.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},tW.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},tW.eraName=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].name;return""},tW.eraNarrow=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].narrow;return""},tW.eraAbbr=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].abbr;return""},tW.eraYear=function(){var e,r,n,i,a=this.localeData().eras();for(e=0,r=a.length;e<r;++e)if(n=a[e].since<=a[e].until?1:-1,i=this.clone().startOf("day").valueOf(),a[e].since<=i&&i<=a[e].until||a[e].until<=i&&i<=a[e].since)return(this.year()-t(a[e].since).year())*n+a[e].offset;return this.year()},tW.year=eS,tW.isLeapYear=function(){return ey(this.year())},tW.weekYear=function(e){return tj.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)},tW.isoWeekYear=function(e){return tj.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},tW.quarter=tW.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)},tW.month=ex,tW.daysInMonth=function(){return eE(this.year(),this.month())},tW.week=tW.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add((e-t)*7,"d")},tW.isoWeek=tW.isoWeeks=function(e){var t=eC(this,1,4).week;return null==e?t:this.add((e-t)*7,"d")},tW.weeksInYear=function(){var e=this.localeData()._week;return eU(this.year(),e.dow,e.doy)},tW.weeksInWeekYear=function(){var e=this.localeData()._week;return eU(this.weekYear(),e.dow,e.doy)},tW.isoWeeksInYear=function(){return eU(this.year(),1,4)},tW.isoWeeksInISOWeekYear=function(){return eU(this.isoWeekYear(),1,4)},tW.date=tB,tW.day=tW.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,r,n=ew(this,"Day");return null==e?n:(t=e,r=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=r.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-n,"d"))},tW.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},tW.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,r=(t=this.localeData(),"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e);return this.day(this.day()%7?r:r-7)},tW.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},tW.hour=tW.hours=eW,tW.minute=tW.minutes=tY,tW.second=tW.seconds=t$,tW.millisecond=tW.milliseconds=y,tW.utcOffset=function(e,r,n){var i,a=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?a:tv(this);if("string"==typeof e){if(null===(e=tm(eo,e)))return this}else 16>Math.abs(e)&&!n&&(e*=60);return!this._isUTC&&r&&(i=tv(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),a!==e&&(!r||this._changeInProgress?tM(this,t_(e-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this},tW.utc=function(e){return this.utcOffset(0,e)},tW.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(tv(this),"m")),this},tW.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=tm(ea,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},tW.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?to(e).utcOffset():0,(this.utcOffset()-e)%60==0)},tW.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},tW.isLocal=function(){return!!this.isValid()&&!this._isUTC},tW.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},tW.isUtc=tS,tW.isUTC=tS,tW.zoneAbbr=function(){return this._isUTC?"UTC":""},tW.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},tW.dates=I("dates accessor is deprecated. Use date instead.",tB),tW.months=I("months accessor is deprecated. Use month instead",ex),tW.years=I("years accessor is deprecated. Use year instead",eS),tW.zone=I("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),tW.isDSTShifted=I("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!s(this._isDSTShifted))return this._isDSTShifted;var e,t={};return b(t,this),(t=ti(t))._a?(e=t._isUTC?f(t._a):to(t._a),this._isDSTShifted=this.isValid()&&function(e,t){var r,n=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),a=0;for(r=0;r<n;r++)eh(e[r])!==eh(t[r])&&a++;return a+i}(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted});var tq=P.prototype;function tz(e,t,r,n){var i=eQ(),a=f().set(n,t);return i[r](a,e)}function tX(e,t,r){if(l(e)&&(t=e,e=void 0),e=e||"",null!=t)return tz(e,t,r,"month");var n,i=[];for(n=0;n<12;n++)i[n]=tz(e,n,r,"month");return i}function tK(e,t,r,n){"boolean"==typeof e||(r=t=e,e=!1),l(t)&&(r=t,t=void 0),t=t||"";var i,a=eQ(),o=e?a._week.dow:0,s=[];if(null!=r)return tz(t,(r+o)%7,n,"day");for(i=0;i<7;i++)s[i]=tz(t,(i+o)%7,n,"day");return s}tq.calendar=function(e,t,r){var n=this._calendar[e]||this._calendar.sameElse;return A(n)?n.call(t,r):n},tq.longDateFormat=function(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(T).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},tq.invalidDate=function(){return this._invalidDate},tq.ordinal=function(e){return this._ordinal.replace("%d",e)},tq.preparse=tG,tq.postformat=tG,tq.relativeTime=function(e,t,r,n){var i=this._relativeTime[r];return A(i)?i(e,t,r,n):i.replace(/%d/i,e)},tq.pastFuture=function(e,t){var r=this._relativeTime[e>0?"future":"past"];return A(r)?r(t):r.replace(/%s/i,t)},tq.set=function(e){var t,r;for(r in e)a(e,r)&&(A(t=e[r])?this[r]=t:this["_"+r]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},tq.eras=function(e,r){var n,i,a,o=this._eras||eQ("en")._eras;for(n=0,i=o.length;n<i;++n)switch("string"==typeof o[n].since&&(a=t(o[n].since).startOf("day"),o[n].since=a.valueOf()),typeof o[n].until){case"undefined":o[n].until=Infinity;break;case"string":a=t(o[n].until).startOf("day").valueOf(),o[n].until=a.valueOf()}return o},tq.erasParse=function(e,t,r){var n,i,a,o,s,l=this.eras();for(e=e.toUpperCase(),n=0,i=l.length;n<i;++n)if(a=l[n].name.toUpperCase(),o=l[n].abbr.toUpperCase(),s=l[n].narrow.toUpperCase(),r)switch(t){case"N":case"NN":case"NNN":if(o===e)return l[n];break;case"NNNN":if(a===e)return l[n];break;case"NNNNN":if(s===e)return l[n]}else if([a,o,s].indexOf(e)>=0)return l[n]},tq.erasConvertYear=function(e,r){var n=e.since<=e.until?1:-1;return void 0===r?t(e.since).year():t(e.since).year()+(r-e.offset)*n},tq.erasAbbrRegex=function(e){return a(this,"_erasAbbrRegex")||tL.call(this),e?this._erasAbbrRegex:this._erasRegex},tq.erasNameRegex=function(e){return a(this,"_erasNameRegex")||tL.call(this),e?this._erasNameRegex:this._erasRegex},tq.erasNarrowRegex=function(e){return a(this,"_erasNarrowRegex")||tL.call(this),e?this._erasNarrowRegex:this._erasRegex},tq.months=function(e,t){return e?n(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||eD).test(t)?"format":"standalone"][e.month()]:n(this._months)?this._months:this._months.standalone},tq.monthsShort=function(e,t){return e?n(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[eD.test(t)?"format":"standalone"][e.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},tq.monthsParse=function(e,t,r){var n,i,a;if(this._monthsParseExact)return eM.call(this,e,t,r);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(i=f([2e3,n]),r&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),r||this._monthsParse[n]||(a="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[n]=RegExp(a.replace(".",""),"i")),r&&"MMMM"===t&&this._longMonthsParse[n].test(e))return n;if(r&&"MMM"===t&&this._shortMonthsParse[n].test(e))return n;if(!r&&this._monthsParse[n].test(e))return n}},tq.monthsRegex=function(e){return this._monthsParseExact?(a(this,"_monthsRegex")||eP.call(this),e)?this._monthsStrictRegex:this._monthsRegex:(a(this,"_monthsRegex")||(this._monthsRegex=es),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},tq.monthsShortRegex=function(e){return this._monthsParseExact?(a(this,"_monthsRegex")||eP.call(this),e)?this._monthsShortStrictRegex:this._monthsShortRegex:(a(this,"_monthsShortRegex")||(this._monthsShortRegex=es),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},tq.week=function(e){return eC(e,this._week.dow,this._week.doy).week},tq.firstDayOfYear=function(){return this._week.doy},tq.firstDayOfWeek=function(){return this._week.dow},tq.weekdays=function(e,t){var r=n(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?eR(r,this._week.dow):e?r[e.day()]:r},tq.weekdaysMin=function(e){return!0===e?eR(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},tq.weekdaysShort=function(e){return!0===e?eR(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},tq.weekdaysParse=function(e,t,r){var n,i,a;if(this._weekdaysParseExact)return eV.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=f([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(a="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=RegExp(a.replace(".",""),"i")),r&&"dddd"===t&&this._fullWeekdaysParse[n].test(e))return n;if(r&&"ddd"===t&&this._shortWeekdaysParse[n].test(e))return n;if(r&&"dd"===t&&this._minWeekdaysParse[n].test(e))return n;else if(!r&&this._weekdaysParse[n].test(e))return n}},tq.weekdaysRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||ej.call(this),e)?this._weekdaysStrictRegex:this._weekdaysRegex:(a(this,"_weekdaysRegex")||(this._weekdaysRegex=es),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},tq.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||ej.call(this),e)?this._weekdaysShortStrictRegex:this._weekdaysShortRegex:(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=es),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},tq.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||ej.call(this),e)?this._weekdaysMinStrictRegex:this._weekdaysMinRegex:(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=es),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},tq.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},tq.meridiem=function(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"},eZ("en",{eras:[{since:"0001-01-01",until:Infinity,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=1===eh(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+r}}),t.lang=I("moment.lang is deprecated. Use moment.locale instead.",eZ),t.langData=I("moment.langData is deprecated. Use moment.localeData instead.",eQ);var tZ=Math.abs;function tJ(e,t,r,n){var i=t_(t,r);return e._milliseconds+=n*i._milliseconds,e._days+=n*i._days,e._months+=n*i._months,e._bubble()}function tQ(e){return e<0?Math.floor(e):Math.ceil(e)}function t0(e){return 4800*e/146097}function t1(e){return 146097*e/4800}function t2(e){return function(){return this.as(e)}}var t8=t2("ms"),t4=t2("s"),t3=t2("m"),t5=t2("h"),t6=t2("d"),t7=t2("w"),t9=t2("M"),re=t2("Q"),rt=t2("y");function rr(e){return function(){return this.isValid()?this._data[e]:NaN}}var rn=rr("milliseconds"),ri=rr("seconds"),ra=rr("minutes"),ro=rr("hours"),rs=rr("days"),rl=rr("months"),ru=rr("years"),rc=Math.round,rd={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function rf(e,t,r,n,i){return i.relativeTime(t||1,!!r,e,n)}var rh=Math.abs;function rp(e){return(e>0)-(e<0)||+e}function rg(){if(!this.isValid())return this.localeData().invalidDate();var e,t,r,n,i,a,o,s,l=rh(this._milliseconds)/1e3,u=rh(this._days),c=rh(this._months),d=this.asSeconds();return d?(e=ef(l/60),t=ef(e/60),l%=60,e%=60,r=ef(c/12),c%=12,n=l?l.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",a=rp(this._months)!==rp(d)?"-":"",o=rp(this._days)!==rp(d)?"-":"",s=rp(this._milliseconds)!==rp(d)?"-":"",i+"P"+(r?a+r+"Y":"")+(c?a+c+"M":"")+(u?o+u+"D":"")+(t||e||l?"T":"")+(t?s+t+"H":"")+(e?s+e+"M":"")+(l?s+n+"S":"")):"P0D"}var rm=td.prototype;return rm.isValid=function(){return this._isValid},rm.abs=function(){var e=this._data;return this._milliseconds=tZ(this._milliseconds),this._days=tZ(this._days),this._months=tZ(this._months),e.milliseconds=tZ(e.milliseconds),e.seconds=tZ(e.seconds),e.minutes=tZ(e.minutes),e.hours=tZ(e.hours),e.months=tZ(e.months),e.years=tZ(e.years),this},rm.add=function(e,t){return tJ(this,e,t,1)},rm.subtract=function(e,t){return tJ(this,e,t,-1)},rm.as=function(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if("month"===(e=j(e))||"quarter"===e||"year"===e)switch(t=this._days+n/864e5,r=this._months+t0(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(t1(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return 24*t+n/36e5;case"minute":return 1440*t+n/6e4;case"second":return 86400*t+n/1e3;case"millisecond":return Math.floor(864e5*t)+n;default:throw Error("Unknown unit "+e)}},rm.asMilliseconds=t8,rm.asSeconds=t4,rm.asMinutes=t3,rm.asHours=t5,rm.asDays=t6,rm.asWeeks=t7,rm.asMonths=t9,rm.asQuarters=re,rm.asYears=rt,rm.valueOf=t8,rm._bubble=function(){var e,t,r,n,i,a=this._milliseconds,o=this._days,s=this._months,l=this._data;return a>=0&&o>=0&&s>=0||a<=0&&o<=0&&s<=0||(a+=864e5*tQ(t1(s)+o),o=0,s=0),l.milliseconds=a%1e3,l.seconds=(e=ef(a/1e3))%60,l.minutes=(t=ef(e/60))%60,l.hours=(r=ef(t/60))%24,o+=ef(r/24),s+=i=ef(t0(o)),o-=tQ(t1(i)),n=ef(s/12),s%=12,l.days=o,l.months=s,l.years=n,this},rm.clone=function(){return t_(this)},rm.get=function(e){return e=j(e),this.isValid()?this[e+"s"]():NaN},rm.milliseconds=rn,rm.seconds=ri,rm.minutes=ra,rm.hours=ro,rm.days=rs,rm.weeks=function(){return ef(this.days()/7)},rm.months=rl,rm.years=ru,rm.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var r,n,i,a,o,s,l,u,c,d,f,h,p,g=!1,m=rd;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(g=e),"object"==typeof t&&(m=Object.assign({},rd,t),null!=t.s&&null==t.ss&&(m.ss=t.s-1)),h=this.localeData(),r=!g,n=m,i=t_(this).abs(),a=rc(i.as("s")),o=rc(i.as("m")),s=rc(i.as("h")),l=rc(i.as("d")),u=rc(i.as("M")),c=rc(i.as("w")),d=rc(i.as("y")),f=a<=n.ss&&["s",a]||a<n.s&&["ss",a]||o<=1&&["m"]||o<n.m&&["mm",o]||s<=1&&["h"]||s<n.h&&["hh",s]||l<=1&&["d"]||l<n.d&&["dd",l],null!=n.w&&(f=f||c<=1&&["w"]||c<n.w&&["ww",c]),(f=f||u<=1&&["M"]||u<n.M&&["MM",u]||d<=1&&["y"]||["yy",d])[2]=r,f[3]=+this>0,f[4]=h,p=rf.apply(null,f),g&&(p=h.pastFuture(+this,p)),h.postformat(p)},rm.toISOString=rg,rm.toString=rg,rm.toJSON=rg,rm.locale=tT,rm.localeData=tN,rm.toIsoString=I("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",rg),rm.lang=tk,U("X",0,0,"unix"),U("x",0,0,"valueOf"),ec("x",ei),ec("X",/[+-]?\d+(\.\d{1,3})?/),eg("X",function(e,t,r){r._d=new Date(1e3*parseFloat(e))}),eg("x",function(e,t,r){r._d=new Date(eh(e))}),t.version="2.30.1",B=to,t.fn=tW,t.min=function(){var e=[].slice.call(arguments,0);return tu("isBefore",e)},t.max=function(){var e=[].slice.call(arguments,0);return tu("isAfter",e)},t.now=function(){return Date.now?Date.now():+new Date},t.utc=f,t.unix=function(e){return to(1e3*e)},t.months=function(e,t){return tX(e,t,"months")},t.isDate=u,t.locale=eZ,t.invalid=g,t.duration=t_,t.isMoment=_,t.weekdays=function(e,t,r){return tK(e,t,r,"weekdays")},t.parseZone=function(){return to.apply(null,arguments).parseZone()},t.localeData=eQ,t.isDuration=tf,t.monthsShort=function(e,t){return tX(e,t,"monthsShort")},t.weekdaysMin=function(e,t,r){return tK(e,t,r,"weekdaysMin")},t.defineLocale=eJ,t.updateLocale=function(e,t){if(null!=t){var r,n,i=eG;null!=eq[e]&&null!=eq[e].parentLocale?eq[e].set(x(eq[e]._config,t)):(null!=(n=eK(e))&&(i=n._config),t=x(i,t),null==n&&(t.abbr=e),(r=new P(t)).parentLocale=eq[e],eq[e]=r),eZ(e)}else null!=eq[e]&&(null!=eq[e].parentLocale?(eq[e]=eq[e].parentLocale,e===eZ()&&eZ(e)):null!=eq[e]&&delete eq[e]);return eq[e]},t.locales=function(){return W(eq)},t.weekdaysShort=function(e,t,r){return tK(e,t,r,"weekdaysShort")},t.normalizeUnits=j,t.relativeTimeRounding=function(e){return void 0===e?rc:"function"==typeof e&&(rc=e,!0)},t.relativeTimeThreshold=function(e,t){return void 0!==rd[e]&&(void 0===t?rd[e]:(rd[e]=t,"s"===e&&(rd.ss=t-1),!0))},t.calendarFormat=function(e,t){var r=e.diff(t,"days",!0);return r<-6?"sameElse":r<-1?"lastWeek":r<0?"lastDay":r<1?"sameDay":r<2?"nextDay":r<7?"nextWeek":"sameElse"},t.prototype=tW,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t}()},118(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=118,e.exports=t},681(e){!function(t,r){if(t){for(var n,i={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},a={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},s={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},l=1;l<20;++l)i[111+l]="f"+l;for(l=0;l<=9;++l)i[l+96]=l.toString();h.prototype.bind=function(e,t,r){return e=e instanceof Array?e:[e],this._bindMultiple.call(this,e,t,r),this},h.prototype.unbind=function(e,t){return this.bind.call(this,e,function(){},t)},h.prototype.trigger=function(e,t){return this._directMap[e+":"+t]&&this._directMap[e+":"+t]({},e),this},h.prototype.reset=function(){return this._callbacks={},this._directMap={},this},h.prototype.stopCallback=function(e,t){if((" "+t.className+" ").indexOf(" mousetrap ")>-1||function e(t,n){return null!==t&&t!==r&&(t===n||e(t.parentNode,n))}(t,this.target))return!1;if("composedPath"in e&&"function"==typeof e.composedPath){var n=e.composedPath()[0];n!==e.target&&(t=n)}return"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},h.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},h.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);n=null},h.init=function(){var e=h(r);for(var t in e)"_"!==t.charAt(0)&&(h[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},h.init(),t.Mousetrap=h,e.exports&&(e.exports=h),"function"==typeof define&&define.amd&&define(function(){return h})}function u(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent("on"+t,r)}function c(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return i[e.which]?i[e.which]:a[e.which]?a[e.which]:String.fromCharCode(e.which).toLowerCase()}function d(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function f(e,t){var r,a,l,u,c,f,h=[];for(u="+"===(r=e)?["+"]:(r=r.replace(/\+{2}/g,"+plus")).split("+"),f=0;f<u.length;++f)s[c=u[f]]&&(c=s[c]),t&&"keypress"!=t&&o[c]&&(c=o[c],h.push("shift")),d(c)&&h.push(c);return a=c,(l=t)||(l=function(){if(!n)for(var e in n={},i)e>95&&e<112||i.hasOwnProperty(e)&&(n[i[e]]=e);return n}()[a]?"keydown":"keypress"),"keypress"==l&&h.length&&(l="keydown"),{key:c,modifiers:h,action:t=l}}function h(e){var t,n=this;if(e=e||r,!(n instanceof h))return new h(e);n.target=e,n._callbacks={},n._directMap={};var i={},a=!1,o=!1,s=!1;function l(e){e=e||{};var t,r=!1;for(t in i){if(e[t]){r=!0;continue}i[t]=0}r||(s=!1)}function p(e,t,r,a,o,s){var l,u,c,f,h=[],p=r.type;if(!n._callbacks[e])return[];for("keyup"==p&&d(e)&&(t=[e]),c=0;c<n._callbacks[e].length;++c)if((f=n._callbacks[e][c],a||!f.seq||i[f.seq]==f.level)&&p==f.action&&("keypress"==p&&!r.metaKey&&!r.ctrlKey||(l=t,u=f.modifiers,l.sort().join(",")===u.sort().join(",")))){var g=!a&&f.combo==o,m=a&&f.seq==a&&f.level==s;(g||m)&&n._callbacks[e].splice(c,1),h.push(f)}return h}function g(e,t,r,i){!n.stopCallback(t,t.target||t.srcElement,r,i)&&!1===e(t,r)&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation?t.stopPropagation():t.cancelBubble=!0)}function m(e){"number"!=typeof e.which&&(e.which=e.keyCode);var t,r=c(e);if(r){if("keyup"==e.type&&a===r){a=!1;return}n.handleKey(r,(t=[],e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t),e)}}n._handleKey=function(e,t,r){var n,i=p(e,t,r),a={},u=0,c=!1;for(n=0;n<i.length;++n)i[n].seq&&(u=Math.max(u,i[n].level));for(n=0;n<i.length;++n){if(i[n].seq){if(i[n].level!=u)continue;c=!0,a[i[n].seq]=1,g(i[n].callback,r,i[n].combo,i[n].seq);continue}c||g(i[n].callback,r,i[n].combo)}var f="keypress"==r.type&&o;r.type!=s||d(e)||f||l(a),o=c&&"keydown"==r.type};n._bindMultiple=function(e,r,o){for(var u=0;u<e.length;++u)!function e(r,o,u,d,h){n._directMap[r+":"+u]=o;var m,y=(r=r.replace(/\s+/g," ")).split(" ");y.length>1?function(r,n,o,u){function d(e){g(o,e,r),"keyup"!==u&&(a=c(e)),setTimeout(l,10)}i[r]=0;for(var h=0;h<n.length;++h){var p=h+1===n.length?d:function(e){return function(){s=e,++i[r],clearTimeout(t),t=setTimeout(l,1e3)}}(u||f(n[h+1]).action);e(n[h],p,u,r,h)}}(r,y,o,u):(m=f(r,u),n._callbacks[m.key]=n._callbacks[m.key]||[],p(m.key,m.modifiers,{type:m.action},d,r,h),n._callbacks[m.key][d?"unshift":"push"]({callback:o,modifiers:m.modifiers,action:m.action,seq:d,level:h,combo:r}))}(e[u],r,o)},u(e,"keypress",m),u(e,"keydown",m),u(e,"keyup",m)}}("u">typeof window?window:null,"u">typeof window?document:null)},985(e,t,r){"use strict";let n=r(182),i=r(956),a=r(646),o=r(913);function s(e){if("string"!=typeof e||1!==e.length)throw TypeError("arrayFormatSeparator must be single character string")}function l(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function u(e,t){return t.decode?i(e):e}function c(e){let t=e.indexOf("#");return -1!==t&&(e=e.slice(0,t)),e}function d(e){let t=(e=c(e)).indexOf("?");return -1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):t.parseBooleans&&null!==e&&("true"===e.toLowerCase()||"false"===e.toLowerCase())&&(e="true"===e.toLowerCase()),e}function h(e,t){s((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);let r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{if(t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),!t){n[e]=r;return}void 0===n[e]&&(n[e]={}),n[e][t[1]]=r};case"bracket":return(e,r,n)=>{if(t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),!t){n[e]=r;return}if(void 0===n[e]){n[e]=[r];return}n[e]=[].concat(n[e],r)};case"comma":case"separator":return(t,r,n)=>{let i="string"==typeof r&&r.includes(e.arrayFormatSeparator),a="string"==typeof r&&!i&&u(r,e).includes(e.arrayFormatSeparator);r=a?u(r,e):r;let o=i||a?r.split(e.arrayFormatSeparator).map(t=>u(t,e)):null===r?r:u(r,e);n[t]=o};default:return(e,t,r)=>{if(void 0===r[e]){r[e]=t;return}r[e]=[].concat(r[e],t)}}}(t),n=Object.create(null);if("string"!=typeof e||!(e=e.trim().replace(/^[?#&]/,"")))return n;for(let i of e.split("&")){if(""===i)continue;let[e,o]=a(t.decode?i.replace(/\+/g," "):i,"=");o=void 0===o?null:["comma","separator"].includes(t.arrayFormat)?o:u(o,t),r(u(e,t),o,n)}for(let e of Object.keys(n)){let r=n[e];if("object"==typeof r&&null!==r)for(let e of Object.keys(r))r[e]=f(r[e],t);else n[e]=f(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{let r=n[t];return r&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=d,t.parse=h,t.stringify=(e,t)=>{if(!e)return"";s((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);let r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{let i=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[l(t,e),"[",i,"]"].join("")]:[...r,[l(t,e),"[",l(i,e),"]=",l(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[l(t,e),"[]"].join("")]:[...r,[l(t,e),"[]=",l(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[l(t,e),"=",l(n,e)].join("")]:[[r,l(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,l(t,e)]:[...r,[l(t,e),"=",l(n,e)].join("")]}}(t),i={};for(let t of Object.keys(e))r(t)||(i[t]=e[t]);let a=Object.keys(i);return!1!==t.sort&&a.sort(t.sort),a.map(r=>{let i=e[r];return void 0===i?"":null===i?l(r,t):Array.isArray(i)?i.reduce(n(r),[]).join("&"):l(r,t)+"="+l(i,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);let[r,n]=a(e,"#");return Object.assign({url:r.split("?")[0]||"",query:h(d(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:u(n,t)}:{})},t.stringifyUrl=(e,r)=>{var n;let i,a;r=Object.assign({encode:!0,strict:!0},r);let o=c(e.url).split("?")[0]||"",s=t.extract(e.url),u=Object.assign(t.parse(s,{sort:!1}),e.query),d=t.stringify(u,r);d&&(d=`?${d}`);let f=(n=e.url,i="",-1!==(a=n.indexOf("#"))&&(i=n.slice(a)),i);return e.fragmentIdentifier&&(f=`#${l(e.fragmentIdentifier,r)}`),`${o}${d}${f}`},t.pick=(e,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0},n);let{url:i,query:a,fragmentIdentifier:s}=t.parseUrl(e,n);return t.stringifyUrl({url:i,query:o(a,r),fragmentIdentifier:s},n)},t.exclude=(e,r,n)=>{let i=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return t.pick(e,i,n)}},249(e,t){"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=(Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider")),o=Symbol.for("react.context"),s=(Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.iterator),l={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},u=Object.assign,c={};function d(e,t,r){this.props=e,this.context=t,this.refs=c,this.updater=r||l}function f(){}function h(e,t,r){this.props=e,this.context=t,this.refs=c,this.updater=r||l}d.prototype.isReactComponent={},d.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},d.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},f.prototype=d.prototype;var p=h.prototype=new f;p.constructor=h,u(p,d.prototype),p.isPureReactComponent=!0;var g=Array.isArray,m=Object.prototype.hasOwnProperty,y=null,v={key:!0,ref:!0,__self:!0,__source:!0},S=null;t.Fragment=i,t.createContext=function(e){return(e={$$typeof:o,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:e},e.Consumer=e},t.createElement=function(e,t,n){var i,a={},o=null,s=null;if(null!=t)for(i in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(o=""+t.key),t)m.call(t,i)&&!v.hasOwnProperty(i)&&(a[i]=t[i]);var l=arguments.length-2;if(1===l)a.children=n;else if(1<l){for(var u=Array(l),c=0;c<l;c++)u[c]=arguments[c+2];a.children=u}if(e&&e.defaultProps)for(i in l=e.defaultProps)void 0===a[i]&&(a[i]=l[i]);return{$$typeof:r,type:e,key:o,ref:s,props:a,_owner:y}},t.useCallback=function(e,t){return S.useCallback(e,t)},t.useContext=function(e){return S.useContext(e)},t.useEffect=function(e,t){return S.useEffect(e,t)},t.useMemo=function(e,t){return S.useMemo(e,t)},t.useRef=function(e){return S.useRef(e)},t.useState=function(e){return S.useState(e)}},326(e,t,r){"use strict";e.exports=r(249)},646(e){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];let r=e.indexOf(t);return -1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},182(e){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)},834(e,t,r){(function(e,t,r){"use strict";var n=function(e,t,r){r=i.extend({},i.options,r);var a=i.runValidations(e,t,r);if(a.some(function(e){return i.isPromise(e.error)}))throw Error("Use validate.async if you want support for promises");return n.processValidationResults(a,r)},i=n;i.extend=function(e){return[].slice.call(arguments,1).forEach(function(t){for(var r in t)e[r]=t[r]}),e},i.extend(n,{version:{major:0,minor:12,patch:0,metadata:null,toString:function(){var e=i.format("%{major}.%{minor}.%{patch}",i.version);return i.isEmpty(i.version.metadata)||(e+="+"+i.version.metadata),e}},Promise:"u">typeof Promise?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(e,t,r){var n,a,o,s,l,u,c=[];for(n in(i.isDomElement(e)||i.isJqueryElement(e))&&(e=i.collectFormValues(e)),t)for(a in o=i.getDeepObjectValue(e,n),s=i.result(t[n],o,e,n,r,t)){if(!(l=i.validators[a]))throw Error(i.format("Unknown validator %{name}",{name:a}));u=s[a],(u=i.result(u,o,e,n,r,t))&&c.push({attribute:n,value:o,validator:a,globalOptions:r,attributes:e,options:u,error:l.call(l,o,u,n,e,r)})}return c},processValidationResults:function(e,t){e=i.pruneEmptyErrors(e,t),e=i.expandMultipleErrors(e,t),e=i.convertErrorMessages(e,t);var r=t.format||"grouped";if("function"==typeof i.formatters[r])e=i.formatters[r](e);else throw Error(i.format("Unknown format %{format}",t));return i.isEmpty(e)?void 0:e},async:function(e,t,r){var n=(r=i.extend({},i.async.options,r)).wrapErrors||function(e){return e};!1!==r.cleanAttributes&&(e=i.cleanAttributes(e,t));var a=i.runValidations(e,t,r);return new i.Promise(function(o,s){i.waitForResults(a).then(function(){var l=i.processValidationResults(a,r);l?s(new n(l,r,e,t)):o(e)},function(e){s(e)})})},single:function(e,t,r){return r=i.extend({},i.single.options,r,{format:"flat",fullMessages:!1}),i({single:e},{single:t},r)},waitForResults:function(e){return e.reduce(function(e,t){return i.isPromise(t.error)?e.then(function(){return t.error.then(function(e){t.error=e||null})}):e},new i.Promise(function(e){e()}))},result:function(e){var t=[].slice.call(arguments,1);return"function"==typeof e&&(e=e.apply(null,t)),e},isNumber:function(e){return"number"==typeof e&&!isNaN(e)},isFunction:function(e){return"function"==typeof e},isInteger:function(e){return i.isNumber(e)&&e%1==0},isBoolean:function(e){return"boolean"==typeof e},isObject:function(e){return e===Object(e)},isDate:function(e){return e instanceof Date},isDefined:function(e){return null!=e},isPromise:function(e){return!!e&&i.isFunction(e.then)},isJqueryElement:function(e){return e&&i.isString(e.jquery)},isDomElement:function(e){return!!e&&!!e.querySelectorAll&&!!e.querySelector&&(!!i.isObject(document)&&e===document||("object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName))},isEmpty:function(e){var t;if(!i.isDefined(e))return!0;if(i.isFunction(e))return!1;if(i.isString(e))return i.EMPTY_STRING_REGEXP.test(e);if(i.isArray(e))return 0===e.length;if(i.isDate(e))return!1;if(i.isObject(e)){for(t in e)return!1;return!0}return!1},format:i.extend(function(e,t){return i.isString(e)?e.replace(i.format.FORMAT_REGEXP,function(e,r,n){return"%"===r?"%{"+n+"}":String(t[n])}):e},{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(e){if(i.isNumber(e))if(100*e%1==0)return""+e;else return parseFloat(Math.round(100*e)/100).toFixed(2);return i.isArray(e)?e.map(function(e){return i.prettify(e)}).join(", "):i.isObject(e)?e.toString():(e=""+e).replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,function(e,t,r){return""+t+" "+r.toLowerCase()}).toLowerCase()},stringifyValue:function(e,t){return(t&&t.prettify||i.prettify)(e)},isString:function(e){return"string"==typeof e},isArray:function(e){return"[object Array]"===({}).toString.call(e)},isHash:function(e){return i.isObject(e)&&!i.isArray(e)&&!i.isFunction(e)},contains:function(e,t){return!!i.isDefined(e)&&(i.isArray(e)?-1!==e.indexOf(t):t in e)},unique:function(e){return i.isArray(e)?e.filter(function(e,t,r){return r.indexOf(e)==t}):e},forEachKeyInKeypath:function(e,t,r){if(i.isString(t)){var n,a="",o=!1;for(n=0;n<t.length;++n)switch(t[n]){case".":o?(o=!1,a+="."):(e=r(e,a,!1),a="");break;case"\\":o?(o=!1,a+="\\"):o=!0;break;default:o=!1,a+=t[n]}return r(e,a,!0)}},getDeepObjectValue:function(e,t){if(i.isObject(e))return i.forEachKeyInKeypath(e,t,function(e,t){if(i.isObject(e))return e[t]})},collectFormValues:function(e,t){var r,n,a,o,s,l,u={};if(i.isJqueryElement(e)&&(e=e[0]),!e)return u;for(t=t||{},o=e.querySelectorAll("input[name], textarea[name]"),r=0;r<o.length;++r)a=o.item(r),i.isDefined(a.getAttribute("data-ignored"))||(name=a.name.replace(/\./g,"\\\\."),l=i.sanitizeFormValue(a.value,t),"number"===a.type?l=l?+l:null:"checkbox"===a.type?a.attributes.value?a.checked||(l=u[name]||null):l=a.checked:"radio"!==a.type||a.checked||(l=u[name]||null),u[name]=l);for(o=e.querySelectorAll("select[name]"),r=0;r<o.length;++r)if(a=o.item(r),!i.isDefined(a.getAttribute("data-ignored"))){if(a.multiple)for(n in l=[],a.options)(s=a.options[n])&&s.selected&&l.push(i.sanitizeFormValue(s.value,t));else{var c=void 0!==a.options[a.selectedIndex]?a.options[a.selectedIndex].value:"";l=i.sanitizeFormValue(c,t)}u[a.name]=l}return u},sanitizeFormValue:function(e,t){return(t.trim&&i.isString(e)&&(e=e.trim()),!1!==t.nullify&&""===e)?null:e},capitalize:function(e){return i.isString(e)?e[0].toUpperCase()+e.slice(1):e},pruneEmptyErrors:function(e){return e.filter(function(e){return!i.isEmpty(e.error)})},expandMultipleErrors:function(e){var t=[];return e.forEach(function(e){i.isArray(e.error)?e.error.forEach(function(r){t.push(i.extend({},e,{error:r}))}):t.push(e)}),t},convertErrorMessages:function(e,t){var r=[],n=(t=t||{}).prettify||i.prettify;return e.forEach(function(e){var a=i.result(e.error,e.value,e.attribute,e.options,e.attributes,e.globalOptions);i.isString(a)?("^"===a[0]?a=a.slice(1):!1!==t.fullMessages&&(a=i.capitalize(n(e.attribute))+" "+a),a=a.replace(/\\\^/g,"^"),a=i.format(a,{value:i.stringifyValue(e.value,t)}),r.push(i.extend({},e,{error:a}))):r.push(e)}),r},groupErrorsByAttribute:function(e){var t={};return e.forEach(function(e){var r=t[e.attribute];r?r.push(e):t[e.attribute]=[e]}),t},flattenErrorsToArray:function(e){return e.map(function(e){return e.error}).filter(function(e,t,r){return r.indexOf(e)===t})},cleanAttributes:function(e,t){function r(e,t,r){return i.isObject(e[t])?e[t]:e[t]=!!r||{}}return i.isObject(t)&&i.isObject(e)?function e(t,r){if(!i.isObject(t))return t;var n,a,o=i.extend({},t);for(a in t)n=r[a],i.isObject(n)?o[a]=e(o[a],n):n||delete o[a];return o}(e,t=function(e){var t,n={};for(t in e)e[t]&&i.forEachKeyInKeypath(n,t,r);return n}(t)):{}},exposeModule:function(e,t,r,n,i){r?(n&&n.exports&&(r=n.exports=e),r.validate=e):(t.validate=e,e.isFunction(i)&&i.amd&&i([],function(){return e}))},warn:function(e){"u">typeof console&&console.warn&&console.warn("[validate.js] "+e)},error:function(e){"u">typeof console&&console.error&&console.error("[validate.js] "+e)}}),n.validators={presence:function(e,t){if(!1!==(t=i.extend({},this.options,t)).allowEmpty?!i.isDefined(e):i.isEmpty(e))return t.message||this.message||"can't be blank"},length:function(e,t,r){if(i.isDefined(e)){var n,a=(t=i.extend({},this.options,t)).is,o=t.maximum,s=t.minimum,l=t.tokenizer||function(e){return e},u=[],c=(e=l(e)).length;if(!i.isNumber(c))return i.error(i.format("Attribute %{attr} has a non numeric value for `length`",{attr:r})),t.message||this.notValid||"has an incorrect length";if(i.isNumber(a)&&c!==a&&(n=t.wrongLength||this.wrongLength||"is the wrong length (should be %{count} characters)",u.push(i.format(n,{count:a}))),i.isNumber(s)&&c<s&&(n=t.tooShort||this.tooShort||"is too short (minimum is %{count} characters)",u.push(i.format(n,{count:s}))),i.isNumber(o)&&c>o&&(n=t.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",u.push(i.format(n,{count:o}))),u.length>0)return t.message||u}},numericality:function(e,t,r,n,a){if(i.isDefined(e)){t=i.extend({},this.options,t);var o,s,l=[],u={greaterThan:function(e,t){return e>t},greaterThanOrEqualTo:function(e,t){return e>=t},equalTo:function(e,t){return e===t},lessThan:function(e,t){return e<t},lessThanOrEqualTo:function(e,t){return e<=t},divisibleBy:function(e,t){return e%t==0}},c=t.prettify||a&&a.prettify||i.prettify;if(i.isString(e)&&t.strict){var d="^-?(0|[1-9]\\d*)";if(t.onlyInteger||(d+="(\\.\\d+)?"),!new RegExp(d+="$").test(e))return t.message||t.notValid||this.notValid||this.message||"must be a valid number"}if(!0!==t.noStrings&&i.isString(e)&&!i.isEmpty(e)&&(e*=1),!i.isNumber(e))return t.message||t.notValid||this.notValid||this.message||"is not a number";if(t.onlyInteger&&!i.isInteger(e))return t.message||t.notInteger||this.notInteger||this.message||"must be an integer";for(o in u)if(s=t[o],i.isNumber(s)&&!u[o](e,s)){var f="not"+i.capitalize(o),h=t[f]||this[f]||this.message||"must be %{type} %{count}";l.push(i.format(h,{count:s,type:c(o)}))}if(t.odd&&e%2!=1&&l.push(t.notOdd||this.notOdd||this.message||"must be odd"),t.even&&e%2!=0&&l.push(t.notEven||this.notEven||this.message||"must be even"),l.length)return t.message||l}},datetime:i.extend(function(e,t){if(!i.isFunction(this.parse)||!i.isFunction(this.format))throw Error("Both the parse and format functions needs to be set to use the datetime/date validator");if(i.isDefined(e)){t=i.extend({},this.options,t);var r,n=[],a=t.earliest?this.parse(t.earliest,t):NaN,o=t.latest?this.parse(t.latest,t):NaN;if(isNaN(e=this.parse(e,t))||t.dateOnly&&e%864e5!=0)return r=t.notValid||t.message||this.notValid||"must be a valid date",i.format(r,{value:arguments[0]});if(!isNaN(a)&&e<a&&(r=t.tooEarly||t.message||this.tooEarly||"must be no earlier than %{date}",r=i.format(r,{value:this.format(e,t),date:this.format(a,t)}),n.push(r)),!isNaN(o)&&e>o&&(r=t.tooLate||t.message||this.tooLate||"must be no later than %{date}",r=i.format(r,{date:this.format(o,t),value:this.format(e,t)}),n.push(r)),n.length)return i.unique(n)}},{parse:null,format:null}),date:function(e,t){return t=i.extend({},t,{dateOnly:!0}),i.validators.datetime.call(i.validators.datetime,e,t)},format:function(e,t){(i.isString(t)||t instanceof RegExp)&&(t={pattern:t});var r,n=(t=i.extend({},this.options,t)).message||this.message||"is invalid",a=t.pattern;if(i.isDefined(e)&&(!i.isString(e)||(i.isString(a)&&(a=new RegExp(t.pattern,t.flags)),!(r=a.exec(e))||r[0].length!=e.length)))return n},inclusion:function(e,t){if(i.isDefined(e)&&(i.isArray(t)&&(t={within:t}),t=i.extend({},this.options,t),!i.contains(t.within,e))){var r=t.message||this.message||"^%{value} is not included in the list";return i.format(r,{value:e})}},exclusion:function(e,t){if(i.isDefined(e)&&(i.isArray(t)&&(t={within:t}),t=i.extend({},this.options,t),i.contains(t.within,e))){var r=t.message||this.message||"^%{value} is restricted";return i.format(r,{value:e})}},email:i.extend(function(e,t){var r=(t=i.extend({},this.options,t)).message||this.message||"is not a valid email";if(i.isDefined(e)&&(!i.isString(e)||!this.PATTERN.exec(e)))return r},{PATTERN:/^[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}$/i}),equality:function(e,t,r,n,a){if(i.isDefined(e)){i.isString(t)&&(t={attribute:t});var o=(t=i.extend({},this.options,t)).message||this.message||"is not equal to %{attribute}";if(i.isEmpty(t.attribute)||!i.isString(t.attribute))throw Error("The attribute must be a non empty string");var s=i.getDeepObjectValue(n,t.attribute),l=t.comparator||function(e,t){return e===t},u=t.prettify||a&&a.prettify||i.prettify;if(!l(e,s,t,r,n))return i.format(o,{attribute:u(t.attribute)})}},url:function(e,t){if(i.isDefined(e)){var r=(t=i.extend({},this.options,t)).message||this.message||"is not a valid url",n=t.schemes||this.schemes||["http","https"],a=t.allowLocal||this.allowLocal||!1;if(!i.isString(e))return r;var o="^(?:(?:"+n.join("|")+")://)(?:\\S+(?::\\S*)?@)?(?:",s="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";if(a?s+="?":o+="(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})",!RegExp(o+="(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"+s+")(?::\\d{2,5})?(?:[/?#]\\S*)?$","i").exec(e))return r}}},n.formatters={detailed:function(e){return e},flat:i.flattenErrorsToArray,grouped:function(e){var t;for(t in e=i.groupErrorsByAttribute(e))e[t]=i.flattenErrorsToArray(e[t]);return e},constraint:function(e){var t;for(t in e=i.groupErrorsByAttribute(e))e[t]=e[t].map(function(e){return e.validator}).sort();return e}},n.exposeModule(n,this,e,t,r)}).call(this,t,e=r.nmd(e),"u">typeof define?define:null)},862(e,t,r){e.exports=(function e(t,n,i){function a(s,l){if(!n[s]){if(!t[s]){var u=r(671);if(!l&&u)return u(s,!0);if(o)return o(s,!0);throw Error("Cannot find module '"+s+"'")}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){return a(t[s][1][e]||e)},c,c.exports,e,t,n,i)}return n[s].exports}for(var o=r(671),s=0;s<i.length;s++)a(i[s]);return a})({1:[function(e,t,r){(function(n,i,a,o,s,l,u,c,d){"use strict";var f=e("crypto");function h(e,t){var r=t=m(e,t);if(void 0===(n="passthrough"!==r.algorithm?f.createHash(r.algorithm):new S).write&&(n.write=n.update,n.end=n.update),v(r,n).dispatch(e),n.update||n.end(""),n.digest)return n.digest("buffer"===r.encoding?void 0:r.encoding);var n,i=n.read();return"buffer"!==r.encoding?i.toString(r.encoding):i}(r=t.exports=h).sha1=function(e){return h(e)},r.keys=function(e){return h(e,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},r.MD5=function(e){return h(e,{algorithm:"md5",encoding:"hex"})},r.keysMD5=function(e){return h(e,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var p=f.getHashes?f.getHashes().slice():["sha1","md5"];p.push("passthrough");var g=["buffer","hex","binary","base64"];function m(e,t){var r={};if(r.algorithm=(t=t||{}).algorithm||"sha1",r.encoding=t.encoding||"hex",r.excludeValues=!!t.excludeValues,r.algorithm=r.algorithm.toLowerCase(),r.encoding=r.encoding.toLowerCase(),r.ignoreUnknown=!0===t.ignoreUnknown,r.respectType=!1!==t.respectType,r.respectFunctionNames=!1!==t.respectFunctionNames,r.respectFunctionProperties=!1!==t.respectFunctionProperties,r.unorderedArrays=!0===t.unorderedArrays,r.unorderedSets=!1!==t.unorderedSets,r.unorderedObjects=!1!==t.unorderedObjects,r.replacer=t.replacer||void 0,r.excludeKeys=t.excludeKeys||void 0,void 0===e)throw Error("Object argument required.");for(var n=0;n<p.length;++n)p[n].toLowerCase()===r.algorithm.toLowerCase()&&(r.algorithm=p[n]);if(-1===p.indexOf(r.algorithm))throw Error('Algorithm "'+r.algorithm+'" not supported. supported values: '+p.join(", "));if(-1===g.indexOf(r.encoding)&&"passthrough"!==r.algorithm)throw Error('Encoding "'+r.encoding+'" not supported. supported values: '+g.join(", "));return r}function y(e){if("function"==typeof e)return null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(e))}function v(e,t,r){function n(e){return t.update?t.update(e,"utf8"):t.write(e,"utf8")}return r=r||[],{dispatch:function(t){return e.replacer&&(t=e.replacer(t)),this["_"+(null===t?"null":typeof t)](t)},_object:function(t){var i,o=Object.prototype.toString.call(t),s=/\[object (.*)\]/i.exec(o);if(s=(s=s?s[1]:"unknown:["+o+"]").toLowerCase(),0<=(i=r.indexOf(t)))return this.dispatch("[CIRCULAR:"+i+"]");if(r.push(t),void 0!==a&&a.isBuffer&&a.isBuffer(t))return n("buffer:"),n(t);if("object"===s||"function"===s||"asyncfunction"===s){var l=Object.keys(t);e.unorderedObjects&&(l=l.sort()),!1===e.respectType||y(t)||l.splice(0,0,"prototype","__proto__","constructor"),e.excludeKeys&&(l=l.filter(function(t){return!e.excludeKeys(t)})),n("object:"+l.length+":");var u=this;return l.forEach(function(r){u.dispatch(r),n(":"),e.excludeValues||u.dispatch(t[r]),n(",")})}if(!this["_"+s]){if(e.ignoreUnknown)return n("["+s+"]");throw Error('Unknown object type "'+s+'"')}this["_"+s](t)},_array:function(t,i){i=void 0!==i?i:!1!==e.unorderedArrays;var a=this;if(n("array:"+t.length+":"),!i||t.length<=1)return t.forEach(function(e){return a.dispatch(e)});var o=[],s=t.map(function(t){var n=new S,i=r.slice();return v(e,n,i).dispatch(t),o=o.concat(i.slice(r.length)),n.read().toString()});return r=r.concat(o),s.sort(),this._array(s,!1)},_date:function(e){return n("date:"+e.toJSON())},_symbol:function(e){return n("symbol:"+e.toString())},_error:function(e){return n("error:"+e.toString())},_boolean:function(e){return n("bool:"+e.toString())},_string:function(e){n("string:"+e.length+":"),n(e.toString())},_function:function(t){n("fn:"),y(t)?this.dispatch("[native]"):this.dispatch(t.toString()),!1!==e.respectFunctionNames&&this.dispatch("function-name:"+String(t.name)),e.respectFunctionProperties&&this._object(t)},_number:function(e){return n("number:"+e.toString())},_xml:function(e){return n("xml:"+e.toString())},_null:function(){return n("Null")},_undefined:function(){return n("Undefined")},_regexp:function(e){return n("regex:"+e.toString())},_uint8array:function(e){return n("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint8clampedarray:function(e){return n("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(e))},_int8array:function(e){return n("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint16array:function(e){return n("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_int16array:function(e){return n("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_uint32array:function(e){return n("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_int32array:function(e){return n("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_float32array:function(e){return n("float32array:"),this.dispatch(Array.prototype.slice.call(e))},_float64array:function(e){return n("float64array:"),this.dispatch(Array.prototype.slice.call(e))},_arraybuffer:function(e){return n("arraybuffer:"),this.dispatch(new Uint8Array(e))},_url:function(e){return n("url:"+e.toString())},_map:function(t){n("map:");var r=Array.from(t);return this._array(r,!1!==e.unorderedSets)},_set:function(t){n("set:");var r=Array.from(t);return this._array(r,!1!==e.unorderedSets)},_file:function(e){return n("file:"),this.dispatch([e.name,e.size,e.type,e.lastModfied])},_blob:function(){if(e.ignoreUnknown)return n("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return n("domwindow")},_process:function(){return n("process")},_timer:function(){return n("timer")},_pipe:function(){return n("pipe")},_tcp:function(){return n("tcp")},_udp:function(){return n("udp")},_tty:function(){return n("tty")},_statwatcher:function(){return n("statwatcher")},_securecontext:function(){return n("securecontext")},_connection:function(){return n("connection")},_zlib:function(){return n("zlib")},_context:function(){return n("context")},_nodescript:function(){return n("nodescript")},_httpparser:function(){return n("httpparser")},_dataview:function(){return n("dataview")},_signal:function(){return n("signal")},_fsevent:function(){return n("fsevent")},_tlswrap:function(){return n("tlswrap")}}}function S(){return{buf:"",write:function(e){this.buf+=e},end:function(e){this.buf+=e},read:function(){return this.buf}}}r.writeToStream=function(e,t,r){return void 0===r&&(r=t,t={}),v(t=m(e,t),r).dispatch(e)}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_5812b7fb.js","/")},{buffer:3,crypto:5,lYpoI2:10}],2:[function(e,t,r){(function(e,t,n,i,a,o,s,l,u){!function(e){"use strict";var t="u">typeof Uint8Array?Uint8Array:Array;function r(e){var t=e.charCodeAt(0);return 43===t||45===t?62:47===t||95===t?63:t<48?-1:t<58?t-48+26+26:t<91?t-65:t<123?t-97+26:void 0}e.toByteArray=function(e){if(0<e.length%4)throw Error("Invalid string. Length must be a multiple of 4");var n,i,a=e.length,o="="===e.charAt(a-2)?2:+("="===e.charAt(a-1)),s=new t(3*e.length/4-o),l=0<o?e.length-4:e.length,u=0;function c(e){s[u++]=e}for(n=0;n<l;n+=4)c((0xff0000&(i=r(e.charAt(n))<<18|r(e.charAt(n+1))<<12|r(e.charAt(n+2))<<6|r(e.charAt(n+3))))>>16),c((65280&i)>>8),c(255&i);return 2==o?c(255&(i=r(e.charAt(n))<<2|r(e.charAt(n+1))>>4)):1==o&&(c((i=r(e.charAt(n))<<10|r(e.charAt(n+1))<<4|r(e.charAt(n+2))>>2)>>8&255),c(255&i)),s},e.fromByteArray=function(e){var t,r,n,i,a=e.length%3,o="";function s(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,n=e.length-a;t<n;t+=3)o+=s((i=r=(e[t]<<16)+(e[t+1]<<8)+e[t+2])>>18&63)+s(i>>12&63)+s(i>>6&63)+s(63&i);switch(a){case 1:o+=s((r=e[e.length-1])>>2),o+=s(r<<4&63),o+="==";break;case 2:o+=s((r=(e[e.length-2]<<8)+e[e.length-1])>>10),o+=s(r>>4&63),o+=s(r<<2&63),o+="="}return o}}(void 0===r?this.base64js={}:r)}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(e,t,r){(function(t,n,i,a,o,s,l,u,c){var d=e("base64-js"),f=e("ieee754");function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);var n,a,o,s,l,u=typeof e;if("base64"===t&&"string"==u)for(e=(n=e).trim?n.trim():n.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==u)a=A(e);else if("string"==u)a=i.byteLength(e,t);else{if("object"!=u)throw Error("First argument needs to be a number, array or string.");a=A(e.length)}if(i._useTypedArrays?o=i._augment(new Uint8Array(a)):((o=this).length=a,o._isBuffer=!0),i._useTypedArrays&&"number"==typeof e.byteLength)o._set(e);else if(x(l=e)||i.isBuffer(l)||l&&"object"==typeof l&&"number"==typeof l.length)for(s=0;s<a;s++)i.isBuffer(e)?o[s]=e.readUInt8(s):o[s]=e[s];else if("string"==u)o.write(e,0,t);else if("number"==u&&!i._useTypedArrays&&!r)for(s=0;s<a;s++)o[s]=0;return o}function h(e,t,r,n){n||(L("boolean"==typeof r,"missing or invalid endian"),L(null!=t,"missing offset"),L(t+1<e.length,"Trying to read beyond buffer length"));var i,a=e.length;if(!(a<=t))return r?(i=e[t],t+1<a&&(i|=e[t+1]<<8)):(i=e[t]<<8,t+1<a&&(i|=e[t+1])),i}function p(e,t,r,n){n||(L("boolean"==typeof r,"missing or invalid endian"),L(null!=t,"missing offset"),L(t+3<e.length,"Trying to read beyond buffer length"));var i,a=e.length;if(!(a<=t))return r?(t+2<a&&(i=e[t+2]<<16),t+1<a&&(i|=e[t+1]<<8),i|=e[t],t+3<a&&(i+=e[t+3]<<24>>>0)):(t+1<a&&(i=e[t+1]<<16),t+2<a&&(i|=e[t+2]<<8),t+3<a&&(i|=e[t+3]),i+=e[t]<<24>>>0),i}function g(e,t,r,n){if(n||(L("boolean"==typeof r,"missing or invalid endian"),L(null!=t,"missing offset"),L(t+1<e.length,"Trying to read beyond buffer length")),!(e.length<=t)){var i=h(e,t,r,!0);return 32768&i?-1*(65535-i+1):i}}function m(e,t,r,n){if(n||(L("boolean"==typeof r,"missing or invalid endian"),L(null!=t,"missing offset"),L(t+3<e.length,"Trying to read beyond buffer length")),!(e.length<=t)){var i=p(e,t,r,!0);return 0x80000000&i?-1*(0xffffffff-i+1):i}}function y(e,t,r,n){return n||(L("boolean"==typeof r,"missing or invalid endian"),L(t+3<e.length,"Trying to read beyond buffer length")),f.read(e,t,r,23,4)}function v(e,t,r,n){return n||(L("boolean"==typeof r,"missing or invalid endian"),L(t+7<e.length,"Trying to read beyond buffer length")),f.read(e,t,r,52,8)}function S(e,t,r,n,i){i||(L(null!=t,"missing value"),L("boolean"==typeof n,"missing or invalid endian"),L(null!=r,"missing offset"),L(r+1<e.length,"trying to write beyond buffer length"),C(t,65535));var a=e.length;if(!(a<=r))for(var o=0,s=Math.min(a-r,2);o<s;o++)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function b(e,t,r,n,i){i||(L(null!=t,"missing value"),L("boolean"==typeof n,"missing or invalid endian"),L(null!=r,"missing offset"),L(r+3<e.length,"trying to write beyond buffer length"),C(t,0xffffffff));var a=e.length;if(!(a<=r))for(var o=0,s=Math.min(a-r,4);o<s;o++)e[r+o]=t>>>8*(n?o:3-o)&255}function w(e,t,r,n,i){i||(L(null!=t,"missing value"),L("boolean"==typeof n,"missing or invalid endian"),L(null!=r,"missing offset"),L(r+1<e.length,"Trying to write beyond buffer length"),U(t,32767,-32768)),e.length<=r||S(e,0<=t?t:65535+t+1,r,n,i)}function _(e,t,r,n,i){i||(L(null!=t,"missing value"),L("boolean"==typeof n,"missing or invalid endian"),L(null!=r,"missing offset"),L(r+3<e.length,"Trying to write beyond buffer length"),U(t,0x7fffffff,-0x80000000)),e.length<=r||b(e,0<=t?t:0xffffffff+t+1,r,n,i)}function E(e,t,r,n,i){i||(L(null!=t,"missing value"),L("boolean"==typeof n,"missing or invalid endian"),L(null!=r,"missing offset"),L(r+3<e.length,"Trying to write beyond buffer length"),R(t,34028234663852886e22,-34028234663852886e22)),e.length<=r||f.write(e,t,r,n,23,4)}function I(e,t,r,n,i){i||(L(null!=t,"missing value"),L("boolean"==typeof n,"missing or invalid endian"),L(null!=r,"missing offset"),L(r+7<e.length,"Trying to write beyond buffer length"),R(t,17976931348623157e292,-17976931348623157e292)),e.length<=r||f.write(e,t,r,n,52,8)}r.Buffer=i,r.SlowBuffer=i,r.INSPECT_MAX_BYTES=50,i.poolSize=8192,i._useTypedArrays=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray}catch(e){return!1}}(),i.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.byteLength=function(e,t){var r;switch(e+="",t||"utf8"){case"hex":r=e.length/2;break;case"utf8":case"utf-8":r=O(e).length;break;case"ascii":case"binary":case"raw":r=e.length;break;case"base64":r=T(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=2*e.length;break;default:throw Error("Unknown encoding")}return r},i.concat=function(e,t){if(L(x(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new i(0);if(1===e.length)return e[0];if("number"!=typeof t)for(a=t=0;a<e.length;a++)t+=e[a].length;for(var r=new i(t),n=0,a=0;a<e.length;a++){var o=e[a];o.copy(r,n),n+=o.length}return r},i.prototype.write=function(e,t,r,n){isFinite(t)?isFinite(r)||(n=r,r=void 0):(u=n,n=t,t=r,r=u),t=Number(t)||0;var a,o,s,l,u,c,d,f,h,p,g=this.length-t;switch((!r||g<(r=Number(r)))&&(r=g),n=String(n||"utf8").toLowerCase()){case"hex":c=function(e,t,r,n){r=Number(r)||0;var a=e.length-r;(!n||a<(n=Number(n)))&&(n=a);var o=t.length;L(o%2==0,"Invalid hex string"),o/2<n&&(n=o/2);for(var s=0;s<n;s++){var l=parseInt(t.substr(2*s,2),16);L(!isNaN(l),"Invalid hex string"),e[r+s]=l}return i._charsWritten=2*s,s}(this,e,t,r);break;case"utf8":case"utf-8":h=t,p=r,c=i._charsWritten=k(O(e),this,h,p);break;case"ascii":case"binary":a=t,o=r,c=i._charsWritten=k(function(e){for(var t=[],r=0;r<e.length;r++)t.push(255&e.charCodeAt(r));return t}(e),this,a,o);break;case"base64":d=t,f=r,c=i._charsWritten=k(T(e),this,d,f);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":s=t,l=r,c=i._charsWritten=k(function(e){for(var t,r,n=[],i=0;i<e.length;i++)r=(t=e.charCodeAt(i))>>8,n.push(t%256),n.push(r);return n}(e),this,s,l);break;default:throw Error("Unknown encoding")}return c},i.prototype.toString=function(e,t,r){var n,i,a;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,(r=void 0!==r?Number(r):r=this.length)===t)return"";switch(e){case"hex":n=function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||n<r)&&(r=n);for(var i="",a=t;a<r;a++)i+=P(e[a]);return i}(this,t,r);break;case"utf8":case"utf-8":n=function(e,t,r){var n="",i="";r=Math.min(e.length,r);for(var a=t;a<r;a++)e[a]<=127?(n+=N(i)+String.fromCharCode(e[a]),i=""):i+="%"+e[a].toString(16);return n+N(i)}(this,t,r);break;case"ascii":case"binary":n=function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;i++)n+=String.fromCharCode(e[i]);return n}(this,t,r);break;case"base64":a=r,n=0===(i=t)&&a===this.length?d.fromByteArray(this):d.fromByteArray(this.slice(i,a));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=function(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,t,r);break;default:throw Error("Unknown encoding")}return n},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},i.prototype.copy=function(e,t,r,n){if(r=r||0,n||0===n||(n=this.length),t=t||0,n!==r&&0!==e.length&&0!==this.length){L(r<=n,"sourceEnd < sourceStart"),L(0<=t&&t<e.length,"targetStart out of bounds"),L(0<=r&&r<this.length,"sourceStart out of bounds"),L(0<=n&&n<=this.length,"sourceEnd out of bounds"),n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var a=n-r;if(a<100||!i._useTypedArrays)for(var o=0;o<a;o++)e[o+t]=this[o+r];else e._set(this.subarray(r,r+a),t)}},i.prototype.slice=function(e,t){var r=this.length;if(e=M(e,r,0),t=M(t,r,r),i._useTypedArrays)return i._augment(this.subarray(e,t));for(var n=t-e,a=new i(n,void 0,!0),o=0;o<n;o++)a[o]=this[o+e];return a},i.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},i.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},i.prototype.readUInt8=function(e,t){if(t||(L(null!=e,"missing offset"),L(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return this[e]},i.prototype.readUInt16LE=function(e,t){return h(this,e,!0,t)},i.prototype.readUInt16BE=function(e,t){return h(this,e,!1,t)},i.prototype.readUInt32LE=function(e,t){return p(this,e,!0,t)},i.prototype.readUInt32BE=function(e,t){return p(this,e,!1,t)},i.prototype.readInt8=function(e,t){if(t||(L(null!=e,"missing offset"),L(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){return g(this,e,!0,t)},i.prototype.readInt16BE=function(e,t){return g(this,e,!1,t)},i.prototype.readInt32LE=function(e,t){return m(this,e,!0,t)},i.prototype.readInt32BE=function(e,t){return m(this,e,!1,t)},i.prototype.readFloatLE=function(e,t){return y(this,e,!0,t)},i.prototype.readFloatBE=function(e,t){return y(this,e,!1,t)},i.prototype.readDoubleLE=function(e,t){return v(this,e,!0,t)},i.prototype.readDoubleBE=function(e,t){return v(this,e,!1,t)},i.prototype.writeUInt8=function(e,t,r){r||(L(null!=e,"missing value"),L(null!=t,"missing offset"),L(t<this.length,"trying to write beyond buffer length"),C(e,255)),t>=this.length||(this[t]=e)},i.prototype.writeUInt16LE=function(e,t,r){S(this,e,t,!0,r)},i.prototype.writeUInt16BE=function(e,t,r){S(this,e,t,!1,r)},i.prototype.writeUInt32LE=function(e,t,r){b(this,e,t,!0,r)},i.prototype.writeUInt32BE=function(e,t,r){b(this,e,t,!1,r)},i.prototype.writeInt8=function(e,t,r){r||(L(null!=e,"missing value"),L(null!=t,"missing offset"),L(t<this.length,"Trying to write beyond buffer length"),U(e,127,-128)),t>=this.length||(0<=e?this.writeUInt8(e,t,r):this.writeUInt8(255+e+1,t,r))},i.prototype.writeInt16LE=function(e,t,r){w(this,e,t,!0,r)},i.prototype.writeInt16BE=function(e,t,r){w(this,e,t,!1,r)},i.prototype.writeInt32LE=function(e,t,r){_(this,e,t,!0,r)},i.prototype.writeInt32BE=function(e,t,r){_(this,e,t,!1,r)},i.prototype.writeFloatLE=function(e,t,r){E(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){E(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){I(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){I(this,e,t,!1,r)},i.prototype.fill=function(e,t,r){if(e=e||0,t=t||0,r=r||this.length,"string"==typeof e&&(e=e.charCodeAt(0)),L("number"==typeof e&&!isNaN(e),"value is not a number"),L(t<=r,"end < start"),r!==t&&0!==this.length){L(0<=t&&t<this.length,"start out of bounds"),L(0<=r&&r<=this.length,"end out of bounds");for(var n=t;n<r;n++)this[n]=e}},i.prototype.inspect=function(){for(var e=[],t=this.length,n=0;n<t;n++)if(e[n]=P(this[n]),n===r.INSPECT_MAX_BYTES){e[n+1]="...";break}return"<Buffer "+e.join(" ")+">"},i.prototype.toArrayBuffer=function(){if("u"<typeof Uint8Array)throw Error("Buffer.toArrayBuffer not supported in this browser");if(i._useTypedArrays)return new i(this).buffer;for(var e=new Uint8Array(this.length),t=0,r=e.length;t<r;t+=1)e[t]=this[t];return e.buffer};var D=i.prototype;function M(e,t,r){return"number"!=typeof e?r:t<=(e=~~e)?t:0<=e||0<=(e+=t)?e:0}function A(e){return(e=~~Math.ceil(+e))<0?0:e}function x(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function P(e){return e<16?"0"+e.toString(16):e.toString(16)}function O(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n<=127)t.push(e.charCodeAt(r));else{var i=r;55296<=n&&n<=57343&&r++;for(var a=encodeURIComponent(e.slice(i,r+1)).substr(1).split("%"),o=0;o<a.length;o++)t.push(parseInt(a[o],16))}}return t}function T(e){return d.toByteArray(e)}function k(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);i++)t[i+r]=e[i];return i}function N(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function C(e,t){L("number"==typeof e,"cannot write a non-number as a number"),L(0<=e,"specified a negative value for writing an unsigned value"),L(e<=t,"value is larger than maximum value for type"),L(Math.floor(e)===e,"value has a fractional component")}function U(e,t,r){L("number"==typeof e,"cannot write a non-number as a number"),L(e<=t,"value larger than maximum allowed value"),L(r<=e,"value smaller than minimum allowed value"),L(Math.floor(e)===e,"value has a fractional component")}function R(e,t,r){L("number"==typeof e,"cannot write a non-number as a number"),L(e<=t,"value larger than maximum allowed value"),L(r<=e,"value smaller than minimum allowed value")}function L(e,t){if(!e)throw Error(t||"Failed assertion")}i._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=D.get,e.set=D.set,e.write=D.write,e.toString=D.toString,e.toLocaleString=D.toString,e.toJSON=D.toJSON,e.copy=D.copy,e.slice=D.slice,e.readUInt8=D.readUInt8,e.readUInt16LE=D.readUInt16LE,e.readUInt16BE=D.readUInt16BE,e.readUInt32LE=D.readUInt32LE,e.readUInt32BE=D.readUInt32BE,e.readInt8=D.readInt8,e.readInt16LE=D.readInt16LE,e.readInt16BE=D.readInt16BE,e.readInt32LE=D.readInt32LE,e.readInt32BE=D.readInt32BE,e.readFloatLE=D.readFloatLE,e.readFloatBE=D.readFloatBE,e.readDoubleLE=D.readDoubleLE,e.readDoubleBE=D.readDoubleBE,e.writeUInt8=D.writeUInt8,e.writeUInt16LE=D.writeUInt16LE,e.writeUInt16BE=D.writeUInt16BE,e.writeUInt32LE=D.writeUInt32LE,e.writeUInt32BE=D.writeUInt32BE,e.writeInt8=D.writeInt8,e.writeInt16LE=D.writeInt16LE,e.writeInt16BE=D.writeInt16BE,e.writeInt32LE=D.writeInt32LE,e.writeInt32BE=D.writeInt32BE,e.writeFloatLE=D.writeFloatLE,e.writeFloatBE=D.writeFloatBE,e.writeDoubleLE=D.writeDoubleLE,e.writeDoubleBE=D.writeDoubleBE,e.fill=D.fill,e.inspect=D.inspect,e.toArrayBuffer=D.toArrayBuffer,e}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(e,t,r){(function(r,n,i,a,o,s,l,u,c){var i=e("buffer").Buffer,d=new i(4);d.fill(0),t.exports={hash:function(e,t,r,n){return i.isBuffer(e)||(e=new i(e)),function(e,t,r){for(var n=new i(t),a=r?n.writeInt32BE:n.writeInt32LE,o=0;o<e.length;o++)a.call(n,e[o],4*o,!0);return n}(t(function(e,t){var r;e.length%4!=0&&(r=e.length+(4-e.length%4),e=i.concat([e,d],r));for(var n=[],a=t?e.readInt32BE:e.readInt32LE,o=0;o<e.length;o+=4)n.push(a.call(e,o));return n}(e,n),8*e.length),r,n)}}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],5:[function(e,t,r){(function(t,n,i,a,o,s,l,u,c){var i=e("buffer").Buffer,d=e("./sha"),f=e("./sha256"),h=e("./rng"),p={sha1:d,sha256:f,md5:e("./md5")},g=new i(64);function m(e,t){var r=p[e=e||"sha1"],n=[];return r||y("algorithm:",e,"is not yet supported"),{update:function(e){return i.isBuffer(e)||(e=new i(e)),n.push(e),e.length,this},digest:function(e){var a=i.concat(n),o=t?function(e,t,r){i.isBuffer(t)||(t=new i(t)),i.isBuffer(r)||(r=new i(r)),t.length>64?t=e(t):t.length<64&&(t=i.concat([t,g],64));for(var n=new i(64),a=new i(64),o=0;o<64;o++)n[o]=54^t[o],a[o]=92^t[o];var s=e(i.concat([n,r]));return e(i.concat([a,s]))}(r,t,a):r(a);return n=null,e?o.toString(e):o}}}function y(){var e=[].slice.call(arguments).join(" ");throw Error([e,"we accept pull requests\nhttp://github.com/dominictarr/crypto-browserify"].join("\n"))}g.fill(0),r.createHash=function(e){return m(e)},r.createHmac=m,r.randomBytes=function(e,t){if(!t||!t.call)return new i(h(e));try{t.call(this,void 0,new i(h(e)))}catch(e){t(e)}},function(e,t){for(var r in e)t(e[r],r)}(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(e){r[e]=function(){y("sorry,",e,"is not implemented yet")}})}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:10}],6:[function(e,t,r){(function(r,n,i,a,o,s,l,u,c){var d=e("./helpers");function f(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var r=0x67452301,n=-0x10325477,i=-0x67452302,a=0x10325476,o=0;o<e.length;o+=16){var s=r,l=n,u=i,c=a,r=p(r,n,i,a,e[o+0],7,-0x28955b88),a=p(a,r,n,i,e[o+1],12,-0x173848aa),i=p(i,a,r,n,e[o+2],17,0x242070db),n=p(n,i,a,r,e[o+3],22,-0x3e423112);r=p(r,n,i,a,e[o+4],7,-0xa83f051),a=p(a,r,n,i,e[o+5],12,0x4787c62a),i=p(i,a,r,n,e[o+6],17,-0x57cfb9ed),n=p(n,i,a,r,e[o+7],22,-0x2b96aff),r=p(r,n,i,a,e[o+8],7,0x698098d8),a=p(a,r,n,i,e[o+9],12,-0x74bb0851),i=p(i,a,r,n,e[o+10],17,-42063),n=p(n,i,a,r,e[o+11],22,-0x76a32842),r=p(r,n,i,a,e[o+12],7,0x6b901122),a=p(a,r,n,i,e[o+13],12,-0x2678e6d),i=p(i,a,r,n,e[o+14],17,-0x5986bc72),r=g(r,n=p(n,i,a,r,e[o+15],22,0x49b40821),i,a,e[o+1],5,-0x9e1da9e),a=g(a,r,n,i,e[o+6],9,-0x3fbf4cc0),i=g(i,a,r,n,e[o+11],14,0x265e5a51),n=g(n,i,a,r,e[o+0],20,-0x16493856),r=g(r,n,i,a,e[o+5],5,-0x29d0efa3),a=g(a,r,n,i,e[o+10],9,0x2441453),i=g(i,a,r,n,e[o+15],14,-0x275e197f),n=g(n,i,a,r,e[o+4],20,-0x182c0438),r=g(r,n,i,a,e[o+9],5,0x21e1cde6),a=g(a,r,n,i,e[o+14],9,-0x3cc8f82a),i=g(i,a,r,n,e[o+3],14,-0xb2af279),n=g(n,i,a,r,e[o+8],20,0x455a14ed),r=g(r,n,i,a,e[o+13],5,-0x561c16fb),a=g(a,r,n,i,e[o+2],9,-0x3105c08),i=g(i,a,r,n,e[o+7],14,0x676f02d9),r=m(r,n=g(n,i,a,r,e[o+12],20,-0x72d5b376),i,a,e[o+5],4,-378558),a=m(a,r,n,i,e[o+8],11,-0x788e097f),i=m(i,a,r,n,e[o+11],16,0x6d9d6122),n=m(n,i,a,r,e[o+14],23,-0x21ac7f4),r=m(r,n,i,a,e[o+1],4,-0x5b4115bc),a=m(a,r,n,i,e[o+4],11,0x4bdecfa9),i=m(i,a,r,n,e[o+7],16,-0x944b4a0),n=m(n,i,a,r,e[o+10],23,-0x41404390),r=m(r,n,i,a,e[o+13],4,0x289b7ec6),a=m(a,r,n,i,e[o+0],11,-0x155ed806),i=m(i,a,r,n,e[o+3],16,-0x2b10cf7b),n=m(n,i,a,r,e[o+6],23,0x4881d05),r=m(r,n,i,a,e[o+9],4,-0x262b2fc7),a=m(a,r,n,i,e[o+12],11,-0x1924661b),i=m(i,a,r,n,e[o+15],16,0x1fa27cf8),r=y(r,n=m(n,i,a,r,e[o+2],23,-0x3b53a99b),i,a,e[o+0],6,-0xbd6ddbc),a=y(a,r,n,i,e[o+7],10,0x432aff97),i=y(i,a,r,n,e[o+14],15,-0x546bdc59),n=y(n,i,a,r,e[o+5],21,-0x36c5fc7),r=y(r,n,i,a,e[o+12],6,0x655b59c3),a=y(a,r,n,i,e[o+3],10,-0x70f3336e),i=y(i,a,r,n,e[o+10],15,-1051523),n=y(n,i,a,r,e[o+1],21,-0x7a7ba22f),r=y(r,n,i,a,e[o+8],6,0x6fa87e4f),a=y(a,r,n,i,e[o+15],10,-0x1d31920),i=y(i,a,r,n,e[o+6],15,-0x5cfebcec),n=y(n,i,a,r,e[o+13],21,0x4e0811a1),r=y(r,n,i,a,e[o+4],6,-0x8ac817e),a=y(a,r,n,i,e[o+11],10,-0x42c50dcb),i=y(i,a,r,n,e[o+2],15,0x2ad7d2bb),n=y(n,i,a,r,e[o+9],21,-0x14792c6f),r=v(r,s),n=v(n,l),i=v(i,u),a=v(a,c)}return[r,n,i,a]}function h(e,t,r,n,i,a){var o;return v((o=v(v(t,e),v(n,a)))<<i|o>>>32-i,r)}function p(e,t,r,n,i,a,o){return h(t&r|~t&n,e,t,i,a,o)}function g(e,t,r,n,i,a,o){return h(t&n|r&~n,e,t,i,a,o)}function m(e,t,r,n,i,a,o){return h(t^r^n,e,t,i,a,o)}function y(e,t,r,n,i,a,o){return h(r^(t|~n),e,t,i,a,o)}function v(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}t.exports=function(e){return d.hash(e,f,16)}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(e,t,r){(function(e,r,n,i,a,o,s,l,u){t.exports=function(e){for(var t,r=Array(e),n=0;n<e;n++)0==(3&n)&&(t=0x100000000*Math.random()),r[n]=t>>>((3&n)<<3)&255;return r}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(e,t,r){(function(r,n,i,a,o,s,l,u,c){var d=e("./helpers");function f(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var r,n,i,a,o,s=Array(80),l=0x67452301,u=-0x10325477,c=-0x67452302,d=0x10325476,f=-0x3c2d1e10,g=0;g<e.length;g+=16){for(var m=l,y=u,v=c,S=d,b=f,w=0;w<80;w++){s[w]=w<16?e[g+w]:p(s[w-3]^s[w-8]^s[w-14]^s[w-16],1);var _=h(h(p(l,5),(i=u,a=c,o=d,(n=w)<20?i&a|~i&o:!(n<40)&&n<60?i&a|i&o|a&o:i^a^o)),h(h(f,s[w]),(r=w)<20?0x5a827999:r<40?0x6ed9eba1:r<60?-0x70e44324:-0x359d3e2a)),f=d,d=c,c=p(u,30),u=l,l=_}l=h(l,m),u=h(u,y),c=h(c,v),d=h(d,S),f=h(f,b)}return[l,u,c,d,f]}function h(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function p(e,t){return e<<t|e>>>32-t}t.exports=function(e){return d.hash(e,f,20,!0)}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(e,t,r){(function(r,n,i,a,o,s,l,u,c){function d(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function f(e,t){return e>>>t|e<<32-t}function h(e,t){var r,n,i,a,o,s,l,u,c,h,p=[0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2],g=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],m=Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var y,v,S,b,w,_,E,I,D=0;D<e.length;D+=16){r=g[0],n=g[1],i=g[2],a=g[3],o=g[4],s=g[5],l=g[6],u=g[7];for(var M=0;M<64;M++)m[M]=M<16?e[M+D]:d(d(d(f(I=m[M-2],17)^f(I,19)^I>>>10,m[M-7]),f(E=m[M-15],7)^f(E,18)^E>>>3),m[M-16]),c=d(d(d(d(u,f(_=o,6)^f(_,11)^f(_,25)),(w=o)&s^~w&l),p[M]),m[M]),h=d(f(b=r,2)^f(b,13)^f(b,22),(y=r)&(v=n)^y&(S=i)^v&S),u=l,l=s,s=o,o=d(a,c),a=i,i=n,n=r,r=d(c,h);g[0]=d(r,g[0]),g[1]=d(n,g[1]),g[2]=d(i,g[2]),g[3]=d(a,g[3]),g[4]=d(o,g[4]),g[5]=d(s,g[5]),g[6]=d(l,g[6]),g[7]=d(u,g[7])}return g}var p=e("./helpers");t.exports=function(e){return p.hash(e,h,32,!0)}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],10:[function(e,t,r){(function(e,r,n,i,a,o,s,l,u){function c(){}(e=t.exports={}).nextTick=function(){var e="u">typeof window&&window.setImmediate,t="u">typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var r=[];return window.addEventListener("message",function(e){var t=e.source;t!==window&&null!==t||"process-tick"!==e.data||(e.stopPropagation(),0<r.length&&r.shift()())},!0),function(e){r.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.on=c,e.addListener=c,e.once=c,e.off=c,e.removeListener=c,e.removeAllListeners=c,e.emit=c,e.binding=function(e){throw Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(e){throw Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:10}],11:[function(e,t,r){(function(e,t,n,i,a,o,s,l,u){r.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,d=r?i-1:0,f=r?-1:1,h=e[t+d];for(d+=f,a=h&(1<<-c)-1,h>>=-c,c+=s;0<c;a=256*a+e[t+d],d+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;0<c;o=256*o+e[t+d],d+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),a-=u}return(h?-1:1)*o*Math.pow(2,a-n)},r.write=function(e,t,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<<u)-1,d=c>>1,f=5960464477539062e-23*(23===i),h=n?0:a-1,p=n?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),2<=(t+=1<=o+d?f/l:f*Math.pow(2,1-d))*l&&(o++,l/=2),c<=o+d?(s=0,o=c):1<=o+d?(s=(t*l-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));8<=i;e[r+h]=255&s,h+=p,s/=256,i-=8);for(o=o<<i|s,u+=i;0<u;e[r+h]=255&o,h+=p,o/=256,u-=8);e[r+h-p]|=128*g}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ieee754/index.js","/node_modules/ieee754")},{buffer:3,lYpoI2:10}]},{},[1])(1)},671(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=671,e.exports=t},557(e){"use strict";e.exports=t},111(t){"use strict";t.exports=e},155(e){"use strict";e.exports=r},534(){}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e].call(r.exports,r,r.exports,a),r.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var o={};return(()=>{"use strict";let e;a.r(o),a.d(o,{CineService:()=>e_,CommandsManager:()=>rJ,CustomizationService:()=>rL,DICOMWeb:()=>nh,DicomMetadataStore:()=>eo,DisplaySetMessage:()=>ed,DisplaySetMessageList:()=>ef,DisplaySetService:()=>eh,Enums:()=>h,ExtensionManager:()=>rZ,HangingProtocolService:()=>rP,HotkeysManager:()=>r3,IWebApiDataSource:()=>nb,MODULE_TYPES:()=>p,MeasurementService:()=>H,MultiMonitorService:()=>rK,OHIF:()=>nx,PanelService:()=>rY,PubSubService:()=>I,ServiceProvidersManager:()=>G,ServicesManager:()=>W,StudyPrefetcherService:()=>rX,SystemContextProvider:()=>rl,ToolbarService:()=>ev,UIDialogService:()=>K,UIModalService:()=>ee,UINotificationService:()=>en,UIViewportDialogService:()=>ea,UserAuthenticationService:()=>rT,ViewportGridService:()=>eb,ViewportRefsProvider:()=>nc,WorkflowStepsService:()=>rW,classes:()=>nl,default:()=>nP,defaults:()=>r1,errorHandler:()=>np,hotkeys:()=>nA,log:()=>m,object:()=>ng,pubSubServiceInterface:()=>S,string:()=>ny,useActiveToolOptions:()=>nD,useActiveViewportDisplaySets:()=>nw,useRunCommand:()=>nM,useSystem:()=>rs,useToolbar:()=>n_,useViewportMousePosition:()=>nI,useViewportRef:()=>nf,useViewportRefs:()=>nd,useViewportSize:()=>nE,user:()=>nv,utils:()=>r_});var t,r,n,i,s,l,u,c,d,f={};a.r(f),a.d(f,{filterAdditionalFindings:()=>ry,filterAnd:()=>rb,filterAny:()=>rh,filterMeasurementsBySeriesUID:()=>ru,filterMeasurementsByStudyUID:()=>rc,filterNone:()=>rp,filterNot:()=>function e(...t){if(1!==t.length)return rb(...t.map(t=>e(t)));let[r]=t;return rS(r)?function(e){return!this[r](e)}:e=>!r(e)},filterOr:()=>rg,filterPlanarMeasurement:()=>rd,filterTool:()=>rf,filterUnless:()=>rv});var h={};a.r(h),a.d(h,{TimingEnum:()=>nS});let p={COMMANDS:"commandsModule",CUSTOMIZATION:"customizationModule",STATE_SYNC:"stateSyncModule",DATA_SOURCE:"dataSourcesModule",PANEL:"panelModule",SOP_CLASS_HANDLER:"sopClassHandlerModule",TOOLBAR:"toolbarModule",VIEWPORT:"viewportModule",CONTEXT:"contextModule",LAYOUT_TEMPLATE:"layoutTemplateModule",HANGING_PROTOCOL:"hangingProtocolModule",UTILITY:"utilityModule"},g={error:console.error,warn:console.warn,info:console.log,trace:console.trace,debug:console.debug,time:e=>{g.timingKeys[e]=!0,console.time(e)},timeEnd:e=>{g.timingKeys[e]&&(g.timingKeys[e]=!1,console.timeEnd(e))},timingKeys:{scriptToView:!0}},m=g,y=()=>{let e=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},v=function(e,t,r){var n;let i=function(){var i=this,a=arguments,o=r&&!n;clearTimeout(n),n=setTimeout(function(){n=null,r||e.apply(i,a)},t),o&&e.apply(i,a)};return i.clearDebounceTimeout=()=>{clearTimeout(n),n=null},i},S={subscribe:b,_broadcastEvent:E,_unsubscribe:w,_isValidEvent:_};function b(e,t){if(this._isValidEvent(e)){let r=y(),n={id:r,callback:t};return Array.isArray(this.listeners[e])?this.listeners[e].push(n):this.listeners[e]=[n],{unsubscribe:()=>this._unsubscribe(e,r)}}throw Error(`Event ${e} not supported.`)}function w(e,t){if(!this.listeners[e])return;let r=this.listeners[e];Array.isArray(r)?this.listeners[e]=r.filter(({id:e,callback:r})=>(r?.clearDebounceTimeout?.(),e!==t)):this.listeners[e]=void 0}function _(e){return Object.values(this.EVENTS).includes(e)}function E(e,t){let r=Object.keys(this.listeners).length>0,n=Array.isArray(this.listeners[e]),i=new CustomEvent(e,{detail:t});document.body.dispatchEvent(i),r&&n&&this.listeners[e].forEach(e=>{e.callback(t)})}class I{constructor(e){this.EVENTS=void 0,this.subscribe=void 0,this._broadcastEvent=void 0,this._unsubscribe=void 0,this._isValidEvent=void 0,this.listeners=void 0,this.unsubscriptions=void 0,this.EVENTS=e,this.subscribe=b,this._broadcastEvent=E,this._unsubscribe=w,this._isValidEvent=_,this.listeners={},this.unsubscriptions=[]}subscribeDebounced(e,t,r=300,n=!1){if(this._isValidEvent(e)){let i=v(t,r,n);return this.subscribe(e,i)}throw Error(`Event ${e} not supported.`)}reset(){this.unsubscriptions.forEach(e=>e()),this.unsubscriptions=[],Object.keys(this.listeners).forEach(e=>this.listeners[e].forEach(({callback:e})=>{e?.clearDebounceTimeout?.()})),this.listeners={}}createConsumableEvent(e){return{...e,isConsumed:!1,consume:function(){this.isConsumed=!0}}}}var D=a(111),M=a.n(D);let A=function(e){let t=[],r=new Map;return{SeriesInstanceUID:e,instances:t,addInstance:function(e){this.addInstances([e])},addInstances:function(e){for(let n=0,i=e.length;n<i;n++){let i=e[n];r.has(i.SOPInstanceUID)||(r.set(i.SOPInstanceUID,i),t.push(i))}},getInstance:function(e){return r.get(e)}}},x=function(e){return{StudyInstanceUID:e,StudyDescription:"",ModalitiesInStudy:[],isLoaded:!1,series:[],addInstanceToSeries:function(e){this.addInstancesToSeries([e])},addInstancesToSeries:function(e){let{SeriesInstanceUID:t}=e[0];this.StudyDescription||(this.StudyDescription=e[0].StudyDescription);let r=this.series.find(e=>e.SeriesInstanceUID===t);r||(r=A(t),this.series.push(r)),r.addInstances(e)},setSeriesMetadata:function(e,t){let r=this.series.find(t=>t.SeriesInstanceUID===e);if(r)r=Object.assign(r,t);else{let r=A(e);this.series.push(Object.assign(r,t))}}}},P=["ImagePositionPatient","ImageOrientationPatient","PixelSpacing"],O=Symbol("isMetadataProxy"),T=function(e){if(!e||e[O])return e;for(let t of P)t in e||Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:()=>e._parentInstance?.[t]??e._parentInstance?._shared?.[t],set:r=>{Object.defineProperty(e,t,{writable:!0,enumerable:!0,value:r})}});return Object.defineProperty(e,O,{value:!0}),e},k={STUDY_ADDED:"event::dicomMetadataStore:studyAdded",INSTANCES_ADDED:"event::dicomMetadataStore:instancesAdded",SERIES_ADDED:"event::dicomMetadataStore:seriesAdded",SERIES_UPDATED:"event::dicomMetadataStore:seriesUpdated"},N=[];function C(e){return N.find(t=>t.StudyInstanceUID===e)}function U(e,t){if(!e)return N.map(e=>e.series).flat().find(e=>e.SeriesInstanceUID===t);let r=C(e);if(r)return r.series.find(e=>e.SeriesInstanceUID===t)}function R(e,t,r){let n=U(e,t);if(n)return n.getInstance(r)}let L=Object.assign({},{EVENTS:k,listeners:{},addInstance(e){let t,r,{StudyInstanceUID:n,NumberOfFrames:i}=r=void 0===(t=e instanceof ArrayBuffer?M().data.DicomMessage.readFile(e).dict:e).SeriesInstanceUID?M().data.DicomMetaDictionary.naturalizeDataset(t):t,a=N.find(e=>e.StudyInstanceUID===n);a||(N.push(x(n)),a=N[N.length-1]),r=i>1?T(r):r,a.addInstanceToSeries(r)},addInstances(e,t=!1){let{StudyInstanceUID:r,SeriesInstanceUID:n,NumberOfFrames:i}=e[0];i>1&&(e=e.map(e=>T(e)));let a=N.find(e=>e.StudyInstanceUID===r);a||(N.push(x(r)),a=N[N.length-1]),a.addInstancesToSeries(e),this._broadcastEvent(k.INSTANCES_ADDED,{StudyInstanceUID:r,SeriesInstanceUID:n,madeInClient:t})},updateSeriesMetadata(e){let{StudyInstanceUID:t,SeriesInstanceUID:r}=e;if(!U(t,r))return;let n=C(t);n&&n.setSeriesMetadata(r,e)},addSeriesMetadata(e,t=!1){if(!e||!e.length||!e[0])return;let{StudyInstanceUID:r}=e[0],n=C(r);n||((n=x(r)).StudyDescription=e[0].StudyDescription,e.forEach(e=>{-1===n.ModalitiesInStudy.indexOf(e.Modality)&&n.ModalitiesInStudy.push(e.Modality)}),n.NumberOfStudyRelatedSeries=e.length,N.push(n)),e.forEach(e=>{let{SeriesInstanceUID:t}=e;n.setSeriesMetadata(t,e)}),this._broadcastEvent(k.SERIES_ADDED,{StudyInstanceUID:r,seriesSummaryMetadata:e,madeInClient:t})},addStudy(e){let{StudyInstanceUID:t}=e;if(!N.find(e=>e.StudyInstanceUID===t)){let r=x(t);r.PatientID=e.PatientID,r.PatientName=e.PatientName,r.StudyDate=e.StudyDate,r.ModalitiesInStudy=e.ModalitiesInStudy,r.StudyDescription=e.StudyDescription,r.AccessionNumber=e.AccessionNumber,r.NumInstances=e.NumInstances,N.push(r)}},getStudyInstanceUIDs:function(){return N.map(e=>e.StudyInstanceUID)},getStudy:C,getSeries:U,getInstance:R,getInstanceByImageId:function(t){let r=e?.get("frameModule",t);if(r){let{studyInstanceUID:e,seriesInstanceUID:t,sopInstanceUID:n}=r;return R(e,t,n)}for(let e of(console.warn("No metadata result found for",t,"looking through instances"),N))for(let r of e.series)for(let e of r.instances)if(e.imageId===t)return e},updateMetadataForSeries:function(e,t,r){let n=C(e);if(!n)return;let{instances:i}=n.series.find(e=>e.SeriesInstanceUID===t);i.forEach(e=>{Object.keys(r).forEach(t=>{"object"==typeof r[t]?e[t]={...e[t],...r[t]}:e[t]=r[t]})}),this._broadcastEvent(k.SERIES_UPDATED,{SeriesInstanceUID:t,StudyInstanceUID:e,madeInClient:!0})},setMetaDataProvider:function(t){e=t}},S),V=["uid","color","data","getReport","displayText","SOPInstanceUID","FrameOfReferenceUID","referenceStudyUID","referenceSeriesUID","frameNumber","displaySetInstanceUID","label","isLocked","isVisible","description","type","unit","points","source","toolName","metadata","area","mean","stdDev","perimeter","length","shortestDiameter","longestDiameter","cachedStats","isSelected","textBox","referencedImageId","isDirty"],j={MEASUREMENT_UPDATED:"event::measurement_updated",INTERNAL_MEASUREMENT_UPDATED:"event:internal_measurement_updated",MEASUREMENT_ADDED:"event::measurement_added",RAW_MEASUREMENT_ADDED:"event::raw_measurement_added",MEASUREMENT_REMOVED:"event::measurement_removed",MEASUREMENTS_CLEARED:"event::measurements_cleared",JUMP_TO_MEASUREMENT:"event:jump_to_measurement"},F={ANGLE:"value_type::polyline",POLYLINE:"value_type::polyline",POINT:"value_type::point",BIDIRECTIONAL:"value_type::shortAxisLongAxis",ELLIPSE:"value_type::ellipse",RECTANGLE:"value_type::rectangle",MULTIPOINT:"value_type::multipoint",CIRCLE:"value_type::circle",ROI_THRESHOLD:"value_type::roiThreshold",ROI_THRESHOLD_MANUAL:"value_type::roiThresholdManual"};var B=((t=B||{}).HandlesUpdated="HandlesUpdated",t.LabelChange="LabelChange",t);let Y=new Set;class $ extends I{constructor(){super(j),this.VALUE_TYPES=F,this.measurements=new Map,this.isMeasurementDeletedIndividually=void 0,this.sources={},this.mappings={},this._arrayOfObjects=e=>Object.entries(e).map(e=>({[e[0]]:e[1]})),this.setIsMeasurementDeletedIndividually=e=>{this.isMeasurementDeletedIndividually=e},this.getIsMeasurementDeletedIndividually=()=>this.isMeasurementDeletedIndividually}addMeasurementSchemaKeys(e){Array.isArray(e)||(e=[e]),V.push(...e)}addValueType(e){if(!F[e]){if(!e||"object"!=typeof e)return void console.warn(`MeasurementService: addValueType: invalid valueType: ${e}`);Object.keys(e).forEach(t=>{F[t]||(F[t]=e[t])})}}getMeasurements(e){let t=[...this.measurements.values()];return e?t.filter(t=>e.call(this,t)):t}getMeasurement(e){return this.measurements.get(e)}setMeasurementSelected(e,t){let r=this.getMeasurement(e);r&&(r.isSelected=t,this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:r.source,measurement:r,notYetUpdatedAtSource:!1}))}createSource(e,t){if(!e)throw Error("Source name not provided.");if(!t)throw Error("Source version not provided.");let r=Object.keys(this.sources);for(let n=0;n<r.length;n++){let i=this.sources[r[n]];if(i.name===e&&i.version===t)return i}let n=y(),i={uid:n,name:e,version:t};return i.annotationToMeasurement=(e,t,r=!1)=>this.annotationToMeasurement(i,e,t,r),i.remove=(e,t)=>this.remove(e,i,t),i.getAnnotation=(e,t)=>this.getAnnotation(i,e,t),m.info(`New '${e}@${t}' source added.`),this.sources[n]=i,i}getSource(e,t){let{sources:r}=this;return r[this._getSourceUID(e,t)]}getSourceMappings(e,t){let{mappings:r}=this;return r[this._getSourceUID(e,t)]}addMapping(e,t,r,n,i){if(!this._isValidSource(e))throw Error("Invalid source.");if(!r)throw Error("Matching criteria not provided.");if(!t)throw Error("annotationType not provided.");if(!n)throw Error("Mapping function to source schema not provided.");if(!i)throw Error("Measurement mapping function not provided.");let a={matchingCriteria:r,annotationType:t,toAnnotationSchema:n,toMeasurementSchema:i};Array.isArray(this.mappings[e.uid])?this.mappings[e.uid].push(a):this.mappings[e.uid]=[a]}getAnnotation(e,t,r){if(!this._isValidSource(e))return void m.warn("Invalid source. Exiting early.");if(!t)return void m.warn("No source annotationType provided. Exiting early.");let n=this.getMeasurement(r),i=this._getMappingByMeasurementSource(n,t);if(i)return i.toAnnotationSchema(n,t);let a=this._getMatchingMapping(e,t,n);if(a){m.info("Matching mapping found:",a);let{toAnnotationSchema:e,annotationType:t}=a;return e(n,t)}}update(e,t,r=!1){if(!this.measurements.has(e))return;let n={...t,modifiedTimestamp:Math.floor(Date.now()/1e3)};return m.info("Updating internal measurement representation...",n),this.measurements.set(e,n),this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:t.source,measurement:n,notYetUpdatedAtSource:r}),n.uid}addRawMeasurement(e,t,r,n,i={}){if(!this._isValidSource(e))return void m.warn("Invalid source. Exiting early.");let a=this._getSourceToString(e);if(!t)return void m.warn("No source annotationType provided. Exiting early.");if(!this._sourceHasMappings(e))return void m.warn(`No measurement mappings found for '${a}' source. Exiting early.`);let o={};try{if(!(o=n(r)))return;o.source=e}catch(e){m.warn(`Failed to map '${a}' measurement for annotationType ${t}:`,e);return}if(!this._isValidMeasurement(o))return void m.warn(`Attempting to add or update a invalid measurement provided by '${a}'. Exiting early.`);let s=r.uid||y(),{annotation:{predecessorImageId:l,data:u}}=r,c={finding:u.finding,predecessorImageId:l,findingSites:u.findingSites,site:u.findingSites?.[0],...o,modifiedTimestamp:Math.floor(Date.now()/1e3),uid:s};return this.measurements.get(s)?(this.measurements.set(s,c),this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:e,measurement:c})):(m.info("Measurement added",c),this.measurements.set(s,c),this._broadcastEvent(this.EVENTS.RAW_MEASUREMENT_ADDED,{source:e,measurement:c,data:r,dataSource:i})),c.uid}annotationToMeasurement(e,t,r,n=!1){if(!this._isValidSource(e))throw Error("Invalid source.");if(!t)throw Error("No source annotationType provided.");let i=this._getSourceToString(e);if(!this._sourceHasMappings(e))throw Error(`No measurement mappings found for '${i}' source. Exiting early.`);let a={};try{let n=this.mappings[e.uid].find(e=>e.annotationType===t);if(!n){Y.has(e.uid)||(console.log("No source mapping",e.uid,t,e),Y.add(e.uid)),this.addUnmappedMeasurement(r,e);return}let{toMeasurementSchema:i}=n;if(!(a=i(r)))return;a.source=e}catch(n){throw this.addUnmappedMeasurement(r,e),console.log("Failed to map",n),Error(`Failed to map '${i}' measurement for annotationType ${t}: ${n.message}`)}if(!this._isValidMeasurement(a))throw Error(`Attempting to add or update a invalid measurement provided by '${i}'. Exiting early.`);let o=r.uid;o||(o=y(),m.info(`Annotation does not have UID, Generating UID for the created Measurement: ${o}`));let s=this.measurements.get(o),l={...s,...a,modifiedTimestamp:Math.floor(Date.now()/1e3),uid:o};return l.isDirty=r.changeType===B.HandlesUpdated||r.changeType===B.LabelChange||s?.isDirty,s?(this.measurements.set(o,l),n?this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:e,measurement:l,notYetUpdatedAtSource:!1}):(m.info("Measurement added.",l),this._broadcastEvent(this.EVENTS.MEASUREMENT_ADDED,{source:e,measurement:l}))):(m.info("Measurement started.",l),this.measurements.set(o,l)),l.uid}findAttributeRecursively(e,t){if(e&&"object"==typeof e){if(e[t])return e[t];for(let r in e)if(e.hasOwnProperty(r)){let n=this.findAttributeRecursively(e[r],t);if(n)return n}}}addUnmappedMeasurement(e,t){if(e.annotation?.invalidated===!0)return void console.log("Measurement is invalidated, skipping...",e);if(e.annotation?.isPreview===!0)return void console.log("Measurement is preview, skipping...",e);let r=this.findAttributeRecursively(e,"metadata"),n=this.findAttributeRecursively(e,"label"),i=this.findAttributeRecursively(e,"referencedImageId"),a=this.findAttributeRecursively(e,"displaySetInstanceUID"),o={...e,isUnmapped:!0,statusTooltip:"This measurement is not compatible with this application",source:{name:t.name,version:t.version,uid:t.uid}};if(r&&(o.metadata=r),n&&(o.label=n),i){o.referencedImageId=i;let e=L.getInstanceByImageId(i);e?(o.referenceStudyUID=e.StudyInstanceUID,o.referenceSeriesUID=e.SeriesInstanceUID):console.warn("Didn't find instance for",i)}a&&(o.displaySetInstanceUID=a),this.measurements.set(e.uid,o)}remove(e){let t=this.measurements.get(e);if(!e||!t)return void console.debug("No uid provided, or unable to find measurement by uid.");let r=t.source;this.measurements.delete(e),this.isMeasurementDeletedIndividually=!0,this._broadcastEvent(this.EVENTS.MEASUREMENT_REMOVED,{source:r,measurement:e})}removeMany(e){let t=[];for(let r of e){let e=this.measurements.get(r);if(!r||!e){console.debug("No uid provided, or unable to find measurement by uid.");continue}this.measurements.delete(r),t.push(e)}t.length&&this._broadcastEvent(this.EVENTS.MEASUREMENTS_CLEARED,{measurements:t})}clearMeasurements(e,t){let r=this.getMeasurements(e),n=[...r];r.forEach(e=>this.measurements.delete(e.uid)),this._broadcastEvent(this.EVENTS.MEASUREMENTS_CLEARED,{measurements:n,...t})}onModeExit(){this.clearMeasurements()}jumpToMeasurement(e,t){let r=this.measurements.get(t);r?this._broadcastEvent(j.JUMP_TO_MEASUREMENT,{viewportId:e,measurement:r}):m.warn("No measurement uid, or unable to find by uid.")}_getSourceUID(e,t){let{sources:r}=this;return Object.keys(r).find(n=>{let i=r[n];return i.name===e&&i.version===t})}_getMappingByMeasurementSource(e,t){if(this._isValidSource(e.source))return this.mappings[e.source.uid].find(e=>e.annotationType===t)}_getMatchingMapping(e,t,r){return this.mappings[e.uid].filter(e=>e.annotationType===t).find(({matchingCriteria:e})=>r.points&&r.points.length===e.points)}_getSourceToString(e){return`${e.name}@${e.version}`}_isValidSource(e){return e&&this.sources[e.uid]}_sourceHasMappings(e){return Array.isArray(this.mappings[e.uid])&&this.mappings[e.uid].length}_isValidMeasurement(e){return Object.keys(e).every(e=>!!V.includes(e)||(m.warn(`Invalid measurement key: ${e}`),!1))}toggleLockMeasurement(e){let t=this.measurements.get(e);t?(t.isLocked=!t.isLocked,this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:t.source,measurement:t,notYetUpdatedAtSource:!0})):console.debug(`No measurement found for uid: ${e}`)}toggleVisibilityMeasurement(e,t){let r=this.measurements.get(e);r?(r.isVisible!==t||void 0===t)&&(r.isVisible=void 0!==t?t:!r.isVisible,this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:r.source,measurement:r,notYetUpdatedAtSource:!0})):console.debug(`No measurement found for uid: ${e}`)}toggleVisibilityMeasurementMany(e,t){return e.forEach(e=>this.toggleVisibilityMeasurement(e,t))}updateColorMeasurement(e,t){let r=this.measurements.get(e);r?(r.color=t,this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:r.source,measurement:r,notYetUpdatedAtSource:!0})):console.debug(`No measurement found for uid: ${e}`)}}$.REGISTRATION={name:"measurementService",altName:"MeasurementService",create:e=>new $},$.EVENTS=j,$.VALUE_TYPES=F;let H=$;class W{constructor(e){this.services={},this.registeredServiceNames=[],this._commandsManager=void 0,this._extensionManager=void 0,this._commandsManager=e,this._extensionManager=null,this.services={},this.registeredServiceNames=[]}setExtensionManager(e){this._extensionManager=e}registerService(e,t={}){e?e.name?this.registeredServiceNames.includes(e.name)?m.warn(`Service name ${e.name} has already been registered. Exiting before duplicating services.`):e.create?(this.services[e.name]=e.create({configuration:t,extensionManager:this._extensionManager,commandsManager:this._commandsManager,servicesManager:this}),e.altName&&(this.services[e.altName]=this.services[e.name]),this.registeredServiceNames.push(e.name)):m.warn("Service create factory function not defined. Exiting early."):m.warn("Service name not set. Exiting early."):m.warn("Attempting to register a null/undefined service. Exiting early.")}registerServices(e){e.forEach(e=>{if(Array.isArray(e)){let[t,r]=e;this.registerService(t,r)}else this.registerService(e)})}}class G{constructor(){this.providers={},this.providers={}}registerProvider(e,t){e?t?this.providers[e]=t:m.warn("Attempting to register a null/undefined provider. Exiting early."):m.warn("Attempting to register a provider to a null/undefined service name. Exiting early.")}}let q="uiDialogService",z={_show:e=>(console.warn("show() NOT IMPLEMENTED"),""),_hide:e=>console.warn("hide() NOT IMPLEMENTED"),_hideAll:()=>console.warn("hideAll() NOT IMPLEMENTED"),_isEmpty:()=>(console.warn("isEmpty() NOT IMPLEMENTED"),!0),_updatePosition:(e,t)=>console.warn("updatePosition() NOT IMPLEMENTED"),_customComponent:null};class X{constructor(){this.name=q}show(e){return z._show(e)}hide(e){return z._hide(e)}hideAll(){return z._hideAll()}isEmpty(){return z._isEmpty()}updatePosition(e,t){return z._updatePosition(e,t)}getCustomComponent(){return z._customComponent}setServiceImplementation({show:e,hide:t,hideAll:r,isEmpty:n,updatePosition:i,customComponent:a}){e&&(z._show=e),t&&(z._hide=t),r&&(z._hideAll=r),n&&(z._isEmpty=n),i&&(z._updatePosition=i),a&&(z._customComponent=a)}}X.REGISTRATION={name:q,altName:"UIDialogService",create:()=>new X};let K=X,Z="uiModalService",J={_hide:()=>console.warn("hide() NOT IMPLEMENTED"),_show:()=>console.warn("show() NOT IMPLEMENTED"),_customComponent:null};class Q{constructor(){this.name=Z}show({content:e=null,contentProps:t=null,title:r=null,className:n=null,shouldCloseOnEsc:i=!0,shouldCloseOnOverlayClick:a=!0,containerClassName:o=null}){return J._show({content:e,contentProps:t,shouldCloseOnEsc:i,title:r,className:n,shouldCloseOnOverlayClick:a,containerClassName:o})}hide(){return J._hide()}getCustomComponent(){return J._customComponent}setServiceImplementation({hide:e,show:t,customComponent:r}){e&&(J._hide=e),t&&(J._show=t),r&&(J._customComponent=r)}}Q.REGISTRATION={name:Z,altName:"UIModalService",create:()=>new Q};let ee=Q,et={_hide:()=>console.debug("hide() NOT IMPLEMENTED"),_show:e=>(console.debug("show() NOT IMPLEMENTED"),null),_customComponent:null};class er{getCustomComponent(){return et._customComponent}setServiceImplementation({hide:e,show:t,customComponent:r}){e&&(et._hide=e),t&&(et._show=t),r&&(et._customComponent=r)}hide(e){return et._hide(e)}show({title:e,message:t,duration:r=2e3,position:n="bottom-right",type:i="info",autoClose:a=!0,promise:o,promiseMessages:s,id:l,allowDuplicates:u=!1,deduplicationInterval:c=3e4,action:d}){if(o&&s){let t=et._show({title:e,message:s.loading||"Loading...",type:"loading",autoClose:!1,position:n,id:l?`${l}-loading`:void 0,allowDuplicates:u,deduplicationInterval:c});return o.then(i=>{let o="function"==typeof s.success?s.success(i):s.success||"Success";et._show({title:e,message:o,type:"success",duration:r,position:n,autoClose:a,id:l?`${l}-success`:void 0,allowDuplicates:u,deduplicationInterval:c,action:d}),this.hide(t)},i=>{let o="function"==typeof s.error?s.error(i):s.error||"Error";et._show({title:e,message:o,type:"error",duration:r,position:n,autoClose:a,id:l?`${l}-error`:void 0,allowDuplicates:u,deduplicationInterval:c,action:d}),this.hide(t)}),t}return et._show({title:e,message:t,duration:r,position:n,type:i,autoClose:a,id:l,allowDuplicates:u,deduplicationInterval:c,action:d})}}er.REGISTRATION={name:"uiNotificationService",altName:"UINotificationService",create:()=>new er};let en=er;class ei extends I{constructor(){super(ei.EVENTS),this.serviceImplementation={_hide:()=>console.warn("hide() NOT IMPLEMENTED"),_show:()=>console.warn("show() NOT IMPLEMENTED")},this.serviceImplementation={...this.serviceImplementation}}show({viewportId:e,id:t,type:r,message:n,actions:i,onSubmit:a,onOutsideClick:o,onKeyPress:s}){return this.serviceImplementation._show({viewportId:e,id:t,type:r,message:n,actions:i,onSubmit:a,onOutsideClick:o,onKeyPress:s})}hide(){return this.serviceImplementation._hide()}setServiceImplementation({hide:e,show:t}){e&&(this.serviceImplementation._hide=e),t&&(this.serviceImplementation._show=t)}}ei.EVENTS={},ei.REGISTRATION={name:"uiViewportDialogService",altName:"UIViewportDialogService",create:({configuration:e={}})=>new ei};let ea=ei,eo=L,es={DISPLAY_SETS_ADDED:"event::displaySetService:displaySetsAdded",DISPLAY_SETS_CHANGED:"event::displaySetService:displaySetsChanged",DISPLAY_SETS_REMOVED:"event::displaySetService:displaySetsRemoved",DISPLAY_SET_SERIES_METADATA_INVALIDATED:"event::displaySetService:displaySetSeriesMetadataInvalidated"},el=new Map,eu=(e,t)=>{let r=new Set;return t.forEach(e=>{let t=e.instances;t?t.forEach(e=>r.add(e.SOPInstanceUID)):console.warn("No instances in",e)}),e.filter(e=>!r.has(e.SOPInstanceUID))};class ec extends I{constructor(){super(es),this.activeDisplaySets=[],this.unsupportedSOPClassHandler=void 0,this.extensionManager=void 0,this.activeDisplaySetsMap=new Map,this.activeDisplaySetsChanged=!1,this.getDisplaySetsForSeries=e=>[...el.values()].filter(t=>t.SeriesInstanceUID===e),this.getDisplaySetsForReferences=e=>{let t=new Map;for(let r of Array.isArray(e)?e:[e]){let{SeriesInstanceUID:e,ReferencedInstanceSequence:n}=r;t.has(e)||t.set(e,new Set);let i=t.get(e);for(let e of n)i.add(e.ReferencedSOPInstanceUID)}return[...el.values()].filter(e=>{let r=t.get(e.SeriesInstanceUID);if(r&&e.instances)return e.instances.some(e=>r.has(e.SOPInstanceUID))})},this.getDisplaySetByUID=e=>{if("string"!=typeof e)throw Error(`getDisplaySetByUID: displaySetInstanceUid must be a string, you passed ${e}`);return el.get(e)},this.makeDisplaySets=(e,{batch:t=!1,madeInClient:r=!1,settings:n={}}={})=>{if(!e||!e.length)throw Error("No instances were provided.");if(t&&!e[0].length)throw Error("Batch displaySet creation does not contain array of array of instances.");let i=[];if(t)for(let t=0;t<e.length;t++){let r=e[t],a=this.makeDisplaySetForInstances(r,n);i.push(...a)}else{let t=this.makeDisplaySetForInstances(e,n);i.push(...t)}let a={};if(r&&(a.madeInClient=!0),this.activeDisplaySetsChanged&&(this.activeDisplaySetsChanged=!1,this._broadcastEvent(es.DISPLAY_SETS_CHANGED,this.activeDisplaySets)),i?.length)return this._broadcastEvent(es.DISPLAY_SETS_ADDED,{displaySetsAdded:i,options:a}),i},this.unsupportedSOPClassHandler="@ohif/extension-default.sopClassHandlerModule.not-supported-display-sets-handler"}init(e,t){this.extensionManager=e,this.SOPClassHandlerIds=t,this.activeDisplaySets=[],this.activeDisplaySetsMap.clear()}_addDisplaySetsToCache(e){e.forEach(e=>{el.set(e.displaySetInstanceUID,e)})}_addActiveDisplaySets(e){let{activeDisplaySets:t,activeDisplaySetsMap:r}=this;e.forEach(e=>{r.has(e.displaySetInstanceUID)||(this.activeDisplaySetsChanged=!0,t.push(e),r.set(e.displaySetInstanceUID,e))})}setUnsuportedSOPClassHandler(e){this.unsupportedSOPClassHandler=e}addDisplaySets(...e){return this._addDisplaySetsToCache(e),this._addActiveDisplaySets(e),this.activeDisplaySetsChanged=!1,this._broadcastEvent(es.DISPLAY_SETS_ADDED,{displaySetsAdded:e,options:{madeInClient:e[0].madeInClient}}),e}getDisplaySetCache(){return el}getMostRecentDisplaySet(){return this.activeDisplaySets[this.activeDisplaySets.length-1]}getActiveDisplaySets(){return this.activeDisplaySets}getDisplaySetForSOPInstanceUID(e,t,r){return(t?this.getDisplaySetsForSeries(t):[...this.getDisplaySetCache().values()]).find(t=>t.instances?.some(t=>t.SOPInstanceUID===e))}setDisplaySetMetadataInvalidated(e,t=!0){this.getDisplaySetByUID(e)&&this._broadcastEvent(es.DISPLAY_SET_SERIES_METADATA_INVALIDATED,{displaySetInstanceUID:e,invalidateData:t})}deleteDisplaySet(e){if(!e)return;let{activeDisplaySets:t,activeDisplaySetsMap:r}=this,n=t.findIndex(t=>t.displaySetInstanceUID===e);el.delete(e),t.splice(n,1),r.delete(e),this._broadcastEvent(es.DISPLAY_SETS_CHANGED,this.activeDisplaySets),this._broadcastEvent(es.DISPLAY_SETS_REMOVED,{displaySetInstanceUIDs:[e]})}onModeExit(){this.getDisplaySetCache().clear(),this.activeDisplaySets.length=0,this.activeDisplaySetsMap.clear()}makeDisplaySetForInstances(e,t){let r=e.reduce((e,t)=>(t.SOPClassUID in e||(e[t.SOPClassUID]=[]),e[t.SOPClassUID].push(t),e),{}),n=Object.keys(r),i=[];return n.forEach(e=>{let n=this._makeDisplaySetForInstances(r[e],t);i=[...i,...n]}),i}_makeDisplaySetForInstances(e,t){let r=[...e],n=r[0],i=this.getDisplaySetsForSeries(n.SeriesInstanceUID)||[],a=this.SOPClassHandlerIds,o=[];for(let e=0;e<a.length&&r.length;e++){let s=a[e],l=this.extensionManager.getModuleEntry(s);if(l.sopClassUids.includes(n.SOPClassUID)){let e=i.filter(e=>e.SOPClassHandlerId===s);if(e.length){for(let t of(r=eu(r,e),e)){let e=t.addInstances?.(r,this);if(e&&(this.activeDisplaySetsChanged=!0,r=eu(r,[e]),this._addActiveDisplaySets([e]),this.setDisplaySetMetadataInvalidated(e.displaySetInstanceUID)),!r.length)return o}if(!r.length)return this._addActiveDisplaySets(e),o}if(!(e=l.getDisplaySetsFromSeries(r))||!e.length)continue;e.forEach(e=>{Object.keys(t).forEach(r=>{e[r]=t[r]})}),this._addDisplaySetsToCache(e),this._addActiveDisplaySets(e),r=eu(r,e),o.push(...e)}}if(0===o.length){let e=this.extensionManager.getModuleEntry(this.unsupportedSOPClassHandler).getDisplaySetsFromSeries(r);e?.length&&(e.forEach(e=>{Object.keys(t).forEach(r=>{e[r]=t[r]})}),this._addDisplaySetsToCache(e),this._addActiveDisplaySets(e),o.push(...e))}return o}getDisplaySetsBy(e){let t=[];if("function"!=typeof e)throw Error(`The comparator ${e} was not a function`);return this.getActiveDisplaySets().forEach(r=>{e(r)&&t.push(r)}),t}sortDisplaySets(e,t="ascending",r=!1){this.activeDisplaySets.sort(e),"descending"===t&&this.activeDisplaySets.reverse(),r||this._broadcastEvent(es.DISPLAY_SETS_CHANGED,this.activeDisplaySets)}}ec.REGISTRATION={altName:"DisplaySetService",name:"displaySetService",create:({configuration:e={}})=>new ec};class ed{constructor(e,t={}){this.id=void 0,this.args=void 0,this.id=e,this.args=t}}ed.CODES={NO_VALID_INSTANCES:1,NO_POSITION_INFORMATION:2,NOT_RECONSTRUCTABLE:3,MULTIFRAME_NO_PIXEL_MEASUREMENTS:4,MULTIFRAME_NO_ORIENTATION:5,MULTIFRAME_NO_POSITION_INFORMATION:6,MISSING_FRAMES:7,IRREGULAR_SPACING:8,INCONSISTENT_DIMENSIONS:9,INCONSISTENT_COMPONENTS:10,INCONSISTENT_ORIENTATIONS:11,INCONSISTENT_POSITION_INFORMATION:12,UNSUPPORTED_DISPLAYSET:13,UNSUPPORTED_SOP_CLASS_UID:14,MISSING_SOP_CLASS_UID:15};class ef{constructor(){this.messages=[]}addMessage(e,t={}){let r=new ed(e,t);this.messages.push(r)}size(){return this.messages.length}includesMessage(e){return this.messages.some(t=>t.id===e)}includesAllMessages(e){return e.every(e=>this.includesMessage(e))}}let eh=ec,ep={TOOL_BAR_MODIFIED:"event::toolBarService:toolBarModified",TOOL_BAR_STATE_MODIFIED:"event::toolBarService:toolBarStateModified"},eg={primary:"primary",secondary:"secondary",viewportActionMenu:{topLeft:"viewportActionMenu.topLeft",topRight:"viewportActionMenu.topRight",bottomLeft:"viewportActionMenu.bottomLeft",bottomRight:"viewportActionMenu.bottomRight",topMiddle:"viewportActionMenu.topMiddle",bottomMiddle:"viewportActionMenu.bottomMiddle",leftMiddle:"viewportActionMenu.leftMiddle",rightMiddle:"viewportActionMenu.rightMiddle"},labelMapSegmentationToolbox:"labelMapSegmentationToolbox",contourSegmentationToolbox:"contourSegmentationToolbox",labelMapSegmentationUtilities:"labelMapSegmentationUtilities",contourSegmentationUtilities:"contourSegmentationUtilities",dynamicToolbox:"dynamic-toolbox",roiThresholdToolbox:"ROIThresholdToolbox"},em=((r={})[r.TopLeft=0]="TopLeft",r[r.TopMiddle=1]="TopMiddle",r[r.TopRight=2]="TopRight",r[r.LeftMiddle=3]="LeftMiddle",r[r.RightMiddle=4]="RightMiddle",r[r.BottomLeft=5]="BottomLeft",r[r.BottomMiddle=6]="BottomMiddle",r[r.BottomRight=7]="BottomRight",r);class ey extends I{get sections(){return eg}static createButton(e){let{id:t,icon:r,label:n,commands:i,tooltip:a,evaluate:o,listeners:s}=e;return{id:t,icon:r,label:n,commands:i,tooltip:a||n,evaluate:o,listeners:s}}constructor(e,t,r){super(ep),this.state={buttons:{},buttonSections:{}},this._commandsManager=void 0,this._extensionManager=void 0,this._servicesManager=void 0,this._evaluateFunction={},this._serviceSubscriptions=[],this.handleEvaluateNested=e=>{let{buttonSection:t}=e;if(!t)return;let r=this.getButtonSection(t);r?.length&&r.forEach(e=>{this.handleEvaluate(e.componentProps)})},this.handleEvaluate=e=>{let{evaluate:t,options:r}=e;if("string"==typeof r){let t=this._getButtonUITypes();e.options=t[r]?.defaultComponent}if("function"!=typeof t){if(Array.isArray(t)){let r=t.map(e=>{let t="object"==typeof e,r=t?e.name:e,n=this._evaluateFunction[r];if(!n)throw Error(`Evaluate function not found for name: ${r}, you can register an evaluate function with the getToolbarModule in your extensions`);return t?t=>n({...t,...e}):n}),n=e.evaluate;e.evaluate=e=>{let t=r.map(t=>t(e)).filter(Boolean),n=t?.some(e=>e.disabled),i=t.reduce((e,t)=>({...e,...t}),{});return n&&(i.disabled=!0),i},e.evaluateProps=n;return}if("string"==typeof t){let r=this._evaluateFunction[t];if(r){e.evaluate=r;return}throw Error(`Evaluate function not found for name: ${t}, you can register an evaluate function with the getToolbarModule in your extensions`)}if("object"==typeof t){let{name:r,...n}=t,i=this._evaluateFunction[r];if(i){let t=e.evaluate;e.evaluate=e=>i({...e,...n}),e.evaluateProps=t;return}throw Error(`Evaluate function not found for name: ${r}, you can register an evaluate function with the getToolbarModule in your extensions`)}}},this._commandsManager=e,this._extensionManager=t,this._servicesManager=r}reset(){this.state={buttons:{},buttonSections:{}},this.unsubscriptions=[]}onModeEnter(){this.reset()}registerEvaluateFunction(e,t){this._evaluateFunction[e]=t}registerEventForToolbarUpdate(e,t){let{viewportGridService:r}=this._servicesManager.services,n=()=>{let e=r.getActiveViewportId();this.refreshToolbarState({viewportId:e})};t.map(t=>e.subscribe?e.subscribe(t,n):e.addEventListener?e.addEventListener(t,n):void 0).forEach(e=>this._serviceSubscriptions.push(e))}removeButton(e){this.state.buttons[e]&&delete this.state.buttons[e],Object.keys(this.state.buttonSections).forEach(t=>{this.state.buttonSections[t]=this.state.buttonSections[t].filter(t=>t!==e)}),this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED,{...this.state})}register(e,t=!1){e.forEach(e=>{(t||!this.state.buttons[e.id])&&(e.props||(e.props={}),!0===e.props.buttonSection&&(e.props.buttonSection=e.id),this.state.buttons[e.id]=e)}),this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED,{...this.state})}recordInteraction(e,t){"string"==typeof e&&(e=this.getButtonProps(e));let r=e.itemId??e.id;e.itemId=r;let n=Array.isArray(e.commands)?e.commands:[e.commands];if(n=n.filter(Boolean),!n?.length)return void this.refreshToolbarState({...t?.refreshProps,itemId:r,interaction:e});let i={...t,...e};(n=(n=n.map(e=>"function"==typeof e?()=>{e({...i,commandsManager:this._commandsManager,servicesManager:this._servicesManager})}:e)).filter(Boolean)).length&&(this._commandsManager.run(n,i),this.refreshToolbarState({...t?.refreshProps,itemId:r,interaction:e}))}refreshToolbarState(e){let t=this.state.buttons,r={...t},n=new Map,i=(e,t,r)=>{if(n.has(e.id)){let{disabled:r,disabledText:i,className:a,isActive:o}=n.get(e.id);return{...t,disabled:r,disabledText:i,className:a,isActive:o}}{let i=t.evaluateProps,a="function"==typeof t.evaluate?t.evaluate({...r,button:e}):void 0,o=i?.hideWhenDisabled||t.hideWhenDisabled,s=a?.visible===void 0?!(o&&a?.disabled):a?.visible,l={...t,...a,disabled:a?.disabled||!1,visible:s,className:a?.className||t?.className||"",isActive:a?.isActive};return n.set(e.id,l),l}},a=new Set;return Object.values(t).forEach(n=>{if(!a.has(n.id))if(n.props?.buttonSection){let o=n.props,{evaluate:s}=o,l="function"==typeof s?s({...e,button:n}):void 0;o={...o,disabled:l?.disabled??o.disabled,disabledText:l?.disabledText??o.disabledText};let u=this.state.buttonSections[o.buttonSection];if(!u)return;u.forEach(n=>{let o=t[n];if(!o||a.has(n))return;let s=i(o,o.props,e);r[n]={...o,props:s},a.add(n)})}else{this.handleEvaluate(n.props);let t=n.props,o=i(n,t,e);r[n.id]={...n,props:o},a.add(n.id)}}),this.setButtons(r),this.state}setButtons(e){this.state.buttons=e,this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED,{buttons:this.state.buttons,buttonSections:this.state.buttonSections})}getButton(e){return this.state.buttons[e]}addButtons(e,t=!1){console.warn("ToolbarService.addButtons() is deprecated. Use ToolbarService.register() instead."),this.register(e,t)}getButtons(){return this.state.buttons}getButtonProps(e){if(this.state.buttons[e])return this.state.buttons[e].props}_getButtonUITypes(){let e=this._extensionManager.modules.toolbarModule;return Array.isArray(e)?e.reduce((e,t)=>(t.module.forEach(t=>{e[t.name]=t}),e),{}):{}}updateSection(e,t){this.state.buttonSections[e]?this.state.buttonSections[e].push(...t.filter(t=>!this.state.buttonSections[e].find(e=>e===t))):this.state.buttonSections[e]=t,this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED,{...this.state})}createButtonSection(e,t){console.warn("ToolbarService.createButtonSection() is deprecated. Use ToolbarService.updateSection() instead."),this.updateSection(e,t)}getButtonSection(e,t){let r=this.state.buttonSections[e];return r?.map(e=>{let r=this.state.buttons[e];return this._mapButtonToDisplay(r,t)})||[]}getButtonPropsInButtonSection(e){let t=this.state.buttonSections[e];return t?.map(e=>this.getButtonProps(e))||[]}getToolNameForButton(e){let{props:t}=e,r=t?.commands||e.commands,n=(Array.isArray(r)?r:[r])[0];return n?.commandOptions?n.commandOptions.toolName??t?.id??e.id:t?.id??e.id}_mapButtonToDisplay(e,t){if(!e)return;let{id:r,uiType:n}=e,{buttonSection:i}=e.props,a=this._getButtonUITypes()[n];if(e.component||(e.component=a.defaultComponent),!a&&!e.component)return void console.warn(`Neither button type nor a component found for button: ${r}`);i?this.handleEvaluateNested(e.props):this.handleEvaluate(e.props);let{id:o,props:s}=e,l=(e,t)=>{let r=Array.isArray(e)?e:[e],n=this.getButtonProps(t);return r.map(e=>"function"==typeof e.optionComponent?e:{...e,onChange:t=>{e.value=t;let r=Array.isArray(e.commands)?e.commands:[e.commands];if(n&&n.options){let r=n.options.findIndex(t=>t.id===e.id);-1!==r&&(n.options[r].value=t)}r.forEach(r=>{let i={...e,value:t,options:n.options,servicesManager:this._servicesManager,commandsManager:this._commandsManager};this._commandsManager.run(r,i)}),this._broadcastEvent(ep.TOOL_BAR_STATE_MODIFIED,{buttons:this.state.buttons,buttonSections:this.state.buttonSections})}})};if(s?.items?.length){let{items:e=[]}=s;e.forEach(e=>{e.options&&(e.options=l(e.options,e.id))})}else s.options?.length?s.options=l(s.options,o):s.optionComponent&&(s.optionComponent=options.optionComponent);return{id:r,Component:e.component,componentProps:Object.assign({id:r},e.props,t)}}getButtonComponentForUIType(e){return e?this._getButtonUITypes()[e]?.defaultComponent??null:null}clearButtonSection(e){this.state.buttonSections[e]=[],this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED,{...this.state})}isInAnySection(e){return!!e&&Object.values(this.state.buttonSections).some(t=>Array.isArray(t)&&t.includes(e))}getAlignAndSide(e){switch(Number(e)){case em.TopLeft:return{align:"start",side:"bottom"};case em.TopMiddle:return{align:"center",side:"bottom"};case em.TopRight:return{align:"end",side:"bottom"};case em.LeftMiddle:return{align:"start",side:"right"};case em.RightMiddle:return{align:"end",side:"left"};case em.BottomLeft:return{align:"start",side:"top"};case em.BottomMiddle:return{align:"center",side:"top"};case em.BottomRight:return{align:"end",side:"top"};default:return{align:"start",side:"bottom"}}}getOptionById(e,t){return e.props.options?.find(e=>e.id===t)}}ey.REGISTRATION={name:"toolbarService",altName:"ToolBarService",create:({commandsManager:e,extensionManager:t,servicesManager:r})=>new ey(e,t,r)},ey.TOOLBAR_SECTIONS=eg;let ev=ey;class eS extends I{constructor({servicesManager:e}){super(eS.EVENTS),this.serviceImplementation={},this.servicesManager=void 0,this.presentationIdProviders=void 0,this.servicesManager=e,this.serviceImplementation={},this.presentationIdProviders=new Map}addPresentationIdProvider(e,t){this.presentationIdProviders.set(e,t)}getPresentationIdProvider(e){return this.presentationIdProviders.get(e)}getPresentationId(e,t){let r=this.getState(),n=r.viewports.get(t);return this._getPresentationId(e,{viewport:n,viewports:r.viewports})}_getPresentationId(e,{viewport:t,viewports:r}){let n=[...r.values()].some(e=>e.displaySetInstanceUIDs?.toString()===t.displaySetInstanceUIDs?.toString()&&e.viewportId===t.viewportId),i=this.presentationIdProviders.get(e);return i?i(e,{viewport:t,viewports:r,isUpdatingSameViewport:n,servicesManager:this.servicesManager}):null}getPresentationIds({viewport:e,viewports:t}){return Array.from(this.presentationIdProviders.keys()).reduce((r,n)=>{let i=this._getPresentationId(n,{viewport:e,viewports:t});return null!==i&&(r[n]=i),r},{})}setServiceImplementation({getState:e,setActiveViewportId:t,setDisplaySetsForViewports:r,setLayout:n,reset:i,onModeExit:a,set:o,getNumViewportPanes:s,setViewportIsReady:l,getViewportState:u}){u&&(this.serviceImplementation._getViewportState=u),e&&(this.serviceImplementation._getState=e),t&&(this.serviceImplementation._setActiveViewport=t),r&&(this.serviceImplementation._setDisplaySetsForViewports=r),n&&(this.serviceImplementation._setLayout=n),i&&(this.serviceImplementation._reset=i),a&&(this.serviceImplementation._onModeExit=a),o&&(this.serviceImplementation._set=o),s&&(this.serviceImplementation._getNumViewportPanes=s),l&&(this.serviceImplementation._setViewportIsReady=l)}publishViewportsReady(){this._broadcastEvent(this.EVENTS.VIEWPORTS_READY,{})}publishViewportOnDropHandled(e){this._broadcastEvent(this.EVENTS.VIEWPORT_ONDROP_HANDLED,{eventData:e})}setActiveViewportId(e){e!==this.getActiveViewportId()&&(this.serviceImplementation._setActiveViewport(e),setTimeout(()=>{this._broadcastEvent(this.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED,{viewportId:e})},0))}getState(){return this.serviceImplementation._getState()}getViewportState(e){return this.serviceImplementation._getViewportState(e)}setViewportIsReady(e,t){this.serviceImplementation._setViewportIsReady(e,t)}getActiveViewportId(){return this.getState().activeViewportId}setViewportGridSizeChanged(){let e=this.getState();this._broadcastEvent(this.EVENTS.GRID_SIZE_CHANGED,{state:e})}setDisplaySetsForViewport(e){this.setDisplaySetsForViewports([e])}async setDisplaySetsForViewports(e){await this.serviceImplementation._setDisplaySetsForViewports(e);let t=this.getState(),r=[],n=[];for(let i of e){let e=t.viewports.get(i.viewportId);e?(r.push(e),0===(e.displaySetInstanceUIDs||[]).length&&n.push(i.viewportId)):n.push(i.viewportId)}setTimeout(()=>{this._broadcastEvent(eS.EVENTS.GRID_STATE_CHANGED,{state:t,viewports:r,removedViewportIds:n})})}getDisplaySetsUIDsForViewport(e){let t=this.getState().viewports.get(e);return t?.displaySetInstanceUIDs}async setLayout({numCols:e,numRows:t,layoutOptions:r,layoutType:n="grid",activeViewportId:i,findOrCreateViewport:a,isHangingProtocolLayout:o=!1}){let s=new Set(this.getState().viewports.keys());await this.serviceImplementation._setLayout({numCols:e,numRows:t,layoutOptions:r,layoutType:n,activeViewportId:i,findOrCreateViewport:a,isHangingProtocolLayout:o}),setTimeout(()=>{let r=this.getState(),n=new Set(r.viewports.keys()),i=[...s].filter(e=>!n.has(e));this._broadcastEvent(this.EVENTS.LAYOUT_CHANGED,{numCols:e,numRows:t}),this._broadcastEvent(this.EVENTS.GRID_STATE_CHANGED,{state:r,removedViewportIds:i})},0)}reset(){this.serviceImplementation._reset()}onModeExit(){this.serviceImplementation._onModeExit()}set(e){let t=new Set(this.getState().viewports.keys());this.serviceImplementation._set(e);let r=this.getState(),n=new Set(r.viewports.keys()),i=[...t].filter(e=>!n.has(e));setTimeout(()=>{this._broadcastEvent(this.EVENTS.GRID_STATE_CHANGED,{state:r,removedViewportIds:i})},0)}getNumViewportPanes(){return this.serviceImplementation._getNumViewportPanes()}getLayoutOptionsFromState(e){return Array.from(e.viewports.entries()).map(([e,t])=>({x:t.x,y:t.y,width:t.width,height:t.height}))}}eS.EVENTS={ACTIVE_VIEWPORT_ID_CHANGED:"event::activeviewportidchanged",LAYOUT_CHANGED:"event::layoutChanged",GRID_STATE_CHANGED:"event::gridStateChanged",GRID_SIZE_CHANGED:"event::gridSizeChanged",VIEWPORTS_READY:"event::viewportsReady",VIEWPORT_ONDROP_HANDLED:"event::viewportOnDropHandled"},eS.REGISTRATION={name:"viewportGridService",altName:"ViewportGridService",create:({configuration:e={},servicesManager:t})=>new eS({servicesManager:t})};let eb=eS;class ew extends I{constructor(){super(ew.EVENTS),this.serviceImplementation={},this.startedClips=new Map,this.closedViewports=new Set,this.serviceImplementation={}}getState(){return this.serviceImplementation._getState()}setCine({id:e,frameRate:t,isPlaying:r}){return this.serviceImplementation._setCine({id:e,frameRate:t,isPlaying:r})}setIsCineEnabled(e){this.serviceImplementation._setIsCineEnabled(e),e&&this.closedViewports.forEach(e=>{this.clearViewportCineClosed(e)}),queueMicrotask(()=>{this._broadcastEvent(this.EVENTS.CINE_STATE_CHANGED,{isCineEnabled:e})})}playClip(e,t){let r=this.serviceImplementation._playClip(e,t);return this.startedClips.set(e,t),this._broadcastEvent(this.EVENTS.CINE_STATE_CHANGED,{isPlaying:!0}),r}stopClip(e,t){let r=this.serviceImplementation._stopClip(e,t);return this._broadcastEvent(this.EVENTS.CINE_STATE_CHANGED,{isPlaying:!1}),r}onModeExit(){this.setIsCineEnabled(!1),this.startedClips.forEach((e,t)=>{this.stopClip(t,e)})}getSyncedViewports(e){return this.serviceImplementation._getSyncedViewports(e)}setViewportCineClosed(e){this.closedViewports.add(e)}isViewportCineClosed(e){return this.closedViewports.size>0}clearViewportCineClosed(e){this.closedViewports.delete(e)}setServiceImplementation({getState:e,setCine:t,setIsCineEnabled:r,playClip:n,stopClip:i,getSyncedViewports:a}){a&&(this.serviceImplementation._getSyncedViewports=a),e&&(this.serviceImplementation._getState=e),t&&(this.serviceImplementation._setCine=t),r&&(this.serviceImplementation._setIsCineEnabled=r),n&&(this.serviceImplementation._playClip=n),i&&(this.serviceImplementation._stopClip=i)}}ew.EVENTS={CINE_STATE_CHANGED:"event::cineStateChanged"},ew.REGISTRATION={name:"cineService",altName:"CineService",create:({configuration:e={}})=>new ew};let e_=ew;var eE=a(359),eI=a.n(eE);function eD(){var e=[].slice.call(arguments),t=e.length;return function(r,n){var i,a,o,s,l,u,c;for(c=0;c<t&&(u=0,i=r[s="string"==typeof(o=e[c])?o:o.name],a=n[s],void 0!==o.primer&&(i=o.primer(i),a=o.primer(a)),l=o.reverse?-1:1,i<a&&(u=-1*l),i>a&&(u=+l),0===u);c++);return u}}var eM=a(834),eA=a.n(eM);eA().validators.equals=function(e,t,r){let n=ex(t),i=eP(e);if(Array.isArray(n)){if(n.length!==i.length)return`${r} must be an array of length ${n.length}`;else for(let e=0;e<n.length;e++)if(n[e]!==i[e])return`${r} ${n[e]} must equal ${i[e]}`}else if(n!==i[0])return`${r} must equal ${n}`},eA().validators.doesNotEqual=function(e,t,r){let n=ex(t),i=eP(e);if(Array.isArray(n)){if(n.length===i.length){let e=0;if(n.forEach((t,r)=>{t===i[r]&&e++}),e===n.length)return`${r} must not equal to ${n}`}}else if(n===i[0])return console.log(i,n),`${r} must not equal to ${n}`},eA().validators.includes=function(e,t,r){let n=ex(t),i=eP(e);return Array.isArray(n)?0===n.filter(e=>i.includes(e)).length?`${r} must include at least one of the following values: ${n.join(", ")}`:void 0:`${r} ${n} must be an array`},eA().validators.doesNotInclude=function(e,t,r){let n=ex(t),i=eP(e);if(!Array.isArray(n))return`${r} ${n} must be an array`;{let e=n.filter(e=>i.includes(e));if(e.length>0)return`${r} must not include the following value: ${e}`}},eA().validators.containsI=function(e,t,r){let n=ex(t);if(Array.isArray(e)){if(e.some(e=>!eA().validators.containsI(e.toLowerCase(),t,r)))return;return`No item of ${e.join(",")} contains ${JSON.stringify(n)}`}if(Array.isArray(n)){if(n.some(t=>!eA().validators.containsI(e,t.toLowerCase(),r)))return;return`${r} must contain at least one of ${n.join(",")}`}if(n&&e.indexOf&&-1===e.toLowerCase().indexOf(n.toLowerCase()))return r+"must contain any case of"+n},eA().validators.contains=function(e,t,r){let n=ex(t);if(Array.isArray(e)){if(e.some(e=>!eA().validators.contains(e,t,r)))return;return`No item of ${e.join(",")} contains ${JSON.stringify(n)}`}if(Array.isArray(n)){if(n.some(t=>!eA().validators.contains(e,t,r)))return;return`${r} must contain at least one of ${n.join(",")}`}if(n&&e.indexOf&&-1===e.indexOf(n))return r+"must contain "+n},eA().validators.containsAll=function(e,t,r){let n=ex(t);if(!Array.isArray(e)||!Array.isArray(n))return`${r} must be an array and test value must be an array.`;let i=n.filter(t=>!e.includes(t));if(i.length>0)return`${r} must contain all of: ${n.join(", ")}. Missing: ${i.join(", ")}`},eA().validators.doesNotContain=function(e,t,r){if(!eA().validators.contains(e,t,r))return`No item of ${e} should contain ${ex(t)}`},eA().validators.doesNotContainI=function(e,t,r){if(!eA().validators.containsI(e,t,r))return`No item of ${e} should not contain ${ex(t)}`},eA().validators.startsWith=function(e,t,r){let n=ex(t);if("string"==typeof n&&(n=[n]),"string"==typeof e){if(!n.some(t=>e.startsWith(t)))return r+" must start with any of these values: "+n}else{if(!Array.isArray(e))return"Value must be a string or an array";let t=!1;for(let r=0;r<e.length;r++){for(let i=0;i<n.length;i++)if(e[r].startsWith(n[i])){t=!0;break}if(t)return}if(!t)return r+" must start with any of these values: "+n}},eA().validators.endsWith=function(e,t,r){let n=ex(t);if("string"==typeof n&&(n=[n]),"string"==typeof e){if(!n.some(t=>e.endsWith(t)))return r+" must end with any of these values: "+n}else{if(!Array.isArray(e))return r+" must be a string or an array";let t=!1;for(let r=0;r<e.length;r++){for(let i=0;i<n.length;i++)if(e[r].endsWith(n[i])){t=!0;break}if(t)return}if(!t)return r+" must end with any of these values: "+n}},eA().validators.greaterThan=function(e,t,r){let n=ex(t);if(Array.isArray(e)||"string"==typeof e)return`${r} is not allowed as an array or string`;if(Array.isArray(n)){if(1===n.length){if(!(e>=n[0]))return`${r} must be greater than or equal to ${n[0]}, but was ${e}`}else if(n.length>1)return r+" must be an array of length 1"}else if(!(e>=n))return r+" must be greater than "+n},eA().validators.lessThan=function(e,t,r){let n=ex(t);if(Array.isArray(n)){if(1===n.length){if(!(e<=n[0]))return`${r} must be less than or equal to ${n[0]}, but was ${e}`}else if(n.length>1)return r+" must be an array of length 1"}else if(!(e<=n))return r+" must be less than "+n},eA().validators.range=function(e,t,r){let n=ex(t);if(!Array.isArray(n)||2!==n.length)return`${r} must be an array of length 2`;{let t=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);if(void 0===e||e<t||e>i)return`${r} with value ${e} must be between ${t} and ${i}`}},eA().validators.notNull=e=>null==e?"Value is null":void 0;let ex=e=>Array.isArray(e)?e.map(e=>e?.value??e):e?.value??e,eP=e=>Array.isArray(e)?[...e]:[e],eO=eA();class eT{constructor(e,t){this.protocols=e,this.customAttributeRetrievalCallbacks=t,this.matchedProtocols=new Map,this.matchedProtocolScores={},this.study=void 0}run({studies:e,displaySets:t,activeStudy:r}){return this.studies=e,this.study=r||e[0],this.displaySets=t,this.getBestProtocolMatch()}getBestProtocolMatch(){this.updateProtocolMatches();let e=this._getHighestScoringProtocol();return console.log("ProtocolEngine::getBestProtocolMatch bestMatch",e),e}updateProtocolMatches(){console.log("ProtocolEngine::updateProtocolMatches"),this._clearMatchedProtocols(),this.findMatchByStudy(this.study,{studies:this.studies,displaySets:this.displaySets}).forEach(e=>{let t=e.protocol;t&&(this.matchedProtocols.has(t.id)||(console.log("ProtocolEngine::updateProtocolMatches inserting protocol match",e),this.matchedProtocols.set(t.id,t),this.matchedProtocolScores[t.id]=e.score))})}findMatch(e,t,r){return((e,t=[],r,n)=>{let i={format:"grouped"},a={passed:[],failed:[]},o={},s=!1,l=0,u=n?.studies?.[1],c=n?.studies?.[0],d=e.instances?.[0],f={prior:u,current:c,instance:d,...n,options:n,metadataInstance:e};return t.forEach(t=>{let u,{attribute:c,from:h="metadataInstance"}=t;r.hasOwnProperty(c)?o[c]=r[c].callback.call(t,e,n):o[c]=f[h]?.[c]??d?.[c];let p=((e,t,r,n)=>{if("object"!=typeof t||null===t)return t;let i={};return Object.entries(t).forEach(([e,t])=>{if("object"==typeof t&&Object.keys(t).length>0&&"attribute"in t){let a=t.attribute,o=t.from??"metadataInstance";if(r.hasOwnProperty(a)){let t=r[a].callback.call(null,n[o],n.options);i[e]={value:t}}else i[e]={value:n[o]?.[a]??n.metadataInstance?.[a]}}else i[e]=t},{}),i})(0,t.constraint,r,f),g={[c]:o[c]};try{u=eO(g,{[c]:p},[i])}catch(e){u=["Something went wrong during validation.",e]}u?(t.required&&(s=!0),a.failed.push({rule:t,errorMessages:u})):(l+=parseInt(t.weight||1,10),a.passed.push({rule:t}))}),s&&(l=0),{score:l,details:a,requiredFailed:s}})(e,t,this.customAttributeRetrievalCallbacks,r)}findMatchByStudy(e,t){let r=[];if(this.protocols.forEach(n=>{let i=n.protocolMatchingRules.slice();if(!i||!i.length)return void console.warn("ProtocolEngine::findMatchByStudy no matching rules - specify protocolMatchingRules for",n.id);let a=this.findMatch(e,i,t).score;a>0&&r.push({score:a,protocol:n})}),!r.length){let e=this.protocols.find(e=>"default"===e.id)??this.protocols[0];return console.log("No protocol matches, defaulting to",e),[{score:0,protocol:e}]}return r.sort((e,t)=>t.score-e.score),console.log("ProtocolEngine::findMatchByStudy matched",r),r}_clearMatchedProtocols(){this.matchedProtocols.clear(),this.matchedProtocolScores={}}_largestKeyByValue(e){return Object.keys(e).reduce((t,r)=>e[t]>e[r]?t:r)}_getHighestScoringProtocol(){if(!Object.keys(this.matchedProtocolScores).length)return;let e=this._largestKeyByValue(this.matchedProtocolScores);return this.matchedProtocols.get(e)}}let ek=class e{static set(t,r,n){let i=e.getPathComponents(r),a=null!==i?i.length:0,o=!1;if(a>0&&e.isValidObject(t)){let r=0,s=a-1,l=t;for(;r<s;){let t=i[r];if(t in l){if(!e.isValidObject(l[t]))break}else l[t]={};l=l[t],r++}r===s&&(l[i[s]]=n,o=!0)}return o}static get(t,r){let n,i=e.getPathComponents(r),a=null!==i?i.length:0;if(a>0&&e.isValidObject(t)){let r=0,o=a-1,s=t;for(;r<o;){let t=i[r],n=e.isValidObject(s[t]);if(t in s&&n)s=s[t],r++;else break}r===o&&i[o]in s&&(n=s[i[o]])}return n}static isValidObject(e){return"object"==typeof e&&null!==e&&e instanceof Object}static getPathComponents(e){return"string"==typeof e?e.split("."):null}},eN=e=>{let t="/";if(!e)return t;let r=window.location.origin,n=r.split("/");if(n.length>4){let i=r.indexOf(n[3]);t+=r.substring(i)+e}else t+=e;return t.replace(/\/\/+/g,"/")};function eC(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}var eU=a(985);let eR=e=>e?eU.parse(e):{};function eL(){let e,t;return Object.freeze({promise:new Promise(function(r,n){t=r,e=n}),resolve:t,reject:e})}var eV=a(681),ej=a.n(eV);!function(e,t={timeout:100}){var r=[],n=null,i=[],a=!1,o=null,s=e.prototype.handleKey;function l(e,t,r){if(!this.recording)return void s.apply(this,arguments);if("keydown"==r.type){1===e.length&&a&&c();for(let e=0;e<t.length;++e)u(t[e]);u(e)}else"keyup"==r.type&&i.length>0&&c()}function u(e){for(let t=0;t<i.length;++t)if(i[t]===e)return;i.push(e),1===e.length&&(a=!0)}function c(){r.push(i),i=[],a=!1,clearTimeout(o),o=setTimeout(d,t.timeout)}function d(){if(n){var e=r;for(let t=0;t<e.length;++t)e[t].sort(function(e,t){return e.length>1&&1===t.length?-1:1===e.length&&t.length>1||e>t?1:-1}),e[t]=e[t].join("+");n(r)}r=[],n=null,i=[]}e.prototype.record=function(e){var t=this;t.recording=!0,n=function(){t.recording=!1,e.apply(t,arguments)}},e.prototype.stopRecord=function(){this.recording=!1},e.prototype.startRecording=function(){this.recording=!0},e.prototype.handleKey=function(){l.apply(this,arguments)},e.init()}(ej()),i=(n=ej()).prototype.stopCallback,n.prototype.stopCallback=function(e,t,r){return!!this.paused||i.call(this,e,t,r)},n.prototype.pause=function(){this.paused=!0},n.prototype.unpause=function(){this.paused=!1},n.init();let eF=ej();function eB(e,t){let r=eY.bind(null,e);return async function(...n){if(e.size>=e.limit)throw Error("Queue limit reached");let i=e$(e.awaiting,t,n);return e.awaiting=i.then(r,r),e.size++,i}}function eY(e){e.size>0&&0==--e.size&&(e.awaiting=null)}async function e$(e,t,r){return await e,t(...r)}var eH=a(867),eW=a.n(eH);function eG(e){return(eG="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 eq(e){var t=function(e,t){if("object"!=eG(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=eG(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==eG(t)?t:t+""}function ez(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?Object(arguments[t]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(t){var n,i;n=t,i=r[t],(n=eq(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i})}return e}function eX(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function eK(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,eq(n.key),n)}}function eZ(e,t,r){return t&&eK(e.prototype,t),r&&eK(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function eJ(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eQ(e,t){if(t&&("object"==eG(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return eJ(e)}function e0(e){return(e0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function e1(e,t){return(e1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function e2(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&e1(e,t)}function e8(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function e4(e,t){if(e){if("string"==typeof e)return e8(e,t);var r=({}).toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e8(e,t):void 0}}function e3(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}(e,t)||e4(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var e5={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){var r;console&&console[e]&&(r=console)[e].apply(r,function(e){if(Array.isArray(e))return e8(e)}(t)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||e4(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}},e6=new(function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eX(this,e),this.init(t,r)}return eZ(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||e5,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,r,n){return n&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(r).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,ez({},{prefix:"".concat(this.prefix,":").concat(t,":")},this.options))}}]),e}()),e7=function(){function e(){eX(this,e),this.observers={}}return eZ(e,[{key:"on",value:function(e,t){var r=this;return e.split(" ").forEach(function(e){r.observers[e]=r.observers[e]||[],r.observers[e].push(t)}),this}},{key:"off",value:function(e,t){if(this.observers[e]){if(!t)return void delete this.observers[e];this.observers[e]=this.observers[e].filter(function(e){return e!==t})}}},{key:"emit",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.observers[e]&&[].concat(this.observers[e]).forEach(function(e){e.apply(void 0,r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(function(t){t.apply(t,[e].concat(r))})}}]),e}();function e9(){var e,t,r=new Promise(function(r,n){e=r,t=n});return r.resolve=e,r.reject=t,r}function te(e){return null==e?"":""+e}function tt(e,t,r){function n(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var a="string"!=typeof t?[].concat(t):t.split(".");a.length>1;){if(i())return{};var o=n(a.shift());!e[o]&&r&&(e[o]=new r),e=e[o]}return i()?{}:{obj:e,k:n(a.shift())}}function tr(e,t,r){var n=tt(e,t,Object);n.obj[n.k]=r}function tn(e,t){var r=tt(e,t),n=r.obj,i=r.k;if(n)return n[i]}function ti(e,t,r){var n=tn(e,r);return void 0!==n?n:tn(t,r)}function ta(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var to={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function ts(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return to[e]}):e}var tl=function(e){function t(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return eX(this,t),r=eQ(this,e0(t).call(this)),e7.call(eJ(r)),r.data=e||{},r.options=n,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r}return e2(t,e),eZ(t,[{key:"addNamespaces",value:function(e){0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,a=[e,t];return r&&"string"!=typeof r&&(a=a.concat(r)),r&&"string"==typeof r&&(a=a.concat(i?r.split(i):r)),e.indexOf(".")>-1&&(a=e.split(".")),tn(this.data,a)}},{key:"addResource",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},a=this.options.keySeparator;void 0===a&&(a=".");var o=[e,t];r&&(o=o.concat(a?r.split(a):r)),e.indexOf(".")>-1&&(o=e.split("."),n=t,t=o[1]),this.addNamespaces(t),tr(this.data,o,n),i.silent||this.emit("added",e,t,r,n)}},{key:"addResources",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in r)("string"==typeof r[i]||"[object Array]"===Object.prototype.toString.apply(r[i]))&&this.addResource(e,t,i,r[i],{silent:!0});n.silent||this.emit("added",e,t,r)}},{key:"addResourceBundle",value:function(e,t,r,n,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),n=r,r=t,t=o[1]),this.addNamespaces(t);var s=tn(this.data,o)||{};n?function e(t,r,n){for(var i in r)i in t?"string"==typeof t[i]||t[i]instanceof String||"string"==typeof r[i]||r[i]instanceof String?n&&(t[i]=r[i]):e(t[i],r[i],n):t[i]=r[i];return t}(s,r,i):s=ez({},s,r),tr(this.data,o,s),a.silent||this.emit("added",e,t,r)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return(t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI)?ez({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"toJSON",value:function(){return this.data}}]),t}(e7),tu={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,n,i){var a=this;return e.forEach(function(e){a.processors[e]&&(t=a.processors[e].process(t,r,n,i))}),t}},tc=function(e){function t(e){var r,n,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return eX(this,t),i=eQ(this,e0(t).call(this)),e7.call(eJ(i)),r=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],n=eJ(i),r.forEach(function(t){e[t]&&(n[t]=e[t])}),i.options=a,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=e6.create("translator"),i}return e2(t,e),eZ(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},r=this.resolve(e,t);return r&&void 0!==r.res}},{key:"extractFromKey",value:function(e,t){var r=t.nsSeparator||this.options.nsSeparator;void 0===r&&(r=":");var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS;if(r&&e.indexOf(r)>-1){var a=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(a[0])>-1)&&(i=a.shift()),e=a.join(n)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t){var r=this;if("object"!==eG(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=this.extractFromKey(e[e.length-1],t),a=i.key,o=i.namespaces,s=o[o.length-1],l=t.lng||this.language,u=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase())return u?s+(t.nsSeparator||this.options.nsSeparator)+a:a;var c=this.resolve(e,t),d=c&&c.res,f=c&&c.usedKey||a,h=c&&c.exactUsedKey||a,p=Object.prototype.toString.apply(d),g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,m=!this.i18nFormat||this.i18nFormat.handleAsObject,y="string"!=typeof d&&"boolean"!=typeof d&&"number"!=typeof d;if(m&&d&&y&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(p)&&("string"!=typeof g||"[object Array]"!==p)){if(!t.returnObjects&&!this.options.returnObjects)return this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,d,t):"key '".concat(a," (").concat(this.language,")' returned an object instead of string.");if(n){var v="[object Array]"===p,S=v?[]:{},b=v?h:f;for(var w in d)if(Object.prototype.hasOwnProperty.call(d,w)){var _="".concat(b).concat(n).concat(w);S[w]=this.translate(_,ez({},t,{joinArrays:!1,ns:o})),S[w]===_&&(S[w]=d[w])}d=S}}else if(m&&"string"==typeof g&&"[object Array]"===p)(d=d.join(g))&&(d=this.extendTranslation(d,e,t));else{var E=!1,I=!1;if(!this.isValidLookup(d)&&void 0!==t.defaultValue){if(E=!0,void 0!==t.count){var D=this.pluralResolver.getSuffix(l,t.count);d=t["defaultValue".concat(D)]}d||(d=t.defaultValue)}this.isValidLookup(d)||(I=!0,d=a);var M=t.defaultValue&&t.defaultValue!==d&&this.options.updateMissing;if(I||E||M){this.logger.log(M?"updateKey":"missingKey",l,s,a,M?t.defaultValue:d);var A=[],x=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&x&&x[0])for(var P=0;P<x.length;P++)A.push(x[P]);else"all"===this.options.saveMissingTo?A=this.languageUtils.toResolveHierarchy(t.lng||this.language):A.push(t.lng||this.language);var O=function(e,n){r.options.missingKeyHandler?r.options.missingKeyHandler(e,s,n,M?t.defaultValue:d,M,t):r.backendConnector&&r.backendConnector.saveMissing&&r.backendConnector.saveMissing(e,s,n,M?t.defaultValue:d,M,t),r.emit("missingKey",e,s,n,d)};if(this.options.saveMissing){var T=void 0!==t.count&&"string"!=typeof t.count;this.options.saveMissingPlurals&&T?A.forEach(function(e){r.pluralResolver.getPluralFormsOfKey(e,a).forEach(function(t){return O([e],t)})}):O(A,a)}}d=this.extendTranslation(d,e,t,c),I&&d===a&&this.options.appendNamespaceToMissingKey&&(d="".concat(s,":").concat(a)),I&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(d))}return d}},{key:"extendTranslation",value:function(e,t,r,n){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,r,n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(ez({},r,{interpolation:ez({},this.options.interpolation,r.interpolation)}));var a=r.replace&&"string"!=typeof r.replace?r.replace:r;this.options.interpolation.defaultVariables&&(a=ez({},this.options.interpolation.defaultVariables,a)),e=this.interpolator.interpolate(e,a,r.lng||this.language,r),!1!==r.nest&&(e=this.interpolator.nest(e,function(){return i.translate.apply(i,arguments)},r)),r.interpolation&&this.interpolator.reset()}var o=r.postProcess||this.options.postProcess,s="string"==typeof o?[o]:o;return null!=e&&s&&s.length&&!1!==r.applyPostProcessor&&(e=tu.handle(s,e,t,this.options&&this.options.postProcessPassResolved?ez({i18nResolved:n},r):r,this)),e}},{key:"resolve",value:function(e){var t,r,n,i,a,o=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach(function(e){if(!o.isValidLookup(t)){var l=o.extractFromKey(e,s),u=l.key;r=u;var c=l.namespaces;o.options.fallbackNS&&(c=c.concat(o.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,f=void 0!==s.context&&"string"==typeof s.context&&""!==s.context,h=s.lngs?s.lngs:o.languageUtils.toResolveHierarchy(s.lng||o.language,s.fallbackLng);c.forEach(function(e){o.isValidLookup(t)||(a=e,o.utils&&o.utils.hasLoadedNamespace&&!o.utils.hasLoadedNamespace(a)&&o.logger.warn('key "'.concat(r,'" for namespace "').concat(a,"\" won't get resolved as namespace was not yet loaded"),"This means something IS WRONG in your application setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"),h.forEach(function(r){if(!o.isValidLookup(t)){i=r;var a,l,c=u,h=[c];for(o.i18nFormat&&o.i18nFormat.addLookupKeys?o.i18nFormat.addLookupKeys(h,u,r,e,s):(d&&(a=o.pluralResolver.getSuffix(r,s.count)),d&&f&&h.push(c+a),f&&h.push(c+="".concat(o.options.contextSeparator).concat(s.context)),d&&h.push(c+=a));l=h.pop();)o.isValidLookup(t)||(n=l,t=o.getResource(r,e,l,s))}}))})}}),{res:t,usedKey:r,exactUsedKey:n,usedLng:i,usedNS:a}}},{key:"isValidLookup",value:function(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}}]),t}(e7);function td(e){return e.charAt(0).toUpperCase()+e.slice(1)}var tf=function(){function e(t){eX(this,e),this.options=t,this.whitelist=this.options.whitelist||!1,this.logger=e6.create("languageUtils")}return eZ(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||0>e.indexOf("-"))return null;var t=e.split("-");return 2===t.length?null:(t.pop(),this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||0>e.indexOf("-"))return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],r=e.split("-");return this.options.lowerCaseLng?r=r.map(function(e){return e.toLowerCase()}):2===r.length?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=td(r[1].toLowerCase()))):3===r.length&&(r[0]=r[0].toLowerCase(),2===r[1].length&&(r[1]=r[1].toUpperCase()),"sgn"!==r[0]&&2===r[2].length&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=td(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=td(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitWhitelist)&&(e=this.getLanguagePartFromCode(e)),!this.whitelist||!this.whitelist.length||this.whitelist.indexOf(e)>-1}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e.default),r||[]}},{key:"toResolveHierarchy",value:function(e,t){var r=this,n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],a=function(e){e&&(r.isWhitelisted(e)?i.push(e):r.logger.warn("rejecting non-whitelisted language code: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&a(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&a(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&a(this.getLanguagePartFromCode(e))):"string"==typeof e&&a(this.formatLanguageCode(e)),n.forEach(function(e){0>i.indexOf(e)&&a(r.formatLanguageCode(e))}),i}}]),e}(),th=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","id","ja","jbo","ka","kk","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he"],nr:[1,2,20,21],fc:22}],tp={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0===e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(+(1!=e&&e%10!=1))},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0===e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0===e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:3*(e%100==3||e%100==4))},22:function(e){return Number(1===e?0:2===e?1:(e<0||e>10)&&e%10==0?2:3)}},tg=function(){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eX(this,e),this.languageUtils=t,this.options=n,this.logger=e6.create("pluralResolver"),this.rules=(r={},th.forEach(function(e){e.lngs.forEach(function(t){r[t]={numbers:e.nr,plurals:tp[e.fc]}})}),r)}return eZ(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var r=this,n=[],i=this.getRule(e);return i&&i.numbers.forEach(function(i){var a=r.getSuffix(e,i);n.push("".concat(t).concat(a))}),n}},{key:"getSuffix",value:function(e,t){var r=this,n=this.getRule(e);if(n){var i=n.noAbs?n.plurals(t):n.plurals(Math.abs(t)),a=n.numbers[i];this.options.simplifyPluralSuffix&&2===n.numbers.length&&1===n.numbers[0]&&(2===a?a="plural":1===a&&(a=""));var o=function(){return r.options.prepend&&a.toString()?r.options.prepend+a.toString():a.toString()};return"v1"===this.options.compatibilityJSON?1===a?"":"number"==typeof a?"_plural_".concat(a.toString()):o():"v2"===this.options.compatibilityJSON?o():this.options.simplifyPluralSuffix&&2===n.numbers.length&&1===n.numbers[0]?o():this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}return this.logger.warn("no plural rule found for: ".concat(e)),""}}]),e}(),tm=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};eX(this,e),this.logger=e6.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return eZ(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:ts,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?ta(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?ta(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?ta(t.nestingPrefix):t.nestingPrefixEscaped||ta("$t("),this.nestingSuffix=t.nestingSuffix?ta(t.nestingSuffix):t.nestingSuffixEscaped||ta(")"),this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=RegExp(t,"g");var r="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=RegExp(r,"g")}},{key:"interpolate",value:function(e,t,r,n){var i,a,o,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(0>e.indexOf(s.formatSeparator))return ti(t,l,e);var n=e.split(s.formatSeparator),i=n.shift().trim(),a=n.join(s.formatSeparator).trim();return s.format(ti(t,l,i),a,r)};this.resetRegExp();var d=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler;for(o=0;i=this.regexpUnescape.exec(e);){if(void 0===(a=c(i[1].trim())))if("function"==typeof d){var f=d(e,i,n);a="string"==typeof f?f:""}else this.logger.warn("missed to pass in variable ".concat(i[1]," for interpolating ").concat(e)),a="";else"string"==typeof a||this.useRawValueToEscape||(a=te(a));if(e=e.replace(i[0],u(a)),this.regexpUnescape.lastIndex=0,++o>=this.maxReplaces)break}for(o=0;i=this.regexp.exec(e);){if(void 0===(a=c(i[1].trim())))if("function"==typeof d){var h=d(e,i,n);a="string"==typeof h?h:""}else this.logger.warn("missed to pass in variable ".concat(i[1]," for interpolating ").concat(e)),a="";else"string"==typeof a||this.useRawValueToEscape||(a=te(a));if(a=u(this.escapeValue?this.escape(a):a),e=e.replace(i[0],a),this.regexp.lastIndex=0,++o>=this.maxReplaces)break}return e}},{key:"nest",value:function(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=ez({},i);function o(e,t){if(0>e.indexOf(","))return e;var r=e.split(",");e=r.shift();var n=r.join(",");n=(n=this.interpolate(n,a)).replace(/'/g,'"');try{a=JSON.parse(n),t&&(a=ez({},t,a))}catch(t){this.logger.error("failed parsing options string in nesting for key ".concat(e),t)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;r=this.nestingRegexp.exec(e);){if((n=t(o.call(this,r[1].trim(),a),a))&&r[0]===e&&"string"!=typeof n)return n;"string"!=typeof n&&(n=te(n)),n||(this.logger.warn("missed to resolve ".concat(r[1]," for nesting ").concat(e)),n=""),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}]),e}(),ty=function(e){function t(e,r,n){var i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return eX(this,t),i=eQ(this,e0(t).call(this)),e7.call(eJ(i)),i.backend=e,i.store=r,i.services=n,i.languageUtils=n.languageUtils,i.options=a,i.logger=e6.create("backendConnector"),i.state={},i.queue=[],i.backend&&i.backend.init&&i.backend.init(n,a.backend,a),i}return e2(t,e),eZ(t,[{key:"queueLoad",value:function(e,t,r,n){var i=this,a=[],o=[],s=[],l=[];return e.forEach(function(e){var n=!0;t.forEach(function(t){var s="".concat(e,"|").concat(t);!r.reload&&i.store.hasResourceBundle(e,t)?i.state[s]=2:i.state[s]<0||(1===i.state[s]?0>o.indexOf(s)&&o.push(s):(i.state[s]=1,n=!1,0>o.indexOf(s)&&o.push(s),0>a.indexOf(s)&&a.push(s),0>l.indexOf(t)&&l.push(t)))}),n||s.push(e)}),(a.length||o.length)&&this.queue.push({pending:o,loaded:{},errors:[],callback:n}),{toLoad:a,pending:o,toLoadLanguages:s,toLoadNamespaces:l}}},{key:"loaded",value:function(e,t,r){var n=e3(e.split("|"),2),i=n[0],a=n[1];t&&this.emit("failedLoading",i,a,t),r&&this.store.addResourceBundle(i,a,r),this.state[e]=t?-1:2;var o={};this.queue.forEach(function(r){n=r.loaded,(l=(s=tt(n,[i],Object)).obj)[u=s.k]=l[u]||[],l[u].push(a);for(var n,s,l,u,c=r.pending,d=c.indexOf(e);-1!==d;)c.splice(d,1),d=c.indexOf(e);t&&r.errors.push(t),0!==r.pending.length||r.done||(Object.keys(r.loaded).forEach(function(e){o[e]||(o[e]=[]),r.loaded[e].length&&r.loaded[e].forEach(function(t){0>o[e].indexOf(t)&&o[e].push(t)})}),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(function(e){return!e.done})}},{key:"read",value:function(e,t,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,o=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[r](e,t,function(s,l){s&&l&&i<5?setTimeout(function(){n.read.call(n,e,t,r,i+1,2*a,o)},a):o(s,l)}):o(null,{})}},{key:"prepareLoading",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var a=this.queueLoad(e,t,n,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(function(e){r.loadOne(e)})}},{key:"load",value:function(e,t,r){this.prepareLoading(e,t,{},r)}},{key:"reload",value:function(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}},{key:"loadOne",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e3(e.split("|"),2),i=n[0],a=n[1];this.read(i,a,"read",null,null,function(n,o){n&&t.logger.warn("".concat(r,"loading namespace ").concat(a," for language ").concat(i," failed"),n),!n&&o&&t.logger.log("".concat(r,"loaded namespace ").concat(a," for language ").concat(i),o),t.loaded(e,n,o)})}},{key:"saveMissing",value:function(e,t,r,n,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(r,'" for namespace "').concat(t,'" as the namespace was not yet loaded'),"This means something IS WRONG in your application setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):(this.backend&&this.backend.create&&this.backend.create(e,t,r,n,null,ez({},a,{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,r,n))}}]),t}(e7);function tv(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&0>e.whitelist.indexOf("cimode")&&(e.whitelist=e.whitelist.concat(["cimode"])),e}function tS(){}let tb=new(function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(eX(this,t),e=eQ(this,e0(t).call(this)),e7.call(eJ(e)),e.options=tv(r),e.services={},e.logger=e6,e.modules={external:[]},n&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,n),eQ(e,eJ(e));setTimeout(function(){e.init(r,n)},0)}return e}return e2(t,e),eZ(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;function n(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(r=t,t={}),this.options=ez({},{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===eG(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===eG(e[2])||"object"===eG(e[3])){var r=e[3]||e[2];Object.keys(r).forEach(function(e){t[e]=r[e]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",maxReplaces:1e3}},this.options,tv(t)),this.format=this.options.interpolation.format,r||(r=tS),!this.options.isClone){this.modules.logger?e6.init(n(this.modules.logger),this.options):e6.init(null,this.options);var i=new tf(this.options);this.store=new tl(this.options.resources,this.options);var a=this.services;a.logger=e6,a.resourceStore=this.store,a.languageUtils=i,a.pluralResolver=new tg(i,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),a.interpolator=new tm(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new ty(n(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];e.emit.apply(e,[t].concat(n))}),this.modules.languageDetector&&(a.languageDetector=n(this.modules.languageDetector),a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=n(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new tc(this.services,this.options),this.translator.on("*",function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];e.emit.apply(e,[t].concat(n))}),this.modules.external.forEach(function(t){t.init&&t.init(e)})}["getResource","addResource","addResources","addResourceBundle","removeResourceBundle","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments)}});var o=e9(),s=function(){e.changeLanguage(e.options.lng,function(t,n){e.isInitialized=!0,e.logger.log("initialized",e.options),e.emit("initialized",e.options),o.resolve(n),r(t,n)})};return this.options.resources||!this.options.initImmediate?s():setTimeout(s,0),o}},{key:"loadResources",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tS;if(!this.options.resources||this.options.partialBundledLanguages){if(this.language&&"cimode"===this.language.toLowerCase())return t();var r=[],n=function(t){t&&e.services.languageUtils.toResolveHierarchy(t).forEach(function(e){0>r.indexOf(e)&&r.push(e)})};this.language?n(this.language):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(function(e){return n(e)}),this.options.preload&&this.options.preload.forEach(function(e){return n(e)}),this.services.backendConnector.load(r,this.options.ns,t)}else t(null)}},{key:"reloadResources",value:function(e,t,r){var n=e9();return e||(e=this.languages),t||(t=this.options.ns),r||(r=tS),this.services.backendConnector.reload(e,t,function(e){n.resolve(),r(e)}),n}},{key:"use",value:function(e){return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&tu.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var r=this,n=e9();this.emit("languageChanging",e);var i=function(e,i){r.translator.changeLanguage(i),i&&(r.emit("languageChanged",i),r.logger.log("languageChanged",i)),n.resolve(function(){return r.t.apply(r,arguments)}),t&&t(e,function(){return r.t.apply(r,arguments)})},a=function(e){e&&(r.language=e,r.languages=r.services.languageUtils.toResolveHierarchy(e),r.translator.language||r.translator.changeLanguage(e),r.services.languageDetector&&r.services.languageDetector.cacheUserLanguage(e)),r.loadResources(function(t){i(t,e)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(a):a(e):a(this.services.languageDetector.detect()),n}},{key:"getFixedT",value:function(e,t){var r=this,n=function e(t,n){var i;if("object"!==eG(n)){for(var a=arguments.length,o=Array(a>2?a-2:0),s=2;s<a;s++)o[s-2]=arguments[s];i=r.options.overloadTranslationOptionHandler([t,n].concat(o))}else i=ez({},n);return i.lng=i.lng||e.lng,i.lngs=i.lngs||e.lngs,i.ns=i.ns||e.ns,r.t(t,i)};return"string"==typeof e?n.lng=e:n.lngs=e,n.ns=t,n}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this;if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.languages[0],n=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return -1===n||2===n};return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||a(r,e)&&(!n||a(i,e)))}},{key:"loadNamespaces",value:function(e,t){var r=this,n=e9();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach(function(e){0>r.options.ns.indexOf(e)&&r.options.ns.push(e)}),this.loadResources(function(e){n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var r=e9();"string"==typeof e&&(e=[e]);var n=this.options.preload||[],i=e.filter(function(e){return 0>n.indexOf(e)});return i.length?(this.options.preload=n.concat(i),this.loadResources(function(e){r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){return(e||(e=this.languages&&this.languages.length>0?this.languages[0]:this.language),e)?["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr":"rtl"}},{key:"createInstance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return new t(e,r)}},{key:"cloneInstance",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tS,i=ez({},this.options,r,{isClone:!0}),a=new t(i);return["store","services","language"].forEach(function(t){a[t]=e[t]}),a.translator=new tc(a.services,a.options),a.translator.on("*",function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];a.emit.apply(a,[e].concat(r))}),a.init(i,n),a.translator.options=a.options,a}}]),t}(e7));function tw(e){if(!e)return;let t=e.Alphabetic??e;return"object"==typeof t&&(t=""),t.replace("^",", ").replace(/\^/g," ").trim()}let t_={"*":"application/octet-stream","1.2.840.10008.1.2.1":"application/octet-stream","1.2.840.10008.1.2":"application/octet-stream","1.2.840.10008.1.2.2":"application/octet-stream","1.2.840.10008.1.2.4.70":"image/jpeg","1.2.840.10008.1.2.4.50":"image/jpeg","1.2.840.10008.1.2.4.51":"image/dicom+jpeg","1.2.840.10008.1.2.4.57":"image/jpeg","1.2.840.10008.1.2.5":"image/dicom-rle","1.2.840.10008.1.2.4.80":"image/jls","1.2.840.10008.1.2.4.81":"image/jls","1.2.840.10008.1.2.4.90":"image/jp2","1.2.840.10008.1.2.4.91":"image/jp2","1.2.840.10008.1.2.4.92":"image/jpx","1.2.840.10008.1.2.4.93":"image/jpx"};function tE(e,t){for(let r=0,n=e.length;r<n;++r){let n=e[r];if(tI(n)){if(n[1].length>0){tE(n[1],t.bind(null,n[0]));continue}n=n[0]}t(n)}}function tI(e){return Array.isArray(e)&&2===e.length&&"string"==typeof e[0]&&Array.isArray(e[1])}let tD=Symbol("Type"),tM=Symbol("Task"),tA=Symbol("List");function tx(e){return tR(tA,e)}function tP(e,t){return tU(tM,{list:tx(e)?e:null,next:tO(t)?t:null,failed:!1,awaiting:null,progress:0})}function tO(e){return tR(tM,e)}function tT(e){if(tx(e)){let t=tP(e,e.head);return e.head=t,tV(e,tN(e)),t}return null}function tk(e){tO(e)&&(e.progress=1,e.awaiting=null,Object.freeze(e),tx(e.list)&&tV(e.list,tN(e.list)))}function tN(e){let t=Object.seal({total:0,partial:0,progress:0,failures:0});if(tx(e)){let r=e.head;for(;tO(r);)t.total++,tL(r.progress)&&(t.partial+=r.progress,1===r.progress&&r.failed&&t.failures++),r=r.next}return t.total>0&&(t.progress=t.partial/t.total),Object.freeze(t)}function tC(e,t){let r=tT(e);return tO(r)?(r.awaiting=Promise.resolve(t).then(function(){tk(r)},function(){r.failed=!0,tk(r)}),r):null}function tU(e,t){return Object.seal(Object.defineProperty(t,tD,{value:e}))}function tR(e,t){return null!==t&&"object"==typeof t&&t[tD]===e}function tL(e){return"number"==typeof e&&e>=0&&e<=1}function tV(e,t){tx(e)&&Array.isArray(e.observers)&&e.observers.length>0&&e.observers.slice().forEach(function(r){if("function"==typeof r)try{r(t,e)}catch(e){}})}let tj=Object.freeze(["SEG","KO","PR","SR","RTSTRUCT","RTDOSE","RTPLAN","RTRECORD","REG"]);function tF(e){return tj.includes(e)}let tB={ComputedRadiographyImageStorage:"1.2.840.10008.5.1.4.1.1.1",DigitalXRayImageStorageForPresentation:"1.2.840.10008.5.1.4.1.1.1.1",DigitalXRayImageStorageForProcessing:"1.2.840.10008.5.1.4.1.1.1.1.1",DigitalMammographyXRayImageStorageForPresentation:"1.2.840.10008.5.1.4.1.1.1.2",DigitalMammographyXRayImageStorageForProcessing:"1.2.840.10008.5.1.4.1.1.1.2.1",DigitalIntraOralXRayImageStorageForPresentation:"1.2.840.10008.5.1.4.1.1.1.3",DigitalIntraOralXRayImageStorageForProcessing:"1.2.840.10008.5.1.4.1.1.1.3.1",CTImageStorage:"1.2.840.10008.5.1.4.1.1.2",EnhancedCTImageStorage:"1.2.840.10008.5.1.4.1.1.2.1",LegacyConvertedEnhancedCTImageStorage:"1.2.840.10008.5.1.4.1.1.2.2",UltrasoundMultiframeImageStorage:"1.2.840.10008.5.1.4.1.1.3.1",MRImageStorage:"1.2.840.10008.5.1.4.1.1.4",EnhancedMRImageStorage:"1.2.840.10008.5.1.4.1.1.4.1",MRSpectroscopyStorage:"1.2.840.10008.5.1.4.1.1.4.2",EnhancedMRColorImageStorage:"1.2.840.10008.5.1.4.1.1.4.3",LegacyConvertedEnhancedMRImageStorage:"1.2.840.10008.5.1.4.1.1.4.4",UltrasoundImageStorage:"1.2.840.10008.5.1.4.1.1.6.1",EnhancedUSVolumeStorage:"1.2.840.10008.5.1.4.1.1.6.2",SecondaryCaptureImageStorage:"1.2.840.10008.5.1.4.1.1.7",MultiframeSingleBitSecondaryCaptureImageStorage:"1.2.840.10008.5.1.4.1.1.7.1",MultiframeGrayscaleByteSecondaryCaptureImageStorage:"1.2.840.10008.5.1.4.1.1.7.2",MultiframeGrayscaleWordSecondaryCaptureImageStorage:"1.2.840.10008.5.1.4.1.1.7.3",MultiframeTrueColorSecondaryCaptureImageStorage:"1.2.840.10008.5.1.4.1.1.7.4",Sop12LeadECGWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.1.1",GeneralECGWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.1.2",AmbulatoryECGWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.1.3",HemodynamicWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.2.1",CardiacElectrophysiologyWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.3.1",BasicVoiceAudioWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.4.1",GeneralAudioWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.4.2",ArterialPulseWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.5.1",RespiratoryWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.6.1",GrayscaleSoftcopyPresentationStateStorage:"1.2.840.10008.5.1.4.1.1.11.1",ColorSoftcopyPresentationStateStorage:"1.2.840.10008.5.1.4.1.1.11.2",PseudoColorSoftcopyPresentationStateStorage:"1.2.840.10008.5.1.4.1.1.11.3",BlendingSoftcopyPresentationStateStorage:"1.2.840.10008.5.1.4.1.1.11.4",XAXRFGrayscaleSoftcopyPresentationStateStorage:"1.2.840.10008.5.1.4.1.1.11.5",XRayAngiographicImageStorage:"1.2.840.10008.5.1.4.1.1.12.1",EnhancedXAImageStorage:"1.2.840.10008.5.1.4.1.1.12.1.1",XRayRadiofluoroscopicImageStorage:"1.2.840.10008.5.1.4.1.1.12.2",EnhancedXRFImageStorage:"1.2.840.10008.5.1.4.1.1.12.2.1",XRay3DAngiographicImageStorage:"1.2.840.10008.5.1.4.1.1.13.1.1",XRay3DCraniofacialImageStorage:"1.2.840.10008.5.1.4.1.1.13.1.2",BreastTomosynthesisImageStorage:"1.2.840.10008.5.1.4.1.1.13.1.3",BreastProjectionXRayImageStorageForPresentation:"1.2.840.10008.5.1.4.1.1.13.1.4",BreastProjectionXRayImageStorageForProcessing:"1.2.840.10008.5.1.4.1.1.13.1.5",IntravascularOpticalCoherenceTomographyImageStorageForPresentation:"1.2.840.10008.5.1.4.1.1.14.1",IntravascularOpticalCoherenceTomographyImageStorageForProcessing:"1.2.840.10008.5.1.4.1.1.14.2",NuclearMedicineImageStorage:"1.2.840.10008.5.1.4.1.1.20",RawDataStorage:"1.2.840.10008.5.1.4.1.1.66",SpatialRegistrationStorage:"1.2.840.10008.5.1.4.1.1.66.1",SpatialFiducialsStorage:"1.2.840.10008.5.1.4.1.1.66.2",DeformableSpatialRegistrationStorage:"1.2.840.10008.5.1.4.1.1.66.3",SegmentationStorage:"1.2.840.10008.5.1.4.1.1.66.4",LabelmapSegmentationStorage:"1.2.840.10008.5.1.4.1.1.66.7",SurfaceSegmentationStorage:"1.2.840.10008.5.1.4.1.1.66.5",RealWorldValueMappingStorage:"1.2.840.10008.5.1.4.1.1.67",SurfaceScanMeshStorage:"1.2.840.10008.5.1.4.1.1.68.1",SurfaceScanPointCloudStorage:"1.2.840.10008.5.1.4.1.1.68.2",VLEndoscopicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.1",VideoEndoscopicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.1.1",VLMicroscopicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.2",VideoMicroscopicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.2.1",VLSlideCoordinatesMicroscopicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.3",VLPhotographicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.4",VideoPhotographicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.4.1",OphthalmicPhotography8BitImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.5.1",OphthalmicPhotography16BitImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.5.2",StereometricRelationshipStorage:"1.2.840.10008.5.1.4.1.1.77.1.5.3",OphthalmicTomographyImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.5.4",VLWholeSlideMicroscopyImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.6",LensometryMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.1",AutorefractionMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.2",KeratometryMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.3",SubjectiveRefractionMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.4",VisualAcuityMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.5",SpectaclePrescriptionReportStorage:"1.2.840.10008.5.1.4.1.1.78.6",OphthalmicAxialMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.7",IntraocularLensCalculationsStorage:"1.2.840.10008.5.1.4.1.1.78.8",MacularGridThicknessandVolumeReport:"1.2.840.10008.5.1.4.1.1.79.1",OphthalmicVisualFieldStaticPerimetryMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.80.1",OphthalmicThicknessMapStorage:"1.2.840.10008.5.1.4.1.1.81.1",CornealTopographyMapStorage:"1.2.840.10008.5.1.4.1.1.82.1",BasicTextSR:"1.2.840.10008.5.1.4.1.1.88.11",EnhancedSR:"1.2.840.10008.5.1.4.1.1.88.22",ComprehensiveSR:"1.2.840.10008.5.1.4.1.1.88.33",Comprehensive3DSR:"1.2.840.10008.5.1.4.1.1.88.34",ProcedureLog:"1.2.840.10008.5.1.4.1.1.88.40",MammographyCADSR:"1.2.840.10008.5.1.4.1.1.88.50",KeyObjectSelection:"1.2.840.10008.5.1.4.1.1.88.59",ChestCADSR:"1.2.840.10008.5.1.4.1.1.88.65",XRayRadiationDoseSR:"1.2.840.10008.5.1.4.1.1.88.67",RadiopharmaceuticalRadiationDoseSR:"1.2.840.10008.5.1.4.1.1.88.68",ColonCADSR:"1.2.840.10008.5.1.4.1.1.88.69",ImplantationPlanSRDocumentStorage:"1.2.840.10008.5.1.4.1.1.88.70",EncapsulatedPDFStorage:"1.2.840.10008.5.1.4.1.1.104.1",EncapsulatedCDAStorage:"1.2.840.10008.5.1.4.1.1.104.2",PositronEmissionTomographyImageStorage:"1.2.840.10008.5.1.4.1.1.128",EnhancedPETImageStorage:"1.2.840.10008.5.1.4.1.1.130",LegacyConvertedEnhancedPETImageStorage:"1.2.840.10008.5.1.4.1.1.128.1",BasicStructuredDisplayStorage:"1.2.840.10008.5.1.4.1.1.131",RTImageStorage:"1.2.840.10008.5.1.4.1.1.481.1",RTDoseStorage:"1.2.840.10008.5.1.4.1.1.481.2",RTStructureSetStorage:"1.2.840.10008.5.1.4.1.1.481.3",RTBeamsTreatmentRecordStorage:"1.2.840.10008.5.1.4.1.1.481.4",RTPlanStorage:"1.2.840.10008.5.1.4.1.1.481.5",RTBrachyTreatmentRecordStorage:"1.2.840.10008.5.1.4.1.1.481.6",RTTreatmentSummaryRecordStorage:"1.2.840.10008.5.1.4.1.1.481.7",RTIonPlanStorage:"1.2.840.10008.5.1.4.1.1.481.8",RTIonBeamsTreatmentRecordStorage:"1.2.840.10008.5.1.4.1.1.481.9",RTBeamsDeliveryInstructionStorage:"1.2.840.10008.5.1.4.34.7",GenericImplantTemplateStorage:"1.2.840.10008.5.1.4.43.1",ImplantAssemblyTemplateStorage:"1.2.840.10008.5.1.4.44.1",ImplantTemplateGroupStorage:"1.2.840.10008.5.1.4.45.1"},tY=[tB.ComputedRadiographyImageStorage,tB.DigitalXRayImageStorageForPresentation,tB.DigitalXRayImageStorageForProcessing,tB.DigitalMammographyXRayImageStorageForPresentation,tB.DigitalMammographyXRayImageStorageForProcessing,tB.DigitalIntraOralXRayImageStorageForPresentation,tB.DigitalIntraOralXRayImageStorageForProcessing,tB.CTImageStorage,tB.EnhancedCTImageStorage,tB.LegacyConvertedEnhancedCTImageStorage,tB.UltrasoundMultiframeImageStorage,tB.EnhancedUSVolumeStorage,tB.MRImageStorage,tB.EnhancedMRImageStorage,tB.EnhancedMRColorImageStorage,tB.LegacyConvertedEnhancedMRImageStorage,tB.UltrasoundImageStorage,tB.SecondaryCaptureImageStorage,tB.MultiframeSingleBitSecondaryCaptureImageStorage,tB.MultiframeGrayscaleByteSecondaryCaptureImageStorage,tB.MultiframeGrayscaleWordSecondaryCaptureImageStorage,tB.MultiframeTrueColorSecondaryCaptureImageStorage,tB.XRayAngiographicImageStorage,tB.EnhancedXAImageStorage,tB.XRayRadiofluoroscopicImageStorage,tB.EnhancedXRFImageStorage,tB.XRay3DAngiographicImageStorage,tB.XRay3DCraniofacialImageStorage,tB.BreastTomosynthesisImageStorage,tB.BreastProjectionXRayImageStorageForPresentation,tB.BreastProjectionXRayImageStorageForProcessing,tB.IntravascularOpticalCoherenceTomographyImageStorageForPresentation,tB.IntravascularOpticalCoherenceTomographyImageStorageForProcessing,tB.NuclearMedicineImageStorage,tB.VLEndoscopicImageStorage,tB.VideoEndoscopicImageStorage,tB.VLMicroscopicImageStorage,tB.VideoMicroscopicImageStorage,tB.VLSlideCoordinatesMicroscopicImageStorage,tB.VLPhotographicImageStorage,tB.VideoPhotographicImageStorage,tB.OphthalmicPhotography8BitImageStorage,tB.OphthalmicPhotography16BitImageStorage,tB.OphthalmicTomographyImageStorage,tB.VLWholeSlideMicroscopyImageStorage,tB.PositronEmissionTomographyImageStorage,tB.EnhancedPETImageStorage,tB.LegacyConvertedEnhancedPETImageStorage,tB.RTImageStorage];function t$(e){return Array.isArray(e)?[...e].map(e=>void 0!==e?Number(e):e):void 0!==e?Number(e):e}var tH=a(155);function tW(e,t){if(void 0!==e&&void 0!==t)return .01>Math.abs(e[0]-t[0])&&.01>Math.abs(e[1]-t[1])&&.01>Math.abs(e[2]-t[2])&&.01>Math.abs(e[3]-t[3])&&.01>Math.abs(e[4]-t[4])&&.01>Math.abs(e[5]-t[5])}function tG(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}let tq="missingframes",tz="irregularspacing";function tX(e){let t=e.indexOf(":");return e.substring(t+1)}function tK(e,t){let r=URL.createObjectURL(e);tZ(r,t),URL.revokeObjectURL(r)}function tZ(e,t){let r=document.createElement("a");r.setAttribute("href",e);let n=t?.filename||"file.dcm";r.setAttribute("download",n),document.body.appendChild(r),r.click(),document.body.removeChild(r)}let tJ={get:(e,t)=>"__isProxy"==t||(t in e?e[t]:e[0][t]),set:(e,t,r)=>("number"==typeof t||t in e?e[t]=r:e[0][t]=r,!0)};function tQ(e){let t=tH.vec3.fromValues(e[0],e[1],e[2]),r=tH.vec3.fromValues(e[3],e[4],e[5]);return tH.vec3.cross(tH.vec3.create(),t,r)}function t0(e){if(!e?.length)return!1;let t=t$(e[0].ImageOrientationPatient);for(let r=1;r<e.length;r++)if(!tW(t$(e[r].ImageOrientationPatient),t))return!1;return!0}let t1=(e,t)=>e==t?0:!e&&t?-1:!t&&e?1:e<t?-1:1,t2=new Map,t8=(e,t)=>{let{compareSameSeries:r="default"}=e,{compareSameSeries:n="default"}=t,i=t2.get(r),a=t2.get(n);if(i&&a){let r=i===a?i.compare(e,t):t1(i.priority,a.priority);if(!r)return r}return t7(e.instance,t.instance)},t4=(e,t)=>t1(e.SeriesInstanceUID,t.SeriesInstanceUID)||t8(e,t),t3=(e,t)=>t1(`${e.seriesDate??e.SeriesDate} ${e.seriesTime??e.SeriesTime}`,`${t.seriesDate??t.SeriesDate} ${t.seriesTime??t.SeriesTime}`)||t4(e,t);function t5(e,t){let r=tF(e.Modality??e.modality),n=tF(t.Modality??t.modality);return r?n?t3(t,e):1:n?-1:t1(e.SeriesNumber??e.seriesNumber,t.SeriesNumber??t.seriesNumber)||t3(e,t)}let t6={default:t5,seriesInfoSortingCriteria:t5,compareSameSeries:t8,compareSeriesDateTime:t3,compareSeriesUID:t4},t7=(e,t)=>e&&t?(parseInt(e.InstanceNumber)||0)!==(parseInt(t.InstanceNumber)||0)?(parseInt(e.InstanceNumber)||0)-(parseInt(t.InstanceNumber)||0):t1(e.SOPInstanceUID,t.SOPInstanceUID)||t1(e.frameNumber,t.frameNumber):!e&&-1||1,t9={default:t7,sortByInstanceNumber:t7},re=(e,t=t6.default,r=null)=>"function"==typeof r?r(e):e.sort(t),rt=(e,t=t9.default)=>e.sort(t),rr=e=>{if(!e)return null;for(let t=0;t<e.length;t++)if(-1!==e[t].indexOf(",")){let r=e[t].split(/,/);e.splice(t,1,...r)}return e},rn=(e,t=new URLSearchParams(window.location.search))=>{let r=[...t.keys()].find(t=>t.toLowerCase()===e);if(r)return rr(t.getAll(r))};var ri=a(326);let ra=(0,ri.createContext)(null),{Provider:ro}=ra,rs=()=>(0,ri.useContext)(ra);function rl({children:e,servicesManager:t,commandsManager:r,extensionManager:n,hotkeysManager:i}){return ri.createElement(ro,{value:{servicesManager:t,commandsManager:r,extensionManager:n,hotkeysManager:i}},e)}function ru(e){if(e)return t=>e.includes(t.referenceSeriesUID)}function rc(e){return t=>t.referenceStudyUID==e}function rd(e){return e?.referencedImageId}function rf(e){return t=>t.metadata?.toolName===e}function rh(e){return!0}function rp(e){return!1}function rg(...e){return function(t){for(let r of e)if(!r||("string"==typeof r&&(r=this[r]),"function"==typeof r&&r.call(this,t)))return!0;return!1}}let{POINT:rm}=H.VALUE_TYPES;function ry(e){return e.type===rm&&e.referencedImageId}function rv(e,t){return r=>!e(r)&&t(r)}let rS=e=>"string"==typeof e||e instanceof String;function rb(...e){let t=e.filter(e=>!!e);if(t.length)return 1===t.length&&"function"==typeof t[0]?t[0]:function(e){for(let r of t)if(rS(r)){if(!this[r](e))return!1}else if(!r.call(this,e))return!1;return!0}}let rw=e=>Array.isArray(e)?e:null!=e?[e]:[],r_={guid:y,uuidv4:eC,ObjectPath:ek,absoluteUrl:eN,sortBy:eD,sortBySeriesDate:re,sortStudy:function(e,t=!0,r=t6.default,n=t9.default){if(!e||!e.series)throw Error("Insufficient study data was provided to sortStudy");return re(e.series,r),t&&e.series.forEach(e=>{rt(e.instances,n)}),e},sortStudySeries:re,sortStudyInstances:rt,sortDisplaySetsCopy:function(e,t){let r=t?.seriesSortingCriteria??t6.default,n=t?.studyInstanceUIDFirst;if(!n)return[...e].sort(r);let i=[],a=[];for(let t of e)t.StudyInstanceUID===n?i.push(t):a.push(t);return[...[...i].sort(r),...a]},sortingCriteria:{seriesSortCriteria:t6,instancesSortCriteria:t9},seriesSortCriteria:t6,instancesSortCriteria:t9,writeScript:function(e,t){let r=document.createElement("script");r.src=eN(e),r.onload=()=>{"function"==typeof t&&t(r)},document.body.appendChild(r)},formatDate:(e,t=tb.t("Common:localDateFormat","DD-MMM-YYYY"))=>{if(!e)return"";let r=tb.language||"en",n=eW()(e,["YYYYMMDD","YYYY.MM.DD"],!0);return n.isValid()?n.locale(r).format(t):eW()(e).locale(r).format(t)},formatTime:function(e,t="HH:mm:ss"){return eW()(e,"HH:mm:ss").format(t)},formatPN:tw,b64toBlob:(e,t="",r=512)=>{let n=atob(e),i=[];for(let e=0;e<n.length;e+=r){let t=n.slice(e,e+r),a=Array(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);let o=new Uint8Array(a);i.push(o)}return new Blob(i,{type:t})},urlUtil:{parse:eR,queryString:{getQueryFilters:(e={})=>{let{search:t}=e;if(!t)return;let r=eR(t),n={};return Object.entries(r).forEach(([e,t])=>{n[e[0].toLowerCase()+e.slice(1)]=t}),n}},paramString:{isValidPath:e=>0>e.indexOf("/:"),parseParam:e=>{let t=((e="")=>{try{return window.atob(e)}catch(t){return e}})(e);if(t&&"string"==typeof t)return t.split(";")},replaceParam:(e="",t,r)=>{let n=`:${t}`;return r?e.replace(n,r):e}}},imageIdToURI:tX,makeDeferred:eL,makeCancelable:function(e){let t=!1,r=Promise.resolve(e).then(function(e){if(t)throw Object.freeze({isCanceled:t});return e},function(e){if(t)throw Object.freeze({isCanceled:t,error:e});throw e});return Object.assign(Object.create(r),{then:r.then.bind(r),cancel(){t=!0}})},structuredCloneWithFunctions:function e(t,r=new WeakMap){if(null===t||"object"!=typeof t||"function"==typeof t)return t;if(r.has(t))return r.get(t);if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)){let n=[];for(let i of(r.set(t,n),t))n.push(e(i,r));return n}let n={};for(let i of(r.set(t,n),Object.keys(t)))n[i]=e(t[i],r);return n},hotkeys:eF,Queue:class{constructor(e){this.limit=e,this.size=0,this.awaiting=null}bind(e){return eB(this,e)}bindSafe(e,t){let r=eB(this,e);return async function(...e){try{return await r(...e)}catch(e){t(e)}}}},isDicomUid:function(e){return"string"==typeof e&&/^\d+(?:\.\d+)*$/.test(e.trim())},isEqualWithin:function(e,t,r=1e-5){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(Math.abs(e[n]-t[n])>r)return!1;return!0},sopClassDictionary:tB,addAccessors:(e,t)=>{if(e.__isProxy)return e;let r=t;if(void 0===r){if("object"!=typeof e||Array.isArray(e)&&1!==e.length)return e;r=Array.isArray(e)?e[0]:e}return new Proxy([r],tJ)},resolveObjectPath:function e(t,r,n){if(null!==t&&"object"==typeof t&&"string"==typeof r){let i,a=r.indexOf(".");return a>=0?e(t[r.slice(0,a)],r.slice(a+1,r.length),n):void 0===(i=t[r])&&void 0!==n?n:i}},hierarchicalListUtils:{addToList:function(e,...t){return Array.isArray(e)?(t.length>0&&function e(t,r){var n,i;let a,o=r.shift(),s=(-2===(a=function(e,t){if("string"==typeof t){for(let r=0,n=e.length;r<n;++r){let n=e[r];if(n===t||tI(n)&&n[0]===t)return r}return -2}return -1}(n=t,i=o))&&(a=n.push(i)-1),a);if(s>=0){if(r.length>0){let n=t[s];return tI(n)||(n=[o+"",[]],t[s]=n),e(n[1],r)}return!0}return!1}(e,t),e):null},getItem:function e(t,r){if(Array.isArray(t)){let n=null,i="number"==typeof r?r:-1;if("string"==typeof r){let e=r.indexOf("/");e>0?(i=parseInt(r.slice(0,e),10),e+1<r.length&&(n=r.slice(e+1,r.length))):i=parseInt(r,10)}if(i>=0&&i<t.length){let r=t[i];return tI(r)?null!==n?e(r[1],n):r[0]:r}}},forEach:function(e,t){return Array.isArray(e)?("function"==typeof t&&tE(e,t),e):null},print:function(e){let t="";if(Array.isArray(e)){let r=[];tE(e,function(...e){let n=r.length;for(let i=0,a=e.length;i<a;++i)i<n&&e[i]===r[i]||(t+=" ".repeat(i)+e[i]+"\n");r=e})}return t}},progressTrackingUtils:{createList:function(){return tU(tA,{head:null,named:Object.create(null),observers:[]})},isList:tx,createTask:tP,isTask:tO,increaseList:tT,update:function(e,t){tO(e)&&tL(t)&&t<1&&e.progress!==t&&(e.progress=t,tx(e.list)&&tV(e.list,tN(e.list)))},finish:tk,getOverallProgress:tN,waitOn:tC,addDeferred:function(e){let t=eL(),r=tC(e,t.promise);return Object.freeze({deferred:t,task:r})},setTaskName:function(e,t,r){return!!function(e,t){if(tx(e)&&tO(t)){let r=e.head;for(;tO(r);){if(r===t)return!0;r=r.next}}return!1}(e,t)&&null!==e.named&&"object"==typeof e.named&&"string"==typeof r&&(e.named[r]=t,!0)},getTaskByName:function(e,t){if(tx(e)&&null!==e.named&&"object"==typeof e.named&&"string"==typeof t){let r=e.named[t];if(tO(r))return r}return null},addObserver:function(e,t){return!!(tx(e)&&Array.isArray(e.observers))&&"function"==typeof t&&(e.observers.push(t),!0)},removeObserver:function(e,t){if(tx(e)&&Array.isArray(e.observers)&&e.observers.length>0){let r=e.observers.indexOf(t);if(r>=0)return e.observers.splice(r,1),!0}return!1}},isLowPriorityModality:tF,isImage:e=>!!e&&-1!==tY.indexOf(e),isDisplaySetReconstructable:function(e,t){let r=e?.filter(Boolean)||[];if(!r.length)return{value:!1};let n=r[0],i=(n.NumberOfFrames||0)>1;if(t){let e=t$(n.Rows),r=t$(n.Columns);if(e>t.max3DTextureSize||r>t.max3DTextureSize)return{value:!1}}if(!i&&1===r.length||!i&&!r.every(e=>e.ImagePositionPatient))return{value:!1};let a=function(e){if(e.length<=1)return e;let{ImagePositionPatient:t,ImageOrientationPatient:r}=e[Math.floor(e.length/2)];if(!t||!r)return e;let n=tH.vec3.fromValues(r[0],r[1],r[2]),i=tH.vec3.fromValues(r[3],r[4],r[5]),a=tH.vec3.cross(tH.vec3.create(),n,i);tH.vec3.set(tH.vec3.create(),t[0],t[1],t[2]);let o=e.map(e=>{let r=e.ImagePositionPatient,n=tH.vec3.create();return tH.vec3.sub(n,t,r),{distance:tH.vec3.dot(n,a),instance:e}});return o.sort((e,t)=>t.distance-e.distance),o.map(e=>e.instance)}(r);return i?function(e){let t,r,n,i,a,o;return(t=e.PerFrameFunctionalGroupsSequence?.[0],r=e.SharedFunctionalGroupsSequence,t?.PixelMeasuresSequence||r?.PixelMeasuresSequence||e.PixelSpacing&&(e.SliceThickness||e.SpacingBetweenFrames))?(n=e.SharedFunctionalGroupsSequence,i=e.PerFrameFunctionalGroupsSequence?.[0],n?.PlaneOrientationSequence||i?.PlaneOrientationSequence||e.ImageOrientationPatient||e.DetectorInformationSequence?.[0]?.ImageOrientationPatient)?(a=e.PerFrameFunctionalGroupsSequence?.[0],a?.PlanePositionSequence||a?.CTPositionSequence||e.ImagePositionPatient||e.DetectorInformationSequence?.[0]?.ImagePositionPatient)?e.Modality.includes("NM")&&"RECON TOMO"!==(o=e.ImageType?.[2])&&"RECON GATED TOMO"!==o?{value:!1}:{value:!0}:(console.log("No image position information, not reconstructable"),{value:!1}):(console.log("No image orientation information, not reconstructable"),{value:!1}):{value:!1}}(a[0]):function(e){let t,r=e[0],n=t$(r.Rows),i=t$(r.Columns),a=t$(r.SamplesPerPixel),o=t$(r.ImageOrientationPatient),s=t$(r.ImagePositionPatient);for(let t=1;t<e.length;t++){let{Rows:r,Columns:s,SamplesPerPixel:l,ImageOrientationPatient:u}=e[t],c=t$(u);if(r!==n||s!==i||l!==a||!tW(c,o))return{value:!1}}if(e.length>2){let r=t$(e[e.length-1].ImagePositionPatient);if(!s||!r)return{value:!1};t=tG(s,r)/(e.length-1);let n=s;for(let r=1;r<e.length;r++){let i=t$(e[r].ImagePositionPatient),a=function(e,t){if(Math.abs(e-t)<.2*t)return;let r=Math.round(e/t);return Math.abs(e-r*t)/r<.2*t?{issue:tq,missingFrames:r-1}:{issue:tz}}(tG(i,n),t);if(a){let e=a.issue;if(e===tq)a.missingFrames;else if(e===tz)return{value:!1}}n=i}}return{value:!0,averageSpacingBetweenFrames:t}}(a)},debounce:v,roundNumber:function e(t,r=2){if(Array.isArray(t))return t.map(t=>e(t,r)).join(", ");if(null==t||""===t)return"NaN";let n=Math.abs(t=Number(t));if(n<1e-4)return`${t}`;let i=n>=100?r-2:n>=10?r-1:n>=1?r:n>=.1?r+1:n>=.01?r+2:n>=.001?r+3:r+4;return t.toFixed(i)},toNumber:t$,downloadCSVReport:function(e){var t,r;let n;if(0===e.length)return;let i=["Patient ID","Patient Name","StudyInstanceUID","SeriesInstanceUID","SOPInstanceUID","Label"],a={};e.forEach(e=>{var t;let r,{referenceStudyUID:n,referenceSeriesUID:i,getReport:o,uid:s}=e;if(!o)return void console.warn("Measurement does not have a getReport function");let l=(t=e,{"Patient ID":(r=L.getSeries(n,i).instances[0]).PatientID,"Patient Name":tw(r.PatientName)||"",StudyInstanceUID:t.referenceStudyUID,SeriesInstanceUID:t.referenceSeriesUID,SOPInstanceUID:t.SOPInstanceUID,Label:t.label||""}),u=o(e);a[s]={report:u,commonRowItems:l}}),Object.keys(a).forEach(e=>{let{report:t}=a[e];t.columns.forEach(e=>{i.includes(e)||i.push(e)})}),tZ(encodeURI("data:text/csv;charset=utf-8,"+(t=a,n=[r=i],Object.keys(t).forEach(e=>{let{report:i,commonRowItems:a}=t[e],o=[];Object.keys(a).forEach(e=>{let t=r.indexOf(e),n=a[e];o[t]=n}),i.columns.forEach((e,t)=>{let n=r.indexOf(e),a=i.values[t];o[n]=a}),n.push(o)}),n).map(e=>e.join(",")).join("\n")),{filename:"MeasurementReport.csv"})},splitComma:rr,getSplitParam:rn,generateAcceptHeader:(e=[],t="*",r=!1)=>{if(e.length>0)return e;let n=["multipart/related"],i=!1;if(t&&t_[t]){let e=t_[t];n.push("type="+e),n.push("transfer-syntax="+t),i=!0}else n.push("type=application/octet-stream");return i||n.push("transfer-syntax=*"),r||(n=n.map(e=>e.startsWith("type=")?'type="'+e.substring(5,e.length)+'"':e.startsWith("transfer-syntax=")?'transfer-syntax="'+e.substring(16,e.length)+'"':e)),[n.join("; ")]},createStudyBrowserTabs:function(e,t,r,n=31536e6){let{servicesManager:i}=rs(),{displaySetService:a,customizationService:o}=i.services,s=[],l=[];t.forEach(t=>{let n=r.filter(e=>e.StudyInstanceUID===t.studyInstanceUid),i=o.getCustomization("sortingCriteria"),u=Object.assign({},t,{displaySets:n.sort((e,t)=>i(a.getDisplaySetByUID(e.displaySetInstanceUID),a.getDisplaySetByUID(t.displaySetInstanceUID)))});e.includes(t.studyInstanceUid)&&s.push(u),l.push(u)});let u=s.filter(e=>e.date).map(e=>new Date(e.date).getTime()),c=u.length>0?l.filter(e=>{let t=Math.min(...u);return!!e.date&&t-new Date(e.date).getTime()<n}):[],d=(e,t)=>{let r=Date.parse(e);return Date.parse(t)-r};return[{name:"primary",label:tb.t("StudyBrowser:Primary"),studies:s.sort((e,t)=>d(e.date,t.date))},{name:"recent",label:tb.t("StudyBrowser:Recent"),studies:c.sort((e,t)=>d(e.date,t.date))},{name:"all",label:tb.t("StudyBrowser:All"),studies:l.sort((e,t)=>d(e.date,t.date))}]},MeasurementFilters:f,getClosestOrientationFromIOP:function(e,t){let r=e.getDisplaySetByUID(t).instances[0].ImageOrientationPatient;if(r?.length!==6)return;let n=tH.vec3.fromValues(r[0],r[1],r[2]),i=tH.vec3.fromValues(r[3],r[4],r[5]),a=tH.vec3.cross(tH.vec3.create(),n,i),o={axial:tH.vec3.fromValues(0,0,1),coronal:tH.vec3.fromValues(0,1,0),sagittal:tH.vec3.fromValues(1,0,0)},s=0,l="";for(let[e,t]of Object.entries(o)){let r=Math.abs(tH.vec3.dot(a,t));r>s&&(s=r,l=e)}return l},calculateScanAxisNormal:tQ,areAllImageOrientationsEqual:t0,thumbnailNoImageModalities:["SR","SEG","RTSTRUCT","RTPLAN","RTDOSE","DOC","PMAP","RWV"],downloadBlob:tK,downloadUrl:tZ,downloadCsv:function(e,t){tK(new Blob([e],{type:"text/csv;charset=utf-8;"}),t)},downloadDicom:function(e,t){tK(new Blob([e],{type:"application/dicom"}),t)}},rE=e=>{let t=new URLSearchParams(window.location.search),r=rn("initialseriesinstanceuid",t),n=rn("initialsopinstanceuid",t);if(!r&&!n)return!1;let i=r?.some(t=>e.SeriesInstanceUID===t),a=n?.some(t=>e.instances?.some(e=>t===e.SOPInstanceUID));return i||a};function rI(e){let t=e?.[0];if(!t)return;let r=rn("initialsopinstanceuid");if(!r)return;let n=t.instances.findIndex(e=>r.includes(e.SOPInstanceUID));return -1===n?void 0:{index:n}}let rD=(e,t)=>{let r=t?.displaySets?.filter(e=>e.numImageFrames>0)?.length;return console.log("number of display sets with images",r),r},rM=(e,t)=>t?.displaySets?.map(e=>e.SeriesDescription),rA={toolGroupId:"default",viewportType:"stack"};class rx extends I{constructor(e,t){super(rx.EVENTS),this.studies=void 0,this.protocols=void 0,this.activeProtocolIds=void 0,this.protocol=void 0,this._originalProtocol=void 0,this.stageIndex=0,this._commandsManager=void 0,this._servicesManager=void 0,this.protocolEngine=void 0,this.customViewportSettings=[],this.displaySets=[],this.activeStudy=void 0,this.debugLogging=void 0,this.customAttributeRetrievalCallbacks={NumberOfStudyRelatedSeries:{name:"The number of series in the study",callback:e=>e.NumberOfStudyRelatedSeries??e.series?.length},NumberOfSeriesRelatedInstances:{name:"The number of instances in the display set",callback:e=>e.numImageFrames},ModalitiesInStudy:{name:"Gets the array of the modalities for the series",callback:e=>{if(e.ModalitiesInStudy?.length>0)return e.ModalitiesInStudy;if(Array.isArray(e.series)){var t,r;return t=e.series,r="Modality",t.reduce((e,t)=>{let n=t[r];return!n&&t.instances&&t.instances[0]&&(n=t.instances[0][r]),n&&-1===e.indexOf(n)&&e.push(n),e},[])}return[]}},isReconstructable:{name:"Checks if the display set is reconstructable",callback:e=>e.isReconstructable??!1},isDisplaySetFromUrl:{name:"Checks if the display set is as specified in the URL",callback:rE},sopInstanceLocation:{name:"Gets the position of the specified sop instance",callback:rI},seriesDescriptions:{name:"seriesDescriptions",description:"List of Series Descriptions",callback:rM},numberOfDisplaySetsWithImages:{name:"numberOfDisplaySetsWithImages",description:"Number of displays sets with images",callback:rD}},this.listeners={},this.registeredImageLoadStrategies={},this.activeImageLoadStrategyName=null,this.customImageLoadPerformed=!1,this.displaySetMatchDetails=new Map,this.viewportMatchDetails=new Map,this._commandsManager=e,this._servicesManager=t,this.protocols=new Map,this.protocolEngine=void 0,this.protocol=void 0,this.stageIndex=void 0,this.studies=[]}destroy(){this.reset(),this.protocols=new Map}reset(){this.studies=[],this.viewportMatchDetails=new Map,this.displaySetMatchDetails=new Map,this.protocol=void 0,this.stageIndex=void 0,this.protocolEngine=void 0}onModeEnter(){this.reset()}getActiveProtocol(){return{protocol:this.protocol,_originalProtocol:this._originalProtocol,stage:this.protocol?.stages?.[this.stageIndex],stageIndex:this.stageIndex,activeStudy:this.activeStudy,viewportMatchDetails:this.viewportMatchDetails,displaySetMatchDetails:this.displaySetMatchDetails,activeImageLoadStrategyName:this.activeImageLoadStrategyName}}getState(){if(this.protocol)return{protocolId:this.protocol.id,stageIndex:this.stageIndex,stageId:this.protocol.stages[this.stageIndex].id,activeStudyUID:this.activeStudy?.StudyInstanceUID}}filterSeriesRequiredForRun(e,t){Array.isArray(e)&&(e=e[0]);let r=this.getProtocolById(e)?.hpInitiationCriteria?.minSeriesLoaded||t.length;return{requiredSeries:t.slice(0,r),remaining:t.slice(r)}}getDefaultProtocol(){return this.getProtocolById("default")}getMatchDetails(){return{viewportMatchDetails:this.viewportMatchDetails,displaySetMatchDetails:this.displaySetMatchDetails}}getProtocols(){let e=[];for(let t of this.activeProtocolIds||this.protocols.keys()){let r=this.getProtocolById(t);r&&e.push(r)}return e}getProtocolById(e,t=!0){if(!e)return;if(e===this.protocol?.id)return this.protocol;let r=this.protocols.get(e);if(!r&&t){let t=e.toLowerCase();for(let[e]of this.protocols)if(e.toLowerCase()===t){r=this.getProtocolById(e);break}}if(!r)throw Error(`No protocol ${e} found`);if(!(r instanceof Function))return this._validateProtocol(r);try{let{protocol:e}=this._getProtocolFromGenerator(r);return e}catch(t){console.warn(`Error while executing protocol generator for protocol ${e}: ${t}`)}}addProtocol(e,t){this.protocols.has(e)&&console.warn(`A protocol with id ${e} already exists. It will be overwritten.`),t instanceof Function||(t=this._validateProtocol(t)),this.protocols.set(e,t)}addActiveProtocolId(e){e&&(this.activeProtocolIds||(this.activeProtocolIds=[]),this.activeProtocolIds.push(e))}setActiveProtocolIds(e){if(!e||!e.length){this.activeProtocolIds=null,console.log("No active protocols, setting all to active");return}"string"==typeof e?this.setActiveProtocolIds([e]):this.activeProtocolIds=[...e]}setActiveStudyUID(e){if(e&&e!==this.activeStudy?.StudyInstanceUID)return this.activeStudy=this.studies.find(t=>t.StudyInstanceUID===e),this.activeStudy}hasStudyUID(e){return this.studies.some(t=>t.StudyInstanceUID===e)}addStudy(e){this.hasStudyUID(e.StudyInstanceUID)||this.studies.push(e)}run({studies:e,displaySets:t,activeStudy:r},n,i={}){if(this.studies=[...e||this.studies],this.displaySets=t,this.setActiveStudyUID(r?.StudyInstanceUID||(r||this.studies[0])?.StudyInstanceUID),this.protocolEngine=new eT(this.getProtocols(),this.customAttributeRetrievalCallbacks),this.protocol=null,n&&"string"==typeof n){let e=this.getProtocolById(n);this._setProtocol(e,i)}else{let e=this.protocolEngine.run({studies:this.studies,activeStudy:r,displaySets:t});this._setProtocol(e)}this.protocol?.callbacks?.onProtocolEnter&&this._commandsManager.run(this.protocol?.callbacks?.onProtocolEnter)}hasCustomImageLoadStrategy(){return null!==this.activeImageLoadStrategyName&&this.registeredImageLoadStrategies[this.activeImageLoadStrategyName]instanceof Function}getCustomImageLoadPerformed(){return this.customImageLoadPerformed}getShouldPerformCustomImageLoad(){return this.hasCustomImageLoadStrategy()&&!this.getCustomImageLoadPerformed()}registerImageLoadStrategy(e,t){t instanceof Function&&e&&(this.registeredImageLoadStrategies[e]=t)}addCustomAttribute(e,t,r,n={}){this.customAttributeRetrievalCallbacks[e]={...n,id:e,name:t,callback:r}}runImageLoadStrategy(e){let t=(0,this.registeredImageLoadStrategies[this.activeImageLoadStrategyName])({data:e,displaySetsMatchDetails:this.displaySetMatchDetails,viewportMatchDetails:this.viewportMatchDetails});return t?(this.customImageLoadPerformed=!0,this._broadcastEvent(this.EVENTS.CUSTOM_IMAGE_LOAD_PERFORMED,t),!0):(console.warn("Not able to load data with custom strategy"),!1)}_validateProtocol(e){e.name=e.name??e.id;let{stages:t}=e;if(!t)return void console.warn("Protocol has not stages:",e.id,e);for(let t of Object.keys(e.displaySetSelectors)){let r=e.displaySetSelectors[t];r.id=t;let{seriesMatchingRules:n}=r;if(!n)return void console.warn("Selector has no series matching rules",e.id,t)}return t.forEach(t=>{if(t.viewports)t.viewports=t.viewports.map((r,n)=>{let i=t.defaultViewport||e.defaultViewport||{},a=r.viewportOptions?.viewportId;return{...r,viewportOptions:{...i.viewportOptions,...r.viewportOptions,viewportId:a||(0===n?"default":eC())},displaySets:r.displaySets||[]}}),t.viewports.forEach(e=>{e.displaySets.forEach(e=>{e.options=e.options||{}})});else{t.name=t.name||t.id,t.viewports=[];let{rows:r,columns:n}=t.viewportStructure.properties;for(let i=0;i<r*n;i++){let r=t.defaultViewport||e.defaultViewport||{};t.viewports.push({viewportOptions:{...r.viewportOptions,viewportId:0===i?"default":eC()},displaySets:[]})}}}),e}_getProtocolFromGenerator(e){let{protocol:t}=e({servicesManager:this._servicesManager,commandsManager:this._commandsManager});return{protocol:this._validateProtocol(t)}}getViewportsRequireUpdate(e,t,r=!0){let n,i=[{viewportId:e,displaySetInstanceUIDs:[t]}];if(!r)return i;let{displaySetService:a}=this._servicesManager.services,o=a.getDisplaySetByUID(t);if(o?.unsupported)throw Error("Unsupported displaySet");if(o?.isOverlayDisplaySet)return i;let s=this.protocol,l=s.stages[this.stageIndex].viewports;if(!l)return i;let u=l.find(t=>t.viewportOptions.viewportId===e);if(!u)return i;if(u.displaySets.length>1)throw Error("Cannot update viewport with multiple displaySets yet");if(0===u.displaySets.length||u.viewportOptions.allowUnmatchedView)return i;let{id:c,matchedDisplaySetsIndex:d=0}=u.displaySets[0],f=s.displaySetSelectors[c];if(!f||f.allowUnmatchedView||(this._validateViewportSpecificMatch({displaySetInstanceUIDs:[t],viewportOptions:{},displaySetOptions:[]},u,s.displaySetSelectors),!this.displaySetMatchDetails.get(c)))return i;let h=this._originalProtocol;h instanceof Function||(n=h.stages[this.stageIndex]);let p=[];return l.forEach((e,r)=>{if(e.displaySets.some(e=>e.id===c&&(e.matchedDisplaySetsIndex||0)===d)){if(n){let i=n.viewports[r],a=i.viewportOptions,o=i.displaySets;e.viewportOptions=this.getComputedOptions(a,[t]),e.displaySets=this.getComputedOptions(o,[t])}let i=[],a=[];this._updateDisplaySetInstanceUIDs(e,c,t,this.displaySetMatchDetails,i,a),p.push({viewportId:e.viewportOptions.viewportId,displaySetInstanceUIDs:i,viewportOptions:e.viewportOptions,displaySetOptions:a})}}),p}runMatchingRules(e,t,r){return this.protocolEngine.findMatch(e,t,r)}_updateDisplaySetInstanceUIDs(e,t,r,n,i,a){e.displaySets.forEach(e=>{let{id:o}=e,s=n.get(o),{displaySetInstanceUID:l}=s,u=e.id===t?r:l;s.displaySetInstanceUID=u,i.push(u),a.push(e)})}getComputedOptions(e,t){if(Array.isArray(e))return e.map(e=>this.getComputedOptions(e,t));if(null===e||"object"!=typeof e)return e;if(e.custom){let r=this.displaySets.filter(e=>t.includes(e.displaySetInstanceUID)),n=e.custom;if(!(n in this.customAttributeRetrievalCallbacks))throw Error(`Custom key "${n}" not found in customAttributeRetrievalCallbacks.`);let i=this.customAttributeRetrievalCallbacks[n].callback.call(e,r);return void 0===i&&(i=e.defaultValue),this.getComputedOptions(i,t)}let r={};for(let n in e)void 0!==e[n]&&(r[n]=this.getComputedOptions(e[n],t));return r}setProtocol(e,t={},r=null){let n=this.protocols.get(e);if(!n)return void console.warn(`ProtocolEngine::setProtocol - Protocol with id ${e} not found - you should register it first via addProtocol`);try{let e=this._validateProtocol(n);t&&this._validateOptions(t),this._setProtocol(e,t)}catch(e){throw console.log(e),r&&r(e),Error(e)}this._commandsManager.run(this.protocol?.callbacks?.onProtocolEnter)}matchActivation(e,t={},r){let{displaySetSelectors:n}=this.protocol,{displaySetSelectorsMatched:i=[]}=t;for(let e of i){let t=n[e];if(!t)return console.warn("No display set selector for",e),!1;let{bestMatch:r}=this._matchImages(t);if(!r)return!1}return e>=(t.minViewportsMatched??r)}_updateStageStatus(e=null){let t=this.protocol.stages;for(let r=0;r<t.length;r++){let n=t[r],{matchedViewports:i}=this._matchAllViewports(n,e,new Map),a=n.stageActivation||{};this.matchActivation(i,a.passive,0)?this.matchActivation(i,a.enabled,1)?n.status="enabled":n.status="passive":n.status="disabled"}this._broadcastEvent(this.EVENTS.STAGE_ACTIVATION,{protocol:this.protocol,stages:this.protocol.stages})}_findStageIndex(e=null){let t,r=e?.stageId,n=this.protocol.stages;if(r){for(let e=0;e<n.length;e++){let t=n[e];if(t.id===r&&"disabled"!==t.status)return e}return}let i=e?.stageIndex;if(void 0!==i)return n[i]?.status!=="disabled"?i:void 0;for(let e=0;e<n.length;e++){if("enabled"===n[e].status)return e;void 0===t&&"disabled"!==n[e].status&&(t=e)}return t}_setProtocol(e,t=null){let r=this.getActiveProtocol();try{if(!this.protocol||this.protocol.id!==e.id){this.stageIndex=t?.stageIndex||0,this.customImageLoadPerformed=!1,this._originalProtocol=this._copyProtocol(e),this.protocol?.callbacks?.onProtocolExit&&this._commandsManager.run(this.protocol.callbacks.onProtocolExit),this.protocol=e;let{imageLoadStrategy:r}=e;r?this.registeredImageLoadStrategies[r]instanceof Function&&(this.activeImageLoadStrategyName=r):this.activeImageLoadStrategyName=null,this._updateStageStatus(t)}let r=this._findStageIndex(t);if(void 0===r)throw Error(`Can't find applicable stage ${e.id} ${t?.stageIndex}`);this.stageIndex=r,this.protocol?.callbacks?.onStageChange&&this._commandsManager.run(this.protocol.callbacks.onStageChange),this._updateViewports(t)}catch(e){throw console.log(e),Object.assign(this,r),Error(e)}t?.restoreProtocol!==!0?this._broadcastEvent(rx.EVENTS.PROTOCOL_CHANGED,{viewportMatchDetails:this.viewportMatchDetails,displaySetMatchDetails:this.displaySetMatchDetails,protocol:this.protocol,stageIdx:this.stageIndex,stage:this.protocol.stages[this.stageIndex],activeStudyUID:this.activeStudy?.StudyInstanceUID}):this._broadcastEvent(rx.EVENTS.PROTOCOL_RESTORED,{protocol:this.protocol,stageIdx:this.stageIndex,stage:this.protocol.stages[this.stageIndex],activeStudyUID:this.activeStudy?.StudyInstanceUID})}getStageIndex(e,t){let r=this.getProtocolById(e),{stageId:n,stageIndex:i}=t;return void 0!==n?r.stages.findIndex(e=>e.id===n):void 0!==i?i:0}_getNumProtocolStages(){if(this.protocol&&this.protocol.stages&&this.protocol.stages.length)return this.protocol.stages.length}_getCurrentStageModel(){return this.protocol.stages[this.stageIndex]}getMissingViewport(e,t,r){this.protocol.id!==e&&(console.warn("setting protocol"),this.protocol=this.getProtocolById(e),this.stageIndex=0);let n=this.protocol,i=(n.stages[t]??n.stages[this.stageIndex]).defaultViewport||n.defaultViewport;if(!i)return;let a={...i};return this._matchViewport(a,r)}getDisplaySetSortFunction(){return(e,t)=>{let r=this._getSeriesSortInfoForDisplaySetSort(e),n=this._getSeriesSortInfoForDisplaySetSort(t);return eD(this._getSeriesFieldForDisplaySetSort())(r,n)}}_updateViewports(e=null){if(!this._getNumProtocolStages())throw Error("No protocol or stages found");this.viewportMatchDetails=new Map,this.displaySetMatchDetails=new Map;let t=this._getCurrentStageModel();if(!t||!t.viewportStructure||!t.viewports||!t.viewports.length)return void console.log("Stage cannot be applied",t);let{layoutType:r}=t.viewportStructure,n=t.viewportStructure.properties;if(!n)return void console.log("No viewportStructure.properties in",t);let{columns:i,rows:a,layoutOptions:o=[]}=n;this.protocol?.callbacks?.onViewportDataInitialized&&this._commandsManager.runCommand("attachProtocolViewportDataListener",{protocol:this.protocol,stageIndex:this.stageIndex}),this._broadcastEvent(this.EVENTS.NEW_LAYOUT,{layoutType:r,numRows:a,numCols:i,layoutOptions:o}),this._matchAllViewports(this.protocol.stages[this.stageIndex],e)}_matchAllViewports(e,t,r=this.viewportMatchDetails,n=this.displaySetMatchDetails){this.activeStudy||=this.studies[0];let i=0;return e.viewports.forEach(e=>{let a=e.viewportOptions.viewportId,o=this._matchViewport(e,t,r,n);o&&(o.displaySetsInfo?.length&&o.displaySetsInfo[0].displaySetInstanceUID?i++:(console.log("Adding an empty set of display sets for mapping purposes"),o.displaySetsInfo=e.displaySets.map(e=>({displaySetOptions:e}))),r.set(a,o))}),{matchedViewports:i,viewportMatchDetails:r,displaySetMatchDetails:n}}findDeduplicatedMatchDetails(e,t,r={}){if(!e)return;if(0===t)return e;let{matchingScores:n=[]}=e;if(-1===t){let{inDisplay:t}=r;if(!t)return e;for(let r=0;r<e.matchingScores.length;r++)if(-1===t.indexOf(e.matchingScores[r].displaySetInstanceUID))return e.matchingScores[r].matchingScore>0?{matchingScores:n,...e.matchingScores[r]}:null;return}let i=n[t];return i?{...i,matchingScores:n}:void 0}validateDisplaySetSelectMatch(e,t,r){if(e.displaySetInstanceUID!==r){if(!e.matchingScores)throw Error("No matchingScores found in "+e);for(let t of e.matchingScores)if(t.displaySetInstanceUID===r)return;throw Error(`Reused viewport details ${t} with ds ${r} not valid`)}}_matchViewport(e,t,r=this.viewportMatchDetails,n=this.displaySetMatchDetails){let i=t?.displaySetSelectorMap||{},{displaySetSelectors:a={}}=this.protocol;for(let t of e.displaySets){let{id:e}=t,r=a[e];if(!r){console.warn("No display set selector for",e);continue}let{bestMatch:i,matchingScores:o}=this._matchImages(r);n.set(e,i),i&&(i.matchingScores=o)}let{viewportOptions:o=rA}=e,s=[],{StudyInstanceUID:l}=this.activeStudy;return e.displaySets.forEach(e=>{let{id:r,matchedDisplaySetsIndex:n=0}=e,a=r&&i[`${l}:${r}:${n||0}`],o=this.displaySetMatchDetails.get(r),u=this.findDeduplicatedMatchDetails(o,n,t);if(a)return void a.forEach(t=>{s.push({displaySetInstanceUID:t,displaySetOptions:e})});if(u){let{displaySetInstanceUID:t}=u;s.push({displaySetInstanceUID:t,displaySetOptions:e})}else console.warn(`
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("dcmjs"),require("@cornerstonejs/core"),require("@cornerstonejs/metadata"),require("gl-matrix")):"function"==typeof define&&define.amd?define(["dcmjs","@cornerstonejs/core","@cornerstonejs/metadata","gl-matrix"],t):"object"==typeof exports?exports["ohif-core"]=t(require("dcmjs"),require("@cornerstonejs/core"),require("@cornerstonejs/metadata"),require("gl-matrix")):e["ohif-core"]=t(e.dcmjs,e["@cornerstonejs/core"],e["@cornerstonejs/metadata"],e["gl-matrix"])}(globalThis,(e,t,r,n)=>(()=>{var i={28(e,t){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,a=u(e),o=a[0],s=a[1],l=new i((o+s)*3/4-s),c=0,d=s>0?o-4:o;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,s=n-i;o<s;o+=16383)a.push(function(e,t,n){for(var i,a=[],o=t;o<n;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}(e,o,o+16383>s?s:o+16383));return 1===i?a.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&a.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),a.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o<s;++o)r[o]=a[o],n[a.charCodeAt(o)]=o;function u(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},429(e,t,r){"use strict";var n=r(28),i=r(801),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!s.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|p(n,i),u=o(a),l=u.write(n,i);return l!==a&&(u=u.slice(0,l)),u}if(ArrayBuffer.isView(e)){var c=e;if(x(c,Uint8Array)){var m=new Uint8Array(c);return f(m.buffer,m.byteOffset,m.byteLength)}return d(c)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(x(e,ArrayBuffer)||e&&x(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(x(e,SharedArrayBuffer)||e&&x(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var g=e.valueOf&&e.valueOf();if(null!=g&&g!==e)return s.from(g,t,r);var y=function(e){if(s.isBuffer(e)){var t=0|h(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(y)return y;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),o(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),s.prototype),n}function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||x(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return I(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return C(e).length;default:if(i)return n?-1:I(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i,a,o,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=F[e[a]];return i}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,a=t,o=r,0===a&&o===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(a,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length-1;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,t,r);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){var a;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r*=1)!=a&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:D(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return D(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function D(e,t,r,n,i){var a,o=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,s/=2,u/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=r;a<s;a++)if(l(e,a)===l(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===u)return c*o}else -1!==c&&(a-=a-c),c=-1}else for(r+u>s&&(r=s-u),a=r;a>=0;a--){for(var d=!0,f=0;f<u;f++)if(l(e,a+f)!==l(t,f)){d=!1;break}if(d)return a}return -1}function v(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,u,l=e[i],c=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=r)switch(d){case 1:l<128&&(c=l);break;case 2:(192&(a=e[i+1]))==128&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}var f=n,h=f.length;if(h<=4096)return String.fromCharCode.apply(String,f);for(var p="",m=0;m<h;)p+=String.fromCharCode.apply(String,f.slice(m,m+=4096));return p}function b(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function S(e,t,r,n,i,a){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function E(e,t,r,n,i,a){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function w(e,t,r,n,a){return t*=1,r>>>=0,a||E(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function _(e,t,r,n,a){return t*=1,r>>>=0,a||E(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.hp=s,t.IS=50,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!s.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(l(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(x(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),x(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(x(a,Uint8Array))i+a.length>n.length?s.from(a).copy(n,i):Uint8Array.prototype.set.call(n,a,i);else if(s.isBuffer(a))a.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=a.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):m.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a&&(s.prototype[a]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(x(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,o=r-t,u=Math.min(a,o),l=this.slice(n,i),c=e.slice(t,r),d=0;d<u;++d)if(l[d]!==c[d]){a=l[d],o=c[d];break}return a<o?-1:+(o<a)},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,o,s,u,l,c,d,f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var h=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s,u=parseInt(t.substr(2*o,2),16);if((s=u)!=s)break;e[r+o]=u}return o}(this,e,t,r);case"utf8":case"utf-8":return i=t,a=r,M(I(e,this.length-i),this,i,a);case"ascii":case"latin1":case"binary":return o=t,s=r,M(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,o,s);case"base64":return u=t,l=r,M(C(e),this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=r,M(function(e,t){for(var r,n,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,d);default:if(h)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),h=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;S(this,e,t,r,i,0)}var a=1,o=0;for(this[t]=255&e;++o<r&&(a*=256);)this[t+o]=e/a&255;return t+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;S(this,e,t,r,i,0)}var a=r-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);S(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);S(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return _(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return _(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var o=s.isBuffer(e)?e:s.from(e,n),u=o.length;if(0===u)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%u]}return this};var A=/[^+/0-9A-Za-z-_]/g;function I(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function C(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(A,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function M(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function x(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var F=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},956(e){"use strict";var t="%[a-f0-9]{2}",r=RegExp("("+t+")|([^%]+?)","gi"),n=RegExp("("+t+")+","gi");e.exports=function(e){if("string"!=typeof e)throw TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},i=n.exec(e);i;){try{t[i[0]]=decodeURIComponent(i[0])}catch(e){var a=function(e){try{return decodeURIComponent(e)}catch(i){for(var t=e.match(r)||[],n=1;n<t.length;n++)t=(e=(function e(t,r){try{return[decodeURIComponent(t.join(""))]}catch(e){}if(1===t.length)return t;r=r||1;var n=t.slice(0,r),i=t.slice(r);return Array.prototype.concat.call([],e(n),e(i))})(t,n).join("")).match(r)||[];return e}}(i[0]);a!==i[0]&&(t[i[0]]=a)}i=n.exec(e)}t["%C2"]="�";for(var o=Object.keys(t),s=0;s<o.length;s++){var u=o[s];e=e.replace(RegExp(u,"g"),t[u])}return e}(e)}}},313(e,t,r){var n=r(429).hp;e.exports=function(e){var t,r;return r={},i.m=t=[function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t),r.d(t,"isStringVr",function(){return a}),r.d(t,"isPrivateTag",function(){return o}),r.d(t,"parsePN",function(){return s}),r.d(t,"parseTM",function(){return u}),r.d(t,"parseDA",function(){return l}),r.d(t,"explicitElementToString",function(){return c}),r.d(t,"explicitDataSetToJS",function(){return d}),r.d(t,"createJPEGBasicOffsetTable",function(){return h}),r.d(t,"parseDicomDataSetExplicit",function(){return x}),r.d(t,"parseDicomDataSetImplicit",function(){return F}),r.d(t,"readFixedString",function(){return y}),r.d(t,"alloc",function(){return P}),r.d(t,"version",function(){return O}),r.d(t,"bigEndianByteArrayParser",function(){return T}),r.d(t,"ByteStream",function(){return B}),r.d(t,"sharedCopy",function(){return k}),r.d(t,"DataSet",function(){return b}),r.d(t,"findAndSetUNElementLength",function(){return g}),r.d(t,"findEndOfEncapsulatedElement",function(){return m}),r.d(t,"findItemDelimitationItemAndSetElementLength",function(){return S}),r.d(t,"littleEndianByteArrayParser",function(){return U}),r.d(t,"parseDicom",function(){return R}),r.d(t,"readDicomElementExplicit",function(){return M}),r.d(t,"readDicomElementImplicit",function(){return E}),r.d(t,"readEncapsulatedImageFrame",function(){return z}),r.d(t,"readEncapsulatedPixelData",function(){return H}),r.d(t,"readEncapsulatedPixelDataFromFragments",function(){return V}),r.d(t,"readPart10Header",function(){return L}),r.d(t,"readSequenceItemsExplicit",function(){return C}),r.d(t,"readSequenceItemsImplicit",function(){return A}),r.d(t,"readSequenceItem",function(){return w}),r.d(t,"readTag",function(){return p});var i={AE:!0,AS:!0,AT:!1,CS:!0,DA:!0,DS:!0,DT:!0,FL:!1,FD:!1,IS:!0,LO:!0,LT:!0,OB:!1,OD:!1,OF:!1,OW:!1,PN:!0,SH:!0,SL:!1,SQ:!1,SS:!1,ST:!0,TM:!0,UI:!0,UL:!1,UN:void 0,UR:!0,US:!1,UT:!0},a=function(e){return i[e]},o=function(e){if(isNaN(e=parseInt(e[4],16)))throw"dicomParser.isPrivateTag: cannot parse last character of group";return e%2==1},s=function(e){if(void 0!==e)return{familyName:(e=e.split("^"))[0],givenName:e[1],middleName:e[2],prefix:e[3],suffix:e[4]}};function u(e,t){if(2<=e.length){var r=parseInt(e.substring(0,2),10),n=4<=e.length?parseInt(e.substring(2,4),10):void 0,i=6<=e.length?parseInt(e.substring(4,6),10):void 0,a=8<=e.length?e.substring(7,13):void 0,a=a?parseInt(a,10)*Math.pow(10,6-a.length):void 0;if(t&&(isNaN(r)||void 0!==n&&isNaN(n)||void 0!==i&&isNaN(i)||void 0!==a&&isNaN(a)||r<0||23<r||n&&(n<0||59<n)||i&&(i<0||59<i)||a&&(a<0||999999<a)))throw"invalid TM '".concat(e,"'");return{hours:r,minutes:n,seconds:i,fractionalSeconds:a}}if(t)throw"invalid TM '".concat(e,"'")}function l(e,t){if(e&&8===e.length){var r=parseInt(e.substring(0,4),10),n=parseInt(e.substring(4,6),10),i=parseInt(e.substring(6,8),10);if(t&&!0!=(!isNaN(r)&&0<n&&n<=12&&0<i&&i<=function(e,t){switch(e){case 2:return t%4==0&&t%100||t%400==0?29:28;case 9:case 4:case 6:case 11:return 30;default:return 31}}(n,r)))throw"invalid DA '".concat(e,"'");return{year:r,month:n,day:i}}if(t)throw"invalid DA '".concat(e,"'")}function c(e,t){if(void 0===e||void 0===t)throw"dicomParser.explicitElementToString: missing required parameters";if(void 0===t.vr)throw"dicomParser.explicitElementToString: cannot convert implicit element to string";var r,n=t.vr,i=t.tag;function o(t,r){for(var n="",a=0;a<t;a++)0!==a&&(n+="/"),n+=r.call(e,i,a).toString();return n}if(!0===a(n))r=e.string(i);else{if("AT"===n){var s=e.uint32(i);return void 0===s?void 0:"x".concat((s=s<0?0xffffffff+s+1:s).toString(16).toUpperCase())}"US"===n?r=o(t.length/2,e.uint16):"SS"===n?r=o(t.length/2,e.int16):"UL"===n?r=o(t.length/4,e.uint32):"SL"===n?r=o(t.length/4,e.int32):"FD"===n?r=o(t.length/8,e.double):"FL"===n&&(r=o(t.length/4,e.float))}return r}function d(e,t){if(void 0===e)throw"dicomParser.explicitDataSetToJS: missing required parameter dataSet";t=t||{omitPrivateAttibutes:!0,maxElementLength:128};var r,n={};for(r in e.elements){var i=e.elements[r];if(!0!==t.omitPrivateAttibutes||!o(r))if(i.items){for(var a=[],s=0;s<i.items.length;s++)a.push(d(i.items[s].dataSet,t));n[r]=a}else{var u=void 0;i.length<t.maxElementLength&&(u=c(e,i)),n[r]=void 0!==u?u:{dataOffset:i.dataOffset,length:i.length}}}return n}function f(e,t){return 255===e.byteArray[t]&&217===e.byteArray[t+1]}function h(e,t,r){if(void 0===e)throw"dicomParser.createJPEGBasicOffsetTable: missing required parameter dataSet";if(void 0===t)throw"dicomParser.createJPEGBasicOffsetTable: missing required parameter pixelDataElement";if("x7fe00010"!==t.tag)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010'";if(!0!==t.encapsulatedPixelData||!0!==t.hadUndefinedLength||void 0===t.basicOffsetTable||void 0===t.fragments||t.fragments.length<=0)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(r&&r.length<=0)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'fragments' must not be zero length";r=r||t.fragments;for(var n=[],i=0;;){n.push(t.fragments[i].offset);var a=function(e,t,r){for(var n,i=r;i<t.fragments.length;i++)if(n=i,!(!f(e,(n=t.fragments[n]).position+n.length-2)&&!f(e,n.position+n.length-3)))return i}(e,t,i);if(void 0===a||a===t.fragments.length-1)return n;i=a+1}}function p(e){if(void 0===e)throw"dicomParser.readTag: missing required parameter 'byteStream'";var t=256*e.readUint16()*256,e=e.readUint16();return"x".concat("00000000".concat((t+e).toString(16)).substr(-8))}function m(e,t,r){if(void 0===e)throw"dicomParser.findEndOfEncapsulatedElement: missing required parameter 'byteStream'";if(void 0===t)throw"dicomParser.findEndOfEncapsulatedElement: missing required parameter 'element'";if(t.encapsulatedPixelData=!0,t.basicOffsetTable=[],t.fragments=[],"xfffee000"!==p(e))throw"dicomParser.findEndOfEncapsulatedElement: basic offset table not found";for(var n=e.readUint32()/4,i=0;i<n;i++){var a=e.readUint32();t.basicOffsetTable.push(a)}for(var o=e.position;e.position<e.byteArray.length;){var s=p(e),u=e.readUint32();if("xfffee0dd"===s)return e.seek(u),void(t.length=e.position-t.dataOffset);if("xfffee000"!==s)return r&&r.push("unexpected tag ".concat(s," while searching for end of pixel data element with undefined length")),u>e.byteArray.length-e.position&&(u=e.byteArray.length-e.position),t.fragments.push({offset:e.position-o-8,position:e.position,length:u}),e.seek(u),void(t.length=e.position-t.dataOffset);t.fragments.push({offset:e.position-o-8,position:e.position,length:u}),e.seek(u)}r&&r.push("pixel data element ".concat(t.tag," missing sequence delimiter tag xfffee0dd"))}function g(e,t){if(void 0===e)throw"dicomParser.findAndSetUNElementLength: missing required parameter 'byteStream'";for(var r=e.byteArray.length-8;e.position<=r;)if(65534===e.readUint16()&&57565===e.readUint16())return 0!==e.readUint32()&&e.warnings("encountered non zero length following item delimiter at position ".concat(e.position-4," while reading element of undefined length with tag ").concat(t.tag)),void(t.length=e.position-t.dataOffset);t.length=e.byteArray.length-t.dataOffset,e.seek(e.byteArray.length-e.position)}function y(e,t,r){if(r<0)throw"dicomParser.readFixedString - length cannot be less than 0";if(t+r>e.length)throw"dicomParser.readFixedString: attempt to read past end of buffer";for(var n,i="",a=0;a<r;a++){if(0===(n=e[t+a]))return t+=r,i;i+=String.fromCharCode(n)}return i}function D(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function v(e,t){return void 0!==e.parser?e.parser:t}var b=function(){var e,t;function r(e,t,n){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),this.byteArrayParser=e,this.byteArray=t,this.elements=n}return e=[{key:"uint16",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return v(e,this.byteArrayParser).readUint16(this.byteArray,e.dataOffset+2*t)}},{key:"int16",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return v(e,this.byteArrayParser).readInt16(this.byteArray,e.dataOffset+2*t)}},{key:"uint32",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return v(e,this.byteArrayParser).readUint32(this.byteArray,e.dataOffset+4*t)}},{key:"int32",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return v(e,this.byteArrayParser).readInt32(this.byteArray,e.dataOffset+4*t)}},{key:"float",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return v(e,this.byteArrayParser).readFloat(this.byteArray,e.dataOffset+4*t)}},{key:"double",value:function(e,t){if(t=void 0!==t?t:0,(e=this.elements[e])&&0!==e.length)return v(e,this.byteArrayParser).readDouble(this.byteArray,e.dataOffset+8*t)}},{key:"numStringValues",value:function(e){if((e=this.elements[e])&&0<e.length)return null===(e=y(this.byteArray,e.dataOffset,e.length).match(/\\/g))?1:e.length+1}},{key:"string",value:function(e,t){return(e=this.elements[e])&&e.Value?e.Value:e&&0<e.length?(e=y(this.byteArray,e.dataOffset,e.length),0<=t?e.split("\\")[t].trim():e.trim()):void 0}},{key:"text",value:function(e,t){if((e=this.elements[e])&&0<e.length)return e=y(this.byteArray,e.dataOffset,e.length),0<=t?e.split("\\")[t].replace(/ +$/,""):e.replace(/ +$/,"")}},{key:"floatString",value:function(e,t){var r=this.elements[e];if(r&&0<r.length&&void 0!==(t=this.string(e,t=void 0!==t?t:0)))return parseFloat(t)}},{key:"intString",value:function(e,t){var r=this.elements[e];if(r&&0<r.length&&void 0!==(t=this.string(e,t=void 0!==t?t:0)))return parseInt(t)}},{key:"attributeTag",value:function(e){var t=this.elements[e];if(t&&4===t.length){var r=v(t,this.byteArrayParser).readUint16,e=this.byteArray,t=t.dataOffset;return"x".concat("00000000".concat((256*r(e,t)*256+r(e,t+2)).toString(16)).substr(-8))}}}],D(r.prototype,e),t&&D(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}();function S(e,t){if(void 0===e)throw"dicomParser.readDicomElementImplicit: missing required parameter 'byteStream'";for(var r=e.byteArray.length-8;e.position<=r;)if(65534===e.readUint16()&&57357===e.readUint16())return 0!==e.readUint32()&&e.warnings("encountered non zero length following item delimiter at position ".concat(e.position-4," while reading element of undefined length with tag ").concat(t.tag)),void(t.length=e.position-t.dataOffset);t.length=e.byteArray.length-t.dataOffset,e.seek(e.byteArray.length-e.position)}function E(e,t,r){if(void 0===e)throw"dicomParser.readDicomElementImplicit: missing required parameter 'byteStream'";var n,i=p(e),i={tag:i,vr:void 0!==r?r(i):void 0,length:e.readUint32(),dataOffset:e.position};return 0xffffffff===i.length&&(i.hadUndefinedLength=!0),i.tag===t||((void 0!==(n=i).vr?"SQ"!==n.vr:e.position+4<=e.byteArray.length?(n=p(e),e.seek(-4),"xfffee000"!==n&&"xfffee0dd"!==n):(e.warnings.push("eof encountered before finding sequence item tag or sequence delimiter tag in peeking to determine VR"),!0))||o(i.tag)&&!i.hadUndefinedLength?i.hadUndefinedLength?S(e,i):e.seek(i.length):(A(e,i,r),o(i.tag)&&(i.items=void 0))),i}function w(e){if(void 0===e)throw"dicomParser.readSequenceItem: missing required parameter 'byteStream'";var t={tag:p(e),length:e.readUint32(),dataOffset:e.position};if("xfffee000"!==t.tag)throw"dicomParser.readSequenceItem: item tag (FFFE,E000) not found at offset ".concat(e.position);return t}function _(e,t){var r=w(e);return 0xffffffff===r.length?(r.hadUndefinedLength=!0,r.dataSet=function(e,t){for(var r={};e.position<e.byteArray.length;){var n=E(e,void 0,t);if("xfffee00d"===(r[n.tag]=n).tag)return new b(e.byteArrayParser,e.byteArray,r)}return e.warnings.push("eof encountered before finding sequence item delimiter in sequence item of undefined length"),new b(e.byteArrayParser,e.byteArray,r)}(e,t),r.length=e.position-r.dataOffset):(r.dataSet=new b(e.byteArrayParser,e.byteArray,{}),F(r.dataSet,e,e.position+r.length,{vrCallback:t})),r}function A(e,t,r){if(void 0===e)throw"dicomParser.readSequenceItemsImplicit: missing required parameter 'byteStream'";if(void 0===t)throw"dicomParser.readSequenceItemsImplicit: missing required parameter 'element'";t.items=[],(0xffffffff===t.length?function(e,t,r){for(;e.position+4<=e.byteArray.length;){var n=p(e);if(e.seek(-4),"xfffee0dd"===n)return t.length=e.position-t.dataOffset,e.seek(8);n=_(e,r),t.items.push(n)}e.warnings.push("eof encountered before finding sequence delimiter in sequence of undefined length"),t.length=e.byteArray.length-t.dataOffset}:function(e,t,r){for(var n=t.dataOffset+t.length;e.position<n;){var i=_(e,r);t.items.push(i)}})(e,t,r)}function I(e,t){var r=w(e);return 0xffffffff===r.length?(r.hadUndefinedLength=!0,r.dataSet=function(e,t){for(var r={};e.position<e.byteArray.length;){var n=M(e,t);if("xfffee00d"===(r[n.tag]=n).tag)return new b(e.byteArrayParser,e.byteArray,r)}return t.push("eof encountered before finding item delimiter tag while reading sequence item of undefined length"),new b(e.byteArrayParser,e.byteArray,r)}(e,t),r.length=e.position-r.dataOffset):(r.dataSet=new b(e.byteArrayParser,e.byteArray,{}),x(r.dataSet,e,e.position+r.length)),r}function C(e,t,r){if(void 0===e)throw"dicomParser.readSequenceItemsExplicit: missing required parameter 'byteStream'";if(void 0===t)throw"dicomParser.readSequenceItemsExplicit: missing required parameter 'element'";t.items=[],(0xffffffff===t.length?function(e,t,r){for(;e.position+4<=e.byteArray.length;){var n=p(e);if(e.seek(-4),"xfffee0dd"===n)return t.length=e.position-t.dataOffset,e.seek(8);n=I(e,r),t.items.push(n)}r.push("eof encountered before finding sequence delimitation tag while reading sequence of undefined length"),t.length=e.position-t.dataOffset}:function(e,t,r){for(var n=t.dataOffset+t.length;e.position<n;){var i=I(e,r);t.items.push(i)}})(e,t,r)}function M(e,t,r){if(void 0===e)throw"dicomParser.readDicomElementExplicit: missing required parameter 'byteStream'";var n,i={tag:p(e),vr:e.readFixedString(2)};return 2==("OB"===(n=i.vr)||"OD"===n||"OL"===n||"OW"===n||"SQ"===n||"OF"===n||"UC"===n||"UR"===n||"UT"===n||"UN"===n?4:2)?i.length=e.readUint16():(e.seek(2),i.length=e.readUint32()),i.dataOffset=e.position,0xffffffff===i.length&&(i.hadUndefinedLength=!0),i.tag===r||("SQ"===i.vr?C(e,i,t):0xffffffff===i.length?"x7fe00010"===i.tag?m(e,i,t):("UN"===i.vr?A:S)(e,i):e.seek(i.length)),i}function x(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};if(r=void 0===r?t.byteArray.length:r,void 0===t)throw"dicomParser.parseDicomDataSetExplicit: missing required parameter 'byteStream'";if(r<t.position||r>t.byteArray.length)throw"dicomParser.parseDicomDataSetExplicit: invalid value for parameter 'maxP osition'";for(var i=e.elements;t.position<r;){var a=M(t,e.warnings,n.untilTag);if((i[a.tag]=a).tag===n.untilTag)return}if(t.position>r)throw"dicomParser:parseDicomDataSetExplicit: buffer overrun"}function F(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};if(r=void 0===r?e.byteArray.length:r,void 0===t)throw"dicomParser.parseDicomDataSetImplicit: missing required parameter 'byteStream'";if(r<t.position||r>t.byteArray.length)throw"dicomParser.parseDicomDataSetImplicit: invalid value for parameter 'maxPosition'";for(var i=e.elements;t.position<r;){var a=E(t,n.untilTag,n.vrCallback);if((i[a.tag]=a).tag===n.untilTag)return}}function P(e,t){if(void 0!==n&&e instanceof n)return n.alloc(t);if(e instanceof Uint8Array)return new Uint8Array(t);throw"dicomParser.alloc: unknown type for byteArray"}var O="1.8.12",T={readUint16:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readUint16: position cannot be less than 0";if(t+2>e.length)throw"bigEndianByteArrayParser.readUint16: attempt to read past end of buffer";return(e[t]<<8)+e[t+1]},readInt16:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readInt16: position cannot be less than 0";if(t+2>e.length)throw"bigEndianByteArrayParser.readInt16: attempt to read past end of buffer";return 32768&(t=(e[t]<<8)+e[t+1])?t-65535-1:t},readUint32:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readUint32: position cannot be less than 0";if(t+4>e.length)throw"bigEndianByteArrayParser.readUint32: attempt to read past end of buffer";return 256*(256*(256*e[t]+e[t+1])+e[t+2])+e[t+3]},readInt32:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readInt32: position cannot be less than 0";if(t+4>e.length)throw"bigEndianByteArrayParser.readInt32: attempt to read past end of buffer";return(e[t]<<24)+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]},readFloat:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readFloat: position cannot be less than 0";if(t+4>e.length)throw"bigEndianByteArrayParser.readFloat: attempt to read past end of buffer";var r=new Uint8Array(4);return r[3]=e[t],r[2]=e[t+1],r[1]=e[t+2],r[0]=e[t+3],new Float32Array(r.buffer)[0]},readDouble:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readDouble: position cannot be less than 0";if(t+8>e.length)throw"bigEndianByteArrayParser.readDouble: attempt to read past end of buffer";var r=new Uint8Array(8);return r[7]=e[t],r[6]=e[t+1],r[5]=e[t+2],r[4]=e[t+3],r[3]=e[t+4],r[2]=e[t+5],r[1]=e[t+6],r[0]=e[t+7],new Float64Array(r.buffer)[0]}};function k(e,t,r){if(void 0!==n&&e instanceof n)return e.slice(t,t+r);if(e instanceof Uint8Array)return new Uint8Array(e.buffer,e.byteOffset+t,r);throw"dicomParser.from: unknown type for byteArray"}function N(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var B=function(){var e,t;function r(e,t,i){if(!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),void 0===e)throw"dicomParser.ByteStream: missing required parameter 'byteArrayParser'";if(void 0===t)throw"dicomParser.ByteStream: missing required parameter 'byteArray'";if(t instanceof Uint8Array==!1&&(void 0===n||t instanceof n==!1))throw"dicomParser.ByteStream: parameter byteArray is not of type Uint8Array or Buffer";if(i<0)throw"dicomParser.ByteStream: parameter 'position' cannot be less than 0";if(i>=t.length)throw"dicomParser.ByteStream: parameter 'position' cannot be greater than or equal to 'byteArray' length";this.byteArrayParser=e,this.byteArray=t,this.position=i||0,this.warnings=[]}return e=[{key:"seek",value:function(e){if(this.position+e<0)throw"dicomParser.ByteStream.prototype.seek: cannot seek to position < 0";this.position+=e}},{key:"readByteStream",value:function(e){if(this.position+e>this.byteArray.length)throw"dicomParser.ByteStream.prototype.readByteStream: readByteStream - buffer overread";var t=k(this.byteArray,this.position,e);return this.position+=e,new r(this.byteArrayParser,t)}},{key:"getSize",value:function(){return this.byteArray.length}},{key:"readUint16",value:function(){var e=this.byteArrayParser.readUint16(this.byteArray,this.position);return this.position+=2,e}},{key:"readUint32",value:function(){var e=this.byteArrayParser.readUint32(this.byteArray,this.position);return this.position+=4,e}},{key:"readFixedString",value:function(e){var t=y(this.byteArray,this.position,e);return this.position+=e,t}}],N(r.prototype,e),t&&N(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}(),U={readUint16:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readUint16: position cannot be less than 0";if(t+2>e.length)throw"littleEndianByteArrayParser.readUint16: attempt to read past end of buffer";return e[t]+256*e[t+1]},readInt16:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readInt16: position cannot be less than 0";if(t+2>e.length)throw"littleEndianByteArrayParser.readInt16: attempt to read past end of buffer";return 32768&(t=e[t]+(e[t+1]<<8))?t-65535-1:t},readUint32:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readUint32: position cannot be less than 0";if(t+4>e.length)throw"littleEndianByteArrayParser.readUint32: attempt to read past end of buffer";return e[t]+256*e[t+1]+256*e[t+2]*256+256*e[t+3]*65536},readInt32:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readInt32: position cannot be less than 0";if(t+4>e.length)throw"littleEndianByteArrayParser.readInt32: attempt to read past end of buffer";return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24)},readFloat:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readFloat: position cannot be less than 0";if(t+4>e.length)throw"littleEndianByteArrayParser.readFloat: attempt to read past end of buffer";var r=new Uint8Array(4);return r[0]=e[t],r[1]=e[t+1],r[2]=e[t+2],r[3]=e[t+3],new Float32Array(r.buffer)[0]},readDouble:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readDouble: position cannot be less than 0";if(t+8>e.length)throw"littleEndianByteArrayParser.readDouble: attempt to read past end of buffer";var r=new Uint8Array(8);return r[0]=e[t],r[1]=e[t+1],r[2]=e[t+2],r[3]=e[t+3],r[4]=e[t+4],r[5]=e[t+5],r[6]=e[t+6],r[7]=e[t+7],new Float64Array(r.buffer)[0]}};function L(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw"dicomParser.readPart10Header: missing required parameter 'byteArray'";var r=t.TransferSyntaxUID,n=new B(U,e);return function(){var e=function(){if(132>=n.getSize()&&r)return!1;if(n.seek(128),"DICM"===n.readFixedString(4))return!0;if(!(t||{}).TransferSyntaxUID)throw"dicomParser.readPart10Header: DICM prefix not found at location 132 - this is not a valid DICOM P10 file.";return n.seek(0),!1}(),i=[],a={};if(!e)return n.position=0,{elements:{x00020010:{tag:"x00020010",vr:"UI",Value:r}},warnings:i};for(;n.position<n.byteArray.length;){var o=n.position,s=M(n,i);if("x0002ffff"<s.tag){n.position=o;break}s.parser=U,a[s.tag]=s}return(e=new b(n.byteArrayParser,n.byteArray,a)).warnings=n.warnings,e.position=n.position,e}()}function R(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw Error("dicomParser.parseDicom: missing required parameter 'byteArray'");var n,i=function(t){if(void 0===t.elements.x00020010)throw Error("dicomParser.parseDicom: missing required meta header attribute 0002,0010");return(t=t.elements.x00020010)&&t.Value||y(e,t.dataOffset,t.length)},a=n=L(e,t),o=function(n){var a=i(n),o="1.2.840.10008.1.2"!==a,a=function(n,i){var a="[object process]"===Object.prototype.toString.call("u">typeof process?process:0);if("1.2.840.10008.1.2.1.99"!==n)return new B("1.2.840.10008.1.2.2"===n?T:U,e,i);if(t&&t.inflater)return new B(U,n=t.inflater(e,i),0);if(!0==a){var o=r(0),s=k(e,i,e.length-i),o=o.inflateRawSync(s),s=P(e,o.length+i);return e.copy(s,0,0,i),o.copy(s,i),new B(U,s,0)}if("u"<typeof pako)throw"dicomParser.parseDicom: no inflater available to handle deflate transfer syntax";return o=e.slice(i),(o=P(e,(s=pako.inflateRaw(o)).length+i)).set(e.slice(0,i),0),o.set(s,i),new B(U,o,0)}(a,n.position),n=new b(a.byteArrayParser,a.byteArray,{});n.warnings=a.warnings;try{(o?x:F)(n,a,a.byteArray.length,t)}catch(e){throw{exception:e,dataSet:n}}return n}(n);for(var s in a.elements)a.elements.hasOwnProperty(s)&&(o.elements[s]=a.elements[s]);return void 0!==a.warnings&&(o.warnings=a.warnings.concat(o.warnings)),o}var j=function(e,t,r){for(var n=0,i=t;i<t+r;i++)n+=e[i].length;return n};function V(e,t,r,n,i){if(i=i||t.fragments,void 0===e)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'dataSet'";if(void 0===t)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'pixelDataElement'";if(void 0===r)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'startFragmentIndex'";if(void 0===(n=n||1))throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'numFragments'";if("x7fe00010"!==t.tag)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010";if(!0!==t.encapsulatedPixelData||!0!==t.hadUndefinedLength||void 0===t.basicOffsetTable||void 0===t.fragments||t.fragments.length<=0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(r<0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragmentIndex' must be >= 0";if(r>=t.fragments.length)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragmentIndex' must be < number of fragments";if(n<1)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'numFragments' must be > 0";if(r+n>t.fragments.length)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragment' + 'numFragments' < number of fragments";var a=new B(e.byteArrayParser,e.byteArray,t.dataOffset),t=w(a);if("xfffee000"!==t.tag)throw"dicomParser.readEncapsulatedPixelData: missing basic offset table xfffee000";a.seek(t.length);var o=a.position;if(1===n)return k(a.byteArray,o+i[r].offset+8,i[r].length);for(var t=j(i,r,n),s=P(a.byteArray,t),u=0,l=r;l<r+n;l++)for(var c=o+i[l].offset+8,d=0;d<i[l].length;d++)s[u++]=a.byteArray[c++];return s}var Y=function(e,t){for(var r=0;r<e.length;r++)if(e[r].offset===t)return r},$=function(e,t,r,n){if(e===t.length-1)return r.length-n;for(var i=t[e+1],a=n+1;a<r.length;a++)if(r[a].offset===i)return a-n;throw"dicomParser.calculateNumberOfFragmentsForFrame: could not find fragment with offset matching basic offset table"};function z(e,t,r,n,i){if(n=n||t.basicOffsetTable,i=i||t.fragments,void 0===e)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'dataSet'";if(void 0===t)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'pixelDataElement'";if(void 0===r)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'frameIndex'";if(void 0===n)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' does not have basicOffsetTable";if("x7fe00010"!==t.tag)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010)";if(!0!==t.encapsulatedPixelData)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(!0!==t.hadUndefinedLength)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have undefined length";if(void 0===t.fragments)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have fragments";if(0===n.length)throw"dicomParser.readEncapsulatedImageFrame: basicOffsetTable has zero entries";if(r<0)throw"dicomParser.readEncapsulatedImageFrame: parameter 'frameIndex' must be >= 0";if(r>=n.length)throw"dicomParser.readEncapsulatedImageFrame: parameter 'frameIndex' must be < basicOffsetTable.length";var a=n[r],a=Y(i,a);if(void 0===a)throw"dicomParser.readEncapsulatedImageFrame: unable to find fragment that matches basic offset table entry";return V(e,t,a,$(r,n,i,a),i)}var W=!1;function H(e,t,r){if(W||(W=!0,console&&console.log&&console.log("WARNING: dicomParser.readEncapsulatedPixelData() has been deprecated")),void 0===e)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'dataSet'";if(void 0===t)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'element'";if(void 0===r)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'frame'";if("x7fe00010"!==t.tag)throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to non pixel data tag (expected tag = x7fe00010)";if(!0!==t.encapsulatedPixelData||!0!==t.hadUndefinedLength||void 0===t.basicOffsetTable||void 0===t.fragments)throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to pixel data element that does not have encapsulated pixel data";if(r<0)throw"dicomParser.readEncapsulatedPixelData: parameter 'frame' must be >= 0";return 0!==t.basicOffsetTable.length?z(e,t,r):V(e,t,0,t.fragments.length)}t.default={isStringVr:a,isPrivateTag:o,parsePN:s,parseTM:u,parseDA:l,explicitElementToString:c,explicitDataSetToJS:d,createJPEGBasicOffsetTable:h,parseDicomDataSetExplicit:x,parseDicomDataSetImplicit:F,readFixedString:y,alloc:P,version:O,bigEndianByteArrayParser:T,ByteStream:B,sharedCopy:k,DataSet:b,findAndSetUNElementLength:g,findEndOfEncapsulatedElement:m,findItemDelimitationItemAndSetElementLength:S,littleEndianByteArrayParser:U,parseDicom:R,readDicomElementExplicit:M,readDicomElementImplicit:E,readEncapsulatedImageFrame:z,readEncapsulatedPixelData:H,readEncapsulatedPixelDataFromFragments:V,readPart10Header:L,readSequenceItemsExplicit:C,readSequenceItemsImplicit:A,readSequenceItem:w,readTag:p,LEI:"1.2.840.10008.1.2",LEE:"1.2.840.10008.1.2.1"}}],i.c=r,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t||4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,(function(t){return e[t]}).bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1);function i(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,i),n.l=!0,n.exports}}(r(534))},913(e){"use strict";e.exports=function(e,t){for(var r={},n=Object.keys(e),i=Array.isArray(t),a=0;a<n.length;a++){var o=n[a],s=e[o];(i?-1!==t.indexOf(o):t(o,s,e))&&(r[o]=s)}return r}},801(e,t){t.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,u=(1<<s)-1,l=u>>1,c=-7,d=r?i-1:0,f=r?-1:1,h=e[t+d];for(d+=f,a=h&(1<<-c)-1,h>>=-c,c+=s;c>0;a=256*a+e[t+d],d+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+e[t+d],d+=f,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),a-=l}return(h?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,s,u,l=8*a-i-1,c=(1<<l)-1,d=c>>1,f=5960464477539062e-23*(23===i),h=n?0:a-1,p=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?t+=f/u:t+=f*Math.pow(2,1-d),t*u>=2&&(o++,u/=2),o+d>=c?(s=0,o=c):o+d>=1?(s=(t*u-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+h]=255&s,h+=p,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[r+h]=255&o,h+=p,o/=256,l-=8);e[r+h-p]|=128*m}},752(e,t){"use strict";function r(e){return"object"!=typeof e||"toString"in e?e:Object.prototype.toString.call(e).slice(8,-1)}Object.defineProperty(t,"__esModule",{value:!0});var n="object"==typeof process;function i(e,t){if(!e){if(n)throw Error("Invariant failed");throw Error(t())}}t.invariant=i;var a=Object.prototype.hasOwnProperty,o=Array.prototype.splice,s=Object.prototype.toString;function u(e){return s.call(e).slice(8,-1)}var l=Object.assign||function(e,t){return c(t).forEach(function(r){a.call(t,r)&&(e[r]=t[r])}),e},c="function"==typeof Object.getOwnPropertySymbols?function(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.keys(e)};function d(e){return Array.isArray(e)?l(e.constructor(e.length),e):"Map"===u(e)?new Map(e):"Set"===u(e)?new Set(e):e&&"object"==typeof e?l(Object.create(Object.getPrototypeOf(e)),e):e}var f=function(){function e(){this.commands=l({},h),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(e,t){return e===t},this.update.newContext=function(){return new e().update}}return Object.defineProperty(e.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(e){this.update.isEquals=e},enumerable:!0,configurable:!0}),e.prototype.extend=function(e,t){this.commands[e]=t},e.prototype.update=function(e,t){var r=this,n="function"==typeof t?{$apply:t}:t;Array.isArray(e)&&Array.isArray(n)||i(!Array.isArray(n),function(){return"update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),i("object"==typeof n&&null!==n,function(){return"update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the following commands: "+Object.keys(r.commands).join(", ")+"."});var o=e;return c(n).forEach(function(t){if(a.call(r.commands,t)){var i=e===o;o=r.commands[t](n[t],o,n,e),i&&r.isEquals(o,e)&&(o=e)}else{var s="Map"===u(e)?r.update(e.get(t),n[t]):r.update(e[t],n[t]),l="Map"===u(o)?o.get(t):o[t];r.isEquals(s,l)&&(void 0!==s||a.call(e,t))||(o===e&&(o=d(e)),"Map"===u(o)?o.set(t,s):o[t]=s)}}),o},e}();t.Context=f;var h={$push:function(e,t,r){return m(t,r,"$push"),e.length?t.concat(e):t},$unshift:function(e,t,r){return m(t,r,"$unshift"),e.length?e.concat(t):t},$splice:function(e,t,n,a){var s,u;return s=t,u=n,i(Array.isArray(s),function(){return"Expected $splice target to be an array; got "+r(s)}),y(u.$splice),e.forEach(function(e){y(e),t===a&&e.length&&(t=d(a)),o.apply(t,e)}),t},$set:function(e,t,r){return i(1===Object.keys(r).length,function(){return"Cannot have more than one key in an object with $set"}),e},$toggle:function(e,t){g(e,"$toggle");var r=e.length?d(t):t;return e.forEach(function(e){r[e]=!t[e]}),r},$unset:function(e,t,r,n){return g(e,"$unset"),e.forEach(function(e){Object.hasOwnProperty.call(t,e)&&(t===n&&(t=d(n)),delete t[e])}),t},$add:function(e,t,r,n){return D(t,"$add"),g(e,"$add"),"Map"===u(t)?e.forEach(function(e){var r=e[0],i=e[1];t===n&&t.get(r)!==i&&(t=d(n)),t.set(r,i)}):e.forEach(function(e){t!==n||t.has(e)||(t=d(n)),t.add(e)}),t},$remove:function(e,t,r,n){return D(t,"$remove"),g(e,"$remove"),e.forEach(function(e){t===n&&t.has(e)&&(t=d(n)),t.delete(e)}),t},$merge:function(e,t,n,a){var o,s;return o=t,i((s=e)&&"object"==typeof s,function(){return"update(): $merge expects a spec of type 'object'; got "+r(s)}),i(o&&"object"==typeof o,function(){return"update(): $merge expects a target of type 'object'; got "+r(o)}),c(e).forEach(function(r){e[r]!==t[r]&&(t===a&&(t=d(a)),t[r]=e[r])}),t},$apply:function(e,t){var n;return i("function"==typeof(n=e),function(){return"update(): expected spec of $apply to be a function; got "+r(n)+"."}),e(t)}},p=new f;function m(e,t,n){i(Array.isArray(e),function(){return"update(): expected target of "+r(n)+" to be an array; got "+r(e)+"."}),g(t[n],n)}function g(e,t){i(Array.isArray(e),function(){return"update(): expected spec of "+r(t)+" to be an array; got "+r(e)+". Did you forget to wrap your parameter in an array?"})}function y(e){i(Array.isArray(e),function(){return"update(): expected spec of $splice to be an array of arrays; got "+r(e)+". Did you forget to wrap your parameters in an array?"})}function D(e,t){var n=u(e);i("Map"===n||"Set"===n,function(){return"update(): "+r(t)+" expects a target of type Set or Map; got "+r(n)})}t.isEquals=p.update.isEquals,t.extend=p.extend,t.default=p.update,t.default.default=e.exports=l(t.default,t)},642(e,t){"use strict";self.atob.bind(self),self.btoa.bind(self)},359(e,t,r){e=r.nmd(e);var n,i="__lodash_hash_undefined__",a="[object Arguments]",o="[object Boolean]",s="[object Date]",u="[object Function]",l="[object GeneratorFunction]",c="[object Map]",d="[object Number]",f="[object Object]",h="[object Promise]",p="[object RegExp]",m="[object Set]",g="[object String]",y="[object Symbol]",D="[object WeakMap]",v="[object ArrayBuffer]",b="[object DataView]",S="[object Float32Array]",E="[object Float64Array]",w="[object Int8Array]",_="[object Int16Array]",A="[object Int32Array]",I="[object Uint8Array]",C="[object Uint8ClampedArray]",M="[object Uint16Array]",x="[object Uint32Array]",F=/\w*$/,P=/^\[object .+?Constructor\]$/,O=/^(?:0|[1-9]\d*)$/,T={};T[a]=T["[object Array]"]=T[v]=T[b]=T[o]=T[s]=T[S]=T[E]=T[w]=T[_]=T[A]=T[c]=T[d]=T[f]=T[p]=T[m]=T[g]=T[y]=T[I]=T[C]=T[M]=T[x]=!0,T["[object Error]"]=T[u]=T[D]=!1;var k="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,N="object"==typeof self&&self&&self.Object===Object&&self,B=k||N||Function("return this")(),U=t&&!t.nodeType&&t,L=U&&e&&!e.nodeType&&e,R=L&&L.exports===U;function j(e,t){return e.set(t[0],t[1]),e}function V(e,t){return e.add(t),e}function Y(e,t,r,n){var i=-1,a=e?e.length:0;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function $(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function z(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function W(e,t){return function(r){return e(t(r))}}function H(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var G=Array.prototype,q=Function.prototype,X=Object.prototype,K=B["__core-js_shared__"],J=(n=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Z=q.toString,Q=X.hasOwnProperty,ee=X.toString,et=RegExp("^"+Z.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),er=R?B.Buffer:void 0,en=B.Symbol,ei=B.Uint8Array,ea=W(Object.getPrototypeOf,Object),eo=Object.create,es=X.propertyIsEnumerable,eu=G.splice,el=Object.getOwnPropertySymbols,ec=er?er.isBuffer:void 0,ed=W(Object.keys,Object),ef=ek(B,"DataView"),eh=ek(B,"Map"),ep=ek(B,"Promise"),em=ek(B,"Set"),eg=ek(B,"WeakMap"),ey=ek(Object,"create"),eD=eL(ef),ev=eL(eh),eb=eL(ep),eS=eL(em),eE=eL(eg),ew=en?en.prototype:void 0,e_=ew?ew.valueOf:void 0;function eA(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function eI(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function eC(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function eM(e){this.__data__=new eI(e)}function ex(e,t,r){var n=e[t];Q.call(e,t)&&eR(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function eF(e,t){for(var r=e.length;r--;)if(eR(e[r][0],t))return r;return -1}function eP(e){var t=new e.constructor(e.byteLength);return new ei(t).set(new ei(e)),t}function eO(e,t,r,n){r||(r={});for(var i=-1,a=t.length;++i<a;){var o=t[i],s=n?n(r[o],e[o],o,r,e):void 0;ex(r,o,void 0===s?e[o]:s)}return r}function eT(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function ek(e,t){var r,n=null==e?void 0:e[t];return!(!ez(n)||(r=n,J&&J in r))&&(e$(n)||$(n)?et:P).test(eL(n))?n:void 0}eA.prototype.clear=function(){this.__data__=ey?ey(null):{}},eA.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},eA.prototype.get=function(e){var t=this.__data__;if(ey){var r=t[e];return r===i?void 0:r}return Q.call(t,e)?t[e]:void 0},eA.prototype.has=function(e){var t=this.__data__;return ey?void 0!==t[e]:Q.call(t,e)},eA.prototype.set=function(e,t){return this.__data__[e]=ey&&void 0===t?i:t,this},eI.prototype.clear=function(){this.__data__=[]},eI.prototype.delete=function(e){var t=this.__data__,r=eF(t,e);return!(r<0)&&(r==t.length-1?t.pop():eu.call(t,r,1),!0)},eI.prototype.get=function(e){var t=this.__data__,r=eF(t,e);return r<0?void 0:t[r][1]},eI.prototype.has=function(e){return eF(this.__data__,e)>-1},eI.prototype.set=function(e,t){var r=this.__data__,n=eF(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},eC.prototype.clear=function(){this.__data__={hash:new eA,map:new(eh||eI),string:new eA}},eC.prototype.delete=function(e){return eT(this,e).delete(e)},eC.prototype.get=function(e){return eT(this,e).get(e)},eC.prototype.has=function(e){return eT(this,e).has(e)},eC.prototype.set=function(e,t){return eT(this,e).set(e,t),this},eM.prototype.clear=function(){this.__data__=new eI},eM.prototype.delete=function(e){return this.__data__.delete(e)},eM.prototype.get=function(e){return this.__data__.get(e)},eM.prototype.has=function(e){return this.__data__.has(e)},eM.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eI){var n=r.__data__;if(!eh||n.length<199)return n.push([e,t]),this;r=this.__data__=new eC(n)}return r.set(e,t),this};var eN=el?W(el,Object):function(){return[]},eB=function(e){return ee.call(e)};function eU(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function eL(e){if(null!=e){try{return Z.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function eR(e,t){return e===t||e!=e&&t!=t}(ef&&eB(new ef(new ArrayBuffer(1)))!=b||eh&&eB(new eh)!=c||ep&&eB(ep.resolve())!=h||em&&eB(new em)!=m||eg&&eB(new eg)!=D)&&(eB=function(e){var t=ee.call(e),r=t==f?e.constructor:void 0,n=r?eL(r):void 0;if(n)switch(n){case eD:return b;case ev:return c;case eb:return h;case eS:return m;case eE:return D}return t});var ej=Array.isArray;function eV(e){var t;return null!=e&&"number"==typeof(t=e.length)&&t>-1&&t%1==0&&t<=0x1fffffffffffff&&!e$(e)}var eY=ec||function(){return!1};function e$(e){var t=ez(e)?ee.call(e):"";return t==u||t==l}function ez(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function eW(e){return eV(e)?function(e){var t,r,n,i,o,s=ej(e)||(n=r=t=e)&&"object"==typeof n&&eV(r)&&Q.call(t,"callee")&&(!es.call(t,"callee")||ee.call(t)==a)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],u=s.length,l=!!u;for(var c in e){Q.call(e,c)&&!(l&&("length"==c||(i=c,(o=null==(o=u)?0x1fffffffffffff:o)&&("number"==typeof i||O.test(i))&&i>-1&&i%1==0&&i<o)))&&s.push(c)}return s}(e):function(e){if(!eU(e))return ed(e);var t=[];for(var r in Object(e))Q.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return function e(t,r,n,i,h,D,P){if(i&&(O=D?i(t,h,D,P):i(t)),void 0!==O)return O;if(!ez(t))return t;var O,k=ej(t);if(k){if(B=(N=t).length,U=N.constructor(B),B&&"string"==typeof N[0]&&Q.call(N,"index")&&(U.index=N.index,U.input=N.input),O=U,!r){var N,B,U,L=t,R=O,W=-1,G=L.length;for(R||(R=Array(G));++W<G;)R[W]=L[W];return R}}else{var q,X,K,J,Z,ee=eB(t),et=ee==u||ee==l;if(eY(t)){var er=t,en=r;if(en)return er.slice();var ei=new er.constructor(er.length);return er.copy(ei),ei}if(ee==f||ee==a||et&&!D){if($(t))return D?t:{};if(O="function"!=typeof(q=et?{}:t).constructor||eU(q)?{}:ez(X=ea(q))?eo(X):{},!r){return K=t,J=(Z=O)&&eO(t,eW(t),Z),eO(K,eN(K),J)}}else{if(!T[ee])return D?t:{};O=function(e,t,r,n){var i,a,u,l=e.constructor;switch(t){case v:return eP(e);case o:case s:return new l(+e);case b:return i=n?eP(e.buffer):e.buffer,new e.constructor(i,e.byteOffset,e.byteLength);case S:case E:case w:case _:case A:case I:case C:case M:case x:return a=n?eP(e.buffer):e.buffer,new e.constructor(a,e.byteOffset,e.length);case c:return Y(n?r(z(e),!0):z(e),j,new e.constructor);case d:case g:return new l(e);case p:return(u=new e.constructor(e.source,F.exec(e))).lastIndex=e.lastIndex,u;case m:return Y(n?r(H(e),!0):H(e),V,new e.constructor);case y:return e_?Object(e_.call(e)):{}}}(t,ee,e,r)}}P||(P=new eM);var es=P.get(t);if(es)return es;if(P.set(t,O),!k)var eu=n?function(e){var t;return t=eW(e),ej(e)?t:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(t,eN(e))}(t):eW(t);return!function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););}(eu||t,function(a,o){eu&&(a=t[o=a]),ex(O,o,e(a,r,n,i,o,t,P))}),O}(e,!0,!0)}},867(e,t,r){e=r.nmd(e),e.exports=function(){"use strict";function t(){return V.apply(null,arguments)}function n(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e){var t;if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(t in e)if(a(e,t))return!1;return!0}function s(e){return void 0===e}function u(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function l(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function c(e,t){var r,n=[],i=e.length;for(r=0;r<i;++r)n.push(t(e[r],r));return n}function d(e,t){for(var r in t)a(t,r)&&(e[r]=t[r]);return a(t,"toString")&&(e.toString=t.toString),a(t,"valueOf")&&(e.valueOf=t.valueOf),e}function f(e,t,r,n){return ta(e,t,r,n,!0).utc()}function h(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function p(e){var t=null,r=!1,n=e._d&&!isNaN(e._d.getTime());return(n&&(t=h(e),r=Y.call(t.parsedDateParts,function(e){return null!=e}),n=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&r),e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)),null!=Object.isFrozen&&Object.isFrozen(e))?n:(e._isValid=n,e._isValid)}function m(e){var t=f(NaN);return null!=e?d(h(t),e):h(t).userInvalidated=!0,t}Y=Array.prototype.some?Array.prototype.some:function(e){var t,r=Object(this),n=r.length>>>0;for(t=0;t<n;t++)if(t in r&&e.call(this,r[t],t,r))return!0;return!1};var g,y,D=t.momentProperties=[],v=!1;function b(e,t){var r,n,i,a=D.length;if(s(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),s(t._i)||(e._i=t._i),s(t._f)||(e._f=t._f),s(t._l)||(e._l=t._l),s(t._strict)||(e._strict=t._strict),s(t._tzm)||(e._tzm=t._tzm),s(t._isUTC)||(e._isUTC=t._isUTC),s(t._offset)||(e._offset=t._offset),s(t._pf)||(e._pf=h(t)),s(t._locale)||(e._locale=t._locale),a>0)for(r=0;r<a;r++)s(i=t[n=D[r]])||(e[n]=i);return e}function S(e){b(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===v&&(v=!0,t.updateOffset(this),v=!1)}function E(e){return e instanceof S||null!=e&&null!=e._isAMomentObject}function w(e){!1===t.suppressDeprecationWarnings&&"u">typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function _(e,r){var n=!0;return d(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),n){var i,o,s,u=[],l=arguments.length;for(o=0;o<l;o++){if(i="","object"==typeof arguments[o]){for(s in i+="\n["+o+"] ",arguments[0])a(arguments[0],s)&&(i+=s+": "+arguments[0][s]+", ");i=i.slice(0,-2)}else i=arguments[o];u.push(i)}w(e+"\nArguments: "+Array.prototype.slice.call(u).join("")+"\n"+Error().stack),n=!1}return r.apply(this,arguments)},r)}var A={};function I(e,r){null!=t.deprecationHandler&&t.deprecationHandler(e,r),A[e]||(w(r),A[e]=!0)}function C(e){return"u">typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function M(e,t){var r,n=d({},e);for(r in t)a(t,r)&&(i(e[r])&&i(t[r])?(n[r]={},d(n[r],e[r]),d(n[r],t[r])):null!=t[r]?n[r]=t[r]:delete n[r]);for(r in e)a(e,r)&&!a(t,r)&&i(e[r])&&(n[r]=d({},n[r]));return n}function x(e){null!=e&&this.set(e)}function F(e,t,r){var n=""+Math.abs(e);return(e>=0?r?"+":"":"-")+Math.pow(10,Math.max(0,t-n.length)).toString().substr(1)+n}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var P=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,O=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,T={},k={};function N(e,t,r,n){var i=n;"string"==typeof n&&(i=function(){return this[n]()}),e&&(k[e]=i),t&&(k[t[0]]=function(){return F(i.apply(this,arguments),t[1],t[2])}),r&&(k[r]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function B(e,t){return e.isValid()?(T[t=U(t,e.localeData())]=T[t]||function(e){var t,r,n,i=e.match(P);for(r=0,n=i.length;r<n;r++)k[i[r]]?i[r]=k[i[r]]:i[r]=(t=i[r]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(t){var r,a="";for(r=0;r<n;r++)a+=C(i[r])?i[r].call(t,e):i[r];return a}}(t),T[t](e)):e.localeData().invalidDate()}function U(e,t){var r=5;function n(e){return t.longDateFormat(e)||e}for(O.lastIndex=0;r>=0&&O.test(e);)e=e.replace(O,n),O.lastIndex=0,r-=1;return e}var L={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function R(e){return"string"==typeof e?L[e]||L[e.toLowerCase()]:void 0}function j(e){var t,r,n={};for(r in e)a(e,r)&&(t=R(r))&&(n[t]=e[r]);return n}var V,Y,$,z={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1},W=Object.keys?Object.keys:function(e){var t,r=[];for(t in e)a(e,t)&&r.push(t);return r},H=/\d/,G=/\d\d/,q=/\d{3}/,X=/\d{4}/,K=/[+-]?\d{6}/,J=/\d\d?/,Z=/\d\d\d\d?/,Q=/\d\d\d\d\d\d?/,ee=/\d{1,3}/,et=/\d{1,4}/,er=/[+-]?\d{1,6}/,en=/\d+/,ei=/[+-]?\d+/,ea=/Z|[+-]\d\d:?\d\d/gi,eo=/Z|[+-]\d\d(?::?\d\d)?/gi,es=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,eu=/^[1-9]\d?/,el=/^([1-9]\d|\d)/;function ec(e,t,r){$[e]=C(t)?t:function(e,n){return e&&r?r:t}}function ed(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ef(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function eh(e){var t=+e,r=0;return 0!==t&&isFinite(t)&&(r=ef(t)),r}$={};var ep={};function em(e,t){var r,n,i=t;for("string"==typeof e&&(e=[e]),u(t)&&(i=function(e,r){r[t]=eh(e)}),n=e.length,r=0;r<n;r++)ep[e[r]]=i}function eg(e,t){em(e,function(e,r,n,i){n._w=n._w||{},t(e,n._w,n,i)})}function ey(e){return e%4==0&&e%100!=0||e%400==0}function eD(e){return ey(e)?366:365}N("Y",0,0,function(){var e=this.year();return e<=9999?F(e,4):"+"+e}),N(0,["YY",2],0,function(){return this.year()%100}),N(0,["YYYY",4],0,"year"),N(0,["YYYYY",5],0,"year"),N(0,["YYYYYY",6,!0],0,"year"),ec("Y",ei),ec("YY",J,G),ec("YYYY",et,X),ec("YYYYY",er,K),ec("YYYYYY",er,K),em(["YYYYY","YYYYYY"],0),em("YYYY",function(e,r){r[0]=2===e.length?t.parseTwoDigitYear(e):eh(e)}),em("YY",function(e,r){r[0]=t.parseTwoDigitYear(e)}),em("Y",function(e,t){t[0]=parseInt(e,10)}),t.parseTwoDigitYear=function(e){return eh(e)+(eh(e)>68?1900:2e3)};var ev=eb("FullYear",!0);function eb(e,r){return function(n){return null!=n?(eE(this,e,n),t.updateOffset(this,r),this):eS(this,e)}}function eS(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function eE(e,t,r){var n,i,a,o;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,i=e._isUTC,t){case"Milliseconds":return void(i?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(i?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(i?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(i?n.setUTCHours(r):n.setHours(r));case"Date":return void(i?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}a=e.month(),o=29!==(o=e.date())||1!==a||ey(r)?o:28,i?n.setUTCFullYear(r,a,o):n.setFullYear(r,a,o)}}function ew(e,t){if(isNaN(e)||isNaN(t))return NaN;var r=(t%12+12)%12;return e+=(t-r)/12,1===r?ey(e)?29:28:31-r%7%2}e$=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return -1},N("M",["MM",2],"Mo",function(){return this.month()+1}),N("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),N("MMMM",0,0,function(e){return this.localeData().months(this,e)}),ec("M",J,eu),ec("MM",J,G),ec("MMM",function(e,t){return t.monthsShortRegex(e)}),ec("MMMM",function(e,t){return t.monthsRegex(e)}),em(["M","MM"],function(e,t){t[1]=eh(e)-1}),em(["MMM","MMMM"],function(e,t,r,n){var i=r._locale.monthsParse(e,n,r._strict);null!=i?t[1]=i:h(r).invalidMonth=e});var e_="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),eA=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;function eI(e,t,r){var n,i,a,o=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],n=0;n<12;++n)a=f([2e3,n]),this._shortMonthsParse[n]=this.monthsShort(a,"").toLocaleLowerCase(),this._longMonthsParse[n]=this.months(a,"").toLocaleLowerCase();if(r)if("MMM"===t)return -1!==(i=e$.call(this._shortMonthsParse,o))?i:null;else return -1!==(i=e$.call(this._longMonthsParse,o))?i:null;return"MMM"===t?-1!==(i=e$.call(this._shortMonthsParse,o))||-1!==(i=e$.call(this._longMonthsParse,o))?i:null:-1!==(i=e$.call(this._longMonthsParse,o))||-1!==(i=e$.call(this._shortMonthsParse,o))?i:null}function eC(e,t){if(!e.isValid())return e;if("string"==typeof t){if(/^\d+$/.test(t))t=eh(t);else if(!u(t=e.localeData().monthsParse(t)))return e}var r=t,n=e.date();return n=n<29?n:Math.min(n,ew(e.year(),r)),e._isUTC?e._d.setUTCMonth(r,n):e._d.setMonth(r,n),e}function eM(e){return null!=e?(eC(this,e),t.updateOffset(this,!0),this):eS(this,"Month")}function ex(){function e(e,t){return t.length-e.length}var t,r,n,i,a=[],o=[],s=[];for(t=0;t<12;t++)r=f([2e3,t]),n=ed(this.monthsShort(r,"")),i=ed(this.months(r,"")),a.push(n),o.push(i),s.push(i),s.push(n);a.sort(e),o.sort(e),s.sort(e),this._monthsRegex=RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=RegExp("^("+o.join("|")+")","i"),this._monthsShortStrictRegex=RegExp("^("+a.join("|")+")","i")}function eF(e,t,r,n,i,a,o){var s;return e<100&&e>=0?isFinite((s=new Date(e+400,t,r,n,i,a,o)).getFullYear())&&s.setFullYear(e):s=new Date(e,t,r,n,i,a,o),s}function eP(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,isFinite((t=new Date(Date.UTC.apply(null,r))).getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function eO(e,t,r){var n=7+t-r;return-((7+eP(e,0,n).getUTCDay()-t)%7)+n-1}function eT(e,t,r,n,i){var a,o,s=1+7*(t-1)+(7+r-n)%7+eO(e,n,i);return s<=0?o=eD(a=e-1)+s:s>eD(e)?(a=e+1,o=s-eD(e)):(a=e,o=s),{year:a,dayOfYear:o}}function ek(e,t,r){var n,i,a=eO(e.year(),t,r),o=Math.floor((e.dayOfYear()-a-1)/7)+1;return o<1?n=o+eN(i=e.year()-1,t,r):o>eN(e.year(),t,r)?(n=o-eN(e.year(),t,r),i=e.year()+1):(i=e.year(),n=o),{week:n,year:i}}function eN(e,t,r){var n=eO(e,t,r),i=eO(e+1,t,r);return(eD(e)-n+i)/7}function eB(e,t){return e.slice(t,7).concat(e.slice(0,t))}N("w",["ww",2],"wo","week"),N("W",["WW",2],"Wo","isoWeek"),ec("w",J,eu),ec("ww",J,G),ec("W",J,eu),ec("WW",J,G),eg(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=eh(e)}),N("d",0,"do","day"),N("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),N("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),N("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),N("e",0,0,"weekday"),N("E",0,0,"isoWeekday"),ec("d",J),ec("e",J),ec("E",J),ec("dd",function(e,t){return t.weekdaysMinRegex(e)}),ec("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ec("dddd",function(e,t){return t.weekdaysRegex(e)}),eg(["dd","ddd","dddd"],function(e,t,r,n){var i=r._locale.weekdaysParse(e,n,r._strict);null!=i?t.d=i:h(r).invalidWeekday=e}),eg(["d","e","E"],function(e,t,r,n){t[n]=eh(e)});var eU="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");function eL(e,t,r){var n,i,a,o=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)a=f([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(a,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(a,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(a,"").toLocaleLowerCase();if(r)if("dddd"===t)return -1!==(i=e$.call(this._weekdaysParse,o))?i:null;else if("ddd"===t)return -1!==(i=e$.call(this._shortWeekdaysParse,o))?i:null;else return -1!==(i=e$.call(this._minWeekdaysParse,o))?i:null;return"dddd"===t?-1!==(i=e$.call(this._weekdaysParse,o))||-1!==(i=e$.call(this._shortWeekdaysParse,o))||-1!==(i=e$.call(this._minWeekdaysParse,o))?i:null:"ddd"===t?-1!==(i=e$.call(this._shortWeekdaysParse,o))||-1!==(i=e$.call(this._weekdaysParse,o))||-1!==(i=e$.call(this._minWeekdaysParse,o))?i:null:-1!==(i=e$.call(this._minWeekdaysParse,o))||-1!==(i=e$.call(this._weekdaysParse,o))||-1!==(i=e$.call(this._shortWeekdaysParse,o))?i:null}function eR(){function e(e,t){return t.length-e.length}var t,r,n,i,a,o=[],s=[],u=[],l=[];for(t=0;t<7;t++)r=f([2e3,1]).day(t),n=ed(this.weekdaysMin(r,"")),i=ed(this.weekdaysShort(r,"")),a=ed(this.weekdays(r,"")),o.push(n),s.push(i),u.push(a),l.push(n),l.push(i),l.push(a);o.sort(e),s.sort(e),u.sort(e),l.sort(e),this._weekdaysRegex=RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=RegExp("^("+o.join("|")+")","i")}function ej(){return this.hours()%12||12}function eV(e,t){N(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function eY(e,t){return t._meridiemParse}N("H",["HH",2],0,"hour"),N("h",["hh",2],0,ej),N("k",["kk",2],0,function(){return this.hours()||24}),N("hmm",0,0,function(){return""+ej.apply(this)+F(this.minutes(),2)}),N("hmmss",0,0,function(){return""+ej.apply(this)+F(this.minutes(),2)+F(this.seconds(),2)}),N("Hmm",0,0,function(){return""+this.hours()+F(this.minutes(),2)}),N("Hmmss",0,0,function(){return""+this.hours()+F(this.minutes(),2)+F(this.seconds(),2)}),eV("a",!0),eV("A",!1),ec("a",eY),ec("A",eY),ec("H",J,el),ec("h",J,eu),ec("k",J,eu),ec("HH",J,G),ec("hh",J,G),ec("kk",J,G),ec("hmm",Z),ec("hmmss",Q),ec("Hmm",Z),ec("Hmmss",Q),em(["H","HH"],3),em(["k","kk"],function(e,t,r){var n=eh(e);t[3]=24===n?0:n}),em(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e}),em(["h","hh"],function(e,t,r){t[3]=eh(e),h(r).bigHour=!0}),em("hmm",function(e,t,r){var n=e.length-2;t[3]=eh(e.substr(0,n)),t[4]=eh(e.substr(n)),h(r).bigHour=!0}),em("hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=eh(e.substr(0,n)),t[4]=eh(e.substr(n,2)),t[5]=eh(e.substr(i)),h(r).bigHour=!0}),em("Hmm",function(e,t,r){var n=e.length-2;t[3]=eh(e.substr(0,n)),t[4]=eh(e.substr(n))}),em("Hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=eh(e.substr(0,n)),t[4]=eh(e.substr(n,2)),t[5]=eh(e.substr(i))});var e$,ez,eW=eb("Hours",!0),eH={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:e_,week:{dow:0,doy:6},weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysShort:eU,meridiemParse:/[ap]\.?m?\.?/i},eG={},eq={};function eX(e){return e?e.toLowerCase().replace("_","-"):e}function eK(t){var n=null;if(void 0===eG[t]&&e&&e.exports&&t&&t.match("^[^/\\\\]*$"))try{n=ez._abbr,r(118)("./locale/"+t),eJ(n)}catch(e){eG[t]=null}return eG[t]}function eJ(e,t){var r;return e&&((r=s(t)?eQ(e):eZ(e,t))?ez=r:"u">typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ez._abbr}function eZ(e,t){if(null===t)return delete eG[e],null;var r,n=eH;if(t.abbr=e,null!=eG[e])I("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=eG[e]._config;else if(null!=t.parentLocale)if(null!=eG[t.parentLocale])n=eG[t.parentLocale]._config;else{if(null==(r=eK(t.parentLocale)))return eq[t.parentLocale]||(eq[t.parentLocale]=[]),eq[t.parentLocale].push({name:e,config:t}),null;n=r._config}return eG[e]=new x(M(n,t)),eq[e]&&eq[e].forEach(function(e){eZ(e.name,e.config)}),eJ(e),eG[e]}function eQ(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ez;if(!n(e)){if(t=eK(e))return t;e=[e]}return function(e){for(var t,r,n,i,a=0;a<e.length;){for(t=(i=eX(e[a]).split("-")).length,r=(r=eX(e[a+1]))?r.split("-"):null;t>0;){if(n=eK(i.slice(0,t).join("-")))return n;if(r&&r.length>=t&&function(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r<n;r+=1)if(e[r]!==t[r])return r;return n}(i,r)>=t-1)break;t--}a++}return ez}(e)}function e0(e){var t,r=e._a;return r&&-2===h(e).overflow&&(t=r[1]<0||r[1]>11?1:r[2]<1||r[2]>ew(r[0],r[1])?2:r[3]<0||r[3]>24||24===r[3]&&(0!==r[4]||0!==r[5]||0!==r[6])?3:r[4]<0||r[4]>59?4:r[5]<0||r[5]>59?5:r[6]<0||r[6]>999?6:-1,h(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),h(e)._overflowWeeks&&-1===t&&(t=7),h(e)._overflowWeekday&&-1===t&&(t=8),h(e).overflow=t),e}var e1=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e2=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e8=/Z|[+-]\d\d(?::?\d\d)?/,e3=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],e4=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],e6=/^\/?Date\((-?\d+)/i,e5=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,e7={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function e9(e){var t,r,n,i,a,o,s=e._i,u=e1.exec(s)||e2.exec(s),l=e3.length,c=e4.length;if(u){for(h(e).iso=!0,t=0,r=l;t<r;t++)if(e3[t][1].exec(u[1])){i=e3[t][0],n=!1!==e3[t][2];break}if(null==i){e._isValid=!1;return}if(u[3]){for(t=0,r=c;t<r;t++)if(e4[t][1].exec(u[3])){a=(u[2]||" ")+e4[t][0];break}if(null==a){e._isValid=!1;return}}if(!n&&null!=a){e._isValid=!1;return}if(u[4])if(e8.exec(u[4]))o="Z";else{e._isValid=!1;return}e._f=i+(a||"")+(o||""),tn(e)}else e._isValid=!1}function te(e){var t,r,n,i,a,o,s,u,l,c,d,f=e5.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(f){if(a=f[4],o=f[3],s=f[2],u=f[5],l=f[6],c=f[7],d=[(t=parseInt(a,10))<=49?2e3+t:t<=999?1900+t:t,e_.indexOf(o),parseInt(s,10),parseInt(u,10),parseInt(l,10)],c&&d.push(parseInt(c,10)),r=f[1],n=d,i=e,r&&eU.indexOf(r)!==new Date(n[0],n[1],n[2]).getDay()&&(h(i).weekdayMismatch=!0,i._isValid=!1,1))return;e._a=d,e._tzm=function(e,t,r){if(e)return e7[e];if(t)return 0;var n=parseInt(r,10),i=n%100;return(n-i)/100*60+i}(f[8],f[9],f[10]),e._d=eP.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),h(e).rfc2822=!0}else e._isValid=!1}function tt(e,t,r){return null!=e?e:null!=t?t:r}function tr(e){var r,n,i,a,o,s,u,l,c,d,f,p,m,g,y,D,v=[];if(!e._d){for(f=new Date(t.now()),g=e._useUTC?[f.getUTCFullYear(),f.getUTCMonth(),f.getUTCDate()]:[f.getFullYear(),f.getMonth(),f.getDate()],e._w&&null==e._a[2]&&null==e._a[1]&&(null!=(n=(r=e)._w).GG||null!=n.W||null!=n.E?(s=1,u=4,i=tt(n.GG,r._a[0],ek(to(),1,4).year),a=tt(n.W,1),((o=tt(n.E,1))<1||o>7)&&(c=!0)):(s=r._locale._week.dow,u=r._locale._week.doy,d=ek(to(),s,u),i=tt(n.gg,r._a[0],d.year),a=tt(n.w,d.week),null!=n.d?((o=n.d)<0||o>6)&&(c=!0):null!=n.e?(o=n.e+s,(n.e<0||n.e>6)&&(c=!0)):o=s),a<1||a>eN(i,s,u)?h(r)._overflowWeeks=!0:null!=c?h(r)._overflowWeekday=!0:(l=eT(i,a,o,s,u),r._a[0]=l.year,r._dayOfYear=l.dayOfYear)),null!=e._dayOfYear&&(D=tt(e._a[0],g[0]),(e._dayOfYear>eD(D)||0===e._dayOfYear)&&(h(e)._overflowDayOfYear=!0),m=eP(D,0,e._dayOfYear),e._a[1]=m.getUTCMonth(),e._a[2]=m.getUTCDate()),p=0;p<3&&null==e._a[p];++p)e._a[p]=v[p]=g[p];for(;p<7;p++)e._a[p]=v[p]=null==e._a[p]?+(2===p):e._a[p];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?eP:eF).apply(null,v),y=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==y&&(h(e).weekdayMismatch=!0)}}function tn(e){if(e._f===t.ISO_8601)return void e9(e);if(e._f===t.RFC_2822)return void te(e);e._a=[],h(e).empty=!0;var r,n,i,o,s,u,l,c,d,f,p,m=""+e._i,g=m.length,y=0;for(p=(l=U(e._f,e._locale).match(P)||[]).length,s=0;s<p;s++)if(c=l[s],(u=(m.match(!a($,c)?new RegExp(ed(c.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,r,n,i){return t||r||n||i}))):$[c](e._strict,e._locale))||[])[0])&&((d=m.substr(0,m.indexOf(u))).length>0&&h(e).unusedInput.push(d),m=m.slice(m.indexOf(u)+u.length),y+=u.length),k[c])u?h(e).empty=!1:h(e).unusedTokens.push(c),null!=u&&a(ep,c)&&ep[c](u,e._a,e,c);else e._strict&&!u&&h(e).unusedTokens.push(c);h(e).charsLeftOver=g-y,m.length>0&&h(e).unusedInput.push(m),e._a[3]<=12&&!0===h(e).bigHour&&e._a[3]>0&&(h(e).bigHour=void 0),h(e).parsedDateParts=e._a.slice(0),h(e).meridiem=e._meridiem,e._a[3]=(r=e._locale,n=e._a[3],null==(i=e._meridiem)?n:null!=r.meridiemHour?r.meridiemHour(n,i):(null!=r.isPM&&((o=r.isPM(i))&&n<12&&(n+=12),o||12!==n||(n=0)),n)),null!==(f=h(e).era)&&(e._a[0]=e._locale.erasConvertYear(f,e._a[0])),tr(e),e0(e)}function ti(e){var r=e._i,a=e._f;return(e._locale=e._locale||eQ(e._l),null===r||void 0===a&&""===r)?m({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),E(r))?new S(e0(r)):(l(r)?e._d=r:n(a)?!function(e){var t,r,n,i,a,o,s=!1,u=e._f.length;if(0===u){h(e).invalidFormat=!0,e._d=new Date(NaN);return}for(i=0;i<u;i++)a=0,o=!1,t=b({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],tn(t),p(t)&&(o=!0),a+=h(t).charsLeftOver,a+=10*h(t).unusedTokens.length,h(t).score=a,s?a<n&&(n=a,r=t):(null==n||a<n||o)&&(n=a,r=t,o&&(s=!0));d(e,r||t)}(e):a?tn(e):function(e){var r=e._i;if(s(r))e._d=new Date(t.now());else if(l(r))e._d=new Date(r.valueOf());else if("string"==typeof r)!function(e){var r=e6.exec(e._i);if(null!==r){e._d=new Date(+r[1]);return}e9(e),!1!==e._isValid||(delete e._isValid,te(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:t.createFromInputFallback(e)))}(e);else if(n(r))e._a=c(r.slice(0),function(e){return parseInt(e,10)}),tr(e);else if(i(r)){if(!e._d){var a=j(e._i),o=void 0===a.day?a.date:a.day;e._a=c([a.year,a.month,o,a.hour,a.minute,a.second,a.millisecond],function(e){return e&&parseInt(e,10)}),tr(e)}}else u(r)?e._d=new Date(r):t.createFromInputFallback(e)}(e),p(e)||(e._d=null),e)}function ta(e,t,r,a,s){var u,l={};return(!0===t||!1===t)&&(a=t,t=void 0),(!0===r||!1===r)&&(a=r,r=void 0),(i(e)&&o(e)||n(e)&&0===e.length)&&(e=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=s,l._l=r,l._i=e,l._f=t,l._strict=a,(u=new S(e0(ti(l))))._nextDay&&(u.add(1,"d"),u._nextDay=void 0),u}function to(e,t,r,n){return ta(e,t,r,n,!1)}t.createFromInputFallback=_("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),t.ISO_8601=function(){},t.RFC_2822=function(){};var ts=_("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=to.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:m()}),tu=_("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=to.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:m()});function tl(e,t){var r,i;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return to();for(r=t[0],i=1;i<t.length;++i)(!t[i].isValid()||t[i][e](r))&&(r=t[i]);return r}var tc=["year","quarter","month","week","day","hour","minute","second","millisecond"];function td(e){var t=j(e),r=t.year||0,n=t.quarter||0,i=t.month||0,o=t.week||t.isoWeek||0,s=t.day||0,u=t.hour||0,l=t.minute||0,c=t.second||0,d=t.millisecond||0;this._isValid=function(e){var t,r,n=!1,i=tc.length;for(t in e)if(a(e,t)&&!(-1!==e$.call(tc,t)&&(null==e[t]||!isNaN(e[t]))))return!1;for(r=0;r<i;++r)if(e[tc[r]]){if(n)return!1;parseFloat(e[tc[r]])!==eh(e[tc[r]])&&(n=!0)}return!0}(t),this._milliseconds=+d+1e3*c+6e4*l+1e3*u*3600,this._days=+s+7*o,this._months=+i+3*n+12*r,this._data={},this._locale=eQ(),this._bubble()}function tf(e){return e instanceof td}function th(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function tp(e,t){N(e,0,0,function(){var e=this.utcOffset(),r="+";return e<0&&(e=-e,r="-"),r+F(~~(e/60),2)+t+F(~~e%60,2)})}tp("Z",":"),tp("ZZ",""),ec("Z",eo),ec("ZZ",eo),em(["Z","ZZ"],function(e,t,r){r._useUTC=!0,r._tzm=tg(eo,e)});var tm=/([\+\-]|\d\d)/gi;function tg(e,t){var r,n,i=(t||"").match(e);return null===i?null:0===(n=+(60*(r=((i[i.length-1]||[])+"").match(tm)||["-",0,0])[1])+eh(r[2]))?0:"+"===r[0]?n:-n}function ty(e,r){var n,i;return r._isUTC?(n=r.clone(),i=(E(e)||l(e)?e.valueOf():to(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),t.updateOffset(n,!1),n):to(e).local()}function tD(e){return-Math.round(e._d.getTimezoneOffset())}function tv(){return!!this.isValid()&&this._isUTC&&0===this._offset}t.updateOffset=function(){};var tb=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,tS=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function tE(e,t){var r,n,i,o,s,l,c=e,d=null;return tf(e)?c={ms:e._milliseconds,d:e._days,M:e._months}:u(e)||!isNaN(+e)?(c={},t?c[t]=+e:c.milliseconds=+e):(d=tb.exec(e))?(o="-"===d[1]?-1:1,c={y:0,d:eh(d[2])*o,h:eh(d[3])*o,m:eh(d[4])*o,s:eh(d[5])*o,ms:eh(th(1e3*d[6]))*o}):(d=tS.exec(e))?(o="-"===d[1]?-1:1,c={y:tw(d[2],o),M:tw(d[3],o),w:tw(d[4],o),d:tw(d[5],o),h:tw(d[6],o),m:tw(d[7],o),s:tw(d[8],o)}):null==c?c={}:"object"==typeof c&&("from"in c||"to"in c)&&(r=to(c.from),n=to(c.to),l=r.isValid()&&n.isValid()?(n=ty(n,r),r.isBefore(n)?i=t_(r,n):((i=t_(n,r)).milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0},(c={}).ms=l.milliseconds,c.M=l.months),s=new td(c),tf(e)&&a(e,"_locale")&&(s._locale=e._locale),tf(e)&&a(e,"_isValid")&&(s._isValid=e._isValid),s}function tw(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function t_(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=t-e.clone().add(r.months,"M"),r}function tA(e,t){return function(r,n){var i;return null===n||isNaN(+n)||(I(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=r,r=n,n=i),tI(this,tE(r,n),e),this}}function tI(e,r,n,i){var a=r._milliseconds,o=th(r._days),s=th(r._months);e.isValid()&&(i=null==i||i,s&&eC(e,eS(e,"Month")+s*n),o&&eE(e,"Date",eS(e,"Date")+o*n),a&&e._d.setTime(e._d.valueOf()+a*n),i&&t.updateOffset(e,o||s))}tE.fn=td.prototype,tE.invalid=function(){return tE(NaN)};var tC=tA(1,"add"),tM=tA(-1,"subtract");function tx(e){return"string"==typeof e||e instanceof String}function tF(e,t){if(e.date()<t.date())return-tF(t,e);var r,n=(t.year()-e.year())*12+(t.month()-e.month()),i=e.clone().add(n,"months");return r=t-i<0?(t-i)/(i-e.clone().add(n-1,"months")):(t-i)/(e.clone().add(n+1,"months")-i),-(n+r)||0}function tP(e){var t;return void 0===e?this._locale._abbr:(null!=(t=eQ(e))&&(this._locale=t),this)}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var tO=_("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function tT(){return this._locale}function tk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-126227808e5:new Date(e,t,r).valueOf()}function tN(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-126227808e5:Date.UTC(e,t,r)}function tB(e,t){return t.erasAbbrRegex(e)}function tU(){var e,t,r,n,i,a=[],o=[],s=[],u=[],l=this.eras();for(e=0,t=l.length;e<t;++e)r=ed(l[e].name),n=ed(l[e].abbr),i=ed(l[e].narrow),o.push(r),a.push(n),s.push(i),u.push(r),u.push(n),u.push(i);this._erasRegex=RegExp("^("+u.join("|")+")","i"),this._erasNameRegex=RegExp("^("+o.join("|")+")","i"),this._erasAbbrRegex=RegExp("^("+a.join("|")+")","i"),this._erasNarrowRegex=RegExp("^("+s.join("|")+")","i")}function tL(e,t){N(0,[e,e.length],0,t)}function tR(e,t,r,n,i){var a;return null==e?ek(this,n,i).year:(t>(a=eN(e,n,i))&&(t=a),tj.call(this,e,t,r,n,i))}function tj(e,t,r,n,i){var a=eT(e,t,r,n,i),o=eP(a.year,0,a.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}N("N",0,0,"eraAbbr"),N("NN",0,0,"eraAbbr"),N("NNN",0,0,"eraAbbr"),N("NNNN",0,0,"eraName"),N("NNNNN",0,0,"eraNarrow"),N("y",["y",1],"yo","eraYear"),N("y",["yy",2],0,"eraYear"),N("y",["yyy",3],0,"eraYear"),N("y",["yyyy",4],0,"eraYear"),ec("N",tB),ec("NN",tB),ec("NNN",tB),ec("NNNN",function(e,t){return t.erasNameRegex(e)}),ec("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),em(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var i=r._locale.erasParse(e,n,r._strict);i?h(r).era=i:h(r).invalidEra=e}),ec("y",en),ec("yy",en),ec("yyy",en),ec("yyyy",en),ec("yo",function(e,t){return t._eraYearOrdinalRegex||en}),em(["y","yy","yyy","yyyy"],0),em(["yo"],function(e,t,r,n){var i;r._locale._eraYearOrdinalRegex&&(i=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[0]=r._locale.eraYearOrdinalParse(e,i):t[0]=parseInt(e,10)}),N(0,["gg",2],0,function(){return this.weekYear()%100}),N(0,["GG",2],0,function(){return this.isoWeekYear()%100}),tL("gggg","weekYear"),tL("ggggg","weekYear"),tL("GGGG","isoWeekYear"),tL("GGGGG","isoWeekYear"),ec("G",ei),ec("g",ei),ec("GG",J,G),ec("gg",J,G),ec("GGGG",et,X),ec("gggg",et,X),ec("GGGGG",er,K),ec("ggggg",er,K),eg(["gggg","ggggg","GGGG","GGGGG"],function(e,t,r,n){t[n.substr(0,2)]=eh(e)}),eg(["gg","GG"],function(e,r,n,i){r[i]=t.parseTwoDigitYear(e)}),N("Q",0,"Qo","quarter"),ec("Q",H),em("Q",function(e,t){t[1]=(eh(e)-1)*3}),N("D",["DD",2],"Do","date"),ec("D",J,eu),ec("DD",J,G),ec("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),em(["D","DD"],2),em("Do",function(e,t){t[2]=eh(e.match(J)[0])});var tV=eb("Date",!0);N("DDD",["DDDD",3],"DDDo","dayOfYear"),ec("DDD",ee),ec("DDDD",q),em(["DDD","DDDD"],function(e,t,r){r._dayOfYear=eh(e)}),N("m",["mm",2],0,"minute"),ec("m",J,el),ec("mm",J,G),em(["m","mm"],4);var tY=eb("Minutes",!1);N("s",["ss",2],0,"second"),ec("s",J,el),ec("ss",J,G),em(["s","ss"],5);var t$=eb("Seconds",!1);for(N("S",0,0,function(){return~~(this.millisecond()/100)}),N(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),N(0,["SSS",3],0,"millisecond"),N(0,["SSSS",4],0,function(){return 10*this.millisecond()}),N(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),N(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),N(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),N(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),N(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),ec("S",ee,H),ec("SS",ee,G),ec("SSS",ee,q),g="SSSS";g.length<=9;g+="S")ec(g,en);function tz(e,t){t[6]=eh(("0."+e)*1e3)}for(g="S";g.length<=9;g+="S")em(g,tz);y=eb("Milliseconds",!1),N("z",0,0,"zoneAbbr"),N("zz",0,0,"zoneName");var tW=S.prototype;function tH(e){return e}tW.add=tC,tW.calendar=function(e,r){if(1==arguments.length)if(arguments[0]){var s,c,d,f;if(s=arguments[0],E(s)||l(s)||tx(s)||u(s)||(d=n(c=s),f=!1,d&&(f=0===c.filter(function(e){return!u(e)&&tx(c)}).length),d&&f)||function(e){var t,r,n=i(e)&&!o(e),s=!1,u=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],l=u.length;for(t=0;t<l;t+=1)r=u[t],s=s||a(e,r);return n&&s}(s)||null==s)e=arguments[0],r=void 0;else(function(e){var t,r,n=i(e)&&!o(e),s=!1,u=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<u.length;t+=1)r=u[t],s=s||a(e,r);return n&&s})(arguments[0])&&(r=arguments[0],e=void 0)}else e=void 0,r=void 0;var h=e||to(),p=ty(h,this).startOf("day"),m=t.calendarFormat(this,p)||"sameElse",g=r&&(C(r[m])?r[m].call(this,h):r[m]);return this.format(g||this.localeData().calendar(m,this,to(h)))},tW.clone=function(){return new S(this)},tW.diff=function(e,t,r){var n,i,a;if(!this.isValid()||!(n=ty(e,this)).isValid())return NaN;switch(i=(n.utcOffset()-this.utcOffset())*6e4,t=R(t)){case"year":a=tF(this,n)/12;break;case"month":a=tF(this,n);break;case"quarter":a=tF(this,n)/3;break;case"second":a=(this-n)/1e3;break;case"minute":a=(this-n)/6e4;break;case"hour":a=(this-n)/36e5;break;case"day":a=(this-n-i)/864e5;break;case"week":a=(this-n-i)/6048e5;break;default:a=this-n}return r?a:ef(a)},tW.endOf=function(e){var r,n;if(void 0===(e=R(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tN:tk,e){case"year":r=n(this.year()+1,0,1)-1;break;case"quarter":r=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":r=n(this.year(),this.month()+1,1)-1;break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":r=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":r=this._d.valueOf(),r+=36e5-((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5-1;break;case"minute":r=this._d.valueOf(),r+=6e4-(r%6e4+6e4)%6e4-1;break;case"second":r=this._d.valueOf(),r+=1e3-(r%1e3+1e3)%1e3-1}return this._d.setTime(r),t.updateOffset(this,!0),this},tW.format=function(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var r=B(this,e);return this.localeData().postformat(r)},tW.from=function(e,t){return this.isValid()&&(E(e)&&e.isValid()||to(e).isValid())?tE({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tW.fromNow=function(e){return this.from(to(),e)},tW.to=function(e,t){return this.isValid()&&(E(e)&&e.isValid()||to(e).isValid())?tE({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tW.toNow=function(e){return this.to(to(),e)},tW.get=function(e){return C(this[e=R(e)])?this[e]():this},tW.invalidAt=function(){return h(this).overflow},tW.isAfter=function(e,t){var r=E(e)?e:to(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=R(t)||"millisecond")?this.valueOf()>r.valueOf():r.valueOf()<this.clone().startOf(t).valueOf())},tW.isBefore=function(e,t){var r=E(e)?e:to(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=R(t)||"millisecond")?this.valueOf()<r.valueOf():this.clone().endOf(t).valueOf()<r.valueOf())},tW.isBetween=function(e,t,r,n){var i=E(e)?e:to(e),a=E(t)?t:to(t);return!!(this.isValid()&&i.isValid()&&a.isValid())&&("("===(n=n||"()")[0]?this.isAfter(i,r):!this.isBefore(i,r))&&(")"===n[1]?this.isBefore(a,r):!this.isAfter(a,r))},tW.isSame=function(e,t){var r,n=E(e)?e:to(e);return!!(this.isValid()&&n.isValid())&&("millisecond"===(t=R(t)||"millisecond")?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(t).valueOf()<=r&&r<=this.clone().endOf(t).valueOf()))},tW.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},tW.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},tW.isValid=function(){return p(this)},tW.lang=tO,tW.locale=tP,tW.localeData=tT,tW.max=tu,tW.min=ts,tW.parsingFlags=function(){return d({},h(this))},tW.set=function(e,t){if("object"==typeof e){var r,n=function(e){var t,r=[];for(t in e)a(e,t)&&r.push({unit:t,priority:z[t]});return r.sort(function(e,t){return e.priority-t.priority}),r}(e=j(e)),i=n.length;for(r=0;r<i;r++)this[n[r].unit](e[n[r].unit])}else if(C(this[e=R(e)]))return this[e](t);return this},tW.startOf=function(e){var r,n;if(void 0===(e=R(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tN:tk,e){case"year":r=n(this.year(),0,1);break;case"quarter":r=n(this.year(),this.month()-this.month()%3,1);break;case"month":r=n(this.year(),this.month(),1);break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":r=n(this.year(),this.month(),this.date());break;case"hour":r=this._d.valueOf(),r-=((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5;break;case"minute":r=this._d.valueOf(),r-=(r%6e4+6e4)%6e4;break;case"second":r=this._d.valueOf(),r-=(r%1e3+1e3)%1e3}return this._d.setTime(r),t.updateOffset(this,!0),this},tW.subtract=tM,tW.toArray=function(){return[this.year(),this.month(),this.date(),this.hour(),this.minute(),this.second(),this.millisecond()]},tW.toObject=function(){return{years:this.year(),months:this.month(),date:this.date(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()}},tW.toDate=function(){return new Date(this.valueOf())},tW.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,r=t?this.clone().utc():this;if(0>r.year()||r.year()>9999)return B(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ");if(C(Date.prototype.toISOString))if(t)return this.toDate().toISOString();else return new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",B(r,"Z"));return B(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},tW.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,r,n="moment",i="";return this.isLocal()||(n=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+n+'("]',t=0<=this.year()&&9999>=this.year()?"YYYY":"YYYYYY",r=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+r)},"u">typeof Symbol&&null!=Symbol.for&&(tW[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),tW.toJSON=function(){return this.isValid()?this.toISOString():null},tW.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},tW.unix=function(){return Math.floor(this.valueOf()/1e3)},tW.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},tW.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},tW.eraName=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].name;return""},tW.eraNarrow=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].narrow;return""},tW.eraAbbr=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].abbr;return""},tW.eraYear=function(){var e,r,n,i,a=this.localeData().eras();for(e=0,r=a.length;e<r;++e)if(n=a[e].since<=a[e].until?1:-1,i=this.clone().startOf("day").valueOf(),a[e].since<=i&&i<=a[e].until||a[e].until<=i&&i<=a[e].since)return(this.year()-t(a[e].since).year())*n+a[e].offset;return this.year()},tW.year=ev,tW.isLeapYear=function(){return ey(this.year())},tW.weekYear=function(e){return tR.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)},tW.isoWeekYear=function(e){return tR.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},tW.quarter=tW.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)},tW.month=eM,tW.daysInMonth=function(){return ew(this.year(),this.month())},tW.week=tW.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add((e-t)*7,"d")},tW.isoWeek=tW.isoWeeks=function(e){var t=ek(this,1,4).week;return null==e?t:this.add((e-t)*7,"d")},tW.weeksInYear=function(){var e=this.localeData()._week;return eN(this.year(),e.dow,e.doy)},tW.weeksInWeekYear=function(){var e=this.localeData()._week;return eN(this.weekYear(),e.dow,e.doy)},tW.isoWeeksInYear=function(){return eN(this.year(),1,4)},tW.isoWeeksInISOWeekYear=function(){return eN(this.isoWeekYear(),1,4)},tW.date=tV,tW.day=tW.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,r,n=eS(this,"Day");return null==e?n:(t=e,r=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=r.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-n,"d"))},tW.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},tW.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,r=(t=this.localeData(),"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e);return this.day(this.day()%7?r:r-7)},tW.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},tW.hour=tW.hours=eW,tW.minute=tW.minutes=tY,tW.second=tW.seconds=t$,tW.millisecond=tW.milliseconds=y,tW.utcOffset=function(e,r,n){var i,a=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?a:tD(this);if("string"==typeof e){if(null===(e=tg(eo,e)))return this}else 16>Math.abs(e)&&!n&&(e*=60);return!this._isUTC&&r&&(i=tD(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),a!==e&&(!r||this._changeInProgress?tI(this,tE(e-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this},tW.utc=function(e){return this.utcOffset(0,e)},tW.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(tD(this),"m")),this},tW.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=tg(ea,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},tW.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?to(e).utcOffset():0,(this.utcOffset()-e)%60==0)},tW.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},tW.isLocal=function(){return!!this.isValid()&&!this._isUTC},tW.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},tW.isUtc=tv,tW.isUTC=tv,tW.zoneAbbr=function(){return this._isUTC?"UTC":""},tW.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},tW.dates=_("dates accessor is deprecated. Use date instead.",tV),tW.months=_("months accessor is deprecated. Use month instead",eM),tW.years=_("years accessor is deprecated. Use year instead",ev),tW.zone=_("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),tW.isDSTShifted=_("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!s(this._isDSTShifted))return this._isDSTShifted;var e,t={};return b(t,this),(t=ti(t))._a?(e=t._isUTC?f(t._a):to(t._a),this._isDSTShifted=this.isValid()&&function(e,t){var r,n=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),a=0;for(r=0;r<n;r++)eh(e[r])!==eh(t[r])&&a++;return a+i}(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted});var tG=x.prototype;function tq(e,t,r,n){var i=eQ(),a=f().set(n,t);return i[r](a,e)}function tX(e,t,r){if(u(e)&&(t=e,e=void 0),e=e||"",null!=t)return tq(e,t,r,"month");var n,i=[];for(n=0;n<12;n++)i[n]=tq(e,n,r,"month");return i}function tK(e,t,r,n){"boolean"==typeof e||(r=t=e,e=!1),u(t)&&(r=t,t=void 0),t=t||"";var i,a=eQ(),o=e?a._week.dow:0,s=[];if(null!=r)return tq(t,(r+o)%7,n,"day");for(i=0;i<7;i++)s[i]=tq(t,(i+o)%7,n,"day");return s}tG.calendar=function(e,t,r){var n=this._calendar[e]||this._calendar.sameElse;return C(n)?n.call(t,r):n},tG.longDateFormat=function(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(P).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},tG.invalidDate=function(){return this._invalidDate},tG.ordinal=function(e){return this._ordinal.replace("%d",e)},tG.preparse=tH,tG.postformat=tH,tG.relativeTime=function(e,t,r,n){var i=this._relativeTime[r];return C(i)?i(e,t,r,n):i.replace(/%d/i,e)},tG.pastFuture=function(e,t){var r=this._relativeTime[e>0?"future":"past"];return C(r)?r(t):r.replace(/%s/i,t)},tG.set=function(e){var t,r;for(r in e)a(e,r)&&(C(t=e[r])?this[r]=t:this["_"+r]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},tG.eras=function(e,r){var n,i,a,o=this._eras||eQ("en")._eras;for(n=0,i=o.length;n<i;++n)switch("string"==typeof o[n].since&&(a=t(o[n].since).startOf("day"),o[n].since=a.valueOf()),typeof o[n].until){case"undefined":o[n].until=Infinity;break;case"string":a=t(o[n].until).startOf("day").valueOf(),o[n].until=a.valueOf()}return o},tG.erasParse=function(e,t,r){var n,i,a,o,s,u=this.eras();for(e=e.toUpperCase(),n=0,i=u.length;n<i;++n)if(a=u[n].name.toUpperCase(),o=u[n].abbr.toUpperCase(),s=u[n].narrow.toUpperCase(),r)switch(t){case"N":case"NN":case"NNN":if(o===e)return u[n];break;case"NNNN":if(a===e)return u[n];break;case"NNNNN":if(s===e)return u[n]}else if([a,o,s].indexOf(e)>=0)return u[n]},tG.erasConvertYear=function(e,r){var n=e.since<=e.until?1:-1;return void 0===r?t(e.since).year():t(e.since).year()+(r-e.offset)*n},tG.erasAbbrRegex=function(e){return a(this,"_erasAbbrRegex")||tU.call(this),e?this._erasAbbrRegex:this._erasRegex},tG.erasNameRegex=function(e){return a(this,"_erasNameRegex")||tU.call(this),e?this._erasNameRegex:this._erasRegex},tG.erasNarrowRegex=function(e){return a(this,"_erasNarrowRegex")||tU.call(this),e?this._erasNarrowRegex:this._erasRegex},tG.months=function(e,t){return e?n(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||eA).test(t)?"format":"standalone"][e.month()]:n(this._months)?this._months:this._months.standalone},tG.monthsShort=function(e,t){return e?n(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[eA.test(t)?"format":"standalone"][e.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},tG.monthsParse=function(e,t,r){var n,i,a;if(this._monthsParseExact)return eI.call(this,e,t,r);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(i=f([2e3,n]),r&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),r||this._monthsParse[n]||(a="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[n]=RegExp(a.replace(".",""),"i")),r&&"MMMM"===t&&this._longMonthsParse[n].test(e))return n;if(r&&"MMM"===t&&this._shortMonthsParse[n].test(e))return n;if(!r&&this._monthsParse[n].test(e))return n}},tG.monthsRegex=function(e){return this._monthsParseExact?(a(this,"_monthsRegex")||ex.call(this),e)?this._monthsStrictRegex:this._monthsRegex:(a(this,"_monthsRegex")||(this._monthsRegex=es),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},tG.monthsShortRegex=function(e){return this._monthsParseExact?(a(this,"_monthsRegex")||ex.call(this),e)?this._monthsShortStrictRegex:this._monthsShortRegex:(a(this,"_monthsShortRegex")||(this._monthsShortRegex=es),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},tG.week=function(e){return ek(e,this._week.dow,this._week.doy).week},tG.firstDayOfYear=function(){return this._week.doy},tG.firstDayOfWeek=function(){return this._week.dow},tG.weekdays=function(e,t){var r=n(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?eB(r,this._week.dow):e?r[e.day()]:r},tG.weekdaysMin=function(e){return!0===e?eB(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},tG.weekdaysShort=function(e){return!0===e?eB(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},tG.weekdaysParse=function(e,t,r){var n,i,a;if(this._weekdaysParseExact)return eL.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=f([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(a="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=RegExp(a.replace(".",""),"i")),r&&"dddd"===t&&this._fullWeekdaysParse[n].test(e))return n;if(r&&"ddd"===t&&this._shortWeekdaysParse[n].test(e))return n;if(r&&"dd"===t&&this._minWeekdaysParse[n].test(e))return n;else if(!r&&this._weekdaysParse[n].test(e))return n}},tG.weekdaysRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||eR.call(this),e)?this._weekdaysStrictRegex:this._weekdaysRegex:(a(this,"_weekdaysRegex")||(this._weekdaysRegex=es),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},tG.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||eR.call(this),e)?this._weekdaysShortStrictRegex:this._weekdaysShortRegex:(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=es),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},tG.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||eR.call(this),e)?this._weekdaysMinStrictRegex:this._weekdaysMinRegex:(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=es),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},tG.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},tG.meridiem=function(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"},eJ("en",{eras:[{since:"0001-01-01",until:Infinity,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=1===eh(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+r}}),t.lang=_("moment.lang is deprecated. Use moment.locale instead.",eJ),t.langData=_("moment.langData is deprecated. Use moment.localeData instead.",eQ);var tJ=Math.abs;function tZ(e,t,r,n){var i=tE(t,r);return e._milliseconds+=n*i._milliseconds,e._days+=n*i._days,e._months+=n*i._months,e._bubble()}function tQ(e){return e<0?Math.floor(e):Math.ceil(e)}function t0(e){return 4800*e/146097}function t1(e){return 146097*e/4800}function t2(e){return function(){return this.as(e)}}var t8=t2("ms"),t3=t2("s"),t4=t2("m"),t6=t2("h"),t5=t2("d"),t7=t2("w"),t9=t2("M"),re=t2("Q"),rt=t2("y");function rr(e){return function(){return this.isValid()?this._data[e]:NaN}}var rn=rr("milliseconds"),ri=rr("seconds"),ra=rr("minutes"),ro=rr("hours"),rs=rr("days"),ru=rr("months"),rl=rr("years"),rc=Math.round,rd={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function rf(e,t,r,n,i){return i.relativeTime(t||1,!!r,e,n)}var rh=Math.abs;function rp(e){return(e>0)-(e<0)||+e}function rm(){if(!this.isValid())return this.localeData().invalidDate();var e,t,r,n,i,a,o,s,u=rh(this._milliseconds)/1e3,l=rh(this._days),c=rh(this._months),d=this.asSeconds();return d?(e=ef(u/60),t=ef(e/60),u%=60,e%=60,r=ef(c/12),c%=12,n=u?u.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",a=rp(this._months)!==rp(d)?"-":"",o=rp(this._days)!==rp(d)?"-":"",s=rp(this._milliseconds)!==rp(d)?"-":"",i+"P"+(r?a+r+"Y":"")+(c?a+c+"M":"")+(l?o+l+"D":"")+(t||e||u?"T":"")+(t?s+t+"H":"")+(e?s+e+"M":"")+(u?s+n+"S":"")):"P0D"}var rg=td.prototype;return rg.isValid=function(){return this._isValid},rg.abs=function(){var e=this._data;return this._milliseconds=tJ(this._milliseconds),this._days=tJ(this._days),this._months=tJ(this._months),e.milliseconds=tJ(e.milliseconds),e.seconds=tJ(e.seconds),e.minutes=tJ(e.minutes),e.hours=tJ(e.hours),e.months=tJ(e.months),e.years=tJ(e.years),this},rg.add=function(e,t){return tZ(this,e,t,1)},rg.subtract=function(e,t){return tZ(this,e,t,-1)},rg.as=function(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if("month"===(e=R(e))||"quarter"===e||"year"===e)switch(t=this._days+n/864e5,r=this._months+t0(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(t1(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return 24*t+n/36e5;case"minute":return 1440*t+n/6e4;case"second":return 86400*t+n/1e3;case"millisecond":return Math.floor(864e5*t)+n;default:throw Error("Unknown unit "+e)}},rg.asMilliseconds=t8,rg.asSeconds=t3,rg.asMinutes=t4,rg.asHours=t6,rg.asDays=t5,rg.asWeeks=t7,rg.asMonths=t9,rg.asQuarters=re,rg.asYears=rt,rg.valueOf=t8,rg._bubble=function(){var e,t,r,n,i,a=this._milliseconds,o=this._days,s=this._months,u=this._data;return a>=0&&o>=0&&s>=0||a<=0&&o<=0&&s<=0||(a+=864e5*tQ(t1(s)+o),o=0,s=0),u.milliseconds=a%1e3,u.seconds=(e=ef(a/1e3))%60,u.minutes=(t=ef(e/60))%60,u.hours=(r=ef(t/60))%24,o+=ef(r/24),s+=i=ef(t0(o)),o-=tQ(t1(i)),n=ef(s/12),s%=12,u.days=o,u.months=s,u.years=n,this},rg.clone=function(){return tE(this)},rg.get=function(e){return e=R(e),this.isValid()?this[e+"s"]():NaN},rg.milliseconds=rn,rg.seconds=ri,rg.minutes=ra,rg.hours=ro,rg.days=rs,rg.weeks=function(){return ef(this.days()/7)},rg.months=ru,rg.years=rl,rg.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var r,n,i,a,o,s,u,l,c,d,f,h,p,m=!1,g=rd;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(m=e),"object"==typeof t&&(g=Object.assign({},rd,t),null!=t.s&&null==t.ss&&(g.ss=t.s-1)),h=this.localeData(),r=!m,n=g,i=tE(this).abs(),a=rc(i.as("s")),o=rc(i.as("m")),s=rc(i.as("h")),u=rc(i.as("d")),l=rc(i.as("M")),c=rc(i.as("w")),d=rc(i.as("y")),f=a<=n.ss&&["s",a]||a<n.s&&["ss",a]||o<=1&&["m"]||o<n.m&&["mm",o]||s<=1&&["h"]||s<n.h&&["hh",s]||u<=1&&["d"]||u<n.d&&["dd",u],null!=n.w&&(f=f||c<=1&&["w"]||c<n.w&&["ww",c]),(f=f||l<=1&&["M"]||l<n.M&&["MM",l]||d<=1&&["y"]||["yy",d])[2]=r,f[3]=+this>0,f[4]=h,p=rf.apply(null,f),m&&(p=h.pastFuture(+this,p)),h.postformat(p)},rg.toISOString=rm,rg.toString=rm,rg.toJSON=rm,rg.locale=tP,rg.localeData=tT,rg.toIsoString=_("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",rm),rg.lang=tO,N("X",0,0,"unix"),N("x",0,0,"valueOf"),ec("x",ei),ec("X",/[+-]?\d+(\.\d{1,3})?/),em("X",function(e,t,r){r._d=new Date(1e3*parseFloat(e))}),em("x",function(e,t,r){r._d=new Date(eh(e))}),t.version="2.30.1",V=to,t.fn=tW,t.min=function(){var e=[].slice.call(arguments,0);return tl("isBefore",e)},t.max=function(){var e=[].slice.call(arguments,0);return tl("isAfter",e)},t.now=function(){return Date.now?Date.now():+new Date},t.utc=f,t.unix=function(e){return to(1e3*e)},t.months=function(e,t){return tX(e,t,"months")},t.isDate=l,t.locale=eJ,t.invalid=m,t.duration=tE,t.isMoment=E,t.weekdays=function(e,t,r){return tK(e,t,r,"weekdays")},t.parseZone=function(){return to.apply(null,arguments).parseZone()},t.localeData=eQ,t.isDuration=tf,t.monthsShort=function(e,t){return tX(e,t,"monthsShort")},t.weekdaysMin=function(e,t,r){return tK(e,t,r,"weekdaysMin")},t.defineLocale=eZ,t.updateLocale=function(e,t){if(null!=t){var r,n,i=eH;null!=eG[e]&&null!=eG[e].parentLocale?eG[e].set(M(eG[e]._config,t)):(null!=(n=eK(e))&&(i=n._config),t=M(i,t),null==n&&(t.abbr=e),(r=new x(t)).parentLocale=eG[e],eG[e]=r),eJ(e)}else null!=eG[e]&&(null!=eG[e].parentLocale?(eG[e]=eG[e].parentLocale,e===eJ()&&eJ(e)):null!=eG[e]&&delete eG[e]);return eG[e]},t.locales=function(){return W(eG)},t.weekdaysShort=function(e,t,r){return tK(e,t,r,"weekdaysShort")},t.normalizeUnits=R,t.relativeTimeRounding=function(e){return void 0===e?rc:"function"==typeof e&&(rc=e,!0)},t.relativeTimeThreshold=function(e,t){return void 0!==rd[e]&&(void 0===t?rd[e]:(rd[e]=t,"s"===e&&(rd.ss=t-1),!0))},t.calendarFormat=function(e,t){var r=e.diff(t,"days",!0);return r<-6?"sameElse":r<-1?"lastWeek":r<0?"lastDay":r<1?"sameDay":r<2?"nextDay":r<7?"nextWeek":"sameElse"},t.prototype=tW,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t}()},118(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=118,e.exports=t},681(e){!function(t,r){if(t){for(var n,i={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},a={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},s={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},u=1;u<20;++u)i[111+u]="f"+u;for(u=0;u<=9;++u)i[u+96]=u.toString();h.prototype.bind=function(e,t,r){return e=e instanceof Array?e:[e],this._bindMultiple.call(this,e,t,r),this},h.prototype.unbind=function(e,t){return this.bind.call(this,e,function(){},t)},h.prototype.trigger=function(e,t){return this._directMap[e+":"+t]&&this._directMap[e+":"+t]({},e),this},h.prototype.reset=function(){return this._callbacks={},this._directMap={},this},h.prototype.stopCallback=function(e,t){if((" "+t.className+" ").indexOf(" mousetrap ")>-1||function e(t,n){return null!==t&&t!==r&&(t===n||e(t.parentNode,n))}(t,this.target))return!1;if("composedPath"in e&&"function"==typeof e.composedPath){var n=e.composedPath()[0];n!==e.target&&(t=n)}return"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},h.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},h.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);n=null},h.init=function(){var e=h(r);for(var t in e)"_"!==t.charAt(0)&&(h[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},h.init(),t.Mousetrap=h,e.exports&&(e.exports=h),"function"==typeof define&&define.amd&&define(function(){return h})}function l(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent("on"+t,r)}function c(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return i[e.which]?i[e.which]:a[e.which]?a[e.which]:String.fromCharCode(e.which).toLowerCase()}function d(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function f(e,t){var r,a,u,l,c,f,h=[];for(l="+"===(r=e)?["+"]:(r=r.replace(/\+{2}/g,"+plus")).split("+"),f=0;f<l.length;++f)s[c=l[f]]&&(c=s[c]),t&&"keypress"!=t&&o[c]&&(c=o[c],h.push("shift")),d(c)&&h.push(c);return a=c,(u=t)||(u=function(){if(!n)for(var e in n={},i)e>95&&e<112||i.hasOwnProperty(e)&&(n[i[e]]=e);return n}()[a]?"keydown":"keypress"),"keypress"==u&&h.length&&(u="keydown"),{key:c,modifiers:h,action:t=u}}function h(e){var t,n=this;if(e=e||r,!(n instanceof h))return new h(e);n.target=e,n._callbacks={},n._directMap={};var i={},a=!1,o=!1,s=!1;function u(e){e=e||{};var t,r=!1;for(t in i){if(e[t]){r=!0;continue}i[t]=0}r||(s=!1)}function p(e,t,r,a,o,s){var u,l,c,f,h=[],p=r.type;if(!n._callbacks[e])return[];for("keyup"==p&&d(e)&&(t=[e]),c=0;c<n._callbacks[e].length;++c)if((f=n._callbacks[e][c],a||!f.seq||i[f.seq]==f.level)&&p==f.action&&("keypress"==p&&!r.metaKey&&!r.ctrlKey||(u=t,l=f.modifiers,u.sort().join(",")===l.sort().join(",")))){var m=!a&&f.combo==o,g=a&&f.seq==a&&f.level==s;(m||g)&&n._callbacks[e].splice(c,1),h.push(f)}return h}function m(e,t,r,i){!n.stopCallback(t,t.target||t.srcElement,r,i)&&!1===e(t,r)&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation?t.stopPropagation():t.cancelBubble=!0)}function g(e){"number"!=typeof e.which&&(e.which=e.keyCode);var t,r=c(e);if(r){if("keyup"==e.type&&a===r){a=!1;return}n.handleKey(r,(t=[],e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t),e)}}n._handleKey=function(e,t,r){var n,i=p(e,t,r),a={},l=0,c=!1;for(n=0;n<i.length;++n)i[n].seq&&(l=Math.max(l,i[n].level));for(n=0;n<i.length;++n){if(i[n].seq){if(i[n].level!=l)continue;c=!0,a[i[n].seq]=1,m(i[n].callback,r,i[n].combo,i[n].seq);continue}c||m(i[n].callback,r,i[n].combo)}var f="keypress"==r.type&&o;r.type!=s||d(e)||f||u(a),o=c&&"keydown"==r.type};n._bindMultiple=function(e,r,o){for(var l=0;l<e.length;++l)!function e(r,o,l,d,h){n._directMap[r+":"+l]=o;var g,y=(r=r.replace(/\s+/g," ")).split(" ");y.length>1?function(r,n,o,l){function d(e){m(o,e,r),"keyup"!==l&&(a=c(e)),setTimeout(u,10)}i[r]=0;for(var h=0;h<n.length;++h){var p=h+1===n.length?d:function(e){return function(){s=e,++i[r],clearTimeout(t),t=setTimeout(u,1e3)}}(l||f(n[h+1]).action);e(n[h],p,l,r,h)}}(r,y,o,l):(g=f(r,l),n._callbacks[g.key]=n._callbacks[g.key]||[],p(g.key,g.modifiers,{type:g.action},d,r,h),n._callbacks[g.key][d?"unshift":"push"]({callback:o,modifiers:g.modifiers,action:g.action,seq:d,level:h,combo:r}))}(e[l],r,o)},l(e,"keypress",g),l(e,"keydown",g),l(e,"keyup",g)}}("u">typeof window?window:null,"u">typeof window?document:null)},985(e,t,r){"use strict";let n=r(182),i=r(956),a=r(646),o=r(913);function s(e){if("string"!=typeof e||1!==e.length)throw TypeError("arrayFormatSeparator must be single character string")}function u(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function l(e,t){return t.decode?i(e):e}function c(e){let t=e.indexOf("#");return -1!==t&&(e=e.slice(0,t)),e}function d(e){let t=(e=c(e)).indexOf("?");return -1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):t.parseBooleans&&null!==e&&("true"===e.toLowerCase()||"false"===e.toLowerCase())&&(e="true"===e.toLowerCase()),e}function h(e,t){s((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);let r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{if(t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),!t){n[e]=r;return}void 0===n[e]&&(n[e]={}),n[e][t[1]]=r};case"bracket":return(e,r,n)=>{if(t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),!t){n[e]=r;return}if(void 0===n[e]){n[e]=[r];return}n[e]=[].concat(n[e],r)};case"comma":case"separator":return(t,r,n)=>{let i="string"==typeof r&&r.includes(e.arrayFormatSeparator),a="string"==typeof r&&!i&&l(r,e).includes(e.arrayFormatSeparator);r=a?l(r,e):r;let o=i||a?r.split(e.arrayFormatSeparator).map(t=>l(t,e)):null===r?r:l(r,e);n[t]=o};default:return(e,t,r)=>{if(void 0===r[e]){r[e]=t;return}r[e]=[].concat(r[e],t)}}}(t),n=Object.create(null);if("string"!=typeof e||!(e=e.trim().replace(/^[?#&]/,"")))return n;for(let i of e.split("&")){if(""===i)continue;let[e,o]=a(t.decode?i.replace(/\+/g," "):i,"=");o=void 0===o?null:["comma","separator"].includes(t.arrayFormat)?o:l(o,t),r(l(e,t),o,n)}for(let e of Object.keys(n)){let r=n[e];if("object"==typeof r&&null!==r)for(let e of Object.keys(r))r[e]=f(r[e],t);else n[e]=f(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{let r=n[t];return r&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=d,t.parse=h,t.stringify=(e,t)=>{if(!e)return"";s((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);let r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{let i=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),"[",i,"]"].join("")]:[...r,[u(t,e),"[",u(i,e),"]=",u(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),"[]"].join("")]:[...r,[u(t,e),"[]=",u(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[u(t,e),"=",u(n,e)].join("")]:[[r,u(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,u(t,e)]:[...r,[u(t,e),"=",u(n,e)].join("")]}}(t),i={};for(let t of Object.keys(e))r(t)||(i[t]=e[t]);let a=Object.keys(i);return!1!==t.sort&&a.sort(t.sort),a.map(r=>{let i=e[r];return void 0===i?"":null===i?u(r,t):Array.isArray(i)?i.reduce(n(r),[]).join("&"):u(r,t)+"="+u(i,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);let[r,n]=a(e,"#");return Object.assign({url:r.split("?")[0]||"",query:h(d(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:l(n,t)}:{})},t.stringifyUrl=(e,r)=>{var n;let i,a;r=Object.assign({encode:!0,strict:!0},r);let o=c(e.url).split("?")[0]||"",s=t.extract(e.url),l=Object.assign(t.parse(s,{sort:!1}),e.query),d=t.stringify(l,r);d&&(d=`?${d}`);let f=(n=e.url,i="",-1!==(a=n.indexOf("#"))&&(i=n.slice(a)),i);return e.fragmentIdentifier&&(f=`#${u(e.fragmentIdentifier,r)}`),`${o}${d}${f}`},t.pick=(e,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0},n);let{url:i,query:a,fragmentIdentifier:s}=t.parseUrl(e,n);return t.stringifyUrl({url:i,query:o(a,r),fragmentIdentifier:s},n)},t.exclude=(e,r,n)=>{let i=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return t.pick(e,i,n)}},249(e,t){"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=(Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider")),o=Symbol.for("react.context"),s=(Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.iterator),u={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},l=Object.assign,c={};function d(e,t,r){this.props=e,this.context=t,this.refs=c,this.updater=r||u}function f(){}function h(e,t,r){this.props=e,this.context=t,this.refs=c,this.updater=r||u}d.prototype.isReactComponent={},d.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},d.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},f.prototype=d.prototype;var p=h.prototype=new f;p.constructor=h,l(p,d.prototype),p.isPureReactComponent=!0;var m=Array.isArray,g=Object.prototype.hasOwnProperty,y=null,D={key:!0,ref:!0,__self:!0,__source:!0},v=null;t.Fragment=i,t.createContext=function(e){return(e={$$typeof:o,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:e},e.Consumer=e},t.createElement=function(e,t,n){var i,a={},o=null,s=null;if(null!=t)for(i in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(o=""+t.key),t)g.call(t,i)&&!D.hasOwnProperty(i)&&(a[i]=t[i]);var u=arguments.length-2;if(1===u)a.children=n;else if(1<u){for(var l=Array(u),c=0;c<u;c++)l[c]=arguments[c+2];a.children=l}if(e&&e.defaultProps)for(i in u=e.defaultProps)void 0===a[i]&&(a[i]=u[i]);return{$$typeof:r,type:e,key:o,ref:s,props:a,_owner:y}},t.useCallback=function(e,t){return v.useCallback(e,t)},t.useContext=function(e){return v.useContext(e)},t.useEffect=function(e,t){return v.useEffect(e,t)},t.useMemo=function(e,t){return v.useMemo(e,t)},t.useRef=function(e){return v.useRef(e)},t.useState=function(e){return v.useState(e)}},326(e,t,r){"use strict";e.exports=r(249)},646(e){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];let r=e.indexOf(t);return -1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},182(e){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)},834(e,t,r){(function(e,t,r){"use strict";var n=function(e,t,r){r=i.extend({},i.options,r);var a=i.runValidations(e,t,r);if(a.some(function(e){return i.isPromise(e.error)}))throw Error("Use validate.async if you want support for promises");return n.processValidationResults(a,r)},i=n;i.extend=function(e){return[].slice.call(arguments,1).forEach(function(t){for(var r in t)e[r]=t[r]}),e},i.extend(n,{version:{major:0,minor:12,patch:0,metadata:null,toString:function(){var e=i.format("%{major}.%{minor}.%{patch}",i.version);return i.isEmpty(i.version.metadata)||(e+="+"+i.version.metadata),e}},Promise:"u">typeof Promise?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(e,t,r){var n,a,o,s,u,l,c=[];for(n in(i.isDomElement(e)||i.isJqueryElement(e))&&(e=i.collectFormValues(e)),t)for(a in o=i.getDeepObjectValue(e,n),s=i.result(t[n],o,e,n,r,t)){if(!(u=i.validators[a]))throw Error(i.format("Unknown validator %{name}",{name:a}));l=s[a],(l=i.result(l,o,e,n,r,t))&&c.push({attribute:n,value:o,validator:a,globalOptions:r,attributes:e,options:l,error:u.call(u,o,l,n,e,r)})}return c},processValidationResults:function(e,t){e=i.pruneEmptyErrors(e,t),e=i.expandMultipleErrors(e,t),e=i.convertErrorMessages(e,t);var r=t.format||"grouped";if("function"==typeof i.formatters[r])e=i.formatters[r](e);else throw Error(i.format("Unknown format %{format}",t));return i.isEmpty(e)?void 0:e},async:function(e,t,r){var n=(r=i.extend({},i.async.options,r)).wrapErrors||function(e){return e};!1!==r.cleanAttributes&&(e=i.cleanAttributes(e,t));var a=i.runValidations(e,t,r);return new i.Promise(function(o,s){i.waitForResults(a).then(function(){var u=i.processValidationResults(a,r);u?s(new n(u,r,e,t)):o(e)},function(e){s(e)})})},single:function(e,t,r){return r=i.extend({},i.single.options,r,{format:"flat",fullMessages:!1}),i({single:e},{single:t},r)},waitForResults:function(e){return e.reduce(function(e,t){return i.isPromise(t.error)?e.then(function(){return t.error.then(function(e){t.error=e||null})}):e},new i.Promise(function(e){e()}))},result:function(e){var t=[].slice.call(arguments,1);return"function"==typeof e&&(e=e.apply(null,t)),e},isNumber:function(e){return"number"==typeof e&&!isNaN(e)},isFunction:function(e){return"function"==typeof e},isInteger:function(e){return i.isNumber(e)&&e%1==0},isBoolean:function(e){return"boolean"==typeof e},isObject:function(e){return e===Object(e)},isDate:function(e){return e instanceof Date},isDefined:function(e){return null!=e},isPromise:function(e){return!!e&&i.isFunction(e.then)},isJqueryElement:function(e){return e&&i.isString(e.jquery)},isDomElement:function(e){return!!e&&!!e.querySelectorAll&&!!e.querySelector&&(!!i.isObject(document)&&e===document||("object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName))},isEmpty:function(e){var t;if(!i.isDefined(e))return!0;if(i.isFunction(e))return!1;if(i.isString(e))return i.EMPTY_STRING_REGEXP.test(e);if(i.isArray(e))return 0===e.length;if(i.isDate(e))return!1;if(i.isObject(e)){for(t in e)return!1;return!0}return!1},format:i.extend(function(e,t){return i.isString(e)?e.replace(i.format.FORMAT_REGEXP,function(e,r,n){return"%"===r?"%{"+n+"}":String(t[n])}):e},{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(e){if(i.isNumber(e))if(100*e%1==0)return""+e;else return parseFloat(Math.round(100*e)/100).toFixed(2);return i.isArray(e)?e.map(function(e){return i.prettify(e)}).join(", "):i.isObject(e)?e.toString():(e=""+e).replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,function(e,t,r){return""+t+" "+r.toLowerCase()}).toLowerCase()},stringifyValue:function(e,t){return(t&&t.prettify||i.prettify)(e)},isString:function(e){return"string"==typeof e},isArray:function(e){return"[object Array]"===({}).toString.call(e)},isHash:function(e){return i.isObject(e)&&!i.isArray(e)&&!i.isFunction(e)},contains:function(e,t){return!!i.isDefined(e)&&(i.isArray(e)?-1!==e.indexOf(t):t in e)},unique:function(e){return i.isArray(e)?e.filter(function(e,t,r){return r.indexOf(e)==t}):e},forEachKeyInKeypath:function(e,t,r){if(i.isString(t)){var n,a="",o=!1;for(n=0;n<t.length;++n)switch(t[n]){case".":o?(o=!1,a+="."):(e=r(e,a,!1),a="");break;case"\\":o?(o=!1,a+="\\"):o=!0;break;default:o=!1,a+=t[n]}return r(e,a,!0)}},getDeepObjectValue:function(e,t){if(i.isObject(e))return i.forEachKeyInKeypath(e,t,function(e,t){if(i.isObject(e))return e[t]})},collectFormValues:function(e,t){var r,n,a,o,s,u,l={};if(i.isJqueryElement(e)&&(e=e[0]),!e)return l;for(t=t||{},o=e.querySelectorAll("input[name], textarea[name]"),r=0;r<o.length;++r)a=o.item(r),i.isDefined(a.getAttribute("data-ignored"))||(name=a.name.replace(/\./g,"\\\\."),u=i.sanitizeFormValue(a.value,t),"number"===a.type?u=u?+u:null:"checkbox"===a.type?a.attributes.value?a.checked||(u=l[name]||null):u=a.checked:"radio"!==a.type||a.checked||(u=l[name]||null),l[name]=u);for(o=e.querySelectorAll("select[name]"),r=0;r<o.length;++r)if(a=o.item(r),!i.isDefined(a.getAttribute("data-ignored"))){if(a.multiple)for(n in u=[],a.options)(s=a.options[n])&&s.selected&&u.push(i.sanitizeFormValue(s.value,t));else{var c=void 0!==a.options[a.selectedIndex]?a.options[a.selectedIndex].value:"";u=i.sanitizeFormValue(c,t)}l[a.name]=u}return l},sanitizeFormValue:function(e,t){return(t.trim&&i.isString(e)&&(e=e.trim()),!1!==t.nullify&&""===e)?null:e},capitalize:function(e){return i.isString(e)?e[0].toUpperCase()+e.slice(1):e},pruneEmptyErrors:function(e){return e.filter(function(e){return!i.isEmpty(e.error)})},expandMultipleErrors:function(e){var t=[];return e.forEach(function(e){i.isArray(e.error)?e.error.forEach(function(r){t.push(i.extend({},e,{error:r}))}):t.push(e)}),t},convertErrorMessages:function(e,t){var r=[],n=(t=t||{}).prettify||i.prettify;return e.forEach(function(e){var a=i.result(e.error,e.value,e.attribute,e.options,e.attributes,e.globalOptions);i.isString(a)?("^"===a[0]?a=a.slice(1):!1!==t.fullMessages&&(a=i.capitalize(n(e.attribute))+" "+a),a=a.replace(/\\\^/g,"^"),a=i.format(a,{value:i.stringifyValue(e.value,t)}),r.push(i.extend({},e,{error:a}))):r.push(e)}),r},groupErrorsByAttribute:function(e){var t={};return e.forEach(function(e){var r=t[e.attribute];r?r.push(e):t[e.attribute]=[e]}),t},flattenErrorsToArray:function(e){return e.map(function(e){return e.error}).filter(function(e,t,r){return r.indexOf(e)===t})},cleanAttributes:function(e,t){function r(e,t,r){return i.isObject(e[t])?e[t]:e[t]=!!r||{}}return i.isObject(t)&&i.isObject(e)?function e(t,r){if(!i.isObject(t))return t;var n,a,o=i.extend({},t);for(a in t)n=r[a],i.isObject(n)?o[a]=e(o[a],n):n||delete o[a];return o}(e,t=function(e){var t,n={};for(t in e)e[t]&&i.forEachKeyInKeypath(n,t,r);return n}(t)):{}},exposeModule:function(e,t,r,n,i){r?(n&&n.exports&&(r=n.exports=e),r.validate=e):(t.validate=e,e.isFunction(i)&&i.amd&&i([],function(){return e}))},warn:function(e){"u">typeof console&&console.warn&&console.warn("[validate.js] "+e)},error:function(e){"u">typeof console&&console.error&&console.error("[validate.js] "+e)}}),n.validators={presence:function(e,t){if(!1!==(t=i.extend({},this.options,t)).allowEmpty?!i.isDefined(e):i.isEmpty(e))return t.message||this.message||"can't be blank"},length:function(e,t,r){if(i.isDefined(e)){var n,a=(t=i.extend({},this.options,t)).is,o=t.maximum,s=t.minimum,u=t.tokenizer||function(e){return e},l=[],c=(e=u(e)).length;if(!i.isNumber(c))return i.error(i.format("Attribute %{attr} has a non numeric value for `length`",{attr:r})),t.message||this.notValid||"has an incorrect length";if(i.isNumber(a)&&c!==a&&(n=t.wrongLength||this.wrongLength||"is the wrong length (should be %{count} characters)",l.push(i.format(n,{count:a}))),i.isNumber(s)&&c<s&&(n=t.tooShort||this.tooShort||"is too short (minimum is %{count} characters)",l.push(i.format(n,{count:s}))),i.isNumber(o)&&c>o&&(n=t.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",l.push(i.format(n,{count:o}))),l.length>0)return t.message||l}},numericality:function(e,t,r,n,a){if(i.isDefined(e)){t=i.extend({},this.options,t);var o,s,u=[],l={greaterThan:function(e,t){return e>t},greaterThanOrEqualTo:function(e,t){return e>=t},equalTo:function(e,t){return e===t},lessThan:function(e,t){return e<t},lessThanOrEqualTo:function(e,t){return e<=t},divisibleBy:function(e,t){return e%t==0}},c=t.prettify||a&&a.prettify||i.prettify;if(i.isString(e)&&t.strict){var d="^-?(0|[1-9]\\d*)";if(t.onlyInteger||(d+="(\\.\\d+)?"),!new RegExp(d+="$").test(e))return t.message||t.notValid||this.notValid||this.message||"must be a valid number"}if(!0!==t.noStrings&&i.isString(e)&&!i.isEmpty(e)&&(e*=1),!i.isNumber(e))return t.message||t.notValid||this.notValid||this.message||"is not a number";if(t.onlyInteger&&!i.isInteger(e))return t.message||t.notInteger||this.notInteger||this.message||"must be an integer";for(o in l)if(s=t[o],i.isNumber(s)&&!l[o](e,s)){var f="not"+i.capitalize(o),h=t[f]||this[f]||this.message||"must be %{type} %{count}";u.push(i.format(h,{count:s,type:c(o)}))}if(t.odd&&e%2!=1&&u.push(t.notOdd||this.notOdd||this.message||"must be odd"),t.even&&e%2!=0&&u.push(t.notEven||this.notEven||this.message||"must be even"),u.length)return t.message||u}},datetime:i.extend(function(e,t){if(!i.isFunction(this.parse)||!i.isFunction(this.format))throw Error("Both the parse and format functions needs to be set to use the datetime/date validator");if(i.isDefined(e)){t=i.extend({},this.options,t);var r,n=[],a=t.earliest?this.parse(t.earliest,t):NaN,o=t.latest?this.parse(t.latest,t):NaN;if(isNaN(e=this.parse(e,t))||t.dateOnly&&e%864e5!=0)return r=t.notValid||t.message||this.notValid||"must be a valid date",i.format(r,{value:arguments[0]});if(!isNaN(a)&&e<a&&(r=t.tooEarly||t.message||this.tooEarly||"must be no earlier than %{date}",r=i.format(r,{value:this.format(e,t),date:this.format(a,t)}),n.push(r)),!isNaN(o)&&e>o&&(r=t.tooLate||t.message||this.tooLate||"must be no later than %{date}",r=i.format(r,{date:this.format(o,t),value:this.format(e,t)}),n.push(r)),n.length)return i.unique(n)}},{parse:null,format:null}),date:function(e,t){return t=i.extend({},t,{dateOnly:!0}),i.validators.datetime.call(i.validators.datetime,e,t)},format:function(e,t){(i.isString(t)||t instanceof RegExp)&&(t={pattern:t});var r,n=(t=i.extend({},this.options,t)).message||this.message||"is invalid",a=t.pattern;if(i.isDefined(e)&&(!i.isString(e)||(i.isString(a)&&(a=new RegExp(t.pattern,t.flags)),!(r=a.exec(e))||r[0].length!=e.length)))return n},inclusion:function(e,t){if(i.isDefined(e)&&(i.isArray(t)&&(t={within:t}),t=i.extend({},this.options,t),!i.contains(t.within,e))){var r=t.message||this.message||"^%{value} is not included in the list";return i.format(r,{value:e})}},exclusion:function(e,t){if(i.isDefined(e)&&(i.isArray(t)&&(t={within:t}),t=i.extend({},this.options,t),i.contains(t.within,e))){var r=t.message||this.message||"^%{value} is restricted";return i.format(r,{value:e})}},email:i.extend(function(e,t){var r=(t=i.extend({},this.options,t)).message||this.message||"is not a valid email";if(i.isDefined(e)&&(!i.isString(e)||!this.PATTERN.exec(e)))return r},{PATTERN:/^[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}$/i}),equality:function(e,t,r,n,a){if(i.isDefined(e)){i.isString(t)&&(t={attribute:t});var o=(t=i.extend({},this.options,t)).message||this.message||"is not equal to %{attribute}";if(i.isEmpty(t.attribute)||!i.isString(t.attribute))throw Error("The attribute must be a non empty string");var s=i.getDeepObjectValue(n,t.attribute),u=t.comparator||function(e,t){return e===t},l=t.prettify||a&&a.prettify||i.prettify;if(!u(e,s,t,r,n))return i.format(o,{attribute:l(t.attribute)})}},url:function(e,t){if(i.isDefined(e)){var r=(t=i.extend({},this.options,t)).message||this.message||"is not a valid url",n=t.schemes||this.schemes||["http","https"],a=t.allowLocal||this.allowLocal||!1;if(!i.isString(e))return r;var o="^(?:(?:"+n.join("|")+")://)(?:\\S+(?::\\S*)?@)?(?:",s="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";if(a?s+="?":o+="(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})",!RegExp(o+="(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"+s+")(?::\\d{2,5})?(?:[/?#]\\S*)?$","i").exec(e))return r}}},n.formatters={detailed:function(e){return e},flat:i.flattenErrorsToArray,grouped:function(e){var t;for(t in e=i.groupErrorsByAttribute(e))e[t]=i.flattenErrorsToArray(e[t]);return e},constraint:function(e){var t;for(t in e=i.groupErrorsByAttribute(e))e[t]=e[t].map(function(e){return e.validator}).sort();return e}},n.exposeModule(n,this,e,t,r)}).call(this,t,e=r.nmd(e),"u">typeof define?define:null)},862(e,t,r){e.exports=(function e(t,n,i){function a(s,u){if(!n[s]){if(!t[s]){var l=r(671);if(!u&&l)return l(s,!0);if(o)return o(s,!0);throw Error("Cannot find module '"+s+"'")}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){return a(t[s][1][e]||e)},c,c.exports,e,t,n,i)}return n[s].exports}for(var o=r(671),s=0;s<i.length;s++)a(i[s]);return a})({1:[function(e,t,r){(function(n,i,a,o,s,u,l,c,d){"use strict";var f=e("crypto");function h(e,t){var r=t=g(e,t);if(void 0===(n="passthrough"!==r.algorithm?f.createHash(r.algorithm):new v).write&&(n.write=n.update,n.end=n.update),D(r,n).dispatch(e),n.update||n.end(""),n.digest)return n.digest("buffer"===r.encoding?void 0:r.encoding);var n,i=n.read();return"buffer"!==r.encoding?i.toString(r.encoding):i}(r=t.exports=h).sha1=function(e){return h(e)},r.keys=function(e){return h(e,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},r.MD5=function(e){return h(e,{algorithm:"md5",encoding:"hex"})},r.keysMD5=function(e){return h(e,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var p=f.getHashes?f.getHashes().slice():["sha1","md5"];p.push("passthrough");var m=["buffer","hex","binary","base64"];function g(e,t){var r={};if(r.algorithm=(t=t||{}).algorithm||"sha1",r.encoding=t.encoding||"hex",r.excludeValues=!!t.excludeValues,r.algorithm=r.algorithm.toLowerCase(),r.encoding=r.encoding.toLowerCase(),r.ignoreUnknown=!0===t.ignoreUnknown,r.respectType=!1!==t.respectType,r.respectFunctionNames=!1!==t.respectFunctionNames,r.respectFunctionProperties=!1!==t.respectFunctionProperties,r.unorderedArrays=!0===t.unorderedArrays,r.unorderedSets=!1!==t.unorderedSets,r.unorderedObjects=!1!==t.unorderedObjects,r.replacer=t.replacer||void 0,r.excludeKeys=t.excludeKeys||void 0,void 0===e)throw Error("Object argument required.");for(var n=0;n<p.length;++n)p[n].toLowerCase()===r.algorithm.toLowerCase()&&(r.algorithm=p[n]);if(-1===p.indexOf(r.algorithm))throw Error('Algorithm "'+r.algorithm+'" not supported. supported values: '+p.join(", "));if(-1===m.indexOf(r.encoding)&&"passthrough"!==r.algorithm)throw Error('Encoding "'+r.encoding+'" not supported. supported values: '+m.join(", "));return r}function y(e){if("function"==typeof e)return null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(e))}function D(e,t,r){function n(e){return t.update?t.update(e,"utf8"):t.write(e,"utf8")}return r=r||[],{dispatch:function(t){return e.replacer&&(t=e.replacer(t)),this["_"+(null===t?"null":typeof t)](t)},_object:function(t){var i,o=Object.prototype.toString.call(t),s=/\[object (.*)\]/i.exec(o);if(s=(s=s?s[1]:"unknown:["+o+"]").toLowerCase(),0<=(i=r.indexOf(t)))return this.dispatch("[CIRCULAR:"+i+"]");if(r.push(t),void 0!==a&&a.isBuffer&&a.isBuffer(t))return n("buffer:"),n(t);if("object"===s||"function"===s||"asyncfunction"===s){var u=Object.keys(t);e.unorderedObjects&&(u=u.sort()),!1===e.respectType||y(t)||u.splice(0,0,"prototype","__proto__","constructor"),e.excludeKeys&&(u=u.filter(function(t){return!e.excludeKeys(t)})),n("object:"+u.length+":");var l=this;return u.forEach(function(r){l.dispatch(r),n(":"),e.excludeValues||l.dispatch(t[r]),n(",")})}if(!this["_"+s]){if(e.ignoreUnknown)return n("["+s+"]");throw Error('Unknown object type "'+s+'"')}this["_"+s](t)},_array:function(t,i){i=void 0!==i?i:!1!==e.unorderedArrays;var a=this;if(n("array:"+t.length+":"),!i||t.length<=1)return t.forEach(function(e){return a.dispatch(e)});var o=[],s=t.map(function(t){var n=new v,i=r.slice();return D(e,n,i).dispatch(t),o=o.concat(i.slice(r.length)),n.read().toString()});return r=r.concat(o),s.sort(),this._array(s,!1)},_date:function(e){return n("date:"+e.toJSON())},_symbol:function(e){return n("symbol:"+e.toString())},_error:function(e){return n("error:"+e.toString())},_boolean:function(e){return n("bool:"+e.toString())},_string:function(e){n("string:"+e.length+":"),n(e.toString())},_function:function(t){n("fn:"),y(t)?this.dispatch("[native]"):this.dispatch(t.toString()),!1!==e.respectFunctionNames&&this.dispatch("function-name:"+String(t.name)),e.respectFunctionProperties&&this._object(t)},_number:function(e){return n("number:"+e.toString())},_xml:function(e){return n("xml:"+e.toString())},_null:function(){return n("Null")},_undefined:function(){return n("Undefined")},_regexp:function(e){return n("regex:"+e.toString())},_uint8array:function(e){return n("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint8clampedarray:function(e){return n("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(e))},_int8array:function(e){return n("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint16array:function(e){return n("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_int16array:function(e){return n("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_uint32array:function(e){return n("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_int32array:function(e){return n("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_float32array:function(e){return n("float32array:"),this.dispatch(Array.prototype.slice.call(e))},_float64array:function(e){return n("float64array:"),this.dispatch(Array.prototype.slice.call(e))},_arraybuffer:function(e){return n("arraybuffer:"),this.dispatch(new Uint8Array(e))},_url:function(e){return n("url:"+e.toString())},_map:function(t){n("map:");var r=Array.from(t);return this._array(r,!1!==e.unorderedSets)},_set:function(t){n("set:");var r=Array.from(t);return this._array(r,!1!==e.unorderedSets)},_file:function(e){return n("file:"),this.dispatch([e.name,e.size,e.type,e.lastModfied])},_blob:function(){if(e.ignoreUnknown)return n("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return n("domwindow")},_process:function(){return n("process")},_timer:function(){return n("timer")},_pipe:function(){return n("pipe")},_tcp:function(){return n("tcp")},_udp:function(){return n("udp")},_tty:function(){return n("tty")},_statwatcher:function(){return n("statwatcher")},_securecontext:function(){return n("securecontext")},_connection:function(){return n("connection")},_zlib:function(){return n("zlib")},_context:function(){return n("context")},_nodescript:function(){return n("nodescript")},_httpparser:function(){return n("httpparser")},_dataview:function(){return n("dataview")},_signal:function(){return n("signal")},_fsevent:function(){return n("fsevent")},_tlswrap:function(){return n("tlswrap")}}}function v(){return{buf:"",write:function(e){this.buf+=e},end:function(e){this.buf+=e},read:function(){return this.buf}}}r.writeToStream=function(e,t,r){return void 0===r&&(r=t,t={}),D(t=g(e,t),r).dispatch(e)}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_5812b7fb.js","/")},{buffer:3,crypto:5,lYpoI2:10}],2:[function(e,t,r){(function(e,t,n,i,a,o,s,u,l){!function(e){"use strict";var t="u">typeof Uint8Array?Uint8Array:Array;function r(e){var t=e.charCodeAt(0);return 43===t||45===t?62:47===t||95===t?63:t<48?-1:t<58?t-48+26+26:t<91?t-65:t<123?t-97+26:void 0}e.toByteArray=function(e){if(0<e.length%4)throw Error("Invalid string. Length must be a multiple of 4");var n,i,a=e.length,o="="===e.charAt(a-2)?2:+("="===e.charAt(a-1)),s=new t(3*e.length/4-o),u=0<o?e.length-4:e.length,l=0;function c(e){s[l++]=e}for(n=0;n<u;n+=4)c((0xff0000&(i=r(e.charAt(n))<<18|r(e.charAt(n+1))<<12|r(e.charAt(n+2))<<6|r(e.charAt(n+3))))>>16),c((65280&i)>>8),c(255&i);return 2==o?c(255&(i=r(e.charAt(n))<<2|r(e.charAt(n+1))>>4)):1==o&&(c((i=r(e.charAt(n))<<10|r(e.charAt(n+1))<<4|r(e.charAt(n+2))>>2)>>8&255),c(255&i)),s},e.fromByteArray=function(e){var t,r,n,i,a=e.length%3,o="";function s(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,n=e.length-a;t<n;t+=3)o+=s((i=r=(e[t]<<16)+(e[t+1]<<8)+e[t+2])>>18&63)+s(i>>12&63)+s(i>>6&63)+s(63&i);switch(a){case 1:o+=s((r=e[e.length-1])>>2),o+=s(r<<4&63),o+="==";break;case 2:o+=s((r=(e[e.length-2]<<8)+e[e.length-1])>>10),o+=s(r>>4&63),o+=s(r<<2&63),o+="="}return o}}(void 0===r?this.base64js={}:r)}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(e,t,r){(function(t,n,i,a,o,s,u,l,c){var d=e("base64-js"),f=e("ieee754");function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);var n,a,o,s,u,l=typeof e;if("base64"===t&&"string"==l)for(e=(n=e).trim?n.trim():n.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==l)a=C(e);else if("string"==l)a=i.byteLength(e,t);else{if("object"!=l)throw Error("First argument needs to be a number, array or string.");a=C(e.length)}if(i._useTypedArrays?o=i._augment(new Uint8Array(a)):((o=this).length=a,o._isBuffer=!0),i._useTypedArrays&&"number"==typeof e.byteLength)o._set(e);else if(M(u=e)||i.isBuffer(u)||u&&"object"==typeof u&&"number"==typeof u.length)for(s=0;s<a;s++)i.isBuffer(e)?o[s]=e.readUInt8(s):o[s]=e[s];else if("string"==l)o.write(e,0,t);else if("number"==l&&!i._useTypedArrays&&!r)for(s=0;s<a;s++)o[s]=0;return o}function h(e,t,r,n){n||(U("boolean"==typeof r,"missing or invalid endian"),U(null!=t,"missing offset"),U(t+1<e.length,"Trying to read beyond buffer length"));var i,a=e.length;if(!(a<=t))return r?(i=e[t],t+1<a&&(i|=e[t+1]<<8)):(i=e[t]<<8,t+1<a&&(i|=e[t+1])),i}function p(e,t,r,n){n||(U("boolean"==typeof r,"missing or invalid endian"),U(null!=t,"missing offset"),U(t+3<e.length,"Trying to read beyond buffer length"));var i,a=e.length;if(!(a<=t))return r?(t+2<a&&(i=e[t+2]<<16),t+1<a&&(i|=e[t+1]<<8),i|=e[t],t+3<a&&(i+=e[t+3]<<24>>>0)):(t+1<a&&(i=e[t+1]<<16),t+2<a&&(i|=e[t+2]<<8),t+3<a&&(i|=e[t+3]),i+=e[t]<<24>>>0),i}function m(e,t,r,n){if(n||(U("boolean"==typeof r,"missing or invalid endian"),U(null!=t,"missing offset"),U(t+1<e.length,"Trying to read beyond buffer length")),!(e.length<=t)){var i=h(e,t,r,!0);return 32768&i?-1*(65535-i+1):i}}function g(e,t,r,n){if(n||(U("boolean"==typeof r,"missing or invalid endian"),U(null!=t,"missing offset"),U(t+3<e.length,"Trying to read beyond buffer length")),!(e.length<=t)){var i=p(e,t,r,!0);return 0x80000000&i?-1*(0xffffffff-i+1):i}}function y(e,t,r,n){return n||(U("boolean"==typeof r,"missing or invalid endian"),U(t+3<e.length,"Trying to read beyond buffer length")),f.read(e,t,r,23,4)}function D(e,t,r,n){return n||(U("boolean"==typeof r,"missing or invalid endian"),U(t+7<e.length,"Trying to read beyond buffer length")),f.read(e,t,r,52,8)}function v(e,t,r,n,i){i||(U(null!=t,"missing value"),U("boolean"==typeof n,"missing or invalid endian"),U(null!=r,"missing offset"),U(r+1<e.length,"trying to write beyond buffer length"),k(t,65535));var a=e.length;if(!(a<=r))for(var o=0,s=Math.min(a-r,2);o<s;o++)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function b(e,t,r,n,i){i||(U(null!=t,"missing value"),U("boolean"==typeof n,"missing or invalid endian"),U(null!=r,"missing offset"),U(r+3<e.length,"trying to write beyond buffer length"),k(t,0xffffffff));var a=e.length;if(!(a<=r))for(var o=0,s=Math.min(a-r,4);o<s;o++)e[r+o]=t>>>8*(n?o:3-o)&255}function S(e,t,r,n,i){i||(U(null!=t,"missing value"),U("boolean"==typeof n,"missing or invalid endian"),U(null!=r,"missing offset"),U(r+1<e.length,"Trying to write beyond buffer length"),N(t,32767,-32768)),e.length<=r||v(e,0<=t?t:65535+t+1,r,n,i)}function E(e,t,r,n,i){i||(U(null!=t,"missing value"),U("boolean"==typeof n,"missing or invalid endian"),U(null!=r,"missing offset"),U(r+3<e.length,"Trying to write beyond buffer length"),N(t,0x7fffffff,-0x80000000)),e.length<=r||b(e,0<=t?t:0xffffffff+t+1,r,n,i)}function w(e,t,r,n,i){i||(U(null!=t,"missing value"),U("boolean"==typeof n,"missing or invalid endian"),U(null!=r,"missing offset"),U(r+3<e.length,"Trying to write beyond buffer length"),B(t,34028234663852886e22,-34028234663852886e22)),e.length<=r||f.write(e,t,r,n,23,4)}function _(e,t,r,n,i){i||(U(null!=t,"missing value"),U("boolean"==typeof n,"missing or invalid endian"),U(null!=r,"missing offset"),U(r+7<e.length,"Trying to write beyond buffer length"),B(t,17976931348623157e292,-17976931348623157e292)),e.length<=r||f.write(e,t,r,n,52,8)}r.Buffer=i,r.SlowBuffer=i,r.INSPECT_MAX_BYTES=50,i.poolSize=8192,i._useTypedArrays=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray}catch(e){return!1}}(),i.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.byteLength=function(e,t){var r;switch(e+="",t||"utf8"){case"hex":r=e.length/2;break;case"utf8":case"utf-8":r=F(e).length;break;case"ascii":case"binary":case"raw":r=e.length;break;case"base64":r=P(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=2*e.length;break;default:throw Error("Unknown encoding")}return r},i.concat=function(e,t){if(U(M(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new i(0);if(1===e.length)return e[0];if("number"!=typeof t)for(a=t=0;a<e.length;a++)t+=e[a].length;for(var r=new i(t),n=0,a=0;a<e.length;a++){var o=e[a];o.copy(r,n),n+=o.length}return r},i.prototype.write=function(e,t,r,n){isFinite(t)?isFinite(r)||(n=r,r=void 0):(l=n,n=t,t=r,r=l),t=Number(t)||0;var a,o,s,u,l,c,d,f,h,p,m=this.length-t;switch((!r||m<(r=Number(r)))&&(r=m),n=String(n||"utf8").toLowerCase()){case"hex":c=function(e,t,r,n){r=Number(r)||0;var a=e.length-r;(!n||a<(n=Number(n)))&&(n=a);var o=t.length;U(o%2==0,"Invalid hex string"),o/2<n&&(n=o/2);for(var s=0;s<n;s++){var u=parseInt(t.substr(2*s,2),16);U(!isNaN(u),"Invalid hex string"),e[r+s]=u}return i._charsWritten=2*s,s}(this,e,t,r);break;case"utf8":case"utf-8":h=t,p=r,c=i._charsWritten=O(F(e),this,h,p);break;case"ascii":case"binary":a=t,o=r,c=i._charsWritten=O(function(e){for(var t=[],r=0;r<e.length;r++)t.push(255&e.charCodeAt(r));return t}(e),this,a,o);break;case"base64":d=t,f=r,c=i._charsWritten=O(P(e),this,d,f);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":s=t,u=r,c=i._charsWritten=O(function(e){for(var t,r,n=[],i=0;i<e.length;i++)r=(t=e.charCodeAt(i))>>8,n.push(t%256),n.push(r);return n}(e),this,s,u);break;default:throw Error("Unknown encoding")}return c},i.prototype.toString=function(e,t,r){var n,i,a;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,(r=void 0!==r?Number(r):r=this.length)===t)return"";switch(e){case"hex":n=function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||n<r)&&(r=n);for(var i="",a=t;a<r;a++)i+=x(e[a]);return i}(this,t,r);break;case"utf8":case"utf-8":n=function(e,t,r){var n="",i="";r=Math.min(e.length,r);for(var a=t;a<r;a++)e[a]<=127?(n+=T(i)+String.fromCharCode(e[a]),i=""):i+="%"+e[a].toString(16);return n+T(i)}(this,t,r);break;case"ascii":case"binary":n=function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;i++)n+=String.fromCharCode(e[i]);return n}(this,t,r);break;case"base64":a=r,n=0===(i=t)&&a===this.length?d.fromByteArray(this):d.fromByteArray(this.slice(i,a));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=function(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,t,r);break;default:throw Error("Unknown encoding")}return n},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},i.prototype.copy=function(e,t,r,n){if(r=r||0,n||0===n||(n=this.length),t=t||0,n!==r&&0!==e.length&&0!==this.length){U(r<=n,"sourceEnd < sourceStart"),U(0<=t&&t<e.length,"targetStart out of bounds"),U(0<=r&&r<this.length,"sourceStart out of bounds"),U(0<=n&&n<=this.length,"sourceEnd out of bounds"),n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var a=n-r;if(a<100||!i._useTypedArrays)for(var o=0;o<a;o++)e[o+t]=this[o+r];else e._set(this.subarray(r,r+a),t)}},i.prototype.slice=function(e,t){var r=this.length;if(e=I(e,r,0),t=I(t,r,r),i._useTypedArrays)return i._augment(this.subarray(e,t));for(var n=t-e,a=new i(n,void 0,!0),o=0;o<n;o++)a[o]=this[o+e];return a},i.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},i.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},i.prototype.readUInt8=function(e,t){if(t||(U(null!=e,"missing offset"),U(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return this[e]},i.prototype.readUInt16LE=function(e,t){return h(this,e,!0,t)},i.prototype.readUInt16BE=function(e,t){return h(this,e,!1,t)},i.prototype.readUInt32LE=function(e,t){return p(this,e,!0,t)},i.prototype.readUInt32BE=function(e,t){return p(this,e,!1,t)},i.prototype.readInt8=function(e,t){if(t||(U(null!=e,"missing offset"),U(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){return m(this,e,!0,t)},i.prototype.readInt16BE=function(e,t){return m(this,e,!1,t)},i.prototype.readInt32LE=function(e,t){return g(this,e,!0,t)},i.prototype.readInt32BE=function(e,t){return g(this,e,!1,t)},i.prototype.readFloatLE=function(e,t){return y(this,e,!0,t)},i.prototype.readFloatBE=function(e,t){return y(this,e,!1,t)},i.prototype.readDoubleLE=function(e,t){return D(this,e,!0,t)},i.prototype.readDoubleBE=function(e,t){return D(this,e,!1,t)},i.prototype.writeUInt8=function(e,t,r){r||(U(null!=e,"missing value"),U(null!=t,"missing offset"),U(t<this.length,"trying to write beyond buffer length"),k(e,255)),t>=this.length||(this[t]=e)},i.prototype.writeUInt16LE=function(e,t,r){v(this,e,t,!0,r)},i.prototype.writeUInt16BE=function(e,t,r){v(this,e,t,!1,r)},i.prototype.writeUInt32LE=function(e,t,r){b(this,e,t,!0,r)},i.prototype.writeUInt32BE=function(e,t,r){b(this,e,t,!1,r)},i.prototype.writeInt8=function(e,t,r){r||(U(null!=e,"missing value"),U(null!=t,"missing offset"),U(t<this.length,"Trying to write beyond buffer length"),N(e,127,-128)),t>=this.length||(0<=e?this.writeUInt8(e,t,r):this.writeUInt8(255+e+1,t,r))},i.prototype.writeInt16LE=function(e,t,r){S(this,e,t,!0,r)},i.prototype.writeInt16BE=function(e,t,r){S(this,e,t,!1,r)},i.prototype.writeInt32LE=function(e,t,r){E(this,e,t,!0,r)},i.prototype.writeInt32BE=function(e,t,r){E(this,e,t,!1,r)},i.prototype.writeFloatLE=function(e,t,r){w(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){w(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){_(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){_(this,e,t,!1,r)},i.prototype.fill=function(e,t,r){if(e=e||0,t=t||0,r=r||this.length,"string"==typeof e&&(e=e.charCodeAt(0)),U("number"==typeof e&&!isNaN(e),"value is not a number"),U(t<=r,"end < start"),r!==t&&0!==this.length){U(0<=t&&t<this.length,"start out of bounds"),U(0<=r&&r<=this.length,"end out of bounds");for(var n=t;n<r;n++)this[n]=e}},i.prototype.inspect=function(){for(var e=[],t=this.length,n=0;n<t;n++)if(e[n]=x(this[n]),n===r.INSPECT_MAX_BYTES){e[n+1]="...";break}return"<Buffer "+e.join(" ")+">"},i.prototype.toArrayBuffer=function(){if("u"<typeof Uint8Array)throw Error("Buffer.toArrayBuffer not supported in this browser");if(i._useTypedArrays)return new i(this).buffer;for(var e=new Uint8Array(this.length),t=0,r=e.length;t<r;t+=1)e[t]=this[t];return e.buffer};var A=i.prototype;function I(e,t,r){return"number"!=typeof e?r:t<=(e=~~e)?t:0<=e||0<=(e+=t)?e:0}function C(e){return(e=~~Math.ceil(+e))<0?0:e}function M(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function x(e){return e<16?"0"+e.toString(16):e.toString(16)}function F(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n<=127)t.push(e.charCodeAt(r));else{var i=r;55296<=n&&n<=57343&&r++;for(var a=encodeURIComponent(e.slice(i,r+1)).substr(1).split("%"),o=0;o<a.length;o++)t.push(parseInt(a[o],16))}}return t}function P(e){return d.toByteArray(e)}function O(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);i++)t[i+r]=e[i];return i}function T(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function k(e,t){U("number"==typeof e,"cannot write a non-number as a number"),U(0<=e,"specified a negative value for writing an unsigned value"),U(e<=t,"value is larger than maximum value for type"),U(Math.floor(e)===e,"value has a fractional component")}function N(e,t,r){U("number"==typeof e,"cannot write a non-number as a number"),U(e<=t,"value larger than maximum allowed value"),U(r<=e,"value smaller than minimum allowed value"),U(Math.floor(e)===e,"value has a fractional component")}function B(e,t,r){U("number"==typeof e,"cannot write a non-number as a number"),U(e<=t,"value larger than maximum allowed value"),U(r<=e,"value smaller than minimum allowed value")}function U(e,t){if(!e)throw Error(t||"Failed assertion")}i._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=A.get,e.set=A.set,e.write=A.write,e.toString=A.toString,e.toLocaleString=A.toString,e.toJSON=A.toJSON,e.copy=A.copy,e.slice=A.slice,e.readUInt8=A.readUInt8,e.readUInt16LE=A.readUInt16LE,e.readUInt16BE=A.readUInt16BE,e.readUInt32LE=A.readUInt32LE,e.readUInt32BE=A.readUInt32BE,e.readInt8=A.readInt8,e.readInt16LE=A.readInt16LE,e.readInt16BE=A.readInt16BE,e.readInt32LE=A.readInt32LE,e.readInt32BE=A.readInt32BE,e.readFloatLE=A.readFloatLE,e.readFloatBE=A.readFloatBE,e.readDoubleLE=A.readDoubleLE,e.readDoubleBE=A.readDoubleBE,e.writeUInt8=A.writeUInt8,e.writeUInt16LE=A.writeUInt16LE,e.writeUInt16BE=A.writeUInt16BE,e.writeUInt32LE=A.writeUInt32LE,e.writeUInt32BE=A.writeUInt32BE,e.writeInt8=A.writeInt8,e.writeInt16LE=A.writeInt16LE,e.writeInt16BE=A.writeInt16BE,e.writeInt32LE=A.writeInt32LE,e.writeInt32BE=A.writeInt32BE,e.writeFloatLE=A.writeFloatLE,e.writeFloatBE=A.writeFloatBE,e.writeDoubleLE=A.writeDoubleLE,e.writeDoubleBE=A.writeDoubleBE,e.fill=A.fill,e.inspect=A.inspect,e.toArrayBuffer=A.toArrayBuffer,e}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(e,t,r){(function(r,n,i,a,o,s,u,l,c){var i=e("buffer").Buffer,d=new i(4);d.fill(0),t.exports={hash:function(e,t,r,n){return i.isBuffer(e)||(e=new i(e)),function(e,t,r){for(var n=new i(t),a=r?n.writeInt32BE:n.writeInt32LE,o=0;o<e.length;o++)a.call(n,e[o],4*o,!0);return n}(t(function(e,t){var r;e.length%4!=0&&(r=e.length+(4-e.length%4),e=i.concat([e,d],r));for(var n=[],a=t?e.readInt32BE:e.readInt32LE,o=0;o<e.length;o+=4)n.push(a.call(e,o));return n}(e,n),8*e.length),r,n)}}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],5:[function(e,t,r){(function(t,n,i,a,o,s,u,l,c){var i=e("buffer").Buffer,d=e("./sha"),f=e("./sha256"),h=e("./rng"),p={sha1:d,sha256:f,md5:e("./md5")},m=new i(64);function g(e,t){var r=p[e=e||"sha1"],n=[];return r||y("algorithm:",e,"is not yet supported"),{update:function(e){return i.isBuffer(e)||(e=new i(e)),n.push(e),e.length,this},digest:function(e){var a=i.concat(n),o=t?function(e,t,r){i.isBuffer(t)||(t=new i(t)),i.isBuffer(r)||(r=new i(r)),t.length>64?t=e(t):t.length<64&&(t=i.concat([t,m],64));for(var n=new i(64),a=new i(64),o=0;o<64;o++)n[o]=54^t[o],a[o]=92^t[o];var s=e(i.concat([n,r]));return e(i.concat([a,s]))}(r,t,a):r(a);return n=null,e?o.toString(e):o}}}function y(){var e=[].slice.call(arguments).join(" ");throw Error([e,"we accept pull requests\nhttp://github.com/dominictarr/crypto-browserify"].join("\n"))}m.fill(0),r.createHash=function(e){return g(e)},r.createHmac=g,r.randomBytes=function(e,t){if(!t||!t.call)return new i(h(e));try{t.call(this,void 0,new i(h(e)))}catch(e){t(e)}},function(e,t){for(var r in e)t(e[r],r)}(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(e){r[e]=function(){y("sorry,",e,"is not implemented yet")}})}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:10}],6:[function(e,t,r){(function(r,n,i,a,o,s,u,l,c){var d=e("./helpers");function f(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var r=0x67452301,n=-0x10325477,i=-0x67452302,a=0x10325476,o=0;o<e.length;o+=16){var s=r,u=n,l=i,c=a,r=p(r,n,i,a,e[o+0],7,-0x28955b88),a=p(a,r,n,i,e[o+1],12,-0x173848aa),i=p(i,a,r,n,e[o+2],17,0x242070db),n=p(n,i,a,r,e[o+3],22,-0x3e423112);r=p(r,n,i,a,e[o+4],7,-0xa83f051),a=p(a,r,n,i,e[o+5],12,0x4787c62a),i=p(i,a,r,n,e[o+6],17,-0x57cfb9ed),n=p(n,i,a,r,e[o+7],22,-0x2b96aff),r=p(r,n,i,a,e[o+8],7,0x698098d8),a=p(a,r,n,i,e[o+9],12,-0x74bb0851),i=p(i,a,r,n,e[o+10],17,-42063),n=p(n,i,a,r,e[o+11],22,-0x76a32842),r=p(r,n,i,a,e[o+12],7,0x6b901122),a=p(a,r,n,i,e[o+13],12,-0x2678e6d),i=p(i,a,r,n,e[o+14],17,-0x5986bc72),r=m(r,n=p(n,i,a,r,e[o+15],22,0x49b40821),i,a,e[o+1],5,-0x9e1da9e),a=m(a,r,n,i,e[o+6],9,-0x3fbf4cc0),i=m(i,a,r,n,e[o+11],14,0x265e5a51),n=m(n,i,a,r,e[o+0],20,-0x16493856),r=m(r,n,i,a,e[o+5],5,-0x29d0efa3),a=m(a,r,n,i,e[o+10],9,0x2441453),i=m(i,a,r,n,e[o+15],14,-0x275e197f),n=m(n,i,a,r,e[o+4],20,-0x182c0438),r=m(r,n,i,a,e[o+9],5,0x21e1cde6),a=m(a,r,n,i,e[o+14],9,-0x3cc8f82a),i=m(i,a,r,n,e[o+3],14,-0xb2af279),n=m(n,i,a,r,e[o+8],20,0x455a14ed),r=m(r,n,i,a,e[o+13],5,-0x561c16fb),a=m(a,r,n,i,e[o+2],9,-0x3105c08),i=m(i,a,r,n,e[o+7],14,0x676f02d9),r=g(r,n=m(n,i,a,r,e[o+12],20,-0x72d5b376),i,a,e[o+5],4,-378558),a=g(a,r,n,i,e[o+8],11,-0x788e097f),i=g(i,a,r,n,e[o+11],16,0x6d9d6122),n=g(n,i,a,r,e[o+14],23,-0x21ac7f4),r=g(r,n,i,a,e[o+1],4,-0x5b4115bc),a=g(a,r,n,i,e[o+4],11,0x4bdecfa9),i=g(i,a,r,n,e[o+7],16,-0x944b4a0),n=g(n,i,a,r,e[o+10],23,-0x41404390),r=g(r,n,i,a,e[o+13],4,0x289b7ec6),a=g(a,r,n,i,e[o+0],11,-0x155ed806),i=g(i,a,r,n,e[o+3],16,-0x2b10cf7b),n=g(n,i,a,r,e[o+6],23,0x4881d05),r=g(r,n,i,a,e[o+9],4,-0x262b2fc7),a=g(a,r,n,i,e[o+12],11,-0x1924661b),i=g(i,a,r,n,e[o+15],16,0x1fa27cf8),r=y(r,n=g(n,i,a,r,e[o+2],23,-0x3b53a99b),i,a,e[o+0],6,-0xbd6ddbc),a=y(a,r,n,i,e[o+7],10,0x432aff97),i=y(i,a,r,n,e[o+14],15,-0x546bdc59),n=y(n,i,a,r,e[o+5],21,-0x36c5fc7),r=y(r,n,i,a,e[o+12],6,0x655b59c3),a=y(a,r,n,i,e[o+3],10,-0x70f3336e),i=y(i,a,r,n,e[o+10],15,-1051523),n=y(n,i,a,r,e[o+1],21,-0x7a7ba22f),r=y(r,n,i,a,e[o+8],6,0x6fa87e4f),a=y(a,r,n,i,e[o+15],10,-0x1d31920),i=y(i,a,r,n,e[o+6],15,-0x5cfebcec),n=y(n,i,a,r,e[o+13],21,0x4e0811a1),r=y(r,n,i,a,e[o+4],6,-0x8ac817e),a=y(a,r,n,i,e[o+11],10,-0x42c50dcb),i=y(i,a,r,n,e[o+2],15,0x2ad7d2bb),n=y(n,i,a,r,e[o+9],21,-0x14792c6f),r=D(r,s),n=D(n,u),i=D(i,l),a=D(a,c)}return[r,n,i,a]}function h(e,t,r,n,i,a){var o;return D((o=D(D(t,e),D(n,a)))<<i|o>>>32-i,r)}function p(e,t,r,n,i,a,o){return h(t&r|~t&n,e,t,i,a,o)}function m(e,t,r,n,i,a,o){return h(t&n|r&~n,e,t,i,a,o)}function g(e,t,r,n,i,a,o){return h(t^r^n,e,t,i,a,o)}function y(e,t,r,n,i,a,o){return h(r^(t|~n),e,t,i,a,o)}function D(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}t.exports=function(e){return d.hash(e,f,16)}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(e,t,r){(function(e,r,n,i,a,o,s,u,l){t.exports=function(e){for(var t,r=Array(e),n=0;n<e;n++)0==(3&n)&&(t=0x100000000*Math.random()),r[n]=t>>>((3&n)<<3)&255;return r}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(e,t,r){(function(r,n,i,a,o,s,u,l,c){var d=e("./helpers");function f(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var r,n,i,a,o,s=Array(80),u=0x67452301,l=-0x10325477,c=-0x67452302,d=0x10325476,f=-0x3c2d1e10,m=0;m<e.length;m+=16){for(var g=u,y=l,D=c,v=d,b=f,S=0;S<80;S++){s[S]=S<16?e[m+S]:p(s[S-3]^s[S-8]^s[S-14]^s[S-16],1);var E=h(h(p(u,5),(i=l,a=c,o=d,(n=S)<20?i&a|~i&o:!(n<40)&&n<60?i&a|i&o|a&o:i^a^o)),h(h(f,s[S]),(r=S)<20?0x5a827999:r<40?0x6ed9eba1:r<60?-0x70e44324:-0x359d3e2a)),f=d,d=c,c=p(l,30),l=u,u=E}u=h(u,g),l=h(l,y),c=h(c,D),d=h(d,v),f=h(f,b)}return[u,l,c,d,f]}function h(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function p(e,t){return e<<t|e>>>32-t}t.exports=function(e){return d.hash(e,f,20,!0)}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(e,t,r){(function(r,n,i,a,o,s,u,l,c){function d(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function f(e,t){return e>>>t|e<<32-t}function h(e,t){var r,n,i,a,o,s,u,l,c,h,p=[0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2],m=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],g=Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var y,D,v,b,S,E,w,_,A=0;A<e.length;A+=16){r=m[0],n=m[1],i=m[2],a=m[3],o=m[4],s=m[5],u=m[6],l=m[7];for(var I=0;I<64;I++)g[I]=I<16?e[I+A]:d(d(d(f(_=g[I-2],17)^f(_,19)^_>>>10,g[I-7]),f(w=g[I-15],7)^f(w,18)^w>>>3),g[I-16]),c=d(d(d(d(l,f(E=o,6)^f(E,11)^f(E,25)),(S=o)&s^~S&u),p[I]),g[I]),h=d(f(b=r,2)^f(b,13)^f(b,22),(y=r)&(D=n)^y&(v=i)^D&v),l=u,u=s,s=o,o=d(a,c),a=i,i=n,n=r,r=d(c,h);m[0]=d(r,m[0]),m[1]=d(n,m[1]),m[2]=d(i,m[2]),m[3]=d(a,m[3]),m[4]=d(o,m[4]),m[5]=d(s,m[5]),m[6]=d(u,m[6]),m[7]=d(l,m[7])}return m}var p=e("./helpers");t.exports=function(e){return p.hash(e,h,32,!0)}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],10:[function(e,t,r){(function(e,r,n,i,a,o,s,u,l){function c(){}(e=t.exports={}).nextTick=function(){var e="u">typeof window&&window.setImmediate,t="u">typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var r=[];return window.addEventListener("message",function(e){var t=e.source;t!==window&&null!==t||"process-tick"!==e.data||(e.stopPropagation(),0<r.length&&r.shift()())},!0),function(e){r.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.on=c,e.addListener=c,e.once=c,e.off=c,e.removeListener=c,e.removeAllListeners=c,e.emit=c,e.binding=function(e){throw Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(e){throw Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:10}],11:[function(e,t,r){(function(e,t,n,i,a,o,s,u,l){r.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,u=(1<<s)-1,l=u>>1,c=-7,d=r?i-1:0,f=r?-1:1,h=e[t+d];for(d+=f,a=h&(1<<-c)-1,h>>=-c,c+=s;0<c;a=256*a+e[t+d],d+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;0<c;o=256*o+e[t+d],d+=f,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),a-=l}return(h?-1:1)*o*Math.pow(2,a-n)},r.write=function(e,t,r,n,i,a){var o,s,u,l=8*a-i-1,c=(1<<l)-1,d=c>>1,f=5960464477539062e-23*(23===i),h=n?0:a-1,p=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),2<=(t+=1<=o+d?f/u:f*Math.pow(2,1-d))*u&&(o++,u/=2),c<=o+d?(s=0,o=c):1<=o+d?(s=(t*u-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));8<=i;e[r+h]=255&s,h+=p,s/=256,i-=8);for(o=o<<i|s,l+=i;0<l;e[r+h]=255&o,h+=p,o/=256,l-=8);e[r+h-p]|=128*m}}).call(this,e("lYpoI2"),"u">typeof self?self:"u">typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ieee754/index.js","/node_modules/ieee754")},{buffer:3,lYpoI2:10}]},{},[1])(1)},671(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=671,e.exports=t},557(e){"use strict";e.exports=t},223(e){"use strict";e.exports=r},111(t){"use strict";t.exports=e},155(e){"use strict";e.exports=n},534(){}},a={};function o(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return i[e].call(r.exports,r,r.exports,o),r.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var s={};return(()=>{"use strict";let e,t,r,n,i,a,u,l,c,d,f,h,p,m,g;o.r(s),o.d(s,{CineService:()=>eB,CommandsManager:()=>nY,CustomizationService:()=>nC,DICOMWeb:()=>io,DicomMetadataStore:()=>eb,DisplaySetMessage:()=>eA,DisplaySetMessageList:()=>eI,DisplaySetService:()=>eC,Enums:()=>C,ExtensionManager:()=>nV,HangingProtocolService:()=>rK,HotkeysManager:()=>nX,IWebApiDataSource:()=>ip,MODULE_TYPES:()=>M,MeasurementService:()=>ei,MultiMonitorService:()=>nj,OHIF:()=>iE,PanelService:()=>nO,PubSubService:()=>L,ServiceProvidersManager:()=>eo,ServicesManager:()=>ea,StudyPrefetcherService:()=>nR,SystemContextProvider:()=>rw,ToolbarService:()=>eO,UIDialogService:()=>ec,UIModalService:()=>ep,UINotificationService:()=>ey,UIViewportDialogService:()=>ev,UserAuthenticationService:()=>rZ,ViewportGridService:()=>ek,ViewportRefsProvider:()=>ir,WorkflowStepsService:()=>nN,classes:()=>ie,default:()=>iw,defaults:()=>nW,errorHandler:()=>is,hotkeys:()=>iS,log:()=>F,object:()=>iu,pubSubServiceInterface:()=>T,string:()=>ic,useActiveToolOptions:()=>iv,useActiveViewportDisplaySets:()=>im,useRunCommand:()=>ib,useSystem:()=>rE,useToolbar:()=>ig,useViewportMousePosition:()=>iD,useViewportRef:()=>ia,useViewportRefs:()=>ii,useViewportSize:()=>iy,user:()=>id,utils:()=>r$});var y,D,v,b,S,E,w,_,A,I={};o.r(I),o.d(I,{filterAdditionalFindings:()=>rO,filterAnd:()=>rN,filterAny:()=>rM,filterMeasurementsBySeriesUID:()=>r_,filterMeasurementsByStudyUID:()=>rA,filterNone:()=>rx,filterNot:()=>function e(...t){if(1!==t.length)return rN(...t.map(t=>e(t)));let[r]=t;return rk(r)?function(e){return!this[r](e)}:e=>!r(e)},filterOr:()=>rF,filterPlanarMeasurement:()=>rI,filterTool:()=>rC,filterUnless:()=>rT});var C={};o.r(C),o.d(C,{TimingEnum:()=>ih});let M={COMMANDS:"commandsModule",CUSTOMIZATION:"customizationModule",STATE_SYNC:"stateSyncModule",DATA_SOURCE:"dataSourcesModule",PANEL:"panelModule",SOP_CLASS_HANDLER:"sopClassHandlerModule",TOOLBAR:"toolbarModule",VIEWPORT:"viewportModule",CONTEXT:"contextModule",LAYOUT_TEMPLATE:"layoutTemplateModule",HANGING_PROTOCOL:"hangingProtocolModule",UTILITY:"utilityModule"},x={error:console.error,warn:console.warn,info:console.log,trace:console.trace,debug:console.debug,time:e=>{x.timingKeys[e]=!0,console.time(e)},timeEnd:e=>{x.timingKeys[e]&&(x.timingKeys[e]=!1,console.timeEnd(e))},timingKeys:{scriptToView:!0}},F=x,P=()=>{let e=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},O=function(e,t,r){var n;let i=function(){var i=this,a=arguments,o=r&&!n;clearTimeout(n),n=setTimeout(function(){n=null,r||e.apply(i,a)},t),o&&e.apply(i,a)};return i.clearDebounceTimeout=()=>{clearTimeout(n),n=null},i},T={subscribe:k,_broadcastEvent:U,_unsubscribe:N,_isValidEvent:B};function k(e,t){if(this._isValidEvent(e)){let r=P(),n={id:r,callback:t};return Array.isArray(this.listeners[e])?this.listeners[e].push(n):this.listeners[e]=[n],{unsubscribe:()=>this._unsubscribe(e,r)}}throw Error(`Event ${e} not supported.`)}function N(e,t){if(!this.listeners[e])return;let r=this.listeners[e];Array.isArray(r)?this.listeners[e]=r.filter(({id:e,callback:r})=>(r?.clearDebounceTimeout?.(),e!==t)):this.listeners[e]=void 0}function B(e){return Object.values(this.EVENTS).includes(e)}function U(e,t){let r=Object.keys(this.listeners).length>0,n=Array.isArray(this.listeners[e]),i=new CustomEvent(e,{detail:t});document.body.dispatchEvent(i),r&&n&&this.listeners[e].forEach(e=>{e.callback(t)})}class L{constructor(e){this.EVENTS=void 0,this.subscribe=void 0,this._broadcastEvent=void 0,this._unsubscribe=void 0,this._isValidEvent=void 0,this.listeners=void 0,this.unsubscriptions=void 0,this.EVENTS=e,this.subscribe=k,this._broadcastEvent=U,this._unsubscribe=N,this._isValidEvent=B,this.listeners={},this.unsubscriptions=[]}subscribeDebounced(e,t,r=300,n=!1){if(this._isValidEvent(e)){let i=O(t,r,n);return this.subscribe(e,i)}throw Error(`Event ${e} not supported.`)}reset(){this.unsubscriptions.forEach(e=>e()),this.unsubscriptions=[],Object.keys(this.listeners).forEach(e=>this.listeners[e].forEach(({callback:e})=>{e?.clearDebounceTimeout?.()})),this.listeners={}}createConsumableEvent(e){return{...e,isConsumed:!1,consume:function(){this.isConsumed=!0}}}}var R=o(111),j=o.n(R);let V=function(e){let t=[],r=new Map;return{SeriesInstanceUID:e,instances:t,addInstance:function(e){this.addInstances([e])},addInstances:function(e){for(let n=0,i=e.length;n<i;n++){let i=e[n];r.has(i.SOPInstanceUID)||(r.set(i.SOPInstanceUID,i),t.push(i))}},getInstance:function(e){return r.get(e)}}},Y=function(e){return{StudyInstanceUID:e,StudyDescription:"",ModalitiesInStudy:[],isLoaded:!1,series:[],addInstanceToSeries:function(e){this.addInstancesToSeries([e])},addInstancesToSeries:function(e){let{SeriesInstanceUID:t}=e[0];this.StudyDescription||(this.StudyDescription=e[0].StudyDescription);let r=this.series.find(e=>e.SeriesInstanceUID===t);r||(r=V(t),this.series.push(r)),r.addInstances(e)},setSeriesMetadata:function(e,t){let r=this.series.find(t=>t.SeriesInstanceUID===e);if(r)r=Object.assign(r,t);else{let r=V(e);this.series.push(Object.assign(r,t))}}}},$=["ImagePositionPatient","ImageOrientationPatient","PixelSpacing"],z=Symbol("isMetadataProxy"),W=function(e){if(!e||e[z])return e;for(let t of $)t in e||Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:()=>e._parentInstance?.[t]??e._parentInstance?._shared?.[t],set:r=>{Object.defineProperty(e,t,{writable:!0,enumerable:!0,value:r})}});return Object.defineProperty(e,z,{value:!0}),e},H={STUDY_ADDED:"event::dicomMetadataStore:studyAdded",INSTANCES_ADDED:"event::dicomMetadataStore:instancesAdded",SERIES_ADDED:"event::dicomMetadataStore:seriesAdded",SERIES_UPDATED:"event::dicomMetadataStore:seriesUpdated"},G=[];function q(e){return G.find(t=>t.StudyInstanceUID===e)}function X(e,t){if(!e)return G.map(e=>e.series).flat().find(e=>e.SeriesInstanceUID===t);let r=q(e);if(r)return r.series.find(e=>e.SeriesInstanceUID===t)}function K(e,t,r){let n=X(e,t);if(n)return n.getInstance(r)}let J=Object.assign({},{EVENTS:H,listeners:{},addInstance(e){let t,r,{StudyInstanceUID:n,NumberOfFrames:i}=r=void 0===(t=e instanceof ArrayBuffer?j().data.DicomMessage.readFile(e).dict:e).SeriesInstanceUID?j().data.DicomMetaDictionary.naturalizeDataset(t):t,a=G.find(e=>e.StudyInstanceUID===n);a||(G.push(Y(n)),a=G[G.length-1]),r=i>1?W(r):r,a.addInstanceToSeries(r)},addInstances(e,t=!1){let{StudyInstanceUID:r,SeriesInstanceUID:n,NumberOfFrames:i}=e[0];i>1&&(e=e.map(e=>W(e)));let a=G.find(e=>e.StudyInstanceUID===r);a||(G.push(Y(r)),a=G[G.length-1]),a.addInstancesToSeries(e),this._broadcastEvent(H.INSTANCES_ADDED,{StudyInstanceUID:r,SeriesInstanceUID:n,madeInClient:t})},updateSeriesMetadata(e){let{StudyInstanceUID:t,SeriesInstanceUID:r}=e;if(!X(t,r))return;let n=q(t);n&&n.setSeriesMetadata(r,e)},addSeriesMetadata(e,t=!1){if(!e||!e.length||!e[0])return;let{StudyInstanceUID:r}=e[0],n=q(r);n||((n=Y(r)).StudyDescription=e[0].StudyDescription,e.forEach(e=>{-1===n.ModalitiesInStudy.indexOf(e.Modality)&&n.ModalitiesInStudy.push(e.Modality)}),n.NumberOfStudyRelatedSeries=e.length,G.push(n)),e.forEach(e=>{let{SeriesInstanceUID:t}=e;n.setSeriesMetadata(t,e)}),this._broadcastEvent(H.SERIES_ADDED,{StudyInstanceUID:r,seriesSummaryMetadata:e,madeInClient:t})},addStudy(e){let{StudyInstanceUID:t}=e;if(!G.find(e=>e.StudyInstanceUID===t)){let r=Y(t);r.PatientID=e.PatientID,r.PatientName=e.PatientName,r.StudyDate=e.StudyDate,r.ModalitiesInStudy=e.ModalitiesInStudy,r.StudyDescription=e.StudyDescription,r.AccessionNumber=e.AccessionNumber,r.NumInstances=e.NumInstances,G.push(r)}},getStudyInstanceUIDs:function(){return G.map(e=>e.StudyInstanceUID)},getStudy:q,getSeries:X,getInstance:K,getInstanceByImageId:function(t){let r=e?.get("frameModule",t);if(r){let{studyInstanceUID:e,seriesInstanceUID:t,sopInstanceUID:n}=r;return K(e,t,n)}for(let e of(console.warn("No metadata result found for",t,"looking through instances"),G))for(let r of e.series)for(let e of r.instances)if(e.imageId===t)return e},updateMetadataForSeries:function(e,t,r){let n=q(e);if(!n)return;let{instances:i}=n.series.find(e=>e.SeriesInstanceUID===t);i.forEach(e=>{Object.keys(r).forEach(t=>{"object"==typeof r[t]?e[t]={...e[t],...r[t]}:e[t]=r[t]})}),this._broadcastEvent(H.SERIES_UPDATED,{SeriesInstanceUID:t,StudyInstanceUID:e,madeInClient:!0})},setMetaDataProvider:function(t){e=t}},T),Z=["uid","color","data","getReport","displayText","SOPInstanceUID","FrameOfReferenceUID","referenceStudyUID","referenceSeriesUID","frameNumber","displaySetInstanceUID","label","isLocked","isVisible","description","type","unit","points","source","toolName","metadata","area","mean","stdDev","perimeter","length","shortestDiameter","longestDiameter","cachedStats","isSelected","textBox","referencedImageId","isDirty"],Q={MEASUREMENT_UPDATED:"event::measurement_updated",INTERNAL_MEASUREMENT_UPDATED:"event:internal_measurement_updated",MEASUREMENT_ADDED:"event::measurement_added",RAW_MEASUREMENT_ADDED:"event::raw_measurement_added",MEASUREMENT_REMOVED:"event::measurement_removed",MEASUREMENTS_CLEARED:"event::measurements_cleared",JUMP_TO_MEASUREMENT:"event:jump_to_measurement"},ee={ANGLE:"value_type::polyline",POLYLINE:"value_type::polyline",POINT:"value_type::point",BIDIRECTIONAL:"value_type::shortAxisLongAxis",ELLIPSE:"value_type::ellipse",RECTANGLE:"value_type::rectangle",MULTIPOINT:"value_type::multipoint",CIRCLE:"value_type::circle",ROI_THRESHOLD:"value_type::roiThreshold",ROI_THRESHOLD_MANUAL:"value_type::roiThresholdManual"};var et=((y=et||{}).HandlesUpdated="HandlesUpdated",y.LabelChange="LabelChange",y);let er=new Set;class en extends L{constructor(){super(Q),this.VALUE_TYPES=ee,this.measurements=new Map,this.isMeasurementDeletedIndividually=void 0,this.sources={},this.mappings={},this._arrayOfObjects=e=>Object.entries(e).map(e=>({[e[0]]:e[1]})),this.setIsMeasurementDeletedIndividually=e=>{this.isMeasurementDeletedIndividually=e},this.getIsMeasurementDeletedIndividually=()=>this.isMeasurementDeletedIndividually}addMeasurementSchemaKeys(e){Array.isArray(e)||(e=[e]),Z.push(...e)}addValueType(e){if(!ee[e]){if(!e||"object"!=typeof e)return void console.warn(`MeasurementService: addValueType: invalid valueType: ${e}`);Object.keys(e).forEach(t=>{ee[t]||(ee[t]=e[t])})}}getMeasurements(e){let t=[...this.measurements.values()];return e?t.filter(t=>e.call(this,t)):t}getMeasurement(e){return this.measurements.get(e)}setMeasurementSelected(e,t){let r=this.getMeasurement(e);r&&(r.isSelected=t,this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:r.source,measurement:r,notYetUpdatedAtSource:!1}))}createSource(e,t){if(!e)throw Error("Source name not provided.");if(!t)throw Error("Source version not provided.");let r=Object.keys(this.sources);for(let n=0;n<r.length;n++){let i=this.sources[r[n]];if(i.name===e&&i.version===t)return i}let n=P(),i={uid:n,name:e,version:t};return i.annotationToMeasurement=(e,t,r=!1)=>this.annotationToMeasurement(i,e,t,r),i.remove=(e,t)=>this.remove(e,i,t),i.getAnnotation=(e,t)=>this.getAnnotation(i,e,t),F.info(`New '${e}@${t}' source added.`),this.sources[n]=i,i}getSource(e,t){let{sources:r}=this;return r[this._getSourceUID(e,t)]}getSourceMappings(e,t){let{mappings:r}=this;return r[this._getSourceUID(e,t)]}addMapping(e,t,r,n,i){if(!this._isValidSource(e))throw Error("Invalid source.");if(!r)throw Error("Matching criteria not provided.");if(!t)throw Error("annotationType not provided.");if(!n)throw Error("Mapping function to source schema not provided.");if(!i)throw Error("Measurement mapping function not provided.");let a={matchingCriteria:r,annotationType:t,toAnnotationSchema:n,toMeasurementSchema:i};Array.isArray(this.mappings[e.uid])?this.mappings[e.uid].push(a):this.mappings[e.uid]=[a]}getAnnotation(e,t,r){if(!this._isValidSource(e))return void F.warn("Invalid source. Exiting early.");if(!t)return void F.warn("No source annotationType provided. Exiting early.");let n=this.getMeasurement(r),i=this._getMappingByMeasurementSource(n,t);if(i)return i.toAnnotationSchema(n,t);let a=this._getMatchingMapping(e,t,n);if(a){F.info("Matching mapping found:",a);let{toAnnotationSchema:e,annotationType:t}=a;return e(n,t)}}update(e,t,r=!1){if(!this.measurements.has(e))return;let n={...t,modifiedTimestamp:Math.floor(Date.now()/1e3)};return F.info("Updating internal measurement representation...",n),this.measurements.set(e,n),this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:t.source,measurement:n,notYetUpdatedAtSource:r}),n.uid}addRawMeasurement(e,t,r,n,i={}){if(!this._isValidSource(e))return void F.warn("Invalid source. Exiting early.");let a=this._getSourceToString(e);if(!t)return void F.warn("No source annotationType provided. Exiting early.");if(!this._sourceHasMappings(e))return void F.warn(`No measurement mappings found for '${a}' source. Exiting early.`);let o={};try{if(!(o=n(r)))return;o.source=e}catch(e){F.warn(`Failed to map '${a}' measurement for annotationType ${t}:`,e);return}if(!this._isValidMeasurement(o))return void F.warn(`Attempting to add or update a invalid measurement provided by '${a}'. Exiting early.`);let s=r.uid||P(),{annotation:{predecessorImageId:u,data:l}}=r,c={finding:l.finding,predecessorImageId:u,findingSites:l.findingSites,site:l.findingSites?.[0],...o,modifiedTimestamp:Math.floor(Date.now()/1e3),uid:s};return this.measurements.get(s)?(this.measurements.set(s,c),this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:e,measurement:c})):(F.info("Measurement added",c),this.measurements.set(s,c),this._broadcastEvent(this.EVENTS.RAW_MEASUREMENT_ADDED,{source:e,measurement:c,data:r,dataSource:i})),c.uid}annotationToMeasurement(e,t,r,n=!1){if(!this._isValidSource(e))throw Error("Invalid source.");if(!t)throw Error("No source annotationType provided.");let i=this._getSourceToString(e);if(!this._sourceHasMappings(e))throw Error(`No measurement mappings found for '${i}' source. Exiting early.`);let a={};try{let n=this.mappings[e.uid].find(e=>e.annotationType===t);if(!n){er.has(e.uid)||(console.log("No source mapping",e.uid,t,e),er.add(e.uid)),this.addUnmappedMeasurement(r,e);return}let{toMeasurementSchema:i}=n;if(!(a=i(r)))return;a.source=e}catch(n){throw this.addUnmappedMeasurement(r,e),console.log("Failed to map",n),Error(`Failed to map '${i}' measurement for annotationType ${t}: ${n.message}`)}if(!this._isValidMeasurement(a))throw Error(`Attempting to add or update a invalid measurement provided by '${i}'. Exiting early.`);let o=r.uid;o||(o=P(),F.info(`Annotation does not have UID, Generating UID for the created Measurement: ${o}`));let s=this.measurements.get(o),u={...s,...a,modifiedTimestamp:Math.floor(Date.now()/1e3),uid:o};return u.isDirty=r.changeType===et.HandlesUpdated||r.changeType===et.LabelChange||s?.isDirty,s?(this.measurements.set(o,u),n?this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:e,measurement:u,notYetUpdatedAtSource:!1}):(F.info("Measurement added.",u),this._broadcastEvent(this.EVENTS.MEASUREMENT_ADDED,{source:e,measurement:u}))):(F.info("Measurement started.",u),this.measurements.set(o,u)),u.uid}findAttributeRecursively(e,t){if(e&&"object"==typeof e){if(e[t])return e[t];for(let r in e)if(e.hasOwnProperty(r)){let n=this.findAttributeRecursively(e[r],t);if(n)return n}}}addUnmappedMeasurement(e,t){if(e.annotation?.invalidated===!0)return void console.log("Measurement is invalidated, skipping...",e);if(e.annotation?.isPreview===!0)return void console.log("Measurement is preview, skipping...",e);let r=this.findAttributeRecursively(e,"metadata"),n=this.findAttributeRecursively(e,"label"),i=this.findAttributeRecursively(e,"referencedImageId"),a=this.findAttributeRecursively(e,"displaySetInstanceUID"),o={...e,isUnmapped:!0,statusTooltip:"This measurement is not compatible with this application",source:{name:t.name,version:t.version,uid:t.uid}};if(r&&(o.metadata=r),n&&(o.label=n),i){o.referencedImageId=i;let e=J.getInstanceByImageId(i);e?(o.referenceStudyUID=e.StudyInstanceUID,o.referenceSeriesUID=e.SeriesInstanceUID):console.warn("Didn't find instance for",i)}a&&(o.displaySetInstanceUID=a),this.measurements.set(e.uid,o)}remove(e){let t=this.measurements.get(e);if(!e||!t)return void console.debug("No uid provided, or unable to find measurement by uid.");let r=t.source;this.measurements.delete(e),this.isMeasurementDeletedIndividually=!0,this._broadcastEvent(this.EVENTS.MEASUREMENT_REMOVED,{source:r,measurement:e})}removeMany(e){let t=[];for(let r of e){let e=this.measurements.get(r);if(!r||!e){console.debug("No uid provided, or unable to find measurement by uid.");continue}this.measurements.delete(r),t.push(e)}t.length&&this._broadcastEvent(this.EVENTS.MEASUREMENTS_CLEARED,{measurements:t})}clearMeasurements(e,t){let r=this.getMeasurements(e),n=[...r];r.forEach(e=>this.measurements.delete(e.uid)),this._broadcastEvent(this.EVENTS.MEASUREMENTS_CLEARED,{measurements:n,...t})}onModeExit(){this.clearMeasurements()}jumpToMeasurement(e,t){let r=this.measurements.get(t);r?this._broadcastEvent(Q.JUMP_TO_MEASUREMENT,{viewportId:e,measurement:r}):F.warn("No measurement uid, or unable to find by uid.")}_getSourceUID(e,t){let{sources:r}=this;return Object.keys(r).find(n=>{let i=r[n];return i.name===e&&i.version===t})}_getMappingByMeasurementSource(e,t){if(this._isValidSource(e.source))return this.mappings[e.source.uid].find(e=>e.annotationType===t)}_getMatchingMapping(e,t,r){return this.mappings[e.uid].filter(e=>e.annotationType===t).find(({matchingCriteria:e})=>r.points&&r.points.length===e.points)}_getSourceToString(e){return`${e.name}@${e.version}`}_isValidSource(e){return e&&this.sources[e.uid]}_sourceHasMappings(e){return Array.isArray(this.mappings[e.uid])&&this.mappings[e.uid].length}_isValidMeasurement(e){return Object.keys(e).every(e=>!!Z.includes(e)||(F.warn(`Invalid measurement key: ${e}`),!1))}toggleLockMeasurement(e){let t=this.measurements.get(e);t?(t.isLocked=!t.isLocked,this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:t.source,measurement:t,notYetUpdatedAtSource:!0})):console.debug(`No measurement found for uid: ${e}`)}toggleVisibilityMeasurement(e,t){let r=this.measurements.get(e);r?(r.isVisible!==t||void 0===t)&&(r.isVisible=void 0!==t?t:!r.isVisible,this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:r.source,measurement:r,notYetUpdatedAtSource:!0})):console.debug(`No measurement found for uid: ${e}`)}toggleVisibilityMeasurementMany(e,t){return e.forEach(e=>this.toggleVisibilityMeasurement(e,t))}updateColorMeasurement(e,t){let r=this.measurements.get(e);r?(r.color=t,this._broadcastEvent(this.EVENTS.MEASUREMENT_UPDATED,{source:r.source,measurement:r,notYetUpdatedAtSource:!0})):console.debug(`No measurement found for uid: ${e}`)}}en.REGISTRATION={name:"measurementService",altName:"MeasurementService",create:e=>new en},en.EVENTS=Q,en.VALUE_TYPES=ee;let ei=en;class ea{constructor(e){this.services={},this.registeredServiceNames=[],this._commandsManager=void 0,this._extensionManager=void 0,this._commandsManager=e,this._extensionManager=null,this.services={},this.registeredServiceNames=[]}setExtensionManager(e){this._extensionManager=e}registerService(e,t={}){e?e.name?this.registeredServiceNames.includes(e.name)?F.warn(`Service name ${e.name} has already been registered. Exiting before duplicating services.`):e.create?(this.services[e.name]=e.create({configuration:t,extensionManager:this._extensionManager,commandsManager:this._commandsManager,servicesManager:this}),e.altName&&(this.services[e.altName]=this.services[e.name]),this.registeredServiceNames.push(e.name)):F.warn("Service create factory function not defined. Exiting early."):F.warn("Service name not set. Exiting early."):F.warn("Attempting to register a null/undefined service. Exiting early.")}registerServices(e){e.forEach(e=>{if(Array.isArray(e)){let[t,r]=e;this.registerService(t,r)}else this.registerService(e)})}}class eo{constructor(){this.providers={},this.providers={}}registerProvider(e,t){e?t?this.providers[e]=t:F.warn("Attempting to register a null/undefined provider. Exiting early."):F.warn("Attempting to register a provider to a null/undefined service name. Exiting early.")}}let es="uiDialogService",eu={_show:e=>(console.warn("show() NOT IMPLEMENTED"),""),_hide:e=>console.warn("hide() NOT IMPLEMENTED"),_hideAll:()=>console.warn("hideAll() NOT IMPLEMENTED"),_isEmpty:()=>(console.warn("isEmpty() NOT IMPLEMENTED"),!0),_updatePosition:(e,t)=>console.warn("updatePosition() NOT IMPLEMENTED"),_customComponent:null};class el{constructor(){this.name=es}show(e){return eu._show(e)}hide(e){return eu._hide(e)}hideAll(){return eu._hideAll()}isEmpty(){return eu._isEmpty()}updatePosition(e,t){return eu._updatePosition(e,t)}getCustomComponent(){return eu._customComponent}setServiceImplementation({show:e,hide:t,hideAll:r,isEmpty:n,updatePosition:i,customComponent:a}){e&&(eu._show=e),t&&(eu._hide=t),r&&(eu._hideAll=r),n&&(eu._isEmpty=n),i&&(eu._updatePosition=i),a&&(eu._customComponent=a)}}el.REGISTRATION={name:es,altName:"UIDialogService",create:()=>new el};let ec=el,ed="uiModalService",ef={_hide:()=>console.warn("hide() NOT IMPLEMENTED"),_show:()=>console.warn("show() NOT IMPLEMENTED"),_customComponent:null};class eh{constructor(){this.name=ed}show({content:e=null,contentProps:t=null,title:r=null,className:n=null,shouldCloseOnEsc:i=!0,shouldCloseOnOverlayClick:a=!0,containerClassName:o=null}){return ef._show({content:e,contentProps:t,shouldCloseOnEsc:i,title:r,className:n,shouldCloseOnOverlayClick:a,containerClassName:o})}hide(){return ef._hide()}getCustomComponent(){return ef._customComponent}setServiceImplementation({hide:e,show:t,customComponent:r}){e&&(ef._hide=e),t&&(ef._show=t),r&&(ef._customComponent=r)}}eh.REGISTRATION={name:ed,altName:"UIModalService",create:()=>new eh};let ep=eh,em={_hide:()=>console.debug("hide() NOT IMPLEMENTED"),_show:e=>(console.debug("show() NOT IMPLEMENTED"),null),_customComponent:null};class eg{getCustomComponent(){return em._customComponent}setServiceImplementation({hide:e,show:t,customComponent:r}){e&&(em._hide=e),t&&(em._show=t),r&&(em._customComponent=r)}hide(e){return em._hide(e)}show({title:e,message:t,duration:r=2e3,position:n="bottom-right",type:i="info",autoClose:a=!0,promise:o,promiseMessages:s,id:u,allowDuplicates:l=!1,deduplicationInterval:c=3e4,action:d}){if(o&&s){let t=em._show({title:e,message:s.loading||"Loading...",type:"loading",autoClose:!1,position:n,id:u?`${u}-loading`:void 0,allowDuplicates:l,deduplicationInterval:c});return o.then(i=>{let o="function"==typeof s.success?s.success(i):s.success||"Success";em._show({title:e,message:o,type:"success",duration:r,position:n,autoClose:a,id:u?`${u}-success`:void 0,allowDuplicates:l,deduplicationInterval:c,action:d}),this.hide(t)},i=>{let o="function"==typeof s.error?s.error(i):s.error||"Error";em._show({title:e,message:o,type:"error",duration:r,position:n,autoClose:a,id:u?`${u}-error`:void 0,allowDuplicates:l,deduplicationInterval:c,action:d}),this.hide(t)}),t}return em._show({title:e,message:t,duration:r,position:n,type:i,autoClose:a,id:u,allowDuplicates:l,deduplicationInterval:c,action:d})}}eg.REGISTRATION={name:"uiNotificationService",altName:"UINotificationService",create:()=>new eg};let ey=eg;class eD extends L{constructor(){super(eD.EVENTS),this.serviceImplementation={_hide:()=>console.warn("hide() NOT IMPLEMENTED"),_show:()=>console.warn("show() NOT IMPLEMENTED")},this.serviceImplementation={...this.serviceImplementation}}show({viewportId:e,id:t,type:r,message:n,actions:i,onSubmit:a,onOutsideClick:o,onKeyPress:s}){return this.serviceImplementation._show({viewportId:e,id:t,type:r,message:n,actions:i,onSubmit:a,onOutsideClick:o,onKeyPress:s})}hide(){return this.serviceImplementation._hide()}setServiceImplementation({hide:e,show:t}){e&&(this.serviceImplementation._hide=e),t&&(this.serviceImplementation._show=t)}}eD.EVENTS={},eD.REGISTRATION={name:"uiViewportDialogService",altName:"UIViewportDialogService",create:({configuration:e={}})=>new eD};let ev=eD,eb=J,eS={DISPLAY_SETS_ADDED:"event::displaySetService:displaySetsAdded",DISPLAY_SETS_CHANGED:"event::displaySetService:displaySetsChanged",DISPLAY_SETS_REMOVED:"event::displaySetService:displaySetsRemoved",DISPLAY_SET_SERIES_METADATA_INVALIDATED:"event::displaySetService:displaySetSeriesMetadataInvalidated"},eE=new Map,ew=(e,t)=>{let r=new Set;return t.forEach(e=>{let t=e.instances;t?t.forEach(e=>r.add(e.SOPInstanceUID)):console.warn("No instances in",e)}),e.filter(e=>!r.has(e.SOPInstanceUID))};class e_ extends L{constructor(){super(eS),this.activeDisplaySets=[],this.unsupportedSOPClassHandler=void 0,this.extensionManager=void 0,this.activeDisplaySetsMap=new Map,this.activeDisplaySetsChanged=!1,this.getDisplaySetsForSeries=e=>[...eE.values()].filter(t=>t.SeriesInstanceUID===e),this.getDisplaySetsForReferences=e=>{let t=new Map;for(let r of Array.isArray(e)?e:[e]){let{SeriesInstanceUID:e,ReferencedInstanceSequence:n}=r;t.has(e)||t.set(e,new Set);let i=t.get(e);for(let e of n)i.add(e.ReferencedSOPInstanceUID)}return[...eE.values()].filter(e=>{let r=t.get(e.SeriesInstanceUID);if(r&&e.instances)return e.instances.some(e=>r.has(e.SOPInstanceUID))})},this.getDisplaySetByUID=e=>{if("string"!=typeof e)throw Error(`getDisplaySetByUID: displaySetInstanceUid must be a string, you passed ${e}`);return eE.get(e)},this.makeDisplaySets=(e,{batch:t=!1,madeInClient:r=!1,settings:n={}}={})=>{if(!e||!e.length)throw Error("No instances were provided.");if(t&&!e[0].length)throw Error("Batch displaySet creation does not contain array of array of instances.");let i=[];if(t)for(let t=0;t<e.length;t++){let r=e[t],a=this.makeDisplaySetForInstances(r,n);i.push(...a)}else{let t=this.makeDisplaySetForInstances(e,n);i.push(...t)}let a={};if(r&&(a.madeInClient=!0),this.activeDisplaySetsChanged&&(this.activeDisplaySetsChanged=!1,this._broadcastEvent(eS.DISPLAY_SETS_CHANGED,this.activeDisplaySets)),i?.length)return this._broadcastEvent(eS.DISPLAY_SETS_ADDED,{displaySetsAdded:i,options:a}),i},this.unsupportedSOPClassHandler="@ohif/extension-default.sopClassHandlerModule.not-supported-display-sets-handler"}init(e,t){this.extensionManager=e,this.SOPClassHandlerIds=t,this.activeDisplaySets=[],this.activeDisplaySetsMap.clear()}_addDisplaySetsToCache(e){e.forEach(e=>{eE.set(e.displaySetInstanceUID,e)})}_addActiveDisplaySets(e){let{activeDisplaySets:t,activeDisplaySetsMap:r}=this;e.forEach(e=>{r.has(e.displaySetInstanceUID)||(this.activeDisplaySetsChanged=!0,t.push(e),r.set(e.displaySetInstanceUID,e))})}setUnsuportedSOPClassHandler(e){this.unsupportedSOPClassHandler=e}addDisplaySets(...e){return this._addDisplaySetsToCache(e),this._addActiveDisplaySets(e),this.activeDisplaySetsChanged=!1,this._broadcastEvent(eS.DISPLAY_SETS_ADDED,{displaySetsAdded:e,options:{madeInClient:e[0].madeInClient}}),e}getDisplaySetCache(){return eE}getMostRecentDisplaySet(){return this.activeDisplaySets[this.activeDisplaySets.length-1]}getActiveDisplaySets(){return this.activeDisplaySets}getDisplaySetForSOPInstanceUID(e,t,r){return(t?this.getDisplaySetsForSeries(t):[...this.getDisplaySetCache().values()]).find(t=>t.instances?.some(t=>t.SOPInstanceUID===e))}setDisplaySetMetadataInvalidated(e,t=!0){this.getDisplaySetByUID(e)&&this._broadcastEvent(eS.DISPLAY_SET_SERIES_METADATA_INVALIDATED,{displaySetInstanceUID:e,invalidateData:t})}deleteDisplaySet(e){if(!e)return;let{activeDisplaySets:t,activeDisplaySetsMap:r}=this,n=t.findIndex(t=>t.displaySetInstanceUID===e);eE.delete(e),t.splice(n,1),r.delete(e),this._broadcastEvent(eS.DISPLAY_SETS_CHANGED,this.activeDisplaySets),this._broadcastEvent(eS.DISPLAY_SETS_REMOVED,{displaySetInstanceUIDs:[e]})}onModeExit(){this.getDisplaySetCache().clear(),this.activeDisplaySets.length=0,this.activeDisplaySetsMap.clear()}makeDisplaySetForInstances(e,t){let r=e.reduce((e,t)=>(t.SOPClassUID in e||(e[t.SOPClassUID]=[]),e[t.SOPClassUID].push(t),e),{}),n=Object.keys(r),i=[];return n.forEach(e=>{let n=this._makeDisplaySetForInstances(r[e],t);i=[...i,...n]}),i}_makeDisplaySetForInstances(e,t){let r=[...e],n=r[0],i=this.getDisplaySetsForSeries(n.SeriesInstanceUID)||[],a=this.SOPClassHandlerIds,o=[];for(let e=0;e<a.length&&r.length;e++){let s=a[e],u=this.extensionManager.getModuleEntry(s);if(u.sopClassUids.includes(n.SOPClassUID)){let e=i.filter(e=>e.SOPClassHandlerId===s);if(e.length){for(let t of(r=ew(r,e),e)){let e=t.addInstances?.(r,this);if(e&&(this.activeDisplaySetsChanged=!0,r=ew(r,[e]),this._addActiveDisplaySets([e]),this.setDisplaySetMetadataInvalidated(e.displaySetInstanceUID)),!r.length)return o}if(!r.length)return this._addActiveDisplaySets(e),o}if(!(e=u.getDisplaySetsFromSeries(r))||!e.length)continue;e.forEach(e=>{Object.keys(t).forEach(r=>{e[r]=t[r]})}),this._addDisplaySetsToCache(e),this._addActiveDisplaySets(e),r=ew(r,e),o.push(...e)}}if(0===o.length){let e=this.extensionManager.getModuleEntry(this.unsupportedSOPClassHandler).getDisplaySetsFromSeries(r);e?.length&&(e.forEach(e=>{Object.keys(t).forEach(r=>{e[r]=t[r]})}),this._addDisplaySetsToCache(e),this._addActiveDisplaySets(e),o.push(...e))}return o}getDisplaySetsBy(e){let t=[];if("function"!=typeof e)throw Error(`The comparator ${e} was not a function`);return this.getActiveDisplaySets().forEach(r=>{e(r)&&t.push(r)}),t}sortDisplaySets(e,t="ascending",r=!1){this.activeDisplaySets.sort(e),"descending"===t&&this.activeDisplaySets.reverse(),r||this._broadcastEvent(eS.DISPLAY_SETS_CHANGED,this.activeDisplaySets)}}e_.REGISTRATION={altName:"DisplaySetService",name:"displaySetService",create:({configuration:e={}})=>new e_};class eA{constructor(e,t={}){this.id=void 0,this.args=void 0,this.id=e,this.args=t}}eA.CODES={NO_VALID_INSTANCES:1,NO_POSITION_INFORMATION:2,NOT_RECONSTRUCTABLE:3,MULTIFRAME_NO_PIXEL_MEASUREMENTS:4,MULTIFRAME_NO_ORIENTATION:5,MULTIFRAME_NO_POSITION_INFORMATION:6,MISSING_FRAMES:7,IRREGULAR_SPACING:8,INCONSISTENT_DIMENSIONS:9,INCONSISTENT_COMPONENTS:10,INCONSISTENT_ORIENTATIONS:11,INCONSISTENT_POSITION_INFORMATION:12,UNSUPPORTED_DISPLAYSET:13,UNSUPPORTED_SOP_CLASS_UID:14,MISSING_SOP_CLASS_UID:15};class eI{constructor(){this.messages=[]}addMessage(e,t={}){let r=new eA(e,t);this.messages.push(r)}size(){return this.messages.length}includesMessage(e){return this.messages.some(t=>t.id===e)}includesAllMessages(e){return e.every(e=>this.includesMessage(e))}}let eC=e_,eM={TOOL_BAR_MODIFIED:"event::toolBarService:toolBarModified",TOOL_BAR_STATE_MODIFIED:"event::toolBarService:toolBarStateModified"},ex={primary:"primary",secondary:"secondary",viewportActionMenu:{topLeft:"viewportActionMenu.topLeft",topRight:"viewportActionMenu.topRight",bottomLeft:"viewportActionMenu.bottomLeft",bottomRight:"viewportActionMenu.bottomRight",topMiddle:"viewportActionMenu.topMiddle",bottomMiddle:"viewportActionMenu.bottomMiddle",leftMiddle:"viewportActionMenu.leftMiddle",rightMiddle:"viewportActionMenu.rightMiddle"},labelMapSegmentationToolbox:"labelMapSegmentationToolbox",contourSegmentationToolbox:"contourSegmentationToolbox",labelMapSegmentationUtilities:"labelMapSegmentationUtilities",contourSegmentationUtilities:"contourSegmentationUtilities",dynamicToolbox:"dynamic-toolbox",roiThresholdToolbox:"ROIThresholdToolbox"},eF=((D={})[D.TopLeft=0]="TopLeft",D[D.TopMiddle=1]="TopMiddle",D[D.TopRight=2]="TopRight",D[D.LeftMiddle=3]="LeftMiddle",D[D.RightMiddle=4]="RightMiddle",D[D.BottomLeft=5]="BottomLeft",D[D.BottomMiddle=6]="BottomMiddle",D[D.BottomRight=7]="BottomRight",D);class eP extends L{get sections(){return ex}static createButton(e){let{id:t,icon:r,label:n,commands:i,tooltip:a,evaluate:o,listeners:s}=e;return{id:t,icon:r,label:n,commands:i,tooltip:a||n,evaluate:o,listeners:s}}constructor(e,t,r){super(eM),this.state={buttons:{},buttonSections:{}},this._commandsManager=void 0,this._extensionManager=void 0,this._servicesManager=void 0,this._evaluateFunction={},this._serviceSubscriptions=[],this.handleEvaluateNested=e=>{let{buttonSection:t}=e;if(!t)return;let r=this.getButtonSection(t);r?.length&&r.forEach(e=>{this.handleEvaluate(e.componentProps)})},this.handleEvaluate=e=>{let{evaluate:t,options:r}=e;if("string"==typeof r){let t=this._getButtonUITypes();e.options=t[r]?.defaultComponent}if("function"!=typeof t){if(Array.isArray(t)){let r=t.map(e=>{let t="object"==typeof e,r=t?e.name:e,n=this._evaluateFunction[r];if(!n)throw Error(`Evaluate function not found for name: ${r}, you can register an evaluate function with the getToolbarModule in your extensions`);return t?t=>n({...t,...e}):n}),n=e.evaluate;e.evaluate=e=>{let t=r.map(t=>t(e)).filter(Boolean),n=t?.some(e=>e.disabled),i=t.reduce((e,t)=>({...e,...t}),{});return n&&(i.disabled=!0),i},e.evaluateProps=n;return}if("string"==typeof t){let r=this._evaluateFunction[t];if(r){e.evaluate=r;return}throw Error(`Evaluate function not found for name: ${t}, you can register an evaluate function with the getToolbarModule in your extensions`)}if("object"==typeof t){let{name:r,...n}=t,i=this._evaluateFunction[r];if(i){let t=e.evaluate;e.evaluate=e=>i({...e,...n}),e.evaluateProps=t;return}throw Error(`Evaluate function not found for name: ${r}, you can register an evaluate function with the getToolbarModule in your extensions`)}}},this._commandsManager=e,this._extensionManager=t,this._servicesManager=r}reset(){this.state={buttons:{},buttonSections:{}},this.unsubscriptions=[]}onModeEnter(){this.reset()}registerEvaluateFunction(e,t){this._evaluateFunction[e]=t}registerEventForToolbarUpdate(e,t){let{viewportGridService:r}=this._servicesManager.services,n=()=>{let e=r.getActiveViewportId();this.refreshToolbarState({viewportId:e})};t.map(t=>e.subscribe?e.subscribe(t,n):e.addEventListener?e.addEventListener(t,n):void 0).forEach(e=>this._serviceSubscriptions.push(e))}removeButton(e){this.state.buttons[e]&&delete this.state.buttons[e],Object.keys(this.state.buttonSections).forEach(t=>{this.state.buttonSections[t]=this.state.buttonSections[t].filter(t=>t!==e)}),this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED,{...this.state})}register(e,t=!1){e.forEach(e=>{(t||!this.state.buttons[e.id])&&(e.props||(e.props={}),!0===e.props.buttonSection&&(e.props.buttonSection=e.id),this.state.buttons[e.id]=e)}),this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED,{...this.state})}recordInteraction(e,t){"string"==typeof e&&(e=this.getButtonProps(e));let r=e.itemId??e.id;e.itemId=r;let n=Array.isArray(e.commands)?e.commands:[e.commands];if(n=n.filter(Boolean),!n?.length)return void this.refreshToolbarState({...t?.refreshProps,itemId:r,interaction:e});let i={...t,...e};(n=(n=n.map(e=>"function"==typeof e?()=>{e({...i,commandsManager:this._commandsManager,servicesManager:this._servicesManager})}:e)).filter(Boolean)).length&&(this._commandsManager.run(n,i),this.refreshToolbarState({...t?.refreshProps,itemId:r,interaction:e}))}refreshToolbarState(e){let t=this.state.buttons,r={...t},n=new Map,i=(e,t,r)=>{if(n.has(e.id)){let{disabled:r,disabledText:i,className:a,isActive:o}=n.get(e.id);return{...t,disabled:r,disabledText:i,className:a,isActive:o}}{let i=t.evaluateProps,a="function"==typeof t.evaluate?t.evaluate({...r,button:e}):void 0,o=i?.hideWhenDisabled||t.hideWhenDisabled,s=a?.visible===void 0?!(o&&a?.disabled):a?.visible,u={...t,...a,disabled:a?.disabled||!1,visible:s,className:a?.className||t?.className||"",isActive:a?.isActive};return n.set(e.id,u),u}},a=new Set;return Object.values(t).forEach(n=>{if(!a.has(n.id))if(n.props?.buttonSection){let o=n.props,{evaluate:s}=o,u="function"==typeof s?s({...e,button:n}):void 0;o={...o,disabled:u?.disabled??o.disabled,disabledText:u?.disabledText??o.disabledText};let l=this.state.buttonSections[o.buttonSection];if(!l)return;l.forEach(n=>{let o=t[n];if(!o||a.has(n))return;let s=i(o,o.props,e);r[n]={...o,props:s},a.add(n)})}else{this.handleEvaluate(n.props);let t=n.props,o=i(n,t,e);r[n.id]={...n,props:o},a.add(n.id)}}),this.setButtons(r),this.state}setButtons(e){this.state.buttons=e,this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED,{buttons:this.state.buttons,buttonSections:this.state.buttonSections})}getButton(e){return this.state.buttons[e]}addButtons(e,t=!1){console.warn("ToolbarService.addButtons() is deprecated. Use ToolbarService.register() instead."),this.register(e,t)}getButtons(){return this.state.buttons}getButtonProps(e){if(this.state.buttons[e])return this.state.buttons[e].props}_getButtonUITypes(){let e=this._extensionManager.modules.toolbarModule;return Array.isArray(e)?e.reduce((e,t)=>(t.module.forEach(t=>{e[t.name]=t}),e),{}):{}}updateSection(e,t){this.state.buttonSections[e]?this.state.buttonSections[e].push(...t.filter(t=>!this.state.buttonSections[e].find(e=>e===t))):this.state.buttonSections[e]=t,this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED,{...this.state})}createButtonSection(e,t){console.warn("ToolbarService.createButtonSection() is deprecated. Use ToolbarService.updateSection() instead."),this.updateSection(e,t)}getButtonSection(e,t){let r=this.state.buttonSections[e];return r?.map(e=>{let r=this.state.buttons[e];return this._mapButtonToDisplay(r,t)})||[]}getButtonPropsInButtonSection(e){let t=this.state.buttonSections[e];return t?.map(e=>this.getButtonProps(e))||[]}getToolNameForButton(e){let{props:t}=e,r=t?.commands||e.commands,n=(Array.isArray(r)?r:[r])[0];return n?.commandOptions?n.commandOptions.toolName??t?.id??e.id:t?.id??e.id}_mapButtonToDisplay(e,t){if(!e)return;let{id:r,uiType:n}=e,{buttonSection:i}=e.props,a=this._getButtonUITypes()[n];if(e.component||(e.component=a.defaultComponent),!a&&!e.component)return void console.warn(`Neither button type nor a component found for button: ${r}`);i?this.handleEvaluateNested(e.props):this.handleEvaluate(e.props);let{id:o,props:s}=e,u=(e,t)=>{let r=Array.isArray(e)?e:[e],n=this.getButtonProps(t);return r.map(e=>"function"==typeof e.optionComponent?e:{...e,onChange:t=>{e.value=t;let r=Array.isArray(e.commands)?e.commands:[e.commands];if(n&&n.options){let r=n.options.findIndex(t=>t.id===e.id);-1!==r&&(n.options[r].value=t)}r.forEach(r=>{let i={...e,value:t,options:n.options,servicesManager:this._servicesManager,commandsManager:this._commandsManager};this._commandsManager.run(r,i)}),this._broadcastEvent(eM.TOOL_BAR_STATE_MODIFIED,{buttons:this.state.buttons,buttonSections:this.state.buttonSections})}})};if(s?.items?.length){let{items:e=[]}=s;e.forEach(e=>{e.options&&(e.options=u(e.options,e.id))})}else s.options?.length?s.options=u(s.options,o):s.optionComponent&&(s.optionComponent=options.optionComponent);return{id:r,Component:e.component,componentProps:Object.assign({id:r},e.props,t)}}getButtonComponentForUIType(e){return e?this._getButtonUITypes()[e]?.defaultComponent??null:null}clearButtonSection(e){this.state.buttonSections[e]=[],this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED,{...this.state})}isInAnySection(e){return!!e&&Object.values(this.state.buttonSections).some(t=>Array.isArray(t)&&t.includes(e))}getAlignAndSide(e){switch(Number(e)){case eF.TopLeft:return{align:"start",side:"bottom"};case eF.TopMiddle:return{align:"center",side:"bottom"};case eF.TopRight:return{align:"end",side:"bottom"};case eF.LeftMiddle:return{align:"start",side:"right"};case eF.RightMiddle:return{align:"end",side:"left"};case eF.BottomLeft:return{align:"start",side:"top"};case eF.BottomMiddle:return{align:"center",side:"top"};case eF.BottomRight:return{align:"end",side:"top"};default:return{align:"start",side:"bottom"}}}getOptionById(e,t){return e.props.options?.find(e=>e.id===t)}}eP.REGISTRATION={name:"toolbarService",altName:"ToolBarService",create:({commandsManager:e,extensionManager:t,servicesManager:r})=>new eP(e,t,r)},eP.TOOLBAR_SECTIONS=ex;let eO=eP;class eT extends L{constructor({servicesManager:e}){super(eT.EVENTS),this.serviceImplementation={},this.servicesManager=void 0,this.presentationIdProviders=void 0,this.servicesManager=e,this.serviceImplementation={},this.presentationIdProviders=new Map}addPresentationIdProvider(e,t){this.presentationIdProviders.set(e,t)}getPresentationIdProvider(e){return this.presentationIdProviders.get(e)}getPresentationId(e,t){let r=this.getState(),n=r.viewports.get(t);return this._getPresentationId(e,{viewport:n,viewports:r.viewports})}_getPresentationId(e,{viewport:t,viewports:r}){let n=[...r.values()].some(e=>e.displaySetInstanceUIDs?.toString()===t.displaySetInstanceUIDs?.toString()&&e.viewportId===t.viewportId),i=this.presentationIdProviders.get(e);return i?i(e,{viewport:t,viewports:r,isUpdatingSameViewport:n,servicesManager:this.servicesManager}):null}getPresentationIds({viewport:e,viewports:t}){return Array.from(this.presentationIdProviders.keys()).reduce((r,n)=>{let i=this._getPresentationId(n,{viewport:e,viewports:t});return null!==i&&(r[n]=i),r},{})}setServiceImplementation({getState:e,setActiveViewportId:t,setDisplaySetsForViewports:r,setLayout:n,reset:i,onModeExit:a,set:o,getNumViewportPanes:s,setViewportIsReady:u,getViewportState:l}){l&&(this.serviceImplementation._getViewportState=l),e&&(this.serviceImplementation._getState=e),t&&(this.serviceImplementation._setActiveViewport=t),r&&(this.serviceImplementation._setDisplaySetsForViewports=r),n&&(this.serviceImplementation._setLayout=n),i&&(this.serviceImplementation._reset=i),a&&(this.serviceImplementation._onModeExit=a),o&&(this.serviceImplementation._set=o),s&&(this.serviceImplementation._getNumViewportPanes=s),u&&(this.serviceImplementation._setViewportIsReady=u)}publishViewportsReady(){this._broadcastEvent(this.EVENTS.VIEWPORTS_READY,{})}publishViewportOnDropHandled(e){this._broadcastEvent(this.EVENTS.VIEWPORT_ONDROP_HANDLED,{eventData:e})}setActiveViewportId(e){e!==this.getActiveViewportId()&&(this.serviceImplementation._setActiveViewport(e),setTimeout(()=>{this._broadcastEvent(this.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED,{viewportId:e})},0))}getState(){return this.serviceImplementation._getState()}getViewportState(e){return this.serviceImplementation._getViewportState(e)}setViewportIsReady(e,t){this.serviceImplementation._setViewportIsReady(e,t)}getActiveViewportId(){return this.getState().activeViewportId}setViewportGridSizeChanged(){let e=this.getState();this._broadcastEvent(this.EVENTS.GRID_SIZE_CHANGED,{state:e})}setDisplaySetsForViewport(e){this.setDisplaySetsForViewports([e])}async setDisplaySetsForViewports(e){await this.serviceImplementation._setDisplaySetsForViewports(e);let t=this.getState(),r=[],n=[];for(let i of e){let e=t.viewports.get(i.viewportId);e?(r.push(e),0===(e.displaySetInstanceUIDs||[]).length&&n.push(i.viewportId)):n.push(i.viewportId)}setTimeout(()=>{this._broadcastEvent(eT.EVENTS.GRID_STATE_CHANGED,{state:t,viewports:r,removedViewportIds:n})})}getDisplaySetsUIDsForViewport(e){let t=this.getState().viewports.get(e);return t?.displaySetInstanceUIDs}async setLayout({numCols:e,numRows:t,layoutOptions:r,layoutType:n="grid",activeViewportId:i,findOrCreateViewport:a,isHangingProtocolLayout:o=!1}){let s=new Set(this.getState().viewports.keys());await this.serviceImplementation._setLayout({numCols:e,numRows:t,layoutOptions:r,layoutType:n,activeViewportId:i,findOrCreateViewport:a,isHangingProtocolLayout:o}),setTimeout(()=>{let r=this.getState(),n=new Set(r.viewports.keys()),i=[...s].filter(e=>!n.has(e));this._broadcastEvent(this.EVENTS.LAYOUT_CHANGED,{numCols:e,numRows:t}),this._broadcastEvent(this.EVENTS.GRID_STATE_CHANGED,{state:r,removedViewportIds:i})},0)}reset(){this.serviceImplementation._reset()}onModeExit(){this.serviceImplementation._onModeExit()}set(e){let t=new Set(this.getState().viewports.keys());this.serviceImplementation._set(e);let r=this.getState(),n=new Set(r.viewports.keys()),i=[...t].filter(e=>!n.has(e));setTimeout(()=>{this._broadcastEvent(this.EVENTS.GRID_STATE_CHANGED,{state:r,removedViewportIds:i})},0)}getNumViewportPanes(){return this.serviceImplementation._getNumViewportPanes()}getLayoutOptionsFromState(e){return Array.from(e.viewports.entries()).map(([e,t])=>({x:t.x,y:t.y,width:t.width,height:t.height}))}}eT.EVENTS={ACTIVE_VIEWPORT_ID_CHANGED:"event::activeviewportidchanged",LAYOUT_CHANGED:"event::layoutChanged",GRID_STATE_CHANGED:"event::gridStateChanged",GRID_SIZE_CHANGED:"event::gridSizeChanged",VIEWPORTS_READY:"event::viewportsReady",VIEWPORT_ONDROP_HANDLED:"event::viewportOnDropHandled"},eT.REGISTRATION={name:"viewportGridService",altName:"ViewportGridService",create:({configuration:e={},servicesManager:t})=>new eT({servicesManager:t})};let ek=eT;class eN extends L{constructor(){super(eN.EVENTS),this.serviceImplementation={},this.startedClips=new Map,this.closedViewports=new Set,this.serviceImplementation={}}getState(){return this.serviceImplementation._getState()}setCine({id:e,frameRate:t,isPlaying:r}){return this.serviceImplementation._setCine({id:e,frameRate:t,isPlaying:r})}setIsCineEnabled(e){this.serviceImplementation._setIsCineEnabled(e),e&&this.closedViewports.forEach(e=>{this.clearViewportCineClosed(e)}),queueMicrotask(()=>{this._broadcastEvent(this.EVENTS.CINE_STATE_CHANGED,{isCineEnabled:e})})}playClip(e,t){let r=this.serviceImplementation._playClip(e,t);return this.startedClips.set(e,t),this._broadcastEvent(this.EVENTS.CINE_STATE_CHANGED,{isPlaying:!0}),r}stopClip(e,t){let r=this.serviceImplementation._stopClip(e,t);return this._broadcastEvent(this.EVENTS.CINE_STATE_CHANGED,{isPlaying:!1}),r}onModeExit(){this.setIsCineEnabled(!1),this.startedClips.forEach((e,t)=>{this.stopClip(t,e)})}getSyncedViewports(e){return this.serviceImplementation._getSyncedViewports(e)}setViewportCineClosed(e){this.closedViewports.add(e)}isViewportCineClosed(e){return this.closedViewports.size>0}clearViewportCineClosed(e){this.closedViewports.delete(e)}setServiceImplementation({getState:e,setCine:t,setIsCineEnabled:r,playClip:n,stopClip:i,getSyncedViewports:a}){a&&(this.serviceImplementation._getSyncedViewports=a),e&&(this.serviceImplementation._getState=e),t&&(this.serviceImplementation._setCine=t),r&&(this.serviceImplementation._setIsCineEnabled=r),n&&(this.serviceImplementation._playClip=n),i&&(this.serviceImplementation._stopClip=i)}}eN.EVENTS={CINE_STATE_CHANGED:"event::cineStateChanged"},eN.REGISTRATION={name:"cineService",altName:"CineService",create:({configuration:e={}})=>new eN};let eB=eN;var eU=o(359),eL=o.n(eU);function eR(){var e=[].slice.call(arguments),t=e.length;return function(r,n){var i,a,o,s,u,l,c;for(c=0;c<t&&(l=0,i=r[s="string"==typeof(o=e[c])?o:o.name],a=n[s],void 0!==o.primer&&(i=o.primer(i),a=o.primer(a)),u=o.reverse?-1:1,i<a&&(l=-1*u),i>a&&(l=+u),0===l);c++);return l}}var ej=o(834),eV=o.n(ej);eV().validators.equals=function(e,t,r){let n=eY(t),i=e$(e);if(Array.isArray(n)){if(n.length!==i.length)return`${r} must be an array of length ${n.length}`;else for(let e=0;e<n.length;e++)if(n[e]!==i[e])return`${r} ${n[e]} must equal ${i[e]}`}else if(n!==i[0])return`${r} must equal ${n}`},eV().validators.doesNotEqual=function(e,t,r){let n=eY(t),i=e$(e);if(Array.isArray(n)){if(n.length===i.length){let e=0;if(n.forEach((t,r)=>{t===i[r]&&e++}),e===n.length)return`${r} must not equal to ${n}`}}else if(n===i[0])return console.log(i,n),`${r} must not equal to ${n}`},eV().validators.includes=function(e,t,r){let n=eY(t),i=e$(e);return Array.isArray(n)?0===n.filter(e=>i.includes(e)).length?`${r} must include at least one of the following values: ${n.join(", ")}`:void 0:`${r} ${n} must be an array`},eV().validators.doesNotInclude=function(e,t,r){let n=eY(t),i=e$(e);if(!Array.isArray(n))return`${r} ${n} must be an array`;{let e=n.filter(e=>i.includes(e));if(e.length>0)return`${r} must not include the following value: ${e}`}},eV().validators.containsI=function(e,t,r){let n=eY(t);if(Array.isArray(e)){if(e.some(e=>!eV().validators.containsI(e.toLowerCase(),t,r)))return;return`No item of ${e.join(",")} contains ${JSON.stringify(n)}`}if(Array.isArray(n)){if(n.some(t=>!eV().validators.containsI(e,t.toLowerCase(),r)))return;return`${r} must contain at least one of ${n.join(",")}`}if(n&&e.indexOf&&-1===e.toLowerCase().indexOf(n.toLowerCase()))return r+"must contain any case of"+n},eV().validators.contains=function(e,t,r){let n=eY(t);if(Array.isArray(e)){if(e.some(e=>!eV().validators.contains(e,t,r)))return;return`No item of ${e.join(",")} contains ${JSON.stringify(n)}`}if(Array.isArray(n)){if(n.some(t=>!eV().validators.contains(e,t,r)))return;return`${r} must contain at least one of ${n.join(",")}`}if(n&&e.indexOf&&-1===e.indexOf(n))return r+"must contain "+n},eV().validators.containsAll=function(e,t,r){let n=eY(t);if(!Array.isArray(e)||!Array.isArray(n))return`${r} must be an array and test value must be an array.`;let i=n.filter(t=>!e.includes(t));if(i.length>0)return`${r} must contain all of: ${n.join(", ")}. Missing: ${i.join(", ")}`},eV().validators.doesNotContain=function(e,t,r){if(!eV().validators.contains(e,t,r))return`No item of ${e} should contain ${eY(t)}`},eV().validators.doesNotContainI=function(e,t,r){if(!eV().validators.containsI(e,t,r))return`No item of ${e} should not contain ${eY(t)}`},eV().validators.startsWith=function(e,t,r){let n=eY(t);if("string"==typeof n&&(n=[n]),"string"==typeof e){if(!n.some(t=>e.startsWith(t)))return r+" must start with any of these values: "+n}else{if(!Array.isArray(e))return"Value must be a string or an array";let t=!1;for(let r=0;r<e.length;r++){for(let i=0;i<n.length;i++)if(e[r].startsWith(n[i])){t=!0;break}if(t)return}if(!t)return r+" must start with any of these values: "+n}},eV().validators.endsWith=function(e,t,r){let n=eY(t);if("string"==typeof n&&(n=[n]),"string"==typeof e){if(!n.some(t=>e.endsWith(t)))return r+" must end with any of these values: "+n}else{if(!Array.isArray(e))return r+" must be a string or an array";let t=!1;for(let r=0;r<e.length;r++){for(let i=0;i<n.length;i++)if(e[r].endsWith(n[i])){t=!0;break}if(t)return}if(!t)return r+" must end with any of these values: "+n}},eV().validators.greaterThan=function(e,t,r){let n=eY(t);if(Array.isArray(e)||"string"==typeof e)return`${r} is not allowed as an array or string`;if(Array.isArray(n)){if(1===n.length){if(!(e>=n[0]))return`${r} must be greater than or equal to ${n[0]}, but was ${e}`}else if(n.length>1)return r+" must be an array of length 1"}else if(!(e>=n))return r+" must be greater than "+n},eV().validators.lessThan=function(e,t,r){let n=eY(t);if(Array.isArray(n)){if(1===n.length){if(!(e<=n[0]))return`${r} must be less than or equal to ${n[0]}, but was ${e}`}else if(n.length>1)return r+" must be an array of length 1"}else if(!(e<=n))return r+" must be less than "+n},eV().validators.range=function(e,t,r){let n=eY(t);if(!Array.isArray(n)||2!==n.length)return`${r} must be an array of length 2`;{let t=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);if(void 0===e||e<t||e>i)return`${r} with value ${e} must be between ${t} and ${i}`}},eV().validators.notNull=e=>null==e?"Value is null":void 0;let eY=e=>Array.isArray(e)?e.map(e=>e?.value??e):e?.value??e,e$=e=>Array.isArray(e)?[...e]:[e],ez=eV();class eW{constructor(e,t){this.protocols=e,this.customAttributeRetrievalCallbacks=t,this.matchedProtocols=new Map,this.matchedProtocolScores={},this.study=void 0}run({studies:e,displaySets:t,activeStudy:r}){return this.studies=e,this.study=r||e[0],this.displaySets=t,this.getBestProtocolMatch()}getBestProtocolMatch(){this.updateProtocolMatches();let e=this._getHighestScoringProtocol();return console.log("ProtocolEngine::getBestProtocolMatch bestMatch",e),e}updateProtocolMatches(){console.log("ProtocolEngine::updateProtocolMatches"),this._clearMatchedProtocols(),this.findMatchByStudy(this.study,{studies:this.studies,displaySets:this.displaySets}).forEach(e=>{let t=e.protocol;t&&(this.matchedProtocols.has(t.id)||(console.log("ProtocolEngine::updateProtocolMatches inserting protocol match",e),this.matchedProtocols.set(t.id,t),this.matchedProtocolScores[t.id]=e.score))})}findMatch(e,t,r){return((e,t=[],r,n)=>{let i={format:"grouped"},a={passed:[],failed:[]},o={},s=!1,u=0,l=n?.studies?.[1],c=n?.studies?.[0],d=e.instances?.[0],f={prior:l,current:c,instance:d,...n,options:n,metadataInstance:e};return t.forEach(t=>{let l,{attribute:c,from:h="metadataInstance"}=t;r.hasOwnProperty(c)?o[c]=r[c].callback.call(t,e,n):o[c]=f[h]?.[c]??d?.[c];let p=((e,t,r,n)=>{if("object"!=typeof t||null===t)return t;let i={};return Object.entries(t).forEach(([e,t])=>{if("object"==typeof t&&Object.keys(t).length>0&&"attribute"in t){let a=t.attribute,o=t.from??"metadataInstance";if(r.hasOwnProperty(a)){let t=r[a].callback.call(null,n[o],n.options);i[e]={value:t}}else i[e]={value:n[o]?.[a]??n.metadataInstance?.[a]}}else i[e]=t},{}),i})(0,t.constraint,r,f),m={[c]:o[c]};try{l=ez(m,{[c]:p},[i])}catch(e){l=["Something went wrong during validation.",e]}l?(t.required&&(s=!0),a.failed.push({rule:t,errorMessages:l})):(u+=parseInt(t.weight||1,10),a.passed.push({rule:t}))}),s&&(u=0),{score:u,details:a,requiredFailed:s}})(e,t,this.customAttributeRetrievalCallbacks,r)}findMatchByStudy(e,t){let r=[];if(this.protocols.forEach(n=>{let i=n.protocolMatchingRules.slice();if(!i||!i.length)return void console.warn("ProtocolEngine::findMatchByStudy no matching rules - specify protocolMatchingRules for",n.id);let a=this.findMatch(e,i,t).score;a>0&&r.push({score:a,protocol:n})}),!r.length){let e=this.protocols.find(e=>"default"===e.id)??this.protocols[0];return console.log("No protocol matches, defaulting to",e),[{score:0,protocol:e}]}return r.sort((e,t)=>t.score-e.score),console.log("ProtocolEngine::findMatchByStudy matched",r),r}_clearMatchedProtocols(){this.matchedProtocols.clear(),this.matchedProtocolScores={}}_largestKeyByValue(e){return Object.keys(e).reduce((t,r)=>e[t]>e[r]?t:r)}_getHighestScoringProtocol(){if(!Object.keys(this.matchedProtocolScores).length)return;let e=this._largestKeyByValue(this.matchedProtocolScores);return this.matchedProtocols.get(e)}}let eH=class e{static set(t,r,n){let i=e.getPathComponents(r),a=null!==i?i.length:0,o=!1;if(a>0&&e.isValidObject(t)){let r=0,s=a-1,u=t;for(;r<s;){let t=i[r];if(t in u){if(!e.isValidObject(u[t]))break}else u[t]={};u=u[t],r++}r===s&&(u[i[s]]=n,o=!0)}return o}static get(t,r){let n,i=e.getPathComponents(r),a=null!==i?i.length:0;if(a>0&&e.isValidObject(t)){let r=0,o=a-1,s=t;for(;r<o;){let t=i[r],n=e.isValidObject(s[t]);if(t in s&&n)s=s[t],r++;else break}r===o&&i[o]in s&&(n=s[i[o]])}return n}static isValidObject(e){return"object"==typeof e&&null!==e&&e instanceof Object}static getPathComponents(e){return"string"==typeof e?e.split("."):null}},eG=e=>{let t="/";if(!e)return t;let r=window.location.origin,n=r.split("/");if(n.length>4){let i=r.indexOf(n[3]);t+=r.substring(i)+e}else t+=e;return t.replace(/\/\/+/g,"/")};function eq(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}var eX=o(985);let eK=e=>e?eX.parse(e):{};function eJ(){let e,t;return Object.freeze({promise:new Promise(function(r,n){t=r,e=n}),resolve:t,reject:e})}var eZ=o(681),eQ=o.n(eZ);!function(e,t={timeout:100}){var r=[],n=null,i=[],a=!1,o=null,s=e.prototype.handleKey;function u(e,t,r){if(!this.recording)return void s.apply(this,arguments);if("keydown"==r.type){1===e.length&&a&&c();for(let e=0;e<t.length;++e)l(t[e]);l(e)}else"keyup"==r.type&&i.length>0&&c()}function l(e){for(let t=0;t<i.length;++t)if(i[t]===e)return;i.push(e),1===e.length&&(a=!0)}function c(){r.push(i),i=[],a=!1,clearTimeout(o),o=setTimeout(d,t.timeout)}function d(){if(n){var e=r;for(let t=0;t<e.length;++t)e[t].sort(function(e,t){return e.length>1&&1===t.length?-1:1===e.length&&t.length>1||e>t?1:-1}),e[t]=e[t].join("+");n(r)}r=[],n=null,i=[]}e.prototype.record=function(e){var t=this;t.recording=!0,n=function(){t.recording=!1,e.apply(t,arguments)}},e.prototype.stopRecord=function(){this.recording=!1},e.prototype.startRecording=function(){this.recording=!0},e.prototype.handleKey=function(){u.apply(this,arguments)},e.init()}(eQ()),b=(v=eQ()).prototype.stopCallback,v.prototype.stopCallback=function(e,t,r){return!!this.paused||b.call(this,e,t,r)},v.prototype.pause=function(){this.paused=!0},v.prototype.unpause=function(){this.paused=!1},v.init();let e0=eQ();function e1(e,t){let r=e2.bind(null,e);return async function(...n){if(e.size>=e.limit)throw Error("Queue limit reached");let i=e8(e.awaiting,t,n);return e.awaiting=i.then(r,r),e.size++,i}}function e2(e){e.size>0&&0==--e.size&&(e.awaiting=null)}async function e8(e,t,r){return await e,t(...r)}var e3=o(867),e4=o.n(e3);function e6(e){return(e6="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 e5(e){var t=function(e,t){if("object"!=e6(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=e6(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==e6(t)?t:t+""}function e7(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?Object(arguments[t]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(t){var n,i;n=t,i=r[t],(n=e5(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i})}return e}function e9(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function te(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,e5(n.key),n)}}function tt(e,t,r){return t&&te(e.prototype,t),r&&te(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function tr(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tn(e,t){if(t&&("object"==e6(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return tr(e)}function ti(e){return(ti=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ta(e,t){return(ta=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function to(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ta(e,t)}function ts(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function tu(e,t){if(e){if("string"==typeof e)return ts(e,t);var r=({}).toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ts(e,t):void 0}}function tl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],u=!0,l=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,i=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}(e,t)||tu(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var tc={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){var r;console&&console[e]&&(r=console)[e].apply(r,function(e){if(Array.isArray(e))return ts(e)}(t)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||tu(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}},td=new(function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e9(this,e),this.init(t,r)}return tt(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||tc,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,r,n){return n&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(r).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,e7({},{prefix:"".concat(this.prefix,":").concat(t,":")},this.options))}}]),e}()),tf=function(){function e(){e9(this,e),this.observers={}}return tt(e,[{key:"on",value:function(e,t){var r=this;return e.split(" ").forEach(function(e){r.observers[e]=r.observers[e]||[],r.observers[e].push(t)}),this}},{key:"off",value:function(e,t){if(this.observers[e]){if(!t)return void delete this.observers[e];this.observers[e]=this.observers[e].filter(function(e){return e!==t})}}},{key:"emit",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.observers[e]&&[].concat(this.observers[e]).forEach(function(e){e.apply(void 0,r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(function(t){t.apply(t,[e].concat(r))})}}]),e}();function th(){var e,t,r=new Promise(function(r,n){e=r,t=n});return r.resolve=e,r.reject=t,r}function tp(e){return null==e?"":""+e}function tm(e,t,r){function n(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var a="string"!=typeof t?[].concat(t):t.split(".");a.length>1;){if(i())return{};var o=n(a.shift());!e[o]&&r&&(e[o]=new r),e=e[o]}return i()?{}:{obj:e,k:n(a.shift())}}function tg(e,t,r){var n=tm(e,t,Object);n.obj[n.k]=r}function ty(e,t){var r=tm(e,t),n=r.obj,i=r.k;if(n)return n[i]}function tD(e,t,r){var n=ty(e,r);return void 0!==n?n:ty(t,r)}function tv(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var tb={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function tS(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return tb[e]}):e}var tE=function(e){function t(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return e9(this,t),r=tn(this,ti(t).call(this)),tf.call(tr(r)),r.data=e||{},r.options=n,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r}return to(t,e),tt(t,[{key:"addNamespaces",value:function(e){0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,a=[e,t];return r&&"string"!=typeof r&&(a=a.concat(r)),r&&"string"==typeof r&&(a=a.concat(i?r.split(i):r)),e.indexOf(".")>-1&&(a=e.split(".")),ty(this.data,a)}},{key:"addResource",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},a=this.options.keySeparator;void 0===a&&(a=".");var o=[e,t];r&&(o=o.concat(a?r.split(a):r)),e.indexOf(".")>-1&&(o=e.split("."),n=t,t=o[1]),this.addNamespaces(t),tg(this.data,o,n),i.silent||this.emit("added",e,t,r,n)}},{key:"addResources",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in r)("string"==typeof r[i]||"[object Array]"===Object.prototype.toString.apply(r[i]))&&this.addResource(e,t,i,r[i],{silent:!0});n.silent||this.emit("added",e,t,r)}},{key:"addResourceBundle",value:function(e,t,r,n,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),n=r,r=t,t=o[1]),this.addNamespaces(t);var s=ty(this.data,o)||{};n?function e(t,r,n){for(var i in r)i in t?"string"==typeof t[i]||t[i]instanceof String||"string"==typeof r[i]||r[i]instanceof String?n&&(t[i]=r[i]):e(t[i],r[i],n):t[i]=r[i];return t}(s,r,i):s=e7({},s,r),tg(this.data,o,s),a.silent||this.emit("added",e,t,r)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return(t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI)?e7({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"toJSON",value:function(){return this.data}}]),t}(tf),tw={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,n,i){var a=this;return e.forEach(function(e){a.processors[e]&&(t=a.processors[e].process(t,r,n,i))}),t}},t_=function(e){function t(e){var r,n,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e9(this,t),i=tn(this,ti(t).call(this)),tf.call(tr(i)),r=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],n=tr(i),r.forEach(function(t){e[t]&&(n[t]=e[t])}),i.options=a,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=td.create("translator"),i}return to(t,e),tt(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},r=this.resolve(e,t);return r&&void 0!==r.res}},{key:"extractFromKey",value:function(e,t){var r=t.nsSeparator||this.options.nsSeparator;void 0===r&&(r=":");var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS;if(r&&e.indexOf(r)>-1){var a=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(a[0])>-1)&&(i=a.shift()),e=a.join(n)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t){var r=this;if("object"!==e6(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=this.extractFromKey(e[e.length-1],t),a=i.key,o=i.namespaces,s=o[o.length-1],u=t.lng||this.language,l=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&"cimode"===u.toLowerCase())return l?s+(t.nsSeparator||this.options.nsSeparator)+a:a;var c=this.resolve(e,t),d=c&&c.res,f=c&&c.usedKey||a,h=c&&c.exactUsedKey||a,p=Object.prototype.toString.apply(d),m=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,g=!this.i18nFormat||this.i18nFormat.handleAsObject,y="string"!=typeof d&&"boolean"!=typeof d&&"number"!=typeof d;if(g&&d&&y&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(p)&&("string"!=typeof m||"[object Array]"!==p)){if(!t.returnObjects&&!this.options.returnObjects)return this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,d,t):"key '".concat(a," (").concat(this.language,")' returned an object instead of string.");if(n){var D="[object Array]"===p,v=D?[]:{},b=D?h:f;for(var S in d)if(Object.prototype.hasOwnProperty.call(d,S)){var E="".concat(b).concat(n).concat(S);v[S]=this.translate(E,e7({},t,{joinArrays:!1,ns:o})),v[S]===E&&(v[S]=d[S])}d=v}}else if(g&&"string"==typeof m&&"[object Array]"===p)(d=d.join(m))&&(d=this.extendTranslation(d,e,t));else{var w=!1,_=!1;if(!this.isValidLookup(d)&&void 0!==t.defaultValue){if(w=!0,void 0!==t.count){var A=this.pluralResolver.getSuffix(u,t.count);d=t["defaultValue".concat(A)]}d||(d=t.defaultValue)}this.isValidLookup(d)||(_=!0,d=a);var I=t.defaultValue&&t.defaultValue!==d&&this.options.updateMissing;if(_||w||I){this.logger.log(I?"updateKey":"missingKey",u,s,a,I?t.defaultValue:d);var C=[],M=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&M&&M[0])for(var x=0;x<M.length;x++)C.push(M[x]);else"all"===this.options.saveMissingTo?C=this.languageUtils.toResolveHierarchy(t.lng||this.language):C.push(t.lng||this.language);var F=function(e,n){r.options.missingKeyHandler?r.options.missingKeyHandler(e,s,n,I?t.defaultValue:d,I,t):r.backendConnector&&r.backendConnector.saveMissing&&r.backendConnector.saveMissing(e,s,n,I?t.defaultValue:d,I,t),r.emit("missingKey",e,s,n,d)};if(this.options.saveMissing){var P=void 0!==t.count&&"string"!=typeof t.count;this.options.saveMissingPlurals&&P?C.forEach(function(e){r.pluralResolver.getPluralFormsOfKey(e,a).forEach(function(t){return F([e],t)})}):F(C,a)}}d=this.extendTranslation(d,e,t,c),_&&d===a&&this.options.appendNamespaceToMissingKey&&(d="".concat(s,":").concat(a)),_&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(d))}return d}},{key:"extendTranslation",value:function(e,t,r,n){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,r,n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(e7({},r,{interpolation:e7({},this.options.interpolation,r.interpolation)}));var a=r.replace&&"string"!=typeof r.replace?r.replace:r;this.options.interpolation.defaultVariables&&(a=e7({},this.options.interpolation.defaultVariables,a)),e=this.interpolator.interpolate(e,a,r.lng||this.language,r),!1!==r.nest&&(e=this.interpolator.nest(e,function(){return i.translate.apply(i,arguments)},r)),r.interpolation&&this.interpolator.reset()}var o=r.postProcess||this.options.postProcess,s="string"==typeof o?[o]:o;return null!=e&&s&&s.length&&!1!==r.applyPostProcessor&&(e=tw.handle(s,e,t,this.options&&this.options.postProcessPassResolved?e7({i18nResolved:n},r):r,this)),e}},{key:"resolve",value:function(e){var t,r,n,i,a,o=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach(function(e){if(!o.isValidLookup(t)){var u=o.extractFromKey(e,s),l=u.key;r=l;var c=u.namespaces;o.options.fallbackNS&&(c=c.concat(o.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,f=void 0!==s.context&&"string"==typeof s.context&&""!==s.context,h=s.lngs?s.lngs:o.languageUtils.toResolveHierarchy(s.lng||o.language,s.fallbackLng);c.forEach(function(e){o.isValidLookup(t)||(a=e,o.utils&&o.utils.hasLoadedNamespace&&!o.utils.hasLoadedNamespace(a)&&o.logger.warn('key "'.concat(r,'" for namespace "').concat(a,"\" won't get resolved as namespace was not yet loaded"),"This means something IS WRONG in your application setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"),h.forEach(function(r){if(!o.isValidLookup(t)){i=r;var a,u,c=l,h=[c];for(o.i18nFormat&&o.i18nFormat.addLookupKeys?o.i18nFormat.addLookupKeys(h,l,r,e,s):(d&&(a=o.pluralResolver.getSuffix(r,s.count)),d&&f&&h.push(c+a),f&&h.push(c+="".concat(o.options.contextSeparator).concat(s.context)),d&&h.push(c+=a));u=h.pop();)o.isValidLookup(t)||(n=u,t=o.getResource(r,e,u,s))}}))})}}),{res:t,usedKey:r,exactUsedKey:n,usedLng:i,usedNS:a}}},{key:"isValidLookup",value:function(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}}]),t}(tf);function tA(e){return e.charAt(0).toUpperCase()+e.slice(1)}var tI=function(){function e(t){e9(this,e),this.options=t,this.whitelist=this.options.whitelist||!1,this.logger=td.create("languageUtils")}return tt(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||0>e.indexOf("-"))return null;var t=e.split("-");return 2===t.length?null:(t.pop(),this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||0>e.indexOf("-"))return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],r=e.split("-");return this.options.lowerCaseLng?r=r.map(function(e){return e.toLowerCase()}):2===r.length?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=tA(r[1].toLowerCase()))):3===r.length&&(r[0]=r[0].toLowerCase(),2===r[1].length&&(r[1]=r[1].toUpperCase()),"sgn"!==r[0]&&2===r[2].length&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=tA(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=tA(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitWhitelist)&&(e=this.getLanguagePartFromCode(e)),!this.whitelist||!this.whitelist.length||this.whitelist.indexOf(e)>-1}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e.default),r||[]}},{key:"toResolveHierarchy",value:function(e,t){var r=this,n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],a=function(e){e&&(r.isWhitelisted(e)?i.push(e):r.logger.warn("rejecting non-whitelisted language code: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&a(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&a(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&a(this.getLanguagePartFromCode(e))):"string"==typeof e&&a(this.formatLanguageCode(e)),n.forEach(function(e){0>i.indexOf(e)&&a(r.formatLanguageCode(e))}),i}}]),e}(),tC=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","id","ja","jbo","ka","kk","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he"],nr:[1,2,20,21],fc:22}],tM={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0===e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(+(1!=e&&e%10!=1))},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0===e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0===e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:3*(e%100==3||e%100==4))},22:function(e){return Number(1===e?0:2===e?1:(e<0||e>10)&&e%10==0?2:3)}},tx=function(){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e9(this,e),this.languageUtils=t,this.options=n,this.logger=td.create("pluralResolver"),this.rules=(r={},tC.forEach(function(e){e.lngs.forEach(function(t){r[t]={numbers:e.nr,plurals:tM[e.fc]}})}),r)}return tt(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var r=this,n=[],i=this.getRule(e);return i&&i.numbers.forEach(function(i){var a=r.getSuffix(e,i);n.push("".concat(t).concat(a))}),n}},{key:"getSuffix",value:function(e,t){var r=this,n=this.getRule(e);if(n){var i=n.noAbs?n.plurals(t):n.plurals(Math.abs(t)),a=n.numbers[i];this.options.simplifyPluralSuffix&&2===n.numbers.length&&1===n.numbers[0]&&(2===a?a="plural":1===a&&(a=""));var o=function(){return r.options.prepend&&a.toString()?r.options.prepend+a.toString():a.toString()};return"v1"===this.options.compatibilityJSON?1===a?"":"number"==typeof a?"_plural_".concat(a.toString()):o():"v2"===this.options.compatibilityJSON?o():this.options.simplifyPluralSuffix&&2===n.numbers.length&&1===n.numbers[0]?o():this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}return this.logger.warn("no plural rule found for: ".concat(e)),""}}]),e}(),tF=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e9(this,e),this.logger=td.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return tt(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:tS,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?tv(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?tv(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?tv(t.nestingPrefix):t.nestingPrefixEscaped||tv("$t("),this.nestingSuffix=t.nestingSuffix?tv(t.nestingSuffix):t.nestingSuffixEscaped||tv(")"),this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=RegExp(t,"g");var r="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=RegExp(r,"g")}},{key:"interpolate",value:function(e,t,r,n){var i,a,o,s=this,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function l(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(0>e.indexOf(s.formatSeparator))return tD(t,u,e);var n=e.split(s.formatSeparator),i=n.shift().trim(),a=n.join(s.formatSeparator).trim();return s.format(tD(t,u,i),a,r)};this.resetRegExp();var d=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler;for(o=0;i=this.regexpUnescape.exec(e);){if(void 0===(a=c(i[1].trim())))if("function"==typeof d){var f=d(e,i,n);a="string"==typeof f?f:""}else this.logger.warn("missed to pass in variable ".concat(i[1]," for interpolating ").concat(e)),a="";else"string"==typeof a||this.useRawValueToEscape||(a=tp(a));if(e=e.replace(i[0],l(a)),this.regexpUnescape.lastIndex=0,++o>=this.maxReplaces)break}for(o=0;i=this.regexp.exec(e);){if(void 0===(a=c(i[1].trim())))if("function"==typeof d){var h=d(e,i,n);a="string"==typeof h?h:""}else this.logger.warn("missed to pass in variable ".concat(i[1]," for interpolating ").concat(e)),a="";else"string"==typeof a||this.useRawValueToEscape||(a=tp(a));if(a=l(this.escapeValue?this.escape(a):a),e=e.replace(i[0],a),this.regexp.lastIndex=0,++o>=this.maxReplaces)break}return e}},{key:"nest",value:function(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=e7({},i);function o(e,t){if(0>e.indexOf(","))return e;var r=e.split(",");e=r.shift();var n=r.join(",");n=(n=this.interpolate(n,a)).replace(/'/g,'"');try{a=JSON.parse(n),t&&(a=e7({},t,a))}catch(t){this.logger.error("failed parsing options string in nesting for key ".concat(e),t)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;r=this.nestingRegexp.exec(e);){if((n=t(o.call(this,r[1].trim(),a),a))&&r[0]===e&&"string"!=typeof n)return n;"string"!=typeof n&&(n=tp(n)),n||(this.logger.warn("missed to resolve ".concat(r[1]," for nesting ").concat(e)),n=""),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}]),e}(),tP=function(e){function t(e,r,n){var i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return e9(this,t),i=tn(this,ti(t).call(this)),tf.call(tr(i)),i.backend=e,i.store=r,i.services=n,i.languageUtils=n.languageUtils,i.options=a,i.logger=td.create("backendConnector"),i.state={},i.queue=[],i.backend&&i.backend.init&&i.backend.init(n,a.backend,a),i}return to(t,e),tt(t,[{key:"queueLoad",value:function(e,t,r,n){var i=this,a=[],o=[],s=[],u=[];return e.forEach(function(e){var n=!0;t.forEach(function(t){var s="".concat(e,"|").concat(t);!r.reload&&i.store.hasResourceBundle(e,t)?i.state[s]=2:i.state[s]<0||(1===i.state[s]?0>o.indexOf(s)&&o.push(s):(i.state[s]=1,n=!1,0>o.indexOf(s)&&o.push(s),0>a.indexOf(s)&&a.push(s),0>u.indexOf(t)&&u.push(t)))}),n||s.push(e)}),(a.length||o.length)&&this.queue.push({pending:o,loaded:{},errors:[],callback:n}),{toLoad:a,pending:o,toLoadLanguages:s,toLoadNamespaces:u}}},{key:"loaded",value:function(e,t,r){var n=tl(e.split("|"),2),i=n[0],a=n[1];t&&this.emit("failedLoading",i,a,t),r&&this.store.addResourceBundle(i,a,r),this.state[e]=t?-1:2;var o={};this.queue.forEach(function(r){n=r.loaded,(u=(s=tm(n,[i],Object)).obj)[l=s.k]=u[l]||[],u[l].push(a);for(var n,s,u,l,c=r.pending,d=c.indexOf(e);-1!==d;)c.splice(d,1),d=c.indexOf(e);t&&r.errors.push(t),0!==r.pending.length||r.done||(Object.keys(r.loaded).forEach(function(e){o[e]||(o[e]=[]),r.loaded[e].length&&r.loaded[e].forEach(function(t){0>o[e].indexOf(t)&&o[e].push(t)})}),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(function(e){return!e.done})}},{key:"read",value:function(e,t,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,o=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[r](e,t,function(s,u){s&&u&&i<5?setTimeout(function(){n.read.call(n,e,t,r,i+1,2*a,o)},a):o(s,u)}):o(null,{})}},{key:"prepareLoading",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var a=this.queueLoad(e,t,n,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(function(e){r.loadOne(e)})}},{key:"load",value:function(e,t,r){this.prepareLoading(e,t,{},r)}},{key:"reload",value:function(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}},{key:"loadOne",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=tl(e.split("|"),2),i=n[0],a=n[1];this.read(i,a,"read",null,null,function(n,o){n&&t.logger.warn("".concat(r,"loading namespace ").concat(a," for language ").concat(i," failed"),n),!n&&o&&t.logger.log("".concat(r,"loaded namespace ").concat(a," for language ").concat(i),o),t.loaded(e,n,o)})}},{key:"saveMissing",value:function(e,t,r,n,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(r,'" for namespace "').concat(t,'" as the namespace was not yet loaded'),"This means something IS WRONG in your application setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):(this.backend&&this.backend.create&&this.backend.create(e,t,r,n,null,e7({},a,{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,r,n))}}]),t}(tf);function tO(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&0>e.whitelist.indexOf("cimode")&&(e.whitelist=e.whitelist.concat(["cimode"])),e}function tT(){}let tk=new(function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(e9(this,t),e=tn(this,ti(t).call(this)),tf.call(tr(e)),e.options=tO(r),e.services={},e.logger=td,e.modules={external:[]},n&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,n),tn(e,tr(e));setTimeout(function(){e.init(r,n)},0)}return e}return to(t,e),tt(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;function n(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(r=t,t={}),this.options=e7({},{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===e6(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===e6(e[2])||"object"===e6(e[3])){var r=e[3]||e[2];Object.keys(r).forEach(function(e){t[e]=r[e]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",maxReplaces:1e3}},this.options,tO(t)),this.format=this.options.interpolation.format,r||(r=tT),!this.options.isClone){this.modules.logger?td.init(n(this.modules.logger),this.options):td.init(null,this.options);var i=new tI(this.options);this.store=new tE(this.options.resources,this.options);var a=this.services;a.logger=td,a.resourceStore=this.store,a.languageUtils=i,a.pluralResolver=new tx(i,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),a.interpolator=new tF(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new tP(n(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];e.emit.apply(e,[t].concat(n))}),this.modules.languageDetector&&(a.languageDetector=n(this.modules.languageDetector),a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=n(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new t_(this.services,this.options),this.translator.on("*",function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];e.emit.apply(e,[t].concat(n))}),this.modules.external.forEach(function(t){t.init&&t.init(e)})}["getResource","addResource","addResources","addResourceBundle","removeResourceBundle","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments)}});var o=th(),s=function(){e.changeLanguage(e.options.lng,function(t,n){e.isInitialized=!0,e.logger.log("initialized",e.options),e.emit("initialized",e.options),o.resolve(n),r(t,n)})};return this.options.resources||!this.options.initImmediate?s():setTimeout(s,0),o}},{key:"loadResources",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tT;if(!this.options.resources||this.options.partialBundledLanguages){if(this.language&&"cimode"===this.language.toLowerCase())return t();var r=[],n=function(t){t&&e.services.languageUtils.toResolveHierarchy(t).forEach(function(e){0>r.indexOf(e)&&r.push(e)})};this.language?n(this.language):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(function(e){return n(e)}),this.options.preload&&this.options.preload.forEach(function(e){return n(e)}),this.services.backendConnector.load(r,this.options.ns,t)}else t(null)}},{key:"reloadResources",value:function(e,t,r){var n=th();return e||(e=this.languages),t||(t=this.options.ns),r||(r=tT),this.services.backendConnector.reload(e,t,function(e){n.resolve(),r(e)}),n}},{key:"use",value:function(e){return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&tw.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var r=this,n=th();this.emit("languageChanging",e);var i=function(e,i){r.translator.changeLanguage(i),i&&(r.emit("languageChanged",i),r.logger.log("languageChanged",i)),n.resolve(function(){return r.t.apply(r,arguments)}),t&&t(e,function(){return r.t.apply(r,arguments)})},a=function(e){e&&(r.language=e,r.languages=r.services.languageUtils.toResolveHierarchy(e),r.translator.language||r.translator.changeLanguage(e),r.services.languageDetector&&r.services.languageDetector.cacheUserLanguage(e)),r.loadResources(function(t){i(t,e)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(a):a(e):a(this.services.languageDetector.detect()),n}},{key:"getFixedT",value:function(e,t){var r=this,n=function e(t,n){var i;if("object"!==e6(n)){for(var a=arguments.length,o=Array(a>2?a-2:0),s=2;s<a;s++)o[s-2]=arguments[s];i=r.options.overloadTranslationOptionHandler([t,n].concat(o))}else i=e7({},n);return i.lng=i.lng||e.lng,i.lngs=i.lngs||e.lngs,i.ns=i.ns||e.ns,r.t(t,i)};return"string"==typeof e?n.lng=e:n.lngs=e,n.ns=t,n}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this;if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.languages[0],n=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return -1===n||2===n};return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||a(r,e)&&(!n||a(i,e)))}},{key:"loadNamespaces",value:function(e,t){var r=this,n=th();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach(function(e){0>r.options.ns.indexOf(e)&&r.options.ns.push(e)}),this.loadResources(function(e){n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var r=th();"string"==typeof e&&(e=[e]);var n=this.options.preload||[],i=e.filter(function(e){return 0>n.indexOf(e)});return i.length?(this.options.preload=n.concat(i),this.loadResources(function(e){r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){return(e||(e=this.languages&&this.languages.length>0?this.languages[0]:this.language),e)?["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr":"rtl"}},{key:"createInstance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return new t(e,r)}},{key:"cloneInstance",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tT,i=e7({},this.options,r,{isClone:!0}),a=new t(i);return["store","services","language"].forEach(function(t){a[t]=e[t]}),a.translator=new t_(a.services,a.options),a.translator.on("*",function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];a.emit.apply(a,[e].concat(r))}),a.init(i,n),a.translator.options=a.options,a}}]),t}(tf));function tN(e){if(!e)return;let t=e.Alphabetic??e;return"object"==typeof t&&(t=""),t.replace("^",", ").replace(/\^/g," ").trim()}let tB={"*":"application/octet-stream","1.2.840.10008.1.2.1":"application/octet-stream","1.2.840.10008.1.2":"application/octet-stream","1.2.840.10008.1.2.2":"application/octet-stream","1.2.840.10008.1.2.4.70":"image/jpeg","1.2.840.10008.1.2.4.50":"image/jpeg","1.2.840.10008.1.2.4.51":"image/dicom+jpeg","1.2.840.10008.1.2.4.57":"image/jpeg","1.2.840.10008.1.2.5":"image/dicom-rle","1.2.840.10008.1.2.4.80":"image/jls","1.2.840.10008.1.2.4.81":"image/jls","1.2.840.10008.1.2.4.90":"image/jp2","1.2.840.10008.1.2.4.91":"image/jp2","1.2.840.10008.1.2.4.92":"image/jpx","1.2.840.10008.1.2.4.93":"image/jpx"};function tU(e,t){for(let r=0,n=e.length;r<n;++r){let n=e[r];if(tL(n)){if(n[1].length>0){tU(n[1],t.bind(null,n[0]));continue}n=n[0]}t(n)}}function tL(e){return Array.isArray(e)&&2===e.length&&"string"==typeof e[0]&&Array.isArray(e[1])}let tR=Symbol("Type"),tj=Symbol("Task"),tV=Symbol("List");function tY(e){return tK(tV,e)}function t$(e,t){return tX(tj,{list:tY(e)?e:null,next:tz(t)?t:null,failed:!1,awaiting:null,progress:0})}function tz(e){return tK(tj,e)}function tW(e){if(tY(e)){let t=t$(e,e.head);return e.head=t,tZ(e,tG(e)),t}return null}function tH(e){tz(e)&&(e.progress=1,e.awaiting=null,Object.freeze(e),tY(e.list)&&tZ(e.list,tG(e.list)))}function tG(e){let t=Object.seal({total:0,partial:0,progress:0,failures:0});if(tY(e)){let r=e.head;for(;tz(r);)t.total++,tJ(r.progress)&&(t.partial+=r.progress,1===r.progress&&r.failed&&t.failures++),r=r.next}return t.total>0&&(t.progress=t.partial/t.total),Object.freeze(t)}function tq(e,t){let r=tW(e);return tz(r)?(r.awaiting=Promise.resolve(t).then(function(){tH(r)},function(){r.failed=!0,tH(r)}),r):null}function tX(e,t){return Object.seal(Object.defineProperty(t,tR,{value:e}))}function tK(e,t){return null!==t&&"object"==typeof t&&t[tR]===e}function tJ(e){return"number"==typeof e&&e>=0&&e<=1}function tZ(e,t){tY(e)&&Array.isArray(e.observers)&&e.observers.length>0&&e.observers.slice().forEach(function(r){if("function"==typeof r)try{r(t,e)}catch(e){}})}let tQ=Object.freeze(["SEG","KO","PR","SR","RTSTRUCT","RTDOSE","RTPLAN","RTRECORD","REG"]);function t0(e){return tQ.includes(e)}let t1={ComputedRadiographyImageStorage:"1.2.840.10008.5.1.4.1.1.1",DigitalXRayImageStorageForPresentation:"1.2.840.10008.5.1.4.1.1.1.1",DigitalXRayImageStorageForProcessing:"1.2.840.10008.5.1.4.1.1.1.1.1",DigitalMammographyXRayImageStorageForPresentation:"1.2.840.10008.5.1.4.1.1.1.2",DigitalMammographyXRayImageStorageForProcessing:"1.2.840.10008.5.1.4.1.1.1.2.1",DigitalIntraOralXRayImageStorageForPresentation:"1.2.840.10008.5.1.4.1.1.1.3",DigitalIntraOralXRayImageStorageForProcessing:"1.2.840.10008.5.1.4.1.1.1.3.1",CTImageStorage:"1.2.840.10008.5.1.4.1.1.2",EnhancedCTImageStorage:"1.2.840.10008.5.1.4.1.1.2.1",LegacyConvertedEnhancedCTImageStorage:"1.2.840.10008.5.1.4.1.1.2.2",UltrasoundMultiframeImageStorage:"1.2.840.10008.5.1.4.1.1.3.1",MRImageStorage:"1.2.840.10008.5.1.4.1.1.4",EnhancedMRImageStorage:"1.2.840.10008.5.1.4.1.1.4.1",MRSpectroscopyStorage:"1.2.840.10008.5.1.4.1.1.4.2",EnhancedMRColorImageStorage:"1.2.840.10008.5.1.4.1.1.4.3",LegacyConvertedEnhancedMRImageStorage:"1.2.840.10008.5.1.4.1.1.4.4",UltrasoundImageStorage:"1.2.840.10008.5.1.4.1.1.6.1",EnhancedUSVolumeStorage:"1.2.840.10008.5.1.4.1.1.6.2",SecondaryCaptureImageStorage:"1.2.840.10008.5.1.4.1.1.7",MultiframeSingleBitSecondaryCaptureImageStorage:"1.2.840.10008.5.1.4.1.1.7.1",MultiframeGrayscaleByteSecondaryCaptureImageStorage:"1.2.840.10008.5.1.4.1.1.7.2",MultiframeGrayscaleWordSecondaryCaptureImageStorage:"1.2.840.10008.5.1.4.1.1.7.3",MultiframeTrueColorSecondaryCaptureImageStorage:"1.2.840.10008.5.1.4.1.1.7.4",Sop12LeadECGWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.1.1",GeneralECGWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.1.2",AmbulatoryECGWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.1.3",HemodynamicWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.2.1",CardiacElectrophysiologyWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.3.1",BasicVoiceAudioWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.4.1",GeneralAudioWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.4.2",ArterialPulseWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.5.1",RespiratoryWaveformStorage:"1.2.840.10008.5.1.4.1.1.9.6.1",GrayscaleSoftcopyPresentationStateStorage:"1.2.840.10008.5.1.4.1.1.11.1",ColorSoftcopyPresentationStateStorage:"1.2.840.10008.5.1.4.1.1.11.2",PseudoColorSoftcopyPresentationStateStorage:"1.2.840.10008.5.1.4.1.1.11.3",BlendingSoftcopyPresentationStateStorage:"1.2.840.10008.5.1.4.1.1.11.4",XAXRFGrayscaleSoftcopyPresentationStateStorage:"1.2.840.10008.5.1.4.1.1.11.5",XRayAngiographicImageStorage:"1.2.840.10008.5.1.4.1.1.12.1",EnhancedXAImageStorage:"1.2.840.10008.5.1.4.1.1.12.1.1",XRayRadiofluoroscopicImageStorage:"1.2.840.10008.5.1.4.1.1.12.2",EnhancedXRFImageStorage:"1.2.840.10008.5.1.4.1.1.12.2.1",XRay3DAngiographicImageStorage:"1.2.840.10008.5.1.4.1.1.13.1.1",XRay3DCraniofacialImageStorage:"1.2.840.10008.5.1.4.1.1.13.1.2",BreastTomosynthesisImageStorage:"1.2.840.10008.5.1.4.1.1.13.1.3",BreastProjectionXRayImageStorageForPresentation:"1.2.840.10008.5.1.4.1.1.13.1.4",BreastProjectionXRayImageStorageForProcessing:"1.2.840.10008.5.1.4.1.1.13.1.5",IntravascularOpticalCoherenceTomographyImageStorageForPresentation:"1.2.840.10008.5.1.4.1.1.14.1",IntravascularOpticalCoherenceTomographyImageStorageForProcessing:"1.2.840.10008.5.1.4.1.1.14.2",NuclearMedicineImageStorage:"1.2.840.10008.5.1.4.1.1.20",RawDataStorage:"1.2.840.10008.5.1.4.1.1.66",SpatialRegistrationStorage:"1.2.840.10008.5.1.4.1.1.66.1",SpatialFiducialsStorage:"1.2.840.10008.5.1.4.1.1.66.2",DeformableSpatialRegistrationStorage:"1.2.840.10008.5.1.4.1.1.66.3",SegmentationStorage:"1.2.840.10008.5.1.4.1.1.66.4",LabelmapSegmentationStorage:"1.2.840.10008.5.1.4.1.1.66.7",SurfaceSegmentationStorage:"1.2.840.10008.5.1.4.1.1.66.5",RealWorldValueMappingStorage:"1.2.840.10008.5.1.4.1.1.67",SurfaceScanMeshStorage:"1.2.840.10008.5.1.4.1.1.68.1",SurfaceScanPointCloudStorage:"1.2.840.10008.5.1.4.1.1.68.2",VLEndoscopicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.1",VideoEndoscopicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.1.1",VLMicroscopicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.2",VideoMicroscopicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.2.1",VLSlideCoordinatesMicroscopicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.3",VLPhotographicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.4",VideoPhotographicImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.4.1",OphthalmicPhotography8BitImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.5.1",OphthalmicPhotography16BitImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.5.2",StereometricRelationshipStorage:"1.2.840.10008.5.1.4.1.1.77.1.5.3",OphthalmicTomographyImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.5.4",VLWholeSlideMicroscopyImageStorage:"1.2.840.10008.5.1.4.1.1.77.1.6",LensometryMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.1",AutorefractionMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.2",KeratometryMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.3",SubjectiveRefractionMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.4",VisualAcuityMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.5",SpectaclePrescriptionReportStorage:"1.2.840.10008.5.1.4.1.1.78.6",OphthalmicAxialMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.78.7",IntraocularLensCalculationsStorage:"1.2.840.10008.5.1.4.1.1.78.8",MacularGridThicknessandVolumeReport:"1.2.840.10008.5.1.4.1.1.79.1",OphthalmicVisualFieldStaticPerimetryMeasurementsStorage:"1.2.840.10008.5.1.4.1.1.80.1",OphthalmicThicknessMapStorage:"1.2.840.10008.5.1.4.1.1.81.1",CornealTopographyMapStorage:"1.2.840.10008.5.1.4.1.1.82.1",BasicTextSR:"1.2.840.10008.5.1.4.1.1.88.11",EnhancedSR:"1.2.840.10008.5.1.4.1.1.88.22",ComprehensiveSR:"1.2.840.10008.5.1.4.1.1.88.33",Comprehensive3DSR:"1.2.840.10008.5.1.4.1.1.88.34",ProcedureLog:"1.2.840.10008.5.1.4.1.1.88.40",MammographyCADSR:"1.2.840.10008.5.1.4.1.1.88.50",KeyObjectSelection:"1.2.840.10008.5.1.4.1.1.88.59",ChestCADSR:"1.2.840.10008.5.1.4.1.1.88.65",XRayRadiationDoseSR:"1.2.840.10008.5.1.4.1.1.88.67",RadiopharmaceuticalRadiationDoseSR:"1.2.840.10008.5.1.4.1.1.88.68",ColonCADSR:"1.2.840.10008.5.1.4.1.1.88.69",ImplantationPlanSRDocumentStorage:"1.2.840.10008.5.1.4.1.1.88.70",EncapsulatedPDFStorage:"1.2.840.10008.5.1.4.1.1.104.1",EncapsulatedCDAStorage:"1.2.840.10008.5.1.4.1.1.104.2",PositronEmissionTomographyImageStorage:"1.2.840.10008.5.1.4.1.1.128",EnhancedPETImageStorage:"1.2.840.10008.5.1.4.1.1.130",LegacyConvertedEnhancedPETImageStorage:"1.2.840.10008.5.1.4.1.1.128.1",BasicStructuredDisplayStorage:"1.2.840.10008.5.1.4.1.1.131",RTImageStorage:"1.2.840.10008.5.1.4.1.1.481.1",RTDoseStorage:"1.2.840.10008.5.1.4.1.1.481.2",RTStructureSetStorage:"1.2.840.10008.5.1.4.1.1.481.3",RTBeamsTreatmentRecordStorage:"1.2.840.10008.5.1.4.1.1.481.4",RTPlanStorage:"1.2.840.10008.5.1.4.1.1.481.5",RTBrachyTreatmentRecordStorage:"1.2.840.10008.5.1.4.1.1.481.6",RTTreatmentSummaryRecordStorage:"1.2.840.10008.5.1.4.1.1.481.7",RTIonPlanStorage:"1.2.840.10008.5.1.4.1.1.481.8",RTIonBeamsTreatmentRecordStorage:"1.2.840.10008.5.1.4.1.1.481.9",RTBeamsDeliveryInstructionStorage:"1.2.840.10008.5.1.4.34.7",GenericImplantTemplateStorage:"1.2.840.10008.5.1.4.43.1",ImplantAssemblyTemplateStorage:"1.2.840.10008.5.1.4.44.1",ImplantTemplateGroupStorage:"1.2.840.10008.5.1.4.45.1"},t2=[t1.ComputedRadiographyImageStorage,t1.DigitalXRayImageStorageForPresentation,t1.DigitalXRayImageStorageForProcessing,t1.DigitalMammographyXRayImageStorageForPresentation,t1.DigitalMammographyXRayImageStorageForProcessing,t1.DigitalIntraOralXRayImageStorageForPresentation,t1.DigitalIntraOralXRayImageStorageForProcessing,t1.CTImageStorage,t1.EnhancedCTImageStorage,t1.LegacyConvertedEnhancedCTImageStorage,t1.UltrasoundMultiframeImageStorage,t1.EnhancedUSVolumeStorage,t1.MRImageStorage,t1.EnhancedMRImageStorage,t1.EnhancedMRColorImageStorage,t1.LegacyConvertedEnhancedMRImageStorage,t1.UltrasoundImageStorage,t1.SecondaryCaptureImageStorage,t1.MultiframeSingleBitSecondaryCaptureImageStorage,t1.MultiframeGrayscaleByteSecondaryCaptureImageStorage,t1.MultiframeGrayscaleWordSecondaryCaptureImageStorage,t1.MultiframeTrueColorSecondaryCaptureImageStorage,t1.XRayAngiographicImageStorage,t1.EnhancedXAImageStorage,t1.XRayRadiofluoroscopicImageStorage,t1.EnhancedXRFImageStorage,t1.XRay3DAngiographicImageStorage,t1.XRay3DCraniofacialImageStorage,t1.BreastTomosynthesisImageStorage,t1.BreastProjectionXRayImageStorageForPresentation,t1.BreastProjectionXRayImageStorageForProcessing,t1.IntravascularOpticalCoherenceTomographyImageStorageForPresentation,t1.IntravascularOpticalCoherenceTomographyImageStorageForProcessing,t1.NuclearMedicineImageStorage,t1.VLEndoscopicImageStorage,t1.VideoEndoscopicImageStorage,t1.VLMicroscopicImageStorage,t1.VideoMicroscopicImageStorage,t1.VLSlideCoordinatesMicroscopicImageStorage,t1.VLPhotographicImageStorage,t1.VideoPhotographicImageStorage,t1.OphthalmicPhotography8BitImageStorage,t1.OphthalmicPhotography16BitImageStorage,t1.OphthalmicTomographyImageStorage,t1.VLWholeSlideMicroscopyImageStorage,t1.PositronEmissionTomographyImageStorage,t1.EnhancedPETImageStorage,t1.LegacyConvertedEnhancedPETImageStorage,t1.RTImageStorage];function t8(e){return Array.isArray(e)?[...e].map(e=>void 0!==e?Number(e):e):void 0!==e?Number(e):e}var t3=o(155);function t4(e,t){if(void 0!==e&&void 0!==t)return .01>Math.abs(e[0]-t[0])&&.01>Math.abs(e[1]-t[1])&&.01>Math.abs(e[2]-t[2])&&.01>Math.abs(e[3]-t[3])&&.01>Math.abs(e[4]-t[4])&&.01>Math.abs(e[5]-t[5])}function t6(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}let t5="missingframes",t7="irregularspacing";function t9(e){let t=e.indexOf(":");return e.substring(t+1)}function re(e){return(/^(http|https|dicomfile):\/\//.test(e)?e:t9(e)).split("&frame=")[0].split("?frame=")[0]}function rt(e,t){let r=URL.createObjectURL(e);rr(r,t),URL.revokeObjectURL(r)}function rr(e,t){let r=document.createElement("a");r.setAttribute("href",e);let n=t?.filename||"file.dcm";r.setAttribute("download",n),document.body.appendChild(r),r.click(),document.body.removeChild(r)}let rn={get:(e,t)=>"__isProxy"==t||(t in e?e[t]:e[0][t]),set:(e,t,r)=>("number"==typeof t||t in e?e[t]=r:e[0][t]=r,!0)};function ri(e){let t=t3.vec3.fromValues(e[0],e[1],e[2]),r=t3.vec3.fromValues(e[3],e[4],e[5]);return t3.vec3.cross(t3.vec3.create(),t,r)}function ra(e){if(!e?.length)return!1;let t=t8(e[0].ImageOrientationPatient);for(let r=1;r<e.length;r++)if(!t4(t8(e[r].ImageOrientationPatient),t))return!1;return!0}let ro=(e,t)=>e==t?0:!e&&t?-1:!t&&e?1:e<t?-1:1,rs=new Map,ru=(e,t)=>{let{compareSameSeries:r="default"}=e,{compareSameSeries:n="default"}=t,i=rs.get(r),a=rs.get(n);if(i&&a){let r=i===a?i.compare(e,t):ro(i.priority,a.priority);if(!r)return r}return rh(e.instance,t.instance)},rl=(e,t)=>ro(e.SeriesInstanceUID,t.SeriesInstanceUID)||ru(e,t),rc=(e,t)=>ro(`${e.seriesDate??e.SeriesDate} ${e.seriesTime??e.SeriesTime}`,`${t.seriesDate??t.SeriesDate} ${t.seriesTime??t.SeriesTime}`)||rl(e,t);function rd(e,t){let r=t0(e.Modality??e.modality),n=t0(t.Modality??t.modality);return r?n?rc(t,e):1:n?-1:ro(e.SeriesNumber??e.seriesNumber,t.SeriesNumber??t.seriesNumber)||rc(e,t)}let rf={default:rd,seriesInfoSortingCriteria:rd,compareSameSeries:ru,compareSeriesDateTime:rc,compareSeriesUID:rl},rh=(e,t)=>e&&t?(parseInt(e.InstanceNumber)||0)!==(parseInt(t.InstanceNumber)||0)?(parseInt(e.InstanceNumber)||0)-(parseInt(t.InstanceNumber)||0):ro(e.SOPInstanceUID,t.SOPInstanceUID)||ro(e.frameNumber,t.frameNumber):!e&&-1||1,rp={default:rh,sortByInstanceNumber:rh},rm=(e,t=rf.default,r=null)=>"function"==typeof r?r(e):e.sort(t),rg=(e,t=rp.default)=>e.sort(t),ry=e=>{if(!e)return null;for(let t=0;t<e.length;t++)if(-1!==e[t].indexOf(",")){let r=e[t].split(/,/);e.splice(t,1,...r)}return e},rD=(e,t=new URLSearchParams(window.location.search))=>{let r=[...t.keys()].find(t=>t.toLowerCase()===e);if(r)return ry(t.getAll(r))};var rv=o(326);let rb=(0,rv.createContext)(null),{Provider:rS}=rb,rE=()=>(0,rv.useContext)(rb);function rw({children:e,servicesManager:t,commandsManager:r,extensionManager:n,hotkeysManager:i}){return rv.createElement(rS,{value:{servicesManager:t,commandsManager:r,extensionManager:n,hotkeysManager:i}},e)}function r_(e){if(e)return t=>e.includes(t.referenceSeriesUID)}function rA(e){return t=>t.referenceStudyUID==e}function rI(e){return e?.referencedImageId}function rC(e){return t=>t.metadata?.toolName===e}function rM(e){return!0}function rx(e){return!1}function rF(...e){return function(t){for(let r of e)if(!r||("string"==typeof r&&(r=this[r]),"function"==typeof r&&r.call(this,t)))return!0;return!1}}let{POINT:rP}=ei.VALUE_TYPES;function rO(e){return e.type===rP&&e.referencedImageId}function rT(e,t){return r=>!e(r)&&t(r)}let rk=e=>"string"==typeof e||e instanceof String;function rN(...e){let t=e.filter(e=>!!e);if(t.length)return 1===t.length&&"function"==typeof t[0]?t[0]:function(e){for(let r of t)if(rk(r)){if(!this[r](e))return!1}else if(!r.call(this,e))return!1;return!0}}let rB=e=>Array.isArray(e)?e:null!=e?[e]:[],rU=new Set(["70531000","70531009"]);function rL(e){let t=new TextDecoder().decode(e).replace(/\0+/g,"").trim().split("\\")[0].trim();if(!t)return;let r=Number(t);return Number.isFinite(r)?r:void 0}function rR(e){let t=ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e)?new Uint8Array(e):void 0;if(t&&0!==t.byteLength){let e,r;return function(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++){let r=e[t],n=r>=48&&r<=57,i=43===r||45===r||46===r||69===r||101===r||92===r||32===r||0===r;if(!n&&!i)return!1}return!0}(t)?rL(t):(r=new DataView(t.buffer,t.byteOffset,t.byteLength),4===t.byteLength?e=r.getFloat32(0,!0):8===t.byteLength&&(e=r.getFloat64(0,!0)),(void 0!==e&&Number.isFinite(e)?e:void 0)??rL(t))}}async function rj(e){let t=e.Value;if(null==t&&"function"==typeof e.retrieveBulkData&&(t=await e.retrieveBulkData()),null!=t)return rR(t)}async function rV(e){e&&await Promise.all([...rU].map(async t=>{let r=t in e?t:t.toLowerCase(),n=e[r];if(null!=n&&"object"==typeof n)try{let t=await rj(n);void 0!==t&&(e[r]=t)}catch(e){console.warn(`resolveBulkDataTags: failed to resolve tag ${t}`,e)}}))}async function rY(e){Array.isArray(e)&&e.length&&await Promise.all(e.map(rV))}let r$={guid:P,uuidv4:eq,ObjectPath:eH,absoluteUrl:eG,sortBy:eR,sortBySeriesDate:rm,sortStudy:function(e,t=!0,r=rf.default,n=rp.default){if(!e||!e.series)throw Error("Insufficient study data was provided to sortStudy");return rm(e.series,r),t&&e.series.forEach(e=>{rg(e.instances,n)}),e},sortStudySeries:rm,sortStudyInstances:rg,sortDisplaySetsCopy:function(e,t){let r=t?.seriesSortingCriteria??rf.default,n=t?.studyInstanceUIDFirst;if(!n)return[...e].sort(r);let i=[],a=[];for(let t of e)t.StudyInstanceUID===n?i.push(t):a.push(t);return[...[...i].sort(r),...a]},sortingCriteria:{seriesSortCriteria:rf,instancesSortCriteria:rp},seriesSortCriteria:rf,instancesSortCriteria:rp,writeScript:function(e,t){let r=document.createElement("script");r.src=eG(e),r.onload=()=>{"function"==typeof t&&t(r)},document.body.appendChild(r)},formatDate:(e,t=tk.t("Common:localDateFormat","DD-MMM-YYYY"))=>{if(!e)return"";let r=tk.language||"en",n=e4()(e,["YYYYMMDD","YYYY.MM.DD"],!0);return n.isValid()?n.locale(r).format(t):e4()(e).locale(r).format(t)},formatTime:function(e,t="HH:mm:ss"){return e4()(e,"HH:mm:ss").format(t)},formatPN:tN,formatValue:function(e){return null==e?null:"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.Alphabetic?e.Alphabetic:"number"==typeof e||"boolean"==typeof e?String(e):null},b64toBlob:(e,t="",r=512)=>{let n=atob(e),i=[];for(let e=0;e<n.length;e+=r){let t=n.slice(e,e+r),a=Array(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);let o=new Uint8Array(a);i.push(o)}return new Blob(i,{type:t})},urlUtil:{parse:eK,queryString:{getQueryFilters:(e={})=>{let{search:t}=e;if(!t)return;let r=eK(t),n={};return Object.entries(r).forEach(([e,t])=>{n[e[0].toLowerCase()+e.slice(1)]=t}),n}},paramString:{isValidPath:e=>0>e.indexOf("/:"),parseParam:e=>{let t=((e="")=>{try{return window.atob(e)}catch(t){return e}})(e);if(t&&"string"==typeof t)return t.split(";")},replaceParam:(e="",t,r)=>{let n=`:${t}`;return r?e.replace(n,r):e}}},imageIdToURI:t9,makeDeferred:eJ,makeCancelable:function(e){let t=!1,r=Promise.resolve(e).then(function(e){if(t)throw Object.freeze({isCanceled:t});return e},function(e){if(t)throw Object.freeze({isCanceled:t,error:e});throw e});return Object.assign(Object.create(r),{then:r.then.bind(r),cancel(){t=!0}})},structuredCloneWithFunctions:function e(t,r=new WeakMap){if(null===t||"object"!=typeof t||"function"==typeof t)return t;if(r.has(t))return r.get(t);if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)){let n=[];for(let i of(r.set(t,n),t))n.push(e(i,r));return n}let n={};for(let i of(r.set(t,n),Object.keys(t)))n[i]=e(t[i],r);return n},hotkeys:e0,Queue:class{constructor(e){this.limit=e,this.size=0,this.awaiting=null}bind(e){return e1(this,e)}bindSafe(e,t){let r=e1(this,e);return async function(...e){try{return await r(...e)}catch(e){t(e)}}}},isDicomUid:function(e){return"string"==typeof e&&/^\d+(?:\.\d+)*$/.test(e.trim())},isEqualWithin:function(e,t,r=1e-5){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(Math.abs(e[n]-t[n])>r)return!1;return!0},sopClassDictionary:t1,addAccessors:(e,t)=>{if(e.__isProxy)return e;let r=t;if(void 0===r){if("object"!=typeof e||Array.isArray(e)&&1!==e.length)return e;r=Array.isArray(e)?e[0]:e}return new Proxy([r],rn)},resolveObjectPath:function e(t,r,n){if(null!==t&&"object"==typeof t&&"string"==typeof r){let i,a=r.indexOf(".");return a>=0?e(t[r.slice(0,a)],r.slice(a+1,r.length),n):void 0===(i=t[r])&&void 0!==n?n:i}},hierarchicalListUtils:{addToList:function(e,...t){return Array.isArray(e)?(t.length>0&&function e(t,r){var n,i;let a,o=r.shift(),s=(-2===(a=function(e,t){if("string"==typeof t){for(let r=0,n=e.length;r<n;++r){let n=e[r];if(n===t||tL(n)&&n[0]===t)return r}return -2}return -1}(n=t,i=o))&&(a=n.push(i)-1),a);if(s>=0){if(r.length>0){let n=t[s];return tL(n)||(n=[o+"",[]],t[s]=n),e(n[1],r)}return!0}return!1}(e,t),e):null},getItem:function e(t,r){if(Array.isArray(t)){let n=null,i="number"==typeof r?r:-1;if("string"==typeof r){let e=r.indexOf("/");e>0?(i=parseInt(r.slice(0,e),10),e+1<r.length&&(n=r.slice(e+1,r.length))):i=parseInt(r,10)}if(i>=0&&i<t.length){let r=t[i];return tL(r)?null!==n?e(r[1],n):r[0]:r}}},forEach:function(e,t){return Array.isArray(e)?("function"==typeof t&&tU(e,t),e):null},print:function(e){let t="";if(Array.isArray(e)){let r=[];tU(e,function(...e){let n=r.length;for(let i=0,a=e.length;i<a;++i)i<n&&e[i]===r[i]||(t+=" ".repeat(i)+e[i]+"\n");r=e})}return t}},progressTrackingUtils:{createList:function(){return tX(tV,{head:null,named:Object.create(null),observers:[]})},isList:tY,createTask:t$,isTask:tz,increaseList:tW,update:function(e,t){tz(e)&&tJ(t)&&t<1&&e.progress!==t&&(e.progress=t,tY(e.list)&&tZ(e.list,tG(e.list)))},finish:tH,getOverallProgress:tG,waitOn:tq,addDeferred:function(e){let t=eJ(),r=tq(e,t.promise);return Object.freeze({deferred:t,task:r})},setTaskName:function(e,t,r){return!!function(e,t){if(tY(e)&&tz(t)){let r=e.head;for(;tz(r);){if(r===t)return!0;r=r.next}}return!1}(e,t)&&null!==e.named&&"object"==typeof e.named&&"string"==typeof r&&(e.named[r]=t,!0)},getTaskByName:function(e,t){if(tY(e)&&null!==e.named&&"object"==typeof e.named&&"string"==typeof t){let r=e.named[t];if(tz(r))return r}return null},addObserver:function(e,t){return!!(tY(e)&&Array.isArray(e.observers))&&"function"==typeof t&&(e.observers.push(t),!0)},removeObserver:function(e,t){if(tY(e)&&Array.isArray(e.observers)&&e.observers.length>0){let r=e.observers.indexOf(t);if(r>=0)return e.observers.splice(r,1),!0}return!1}},isLowPriorityModality:t0,isImage:e=>!!e&&-1!==t2.indexOf(e),isDisplaySetReconstructable:function(e,t){let r=e?.filter(Boolean)||[];if(!r.length)return{value:!1};let n=r[0],i=(n.NumberOfFrames||0)>1;if(t){let e=t8(n.Rows),r=t8(n.Columns);if(e>t.max3DTextureSize||r>t.max3DTextureSize)return{value:!1}}if(!i&&1===r.length||!i&&!r.every(e=>e.ImagePositionPatient))return{value:!1};let a=function(e){if(e.length<=1)return e;let{ImagePositionPatient:t,ImageOrientationPatient:r}=e[Math.floor(e.length/2)];if(!t||!r)return e;let n=t3.vec3.fromValues(r[0],r[1],r[2]),i=t3.vec3.fromValues(r[3],r[4],r[5]),a=t3.vec3.cross(t3.vec3.create(),n,i);t3.vec3.set(t3.vec3.create(),t[0],t[1],t[2]);let o=e.map(e=>{let r=e.ImagePositionPatient,n=t3.vec3.create();return t3.vec3.sub(n,t,r),{distance:t3.vec3.dot(n,a),instance:e}});return o.sort((e,t)=>t.distance-e.distance),o.map(e=>e.instance)}(r);return i?function(e){let t,r,n,i,a,o;return(t=e.PerFrameFunctionalGroupsSequence?.[0],r=e.SharedFunctionalGroupsSequence,t?.PixelMeasuresSequence||r?.PixelMeasuresSequence||e.PixelSpacing&&(e.SliceThickness||e.SpacingBetweenFrames))?(n=e.SharedFunctionalGroupsSequence,i=e.PerFrameFunctionalGroupsSequence?.[0],n?.PlaneOrientationSequence||i?.PlaneOrientationSequence||e.ImageOrientationPatient||e.DetectorInformationSequence?.[0]?.ImageOrientationPatient)?(a=e.PerFrameFunctionalGroupsSequence?.[0],a?.PlanePositionSequence||a?.CTPositionSequence||e.ImagePositionPatient||e.DetectorInformationSequence?.[0]?.ImagePositionPatient)?e.Modality.includes("NM")&&"RECON TOMO"!==(o=e.ImageType?.[2])&&"RECON GATED TOMO"!==o?{value:!1}:{value:!0}:(console.log("No image position information, not reconstructable"),{value:!1}):(console.log("No image orientation information, not reconstructable"),{value:!1}):{value:!1}}(a[0]):function(e){let t,r=e[0],n=t8(r.Rows),i=t8(r.Columns),a=t8(r.SamplesPerPixel),o=t8(r.ImageOrientationPatient),s=t8(r.ImagePositionPatient);for(let t=1;t<e.length;t++){let{Rows:r,Columns:s,SamplesPerPixel:u,ImageOrientationPatient:l}=e[t],c=t8(l);if(r!==n||s!==i||u!==a||!t4(c,o))return{value:!1}}if(e.length>2){let r=t8(e[e.length-1].ImagePositionPatient);if(!s||!r)return{value:!1};t=t6(s,r)/(e.length-1);let n=s;for(let r=1;r<e.length;r++){let i=t8(e[r].ImagePositionPatient),a=function(e,t){if(Math.abs(e-t)<.2*t)return;let r=Math.round(e/t);return Math.abs(e-r*t)/r<.2*t?{issue:t5,missingFrames:r-1}:{issue:t7}}(t6(i,n),t);if(a){let e=a.issue;if(e===t5)a.missingFrames;else if(e===t7)return{value:!1}}n=i}}return{value:!0,averageSpacingBetweenFrames:t}}(a)},debounce:O,roundNumber:function e(t,r=2){if(Array.isArray(t))return t.map(t=>e(t,r)).join(", ");if(null==t||""===t)return"NaN";let n=Math.abs(t=Number(t));if(n<1e-4)return`${t}`;let i=n>=100?r-2:n>=10?r-1:n>=1?r:n>=.1?r+1:n>=.01?r+2:n>=.001?r+3:r+4;return t.toFixed(i)},toNumber:t8,downloadCSVReport:function(e){var t,r;let n;if(0===e.length)return;let i=["Patient ID","Patient Name","StudyInstanceUID","SeriesInstanceUID","SOPInstanceUID","Label"],a={};e.forEach(e=>{var t;let r,{referenceStudyUID:n,referenceSeriesUID:i,getReport:o,uid:s}=e;if(!o)return void console.warn("Measurement does not have a getReport function");let u=(t=e,{"Patient ID":(r=J.getSeries(n,i).instances[0]).PatientID,"Patient Name":tN(r.PatientName)||"",StudyInstanceUID:t.referenceStudyUID,SeriesInstanceUID:t.referenceSeriesUID,SOPInstanceUID:t.SOPInstanceUID,Label:t.label||""}),l=o(e);a[s]={report:l,commonRowItems:u}}),Object.keys(a).forEach(e=>{let{report:t}=a[e];t.columns.forEach(e=>{i.includes(e)||i.push(e)})}),rr(encodeURI("data:text/csv;charset=utf-8,"+(t=a,n=[r=i],Object.keys(t).forEach(e=>{let{report:i,commonRowItems:a}=t[e],o=[];Object.keys(a).forEach(e=>{let t=r.indexOf(e),n=a[e];o[t]=n}),i.columns.forEach((e,t)=>{let n=r.indexOf(e),a=i.values[t];o[n]=a}),n.push(o)}),n).map(e=>e.join(",")).join("\n")),{filename:"MeasurementReport.csv"})},splitComma:ry,getSplitParam:rD,generateAcceptHeader:(e=[],t="*",r=!1)=>{if(e.length>0)return e;let n=["multipart/related"],i=!1;if(t&&tB[t]){let e=tB[t];n.push("type="+e),n.push("transfer-syntax="+t),i=!0}else n.push("type=application/octet-stream");return i||n.push("transfer-syntax=*"),r||(n=n.map(e=>e.startsWith("type=")?'type="'+e.substring(5,e.length)+'"':e.startsWith("transfer-syntax=")?'transfer-syntax="'+e.substring(16,e.length)+'"':e)),[n.join("; ")]},createStudyBrowserTabs:function(e,t,r,n=31536e6){let{servicesManager:i}=rE(),{displaySetService:a,customizationService:o}=i.services,s=[],u=[];t.forEach(t=>{let n=r.filter(e=>e.StudyInstanceUID===t.studyInstanceUid),i=o.getCustomization("sortingCriteria"),l=Object.assign({},t,{displaySets:n.sort((e,t)=>i(a.getDisplaySetByUID(e.displaySetInstanceUID),a.getDisplaySetByUID(t.displaySetInstanceUID)))});e.includes(t.studyInstanceUid)&&s.push(l),u.push(l)});let l=s.filter(e=>e.date).map(e=>new Date(e.date).getTime()),c=l.length>0?u.filter(e=>{let t=Math.min(...l);return!!e.date&&t-new Date(e.date).getTime()<n}):[],d=(e,t)=>{let r=Date.parse(e);return Date.parse(t)-r};return[{name:"primary",label:tk.t("StudyBrowser:Primary"),studies:s.sort((e,t)=>d(e.date,t.date))},{name:"recent",label:tk.t("StudyBrowser:Recent"),studies:c.sort((e,t)=>d(e.date,t.date))},{name:"all",label:tk.t("StudyBrowser:All"),studies:u.sort((e,t)=>d(e.date,t.date))}]},MeasurementFilters:I,getClosestOrientationFromIOP:function(e,t){let r=e.getDisplaySetByUID(t).instances[0].ImageOrientationPatient;if(r?.length!==6)return;let n=t3.vec3.fromValues(r[0],r[1],r[2]),i=t3.vec3.fromValues(r[3],r[4],r[5]),a=t3.vec3.cross(t3.vec3.create(),n,i),o={axial:t3.vec3.fromValues(0,0,1),coronal:t3.vec3.fromValues(0,1,0),sagittal:t3.vec3.fromValues(1,0,0)},s=0,u="";for(let[e,t]of Object.entries(o)){let r=Math.abs(t3.vec3.dot(a,t));r>s&&(s=r,u=e)}return u},calculateScanAxisNormal:ri,areAllImageOrientationsEqual:ra,thumbnailNoImageModalities:["SR","SEG","RTSTRUCT","RTPLAN","RTDOSE","DOC","PMAP","RWV"],downloadBlob:rt,downloadUrl:rr,downloadCsv:function(e,t){rt(new Blob([e],{type:"text/csv;charset=utf-8;"}),t)},downloadDicom:function(e,t){rt(new Blob([e],{type:"application/dicom"}),t)},resolveBulkDataTags:rY,registerResolvedBulkDataTags:function(e){for(let t of Array.isArray(e)?e:[e])"string"==typeof t&&t.length&&rU.add(t.toUpperCase())},getResolvedBulkDataTags:function(){return[...rU]},decodeNumericBulkData:rR},rz=e=>{let t=new URLSearchParams(window.location.search),r=rD("initialseriesinstanceuid",t),n=rD("initialsopinstanceuid",t);if(!r&&!n)return!1;let i=r?.some(t=>e.SeriesInstanceUID===t),a=n?.some(t=>e.instances?.some(e=>t===e.SOPInstanceUID));return i||a};function rW(e){let t=e?.[0];if(!t)return;let r=rD("initialsopinstanceuid");if(!r)return;let n=t.instances.findIndex(e=>r.includes(e.SOPInstanceUID));return -1===n?void 0:{index:n}}let rH=(e,t)=>{let r=t?.displaySets?.filter(e=>e.numImageFrames>0)?.length;return console.log("number of display sets with images",r),r},rG=(e,t)=>t?.displaySets?.map(e=>e.SeriesDescription),rq={toolGroupId:"default",viewportType:"stack"};class rX extends L{constructor(e,t){super(rX.EVENTS),this.studies=void 0,this.protocols=void 0,this.activeProtocolIds=void 0,this.protocol=void 0,this._originalProtocol=void 0,this.stageIndex=0,this._commandsManager=void 0,this._servicesManager=void 0,this.protocolEngine=void 0,this.customViewportSettings=[],this.displaySets=[],this.activeStudy=void 0,this.debugLogging=void 0,this.customAttributeRetrievalCallbacks={NumberOfStudyRelatedSeries:{name:"The number of series in the study",callback:e=>e.NumberOfStudyRelatedSeries??e.series?.length},NumberOfSeriesRelatedInstances:{name:"The number of instances in the display set",callback:e=>e.numImageFrames},ModalitiesInStudy:{name:"Gets the array of the modalities for the series",callback:e=>{if(e.ModalitiesInStudy?.length>0)return e.ModalitiesInStudy;if(Array.isArray(e.series)){var t,r;return t=e.series,r="Modality",t.reduce((e,t)=>{let n=t[r];return!n&&t.instances&&t.instances[0]&&(n=t.instances[0][r]),n&&-1===e.indexOf(n)&&e.push(n),e},[])}return[]}},isReconstructable:{name:"Checks if the display set is reconstructable",callback:e=>e.isReconstructable??!1},isDisplaySetFromUrl:{name:"Checks if the display set is as specified in the URL",callback:rz},sopInstanceLocation:{name:"Gets the position of the specified sop instance",callback:rW},seriesDescriptions:{name:"seriesDescriptions",description:"List of Series Descriptions",callback:rG},numberOfDisplaySetsWithImages:{name:"numberOfDisplaySetsWithImages",description:"Number of displays sets with images",callback:rH}},this.listeners={},this.registeredImageLoadStrategies={},this.activeImageLoadStrategyName=null,this.customImageLoadPerformed=!1,this.displaySetMatchDetails=new Map,this.viewportMatchDetails=new Map,this._commandsManager=e,this._servicesManager=t,this.protocols=new Map,this.protocolEngine=void 0,this.protocol=void 0,this.stageIndex=void 0,this.studies=[]}destroy(){this.reset(),this.protocols=new Map}reset(){this.studies=[],this.viewportMatchDetails=new Map,this.displaySetMatchDetails=new Map,this.protocol=void 0,this.stageIndex=void 0,this.protocolEngine=void 0}onModeEnter(){this.reset()}getActiveProtocol(){return{protocol:this.protocol,_originalProtocol:this._originalProtocol,stage:this.protocol?.stages?.[this.stageIndex],stageIndex:this.stageIndex,activeStudy:this.activeStudy,viewportMatchDetails:this.viewportMatchDetails,displaySetMatchDetails:this.displaySetMatchDetails,activeImageLoadStrategyName:this.activeImageLoadStrategyName}}getState(){if(this.protocol)return{protocolId:this.protocol.id,stageIndex:this.stageIndex,stageId:this.protocol.stages[this.stageIndex].id,activeStudyUID:this.activeStudy?.StudyInstanceUID}}filterSeriesRequiredForRun(e,t){Array.isArray(e)&&(e=e[0]);let r=this.getProtocolById(e)?.hpInitiationCriteria?.minSeriesLoaded||t.length;return{requiredSeries:t.slice(0,r),remaining:t.slice(r)}}getDefaultProtocol(){return this.getProtocolById("default")}getMatchDetails(){return{viewportMatchDetails:this.viewportMatchDetails,displaySetMatchDetails:this.displaySetMatchDetails}}getProtocols(){let e=[];for(let t of this.activeProtocolIds||this.protocols.keys()){let r=this.getProtocolById(t);r&&e.push(r)}return e}getProtocolById(e,t=!0){if(!e)return;if(e===this.protocol?.id)return this.protocol;let r=this.protocols.get(e);if(!r&&t){let t=e.toLowerCase();for(let[e]of this.protocols)if(e.toLowerCase()===t){r=this.getProtocolById(e);break}}if(!r)throw Error(`No protocol ${e} found`);if(!(r instanceof Function))return this._validateProtocol(r);try{let{protocol:e}=this._getProtocolFromGenerator(r);return e}catch(t){console.warn(`Error while executing protocol generator for protocol ${e}: ${t}`)}}addProtocol(e,t){this.protocols.has(e)&&console.warn(`A protocol with id ${e} already exists. It will be overwritten.`),t instanceof Function||(t=this._validateProtocol(t)),this.protocols.set(e,t)}addActiveProtocolId(e){e&&(this.activeProtocolIds||(this.activeProtocolIds=[]),this.activeProtocolIds.push(e))}setActiveProtocolIds(e){if(!e||!e.length){this.activeProtocolIds=null,console.log("No active protocols, setting all to active");return}"string"==typeof e?this.setActiveProtocolIds([e]):this.activeProtocolIds=[...e]}setActiveStudyUID(e){if(e&&e!==this.activeStudy?.StudyInstanceUID)return this.activeStudy=this.studies.find(t=>t.StudyInstanceUID===e),this.activeStudy}hasStudyUID(e){return this.studies.some(t=>t.StudyInstanceUID===e)}addStudy(e){this.hasStudyUID(e.StudyInstanceUID)||this.studies.push(e)}run({studies:e,displaySets:t,activeStudy:r},n,i={}){if(this.studies=[...e||this.studies],this.displaySets=t,this.setActiveStudyUID(r?.StudyInstanceUID||(r||this.studies[0])?.StudyInstanceUID),this.protocolEngine=new eW(this.getProtocols(),this.customAttributeRetrievalCallbacks),this.protocol=null,n&&"string"==typeof n){let e=this.getProtocolById(n);this._setProtocol(e,i)}else{let e=this.protocolEngine.run({studies:this.studies,activeStudy:r,displaySets:t});this._setProtocol(e)}this.protocol?.callbacks?.onProtocolEnter&&this._commandsManager.run(this.protocol?.callbacks?.onProtocolEnter)}hasCustomImageLoadStrategy(){return null!==this.activeImageLoadStrategyName&&this.registeredImageLoadStrategies[this.activeImageLoadStrategyName]instanceof Function}getCustomImageLoadPerformed(){return this.customImageLoadPerformed}getShouldPerformCustomImageLoad(){return this.hasCustomImageLoadStrategy()&&!this.getCustomImageLoadPerformed()}registerImageLoadStrategy(e,t){t instanceof Function&&e&&(this.registeredImageLoadStrategies[e]=t)}addCustomAttribute(e,t,r,n={}){this.customAttributeRetrievalCallbacks[e]={...n,id:e,name:t,callback:r}}runImageLoadStrategy(e){let t=(0,this.registeredImageLoadStrategies[this.activeImageLoadStrategyName])({data:e,displaySetsMatchDetails:this.displaySetMatchDetails,viewportMatchDetails:this.viewportMatchDetails});return t?(this.customImageLoadPerformed=!0,this._broadcastEvent(this.EVENTS.CUSTOM_IMAGE_LOAD_PERFORMED,t),!0):(console.warn("Not able to load data with custom strategy"),!1)}_validateProtocol(e){e.name=e.name??e.id;let{stages:t}=e;if(!t)return void console.warn("Protocol has not stages:",e.id,e);for(let t of Object.keys(e.displaySetSelectors)){let r=e.displaySetSelectors[t];r.id=t;let{seriesMatchingRules:n}=r;if(!n)return void console.warn("Selector has no series matching rules",e.id,t)}return t.forEach(t=>{if(t.viewports)t.viewports=t.viewports.map((r,n)=>{let i=t.defaultViewport||e.defaultViewport||{},a=r.viewportOptions?.viewportId;return{...r,viewportOptions:{...i.viewportOptions,...r.viewportOptions,viewportId:a||(0===n?"default":eq())},displaySets:r.displaySets||[]}}),t.viewports.forEach(e=>{e.displaySets.forEach(e=>{e.options=e.options||{}})});else{t.name=t.name||t.id,t.viewports=[];let{rows:r,columns:n}=t.viewportStructure.properties;for(let i=0;i<r*n;i++){let r=t.defaultViewport||e.defaultViewport||{};t.viewports.push({viewportOptions:{...r.viewportOptions,viewportId:0===i?"default":eq()},displaySets:[]})}}}),e}_getProtocolFromGenerator(e){let{protocol:t}=e({servicesManager:this._servicesManager,commandsManager:this._commandsManager});return{protocol:this._validateProtocol(t)}}getViewportsRequireUpdate(e,t,r=!0){let n,i=[{viewportId:e,displaySetInstanceUIDs:[t]}];if(!r)return i;let{displaySetService:a}=this._servicesManager.services,o=a.getDisplaySetByUID(t);if(o?.unsupported)throw Error("Unsupported displaySet");if(o?.isOverlayDisplaySet)return i;let s=this.protocol,u=s.stages[this.stageIndex].viewports;if(!u)return i;let l=u.find(t=>t.viewportOptions.viewportId===e);if(!l)return i;if(l.displaySets.length>1)throw Error("Cannot update viewport with multiple displaySets yet");if(0===l.displaySets.length||l.viewportOptions.allowUnmatchedView)return i;let{id:c,matchedDisplaySetsIndex:d=0}=l.displaySets[0],f=s.displaySetSelectors[c];if(!f||f.allowUnmatchedView||(this._validateViewportSpecificMatch({displaySetInstanceUIDs:[t],viewportOptions:{},displaySetOptions:[]},l,s.displaySetSelectors),!this.displaySetMatchDetails.get(c)))return i;let h=this._originalProtocol;h instanceof Function||(n=h.stages[this.stageIndex]);let p=[];return u.forEach((e,r)=>{if(e.displaySets.some(e=>e.id===c&&(e.matchedDisplaySetsIndex||0)===d)){if(n){let i=n.viewports[r],a=i.viewportOptions,o=i.displaySets;e.viewportOptions=this.getComputedOptions(a,[t]),e.displaySets=this.getComputedOptions(o,[t])}let i=[],a=[];this._updateDisplaySetInstanceUIDs(e,c,t,this.displaySetMatchDetails,i,a),p.push({viewportId:e.viewportOptions.viewportId,displaySetInstanceUIDs:i,viewportOptions:e.viewportOptions,displaySetOptions:a})}}),p}runMatchingRules(e,t,r){return this.protocolEngine.findMatch(e,t,r)}_updateDisplaySetInstanceUIDs(e,t,r,n,i,a){e.displaySets.forEach(e=>{let{id:o}=e,s=n.get(o),{displaySetInstanceUID:u}=s,l=e.id===t?r:u;s.displaySetInstanceUID=l,i.push(l),a.push(e)})}getComputedOptions(e,t){if(Array.isArray(e))return e.map(e=>this.getComputedOptions(e,t));if(null===e||"object"!=typeof e)return e;if(e.custom){let r=this.displaySets.filter(e=>t.includes(e.displaySetInstanceUID)),n=e.custom;if(!(n in this.customAttributeRetrievalCallbacks))throw Error(`Custom key "${n}" not found in customAttributeRetrievalCallbacks.`);let i=this.customAttributeRetrievalCallbacks[n].callback.call(e,r);return void 0===i&&(i=e.defaultValue),this.getComputedOptions(i,t)}let r={};for(let n in e)void 0!==e[n]&&(r[n]=this.getComputedOptions(e[n],t));return r}setProtocol(e,t={},r=null){let n=this.protocols.get(e);if(!n)return void console.warn(`ProtocolEngine::setProtocol - Protocol with id ${e} not found - you should register it first via addProtocol`);try{let e=this._validateProtocol(n);t&&this._validateOptions(t),this._setProtocol(e,t)}catch(e){throw console.log(e),r&&r(e),Error(e)}this._commandsManager.run(this.protocol?.callbacks?.onProtocolEnter)}matchActivation(e,t={},r){let{displaySetSelectors:n}=this.protocol,{displaySetSelectorsMatched:i=[]}=t;for(let e of i){let t=n[e];if(!t)return console.warn("No display set selector for",e),!1;let{bestMatch:r}=this._matchImages(t);if(!r)return!1}return e>=(t.minViewportsMatched??r)}_updateStageStatus(e=null){let t=this.protocol.stages;for(let r=0;r<t.length;r++){let n=t[r],{matchedViewports:i}=this._matchAllViewports(n,e,new Map),a=n.stageActivation||{};this.matchActivation(i,a.passive,0)?this.matchActivation(i,a.enabled,1)?n.status="enabled":n.status="passive":n.status="disabled"}this._broadcastEvent(this.EVENTS.STAGE_ACTIVATION,{protocol:this.protocol,stages:this.protocol.stages})}_findStageIndex(e=null){let t,r=e?.stageId,n=this.protocol.stages;if(r){for(let e=0;e<n.length;e++){let t=n[e];if(t.id===r&&"disabled"!==t.status)return e}return}let i=e?.stageIndex;if(void 0!==i)return n[i]?.status!=="disabled"?i:void 0;for(let e=0;e<n.length;e++){if("enabled"===n[e].status)return e;void 0===t&&"disabled"!==n[e].status&&(t=e)}return t}_setProtocol(e,t=null){let r=this.getActiveProtocol();try{if(!this.protocol||this.protocol.id!==e.id){this.stageIndex=t?.stageIndex||0,this.customImageLoadPerformed=!1,this._originalProtocol=this._copyProtocol(e),this.protocol?.callbacks?.onProtocolExit&&this._commandsManager.run(this.protocol.callbacks.onProtocolExit),this.protocol=e;let{imageLoadStrategy:r}=e;r?this.registeredImageLoadStrategies[r]instanceof Function&&(this.activeImageLoadStrategyName=r):this.activeImageLoadStrategyName=null,this._updateStageStatus(t)}let r=this._findStageIndex(t);if(void 0===r)throw Error(`Can't find applicable stage ${e.id} ${t?.stageIndex}`);this.stageIndex=r,this.protocol?.callbacks?.onStageChange&&this._commandsManager.run(this.protocol.callbacks.onStageChange),this._updateViewports(t)}catch(e){throw console.log(e),Object.assign(this,r),Error(e)}t?.restoreProtocol!==!0?this._broadcastEvent(rX.EVENTS.PROTOCOL_CHANGED,{viewportMatchDetails:this.viewportMatchDetails,displaySetMatchDetails:this.displaySetMatchDetails,protocol:this.protocol,stageIdx:this.stageIndex,stage:this.protocol.stages[this.stageIndex],activeStudyUID:this.activeStudy?.StudyInstanceUID}):this._broadcastEvent(rX.EVENTS.PROTOCOL_RESTORED,{protocol:this.protocol,stageIdx:this.stageIndex,stage:this.protocol.stages[this.stageIndex],activeStudyUID:this.activeStudy?.StudyInstanceUID})}getStageIndex(e,t){let r=this.getProtocolById(e),{stageId:n,stageIndex:i}=t;return void 0!==n?r.stages.findIndex(e=>e.id===n):void 0!==i?i:0}_getNumProtocolStages(){if(this.protocol&&this.protocol.stages&&this.protocol.stages.length)return this.protocol.stages.length}_getCurrentStageModel(){return this.protocol.stages[this.stageIndex]}getMissingViewport(e,t,r){this.protocol.id!==e&&(console.warn("setting protocol"),this.protocol=this.getProtocolById(e),this.stageIndex=0);let n=this.protocol,i=(n.stages[t]??n.stages[this.stageIndex]).defaultViewport||n.defaultViewport;if(!i)return;let a={...i};return this._matchViewport(a,r)}getDisplaySetSortFunction(){return(e,t)=>{let r=this._getSeriesSortInfoForDisplaySetSort(e),n=this._getSeriesSortInfoForDisplaySetSort(t);return eR(this._getSeriesFieldForDisplaySetSort())(r,n)}}_updateViewports(e=null){if(!this._getNumProtocolStages())throw Error("No protocol or stages found");this.viewportMatchDetails=new Map,this.displaySetMatchDetails=new Map;let t=this._getCurrentStageModel();if(!t||!t.viewportStructure||!t.viewports||!t.viewports.length)return void console.log("Stage cannot be applied",t);let{layoutType:r}=t.viewportStructure,n=t.viewportStructure.properties;if(!n)return void console.log("No viewportStructure.properties in",t);let{columns:i,rows:a,layoutOptions:o=[]}=n;this.protocol?.callbacks?.onViewportDataInitialized&&this._commandsManager.runCommand("attachProtocolViewportDataListener",{protocol:this.protocol,stageIndex:this.stageIndex}),this._broadcastEvent(this.EVENTS.NEW_LAYOUT,{layoutType:r,numRows:a,numCols:i,layoutOptions:o}),this._matchAllViewports(this.protocol.stages[this.stageIndex],e)}_matchAllViewports(e,t,r=this.viewportMatchDetails,n=this.displaySetMatchDetails){this.activeStudy||=this.studies[0];let i=0;return e.viewports.forEach(e=>{let a=e.viewportOptions.viewportId,o=this._matchViewport(e,t,r,n);o&&(o.displaySetsInfo?.length&&o.displaySetsInfo[0].displaySetInstanceUID?i++:(console.log("Adding an empty set of display sets for mapping purposes"),o.displaySetsInfo=e.displaySets.map(e=>({displaySetOptions:e}))),r.set(a,o))}),{matchedViewports:i,viewportMatchDetails:r,displaySetMatchDetails:n}}findDeduplicatedMatchDetails(e,t,r={}){if(!e)return;if(0===t)return e;let{matchingScores:n=[]}=e;if(-1===t){let{inDisplay:t}=r;if(!t)return e;for(let r=0;r<e.matchingScores.length;r++)if(-1===t.indexOf(e.matchingScores[r].displaySetInstanceUID))return e.matchingScores[r].matchingScore>0?{matchingScores:n,...e.matchingScores[r]}:null;return}let i=n[t];return i?{...i,matchingScores:n}:void 0}validateDisplaySetSelectMatch(e,t,r){if(e.displaySetInstanceUID!==r){if(!e.matchingScores)throw Error("No matchingScores found in "+e);for(let t of e.matchingScores)if(t.displaySetInstanceUID===r)return;throw Error(`Reused viewport details ${t} with ds ${r} not valid`)}}_matchViewport(e,t,r=this.viewportMatchDetails,n=this.displaySetMatchDetails){let i=t?.displaySetSelectorMap||{},{displaySetSelectors:a={}}=this.protocol;for(let t of e.displaySets){let{id:e}=t,r=a[e];if(!r){console.warn("No display set selector for",e);continue}let{bestMatch:i,matchingScores:o}=this._matchImages(r);n.set(e,i),i&&(i.matchingScores=o)}let{viewportOptions:o=rq}=e,s=[],{StudyInstanceUID:u}=this.activeStudy;return e.displaySets.forEach(e=>{let{id:r,matchedDisplaySetsIndex:n=0}=e,a=r&&i[`${u}:${r}:${n||0}`],o=this.displaySetMatchDetails.get(r),l=this.findDeduplicatedMatchDetails(o,n,t);if(a)return void a.forEach(t=>{s.push({displaySetInstanceUID:t,displaySetOptions:e})});if(l){let{displaySetInstanceUID:t}=l;s.push({displaySetInstanceUID:t,displaySetOptions:e})}else console.warn(`
|
|
2
2
|
The hanging protocol viewport is requesting to display ${r} displaySet that is not
|
|
3
3
|
matched based on the provided criteria (e.g. matching rules).
|
|
4
|
-
`)}),{viewportOptions:o,displaySetsInfo:s}}_validateViewportSpecificMatch(e,t,r){let{displaySetService:n}=this._servicesManager.services,i=t.displaySets,a=e.displaySetInstanceUIDs.length;if(i.length>0&&a!==i.length)throw Error(`The number of displaySets to set ${a} does not match the number of displaySets in the protocol ${i} - not currently implemented`);e.displaySetInstanceUIDs.forEach(e=>{let i=n.getDisplaySetByUID(e),{displaySets:a}=t;for(let e of a){let t=r[e.id];t&&this._validateRequiredSelectors(t,i)}})}areRequiredSelectorsValid(e,t){let r=!0;for(let n of e)try{this._validateRequiredSelectors(n,t)}catch(e){r=!1;break}return r}_validateRequiredSelectors(e,t){let{seriesMatchingRules:r}=e,n=r.filter(e=>e.required);if(n.length){let e=this.protocolEngine.findMatch(t,n);if(!e||0===e.score)throw Error(`The displaySetInstanceUID ${t.displaySetInstanceUID} does not satisfy the required seriesMatching criteria for the protocol`)}}_validateOptions(e){let{displaySetService:t}=this._servicesManager.services,{displaySetSelectorMap:r}=e;r&&Object.entries(r).forEach(([e,r])=>{r.forEach(e=>{if(!t.getDisplaySetByUID(e))throw Error(`The displaySetInstanceUID ${e} is not found in the displaySetService`)})})}_matchImages(e){let{id:t,studyMatchingRules:r=[],seriesMatchingRules:n}=e,i=[],a=0;console.log("ProtocolEngine::matchImages",r,n);let o=-1===this.protocol.numberOfPriorsReferenced;this.studies.forEach((e,t)=>{if(o&&this.activeStudy!==e)return;let s=this.displaySets.filter(t=>t.StudyInstanceUID===e.StudyInstanceUID&&!t?.unsupported),l=this.protocolEngine.findMatch(e,r,{studies:this.studies,displaySets:s,allDisplaySets:this.displaySets,displaySetMatchDetails:this.displaySetMatchDetails,studyInstanceUIDsIndex:t});!0!==l.requiredFailed&&(this.debug("study",e.StudyInstanceUID,"display sets #",s.length),s.forEach(t=>{let{StudyInstanceUID:r,SeriesInstanceUID:o,displaySetInstanceUID:u}=t,c=this.protocolEngine.findMatch(t,n,{studies:this.studies,instance:t.images?.[0],displaySetMatchDetails:this.displaySetMatchDetails,displaySets:s});if(!0===c.requiredFailed)return void this.debug("Display set required failed",t,n);this.debug("Found displaySet for rules",t),a=Math.max(c.score,a);let d={passed:[],failed:[]};d.passed=d.passed.concat(c.details.passed),d.passed=d.passed.concat(l.details.passed),d.failed=d.failed.concat(c.details.failed),d.failed=d.failed.concat(l.details.failed);let f=c.score+l.score,h={StudyInstanceUID:r,SeriesInstanceUID:o,displaySetInstanceUID:u,matchingScore:f,matchDetails:d,sortingInfo:{score:f,study:e.StudyInstanceUID,...this._getSeriesSortInfoForDisplaySetSort(t)}};this.debug("Adding display set",t,h),i.push(h)}))}),0===i.length&&console.log("No match found",t);let s=eD({name:"score",reverse:!0},{name:"study",reverse:!0},this._getSeriesFieldForDisplaySetSort());i.sort((e,t)=>s(e.sortingInfo,t.sortingInfo));let l=i[0];return console.log("ProtocolEngine::matchImages bestMatch",l,i),{bestMatch:l,matchingScores:i}}_getSeriesSortInfoForDisplaySetSort(e){return{[this._getSeriesFieldForDisplaySetSort().name]:null!=e.SeriesNumber?parseInt(e.SeriesNumber):parseInt(e.seriesNumber)}}_getSeriesFieldForDisplaySetSort(){return{name:"series"}}_isNextStageAvailable(){let e=this._getNumProtocolStages();return this.stageIndex+1<e}_isPreviousStageAvailable(){return this.stageIndex-1>=0}_setCurrentProtocolStage(e,t){let r;for(r=this.stageIndex+e;r>=0&&r<this.protocol.stages.length&&"disabled"===this.protocol.stages[r].status;r+=e);return!(r<0)&&!(r>=this.protocol.stages.length)&&(this.stageIndex=r,this.debug(`ProtocolEngine::setCurrentProtocolStage stage = ${this.stageIndex}`),this._updateViewports(t),this._broadcastEvent(this.EVENTS.PROTOCOL_CHANGED,{viewportMatchDetails:this.viewportMatchDetails,displaySetMatchDetails:this.displaySetMatchDetails,protocol:this.protocol,stageIdx:this.stageIndex,stage:this.protocol.stages[this.stageIndex]}),!0)}debug(...e){this.debugLogging&&console.log(...e)}_copyProtocol(e){return eI()(e)}}rx.EVENTS={PROTOCOL_CHANGED:"event::hanging_protocol_changed",PROTOCOL_RESTORED:"event::hanging_protocol_restore",NEW_LAYOUT:"event::hanging_protocol_new_layout",STAGE_ACTIVATION:"event::hanging_protocol_stage_activation",CUSTOM_IMAGE_LOAD_PERFORMED:"event::hanging_protocol_custom_image_load_performed"},rx.REGISTRATION={name:"hangingProtocolService",altName:"HangingProtocolService",create:({configuration:e={},commandsManager:t,servicesManager:r})=>new rx(t,r)};let rP=rx;class rO extends I{constructor(){super(rO.EVENTS),this.serviceImplementation={_getState:()=>console.warn("getState() NOT IMPLEMENTED"),_setUser:()=>console.warn("_setUser() NOT IMPLEMENTED"),_getUser:()=>console.warn("_getUser() NOT IMPLEMENTED"),_getAuthorizationHeader:()=>{},_handleUnauthenticated:()=>console.warn("_handleUnauthenticated() NOT IMPLEMENTED"),_reset:()=>console.warn("reset() NOT IMPLEMENTED"),_set:()=>console.warn("set() NOT IMPLEMENTED")},this.serviceImplementation={...this.serviceImplementation}}getState(){return this.serviceImplementation._getState()}setUser(e){return this.serviceImplementation._setUser(e)}getUser(){return this.serviceImplementation._getUser()}getAuthorizationHeader(){return this.serviceImplementation._getAuthorizationHeader()}handleUnauthenticated(){return this.serviceImplementation._handleUnauthenticated()}reset(){return this.serviceImplementation._reset()}set(e){return this.serviceImplementation._set(e)}setServiceImplementation({getState:e,setUser:t,getUser:r,getAuthorizationHeader:n,handleUnauthenticated:i,reset:a,set:o}){e&&(this.serviceImplementation._getState=e),t&&(this.serviceImplementation._setUser=t),r&&(this.serviceImplementation._getUser=r),n&&(this.serviceImplementation._getAuthorizationHeader=n),i&&(this.serviceImplementation._handleUnauthenticated=i),a&&(this.serviceImplementation._reset=a),o&&(this.serviceImplementation._set=o)}}rO.EVENTS={},rO.REGISTRATION={name:"userAuthenticationService",altName:"UserAuthenticationService",create:({configuration:e={}})=>new rO};let rT=rO;var rk=a(752),rN=a.n(rk);let rC={MODE_CUSTOMIZATION_MODIFIED:"event::CustomizationService:modeModified",GLOBAL_CUSTOMIZATION_MODIFIED:"event::CustomizationService:globalModified",DEFAULT_CUSTOMIZATION_MODIFIED:"event::CustomizationService:defaultModified"},rU=((s={}).Global="global",s.Mode="mode",s.Default="default",s);class rR extends I{constructor({configuration:e,commandsManager:t}){super(rC),this.Scope=rU,this.commandsManager=void 0,this.extensionManager=void 0,this.globalCustomizations=new Map,this.modeCustomizations=new Map,this.defaultCustomizations=new Map,this.transformedCustomizations=new Map,this.configuration=void 0,this.configuration=e,this.commandsManager=t}init(e){this.extensionManager=e,this.defaultCustomizations.clear(),this.modeCustomizations.clear(),this.extensionManager.getRegisteredExtensionIds().forEach(e=>{let t=`${e}.customizationModule.default`,r=this._findExtensionValue(t);if(r){let{value:e}=r;this._addReference(e,rU.Default)}let n=`${e}.customizationModule.global`,i=this._findExtensionValue(n);if(i){let{value:e}=i;this._addReference(e,rU.Global)}}),this.configuration?._hasBeenAdded||(this.addReferences(this.configuration),Object.defineProperty(this.configuration,"_hasBeenAdded",{value:!0,writable:!1}))}onModeEnter(){this.clearTransformedCustomizations(),this.init(this.extensionManager)}onModeExit(){this.clearTransformedCustomizations()}clearTransformedCustomizations(){for(let e of(super.reset(),Array.from(this.modeCustomizations.keys())))this.transformedCustomizations.delete(e);this.modeCustomizations.clear()}getCustomization(e){let t=this.transformedCustomizations.get(e);if(t)return t;let r=this.globalCustomizations.get(e)??this.modeCustomizations.get(e)??this.defaultCustomizations.get(e),n=this.transform(r);return void 0!==n&&this.transformedCustomizations.set(e,n),n}setCustomizations(e,t=rU.Mode){Array.isArray(e)?e.forEach(e=>{this._addReference(e,t)}):Object.entries(e).forEach(([e,r])=>{this._setCustomization(e,r,t)})}setCustomization(e,t,r=rU.Mode){console.warn("setCustomization is deprecated. Please use setCustomizations with an object instead."),this._setCustomization(e,t,r)}_setCustomization(e,t,r=rU.Mode){switch(r){case rU.Global:this.setGlobalCustomization(e,t);break;case rU.Mode:this.setModeCustomization(e,t);break;case rU.Default:this.setDefaultCustomization(e,t);break;default:throw Error(`Invalid customization scope: ${r}`)}}getCustomizations(e){return e===rU.Global?this.globalCustomizations:e===rU.Mode?this.modeCustomizations:this.defaultCustomizations}hasCustomization(e){return this.globalCustomizations.has(e)||this.modeCustomizations.has(e)}transform(e){if(!e)return e;let{inheritsFrom:t}=e;if(!t)return e;let r=this.getCustomization(t),n=r?Object.assign({},r,e):e;return n.$transform?.(this)||n}setModeCustomization(e,t){let r=this.defaultCustomizations.get(e),n=this.modeCustomizations.get(e),i=this.globalCustomizations.get(e),a=n||this._cloneIfNeeded(i)||r,o=this._update(a,t);this.modeCustomizations.set(e,o),this.transformedCustomizations.clear(),this._broadcastEvent(this.EVENTS.MODE_CUSTOMIZATION_MODIFIED,{buttons:this.modeCustomizations,button:this.modeCustomizations.get(e)})}setGlobalCustomization(e,t){let r=this.defaultCustomizations.get(e),n=this.globalCustomizations.get(e),i=this._cloneIfNeeded(n)||r;this.globalCustomizations.set(e,this._update(i,t)),this.transformedCustomizations.clear(),this._broadcastEvent(this.EVENTS.GLOBAL_CUSTOMIZATION_MODIFIED,{buttons:this.defaultCustomizations,button:this.defaultCustomizations.get(e)})}setDefaultCustomization(e,t){this.defaultCustomizations.has(e)&&console.warn(`Trying to update existing default for customization ${e}`),this.transformedCustomizations.clear();let r=this.defaultCustomizations.get(e);this.defaultCustomizations.set(e,this._update(r,t)),this._broadcastEvent(this.EVENTS.DEFAULT_CUSTOMIZATION_MODIFIED,{buttons:this.defaultCustomizations,button:this.defaultCustomizations.get(e)})}_findExtensionValue(e){return this.extensionManager.getModuleEntry(e)}registerCustomUpdateCommand(e,t){e.startsWith("$")||(e="$"+e),(0,rk.extend)(e,t)}_update(e,t){return(e||(e=void 0),!function e(t){if(Array.isArray(t)){for(let r of t)if(e(r))return!0}else if(t&&"object"==typeof t){if(t.$$typeof)return!1;for(let r of Object.keys(t))if(r.startsWith("$")&&"$transform"!==r||e(t[r]))return!0}return!1}(t))?t:rN()(e,t)}_cloneIfNeeded(e){return e&&"object"==typeof e?Array.isArray(e)?[...e]:{...e}:e}_addReference(e,t=rU.Global){e&&("string"==typeof e&&(e=this._findExtensionValue(e).value),Object.entries(e).forEach(([e,r])=>{this[t===rU.Global&&"setGlobalCustomization"||t===rU.Default&&"setDefaultCustomization"||"setModeCustomization"](e,r)}))}addReferences(e,t=rU.Global){e&&(Array.isArray(e)?e.forEach(e=>{this._addReference(e,t)}):this._addReference(e,t))}}rR.EVENTS=rC,rR.REGISTRATION={name:"customizationService",create:({configuration:e,commandsManager:t})=>new rR({configuration:e,commandsManager:t})},(0,rk.extend)("$filter",(e,t)=>(function e(t,r){if(Array.isArray(t))return"function"==typeof r?t.filter(r):"string"==typeof r?t.filter(e=>e.id!==r):"object"==typeof r&&r.match&&r.$merge?t.map(t=>e(t,r)).map(e=>{var t;return(t=r.match,e&&"object"==typeof e&&Object.entries(t).every(([t,r])=>e[t]===r))?{...e,...r.$merge}:e}):"object"==typeof r&&r.id&&r.$merge?t.map(t=>e(t,r)).map(e=>e.id===r.id?{...e,...r.$merge}:e):t.map(t=>e(t,r));if(t&&"object"==typeof t){let n={...t};for(let[t,i]of Object.entries(n))n[t]=e(i,r);return n}return t})(t,e));let rL=rR;function rV(){return(rV=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}let rj={PANELS_CHANGED:"event::panelService:panelsChanged",ACTIVATE_PANEL:"event::panelService:activatePanel"},rF=((l={}).Left="left",l.Right="right",l.Bottom="bottom",l);class rB extends I{constructor(e){super(rj),this._extensionManager=void 0,this._panelsGroups=new Map,this._extensionManager=e}get PanelPosition(){return rF}_getPanelComponent(e){let t=this._extensionManager.getModuleEntry(e);if(!t){let t=this._getSimilarPanels(e);if(t.length>0){let r=`Did you mean: ${t.join(", ")}?`;throw Error(`${e} is not a valid entry for an extension module. ${r} Please check your configuration or make sure the extension is registered.`)}throw Error(`${e} is not a valid entry for an extension module, please check your configuration or make sure the extension is registered.`)}if(!t?.component)throw Error(`No component found from extension ${e}. Check the reference string to the extension in your Mode configuration`);let r=t.component;return{entry:t,content:r}}_getSimilarPanels(e,t=.8){return Object.keys(this._extensionManager.modulesMap).filter(e=>e.includes("panelModule")).filter(r=>this._calculateSimilarity(e,r)>=t)}_calculateSimilarity(e,t){let r=new Set(e.toLowerCase().split("")),n=new Set(t.toLowerCase().split("")),i=new Set([...r].filter(e=>n.has(e))),a=new Set([...r,...n]);return i.size/a.size}getPanelData(e){let t,r;if(Array.isArray(e)){let n=e.map(e=>this._getPanelComponent(e));r=n[0].entry,t=e=>ri.createElement(ri.Fragment,null,n.map(({content:t},r)=>ri.createElement(t,rV({key:r},e))))}else({content:t,entry:r}=this._getPanelComponent(e));return{id:r.id,iconName:r.iconName,iconLabel:r.iconLabel,label:r.label,name:r.name,content:t}}addPanel(e,t,r){let n=this._panelsGroups.get(e);n||(n=[],this._panelsGroups.set(e,n));let i=this.getPanelData(t);n.push(i),this._broadcastEvent(rj.PANELS_CHANGED,{position:e,options:r})}addPanels(e,t,r){if(!Array.isArray(t))throw Error('Invalid "panelsIds" array');t.forEach(t=>this.addPanel(e,t,r))}setPanels(e,t){this.reset(),Object.keys(e).forEach(r=>{this.addPanels(r,e[r],t)})}getPanels(e){return[...this._panelsGroups.get(e)??[]]}reset(){let e=Array.from(this._panelsGroups.keys());this._panelsGroups.clear(),e.forEach(e=>this._broadcastEvent(rj.PANELS_CHANGED,{position:e}))}onModeExit(){this.reset()}activatePanel(e,t=!1){this._broadcastEvent(rj.ACTIVATE_PANEL,{panelId:e,forceActive:t})}addActivatePanelTriggers(e,t,r=!1){return t.map(t=>t.sourceEvents.map(n=>t.sourcePubSubService.subscribe(n,()=>this.activatePanel(e,r)))).flat()}}rB.REGISTRATION={name:"panelService",create:({extensionManager:e})=>new rB(e)};let rY=rB,r$={ACTIVE_STEP_CHANGED:"event::workflowStepsService:activateStepChanged",STEPS_CHANGED:"event::workflowStepsService:stepsChanged"};class rH extends I{constructor(e,t,r){super(r$),this._extensionManager=void 0,this._servicesManager=void 0,this._commandsManager=void 0,this._workflowSteps=void 0,this._activeWorkflowStep=void 0,this._workflowSteps=[],this._activeWorkflowStep=null,this._extensionManager=e,this._commandsManager=t,this._servicesManager=r}get workflowSteps(){return[...this._workflowSteps]}get activeWorkflowStep(){return this._activeWorkflowStep}addWorkflowSteps(e){let t=!1;e.forEach(e=>{if(this._workflowSteps.some(t=>t.id===e.id))throw Error(`Duplicated workflow step id (${e.id})`);this._workflowSteps.push(e),t=!0}),t&&this._broadcastEvent(r$.STEPS_CHANGED,{})}_updateToolBar(e){let{toolbarService:t}=this._servicesManager.services,{toolbarButtons:r}=e;(Array.isArray(r)?r:[r]).forEach(({buttonSection:e,buttons:r})=>{t.clearButtonSection(e),t.updateSection(e,r)})}_updatePanels(e){let{panelService:t}=this._servicesManager.services,r=e?.layout?.panels;r&&t.setPanels(r,e?.layout?.options)}_updateHangingProtocol(e){let{hangingProtocol:t}=e;t&&this._commandsManager.runCommand("setHangingProtocol",{protocolId:t.protocolId,stageId:t.stageId,stageIndex:t.stageIndex})}_invokeCallbacks(e){if(!e)return;let t=this._commandsManager;Array.isArray(e)||(e=[e]),e.forEach(e=>{let r=e;if(e?.commandName){let{commandName:n,options:i}=e;r=()=>t.runCommand(n,i)}r()})}setActiveWorkflowStep(e){let t=this._activeWorkflowStep;if(e===t?.id)return;let r=this._workflowSteps.find(t=>t.id===e);if(!r)throw Error(`Invalid workflowStepId (${e})`);this._activeWorkflowStep&&this._invokeCallbacks(t.onExit),this._invokeCallbacks(r.onEnter),this._activeWorkflowStep=r,this._updateToolBar(r),this._updatePanels(r),this._updateHangingProtocol(r),this._broadcastEvent(r$.ACTIVE_STEP_CHANGED,{activeWorkflowStep:r})}reset(){this._activeWorkflowStep=null,this._workflowSteps=[]}onModeEnter(){this.reset()}}rH.REGISTRATION={name:"workflowStepsService",create:({extensionManager:e,commandsManager:t,servicesManager:r})=>new rH(e,t,r)};let rW=rH;var rG=((u=rG||{}).Interaction="interaction",u.Thumbnail="thumbnail",u.Prefetch="prefetch",u.Compute="compute",u);let rq={SERVICE_STARTED:"event::studyPrefetcherService:started",SERVICE_STOPPED:"event::studyPrefetcherService:stopped",DISPLAYSET_LOAD_PROGRESS:"event::studyPrefetcherService:displaySetLoadProgress",DISPLAYSET_LOAD_COMPLETE:"event::studyPrefetcherService:displaySetLoadComplete"};var rz=((c=rz||{}).closest="closest",c.downward="downward",c.upward="upward",c);class rX extends I{constructor({servicesManager:e,extensionManager:t,configuration:r}){super(rq),this._extensionManager=void 0,this._servicesManager=void 0,this._subscriptions=void 0,this._activeDisplaySetsInstanceUIDs=[],this._pendingRequests=[],this._inflightRequests=new Map,this._isRunning=!1,this._displaySetLoadingStates=new Map,this._imageIdsToDisplaySetsMap=new Map,this.config={enabled:!1,displaySetsCount:1,maxNumPrefetchRequests:10,order:rz.downward},this.requestType=rG.Prefetch,this.cache=void 0,this.imageLoadPoolManager=void 0,this.imageLoader=void 0,this.imageLoadEventsManager=void 0,this._servicesManager=e,this._extensionManager=t,this._subscriptions=[],Object.assign(this.config,r)}onModeEnter(){this._addEventListeners()}onModeExit(){this._removeEventListeners(),this._stopPrefetching()}_addImageLoadingEventsListeners(){let e=e=>{this._inflightRequests.get(e)||this._sendNextRequests()},t=t=>{let{image:r}=t.detail,{imageId:n}=r;this._moveImageIdToLoadedSet(n),e(n)},r=t=>{let{imageId:r}=t.detail;this._moveImageIdToFailedSet(r),e(r)};return this.imageLoadEventsManager.addEventListeners(t,r)}_addServicesListeners(){let{displaySetService:e,viewportGridService:t}=this._servicesManager.services;return[e.subscribe(e.EVENTS.DISPLAY_SETS_CHANGED,()=>this._syncWithActiveViewport({forceRestart:!0})),t.subscribe(eb.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED,({viewportId:e})=>this._syncWithActiveViewport({activeViewportId:e})),t.subscribe(eb.EVENTS.LAYOUT_CHANGED,()=>this._syncWithActiveViewport()),t.subscribe(eb.EVENTS.GRID_STATE_CHANGED,()=>this._syncWithActiveViewport()),t.subscribe(eb.EVENTS.VIEWPORTS_READY,()=>{this._syncWithActiveViewport(),this._startPrefetching()})]}_addEventListeners(){let e=this._addImageLoadingEventsListeners(),t=this._addServicesListeners();this._subscriptions.push(...e),this._subscriptions.push(...t)}_removeEventListeners(){this._subscriptions.forEach(e=>e.unsubscribe()),this._subscriptions=[]}_syncWithActiveViewport({activeViewportId:e,forceRestart:t}={}){let{viewportGridService:r}=this._servicesManager.services,n=r.getState(),{viewports:i}=n;if(!(e=e??n.activeViewportId))return;let a=i.get(e);if(!a)return;let o=this._setActiveDisplaySetsUIDs(a.displaySetInstanceUIDs);(t||o)&&this._restartPrefetching()}_setActiveDisplaySetsUIDs(e){return!(e.length===this._activeDisplaySetsInstanceUIDs.length&&e.every(e=>this._activeDisplaySetsInstanceUIDs.includes(e)))&&(this._activeDisplaySetsInstanceUIDs=[...e],this._restartPrefetching(),!0)}_areActiveDisplaySetsLoaded(){let{_activeDisplaySetsInstanceUIDs:e}=this;return e.length&&e.every(e=>this._displaySetLoadingStates.get(e).loadingProgress>=1)}_getClosestDisplaySets(e,t){let r=[],n=t-1,i=t+1;for(;n>=0||i<e.length;)n>=0&&(r.push(e[n]),n--),i<e.length&&(r.push(e[i]),i++);return r}_getDownwardDisplaySets(e,t){let r=[];for(let n=t+1;n<e.length;n++)r.push(e[n]);return r}_getUpwardDisplaySets(e,t){let r=[];for(let n=t-1;n>=0&&n!==t;n--)r.push(e[n]);return r}_getSortedDisplaySetsToPrefetch(e){if(!this._activeDisplaySetsInstanceUIDs?.length)return[];let{displaySetsCount:t}=this.config,r=this._activeDisplaySetsInstanceUIDs,[n]=r,i=e.findIndex(e=>e.displaySetInstanceUID===n),a={[rz.closest]:this._getClosestDisplaySets,[rz.downward]:this._getDownwardDisplaySets,[rz.upward]:this._getUpwardDisplaySets},{order:o}=this.config,s=a[o];if(!s)throw Error(`Invalid order (${o})`);let l=new Set(r);return s.call(this,e,i).filter(e=>!l.has(e.displaySetInstanceUID)).slice(0,t)}_getDisplaySets(){let{displaySetService:e}=this._servicesManager.services,t=[...e.getActiveDisplaySets()],r=this._getSortedDisplaySetsToPrefetch(t);return{displaySets:t,displaySetsToPrefetch:r}}_updateImageIdsDisplaySetMap(e,t){for(let r of t){let t=this._imageIdsToDisplaySetsMap.get(r);t||(t=new Set,this._imageIdsToDisplaySetsMap.set(r,t)),t.add(e)}}_getImageIdsForDisplaySet(e){return this._extensionManager.getActiveDataSource()[0].getImageIdsForDisplaySet(e)}_updateDisplaySetLoadingProgress(e){let{numInstances:t,loadedImageIds:r,failedImageIds:n}=e;e.loadingProgress=(r.size+n.size)/t}_addDisplaySetLoadingState(e){let{displaySetInstanceUID:t}=e,r=this._getImageIdsForDisplaySet(e),n=this._displaySetLoadingStates.get(t);if(n)return;let i=new Set(r),a=new Set;for(let e of r)this.cache.isImageCached(e)?a.add(e):i.add(e);n={displaySetInstanceUID:t,numInstances:r.length,pendingImageIds:i,loadedImageIds:a,failedImageIds:new Set,loadingProgress:0},this._updateDisplaySetLoadingProgress(n),this._displaySetLoadingStates.set(t,n),this._updateImageIdsDisplaySetMap(t,r),a.size&&this._triggerDisplaySetEvents(t)}_loadDisplaySets(){let{displaySets:e,displaySetsToPrefetch:t}=this._getDisplaySets();e.forEach(e=>this._addDisplaySetLoadingState(e)),t.forEach(e=>this._enqueueDisplaySetImagesRequests(e))}_moveImageIdToLoadedSet(e){let t=this._imageIdsToDisplaySetsMap.get(e);if(t){for(let r of Array.from(t.values())){let t=this._displaySetLoadingStates.get(r),{pendingImageIds:n,loadedImageIds:i}=t;n.delete(e),i.add(e),this._updateDisplaySetLoadingProgress(t),this._triggerDisplaySetEvents(r)}return!0}}_moveImageIdToFailedSet(e){let t=this._imageIdsToDisplaySetsMap.get(e);if(t){for(let r of Array.from(t.values())){let t=this._displaySetLoadingStates.get(r),{pendingImageIds:n,failedImageIds:i}=t;n.delete(e),i.add(e),this._updateDisplaySetLoadingProgress(t),this._triggerDisplaySetEvents(r)}return!0}}_triggerDisplaySetEvents(e){let{loadingProgress:t,numInstances:r}=this._displaySetLoadingStates.get(e);this._broadcastEvent(this.EVENTS.DISPLAYSET_LOAD_PROGRESS,{displaySetInstanceUID:e,numInstances:r,loadingProgress:t}),t>=1&&this._broadcastEvent(this.EVENTS.DISPLAYSET_LOAD_COMPLETE,{displaySetInstanceUID:e})}_onImagePrefetchSuccess(e){if(e.aborted)return;let{imageId:t}=e;this._inflightRequests.delete(t),this._moveImageIdToLoadedSet(t),this._sendNextRequests()}_onImagePrefetchFailed(e,t){if(e.aborted)return;console.warn(`An error ocurred when trying to load "${e.imageId}"`,t);let{imageId:r}=e;this._inflightRequests.delete(r),this._moveImageIdToFailedSet(r),this._sendNextRequests()}async _sendNextRequests(){if(!this._isRunning||!this._areActiveDisplaySetsLoaded())return;let{_pendingRequests:e,_inflightRequests:t}=this,{maxNumPrefetchRequests:r}=this.config;if(!e.length||t.size>=r)return;let n=Math.min(e.length,r-t.size);this._pendingRequests.splice(0,n).forEach(e=>{let{imageId:r}=e,n={priority:-5,requestType:this.requestType,additionalDetails:{imageId:r},preScale:{enabled:!0}};this.imageLoadPoolManager.addRequest(async()=>this.imageLoader.loadAndCacheImage(r,n).then(t=>this._onImagePrefetchSuccess(e),t=>this._onImagePrefetchFailed(e,t)),this.requestType,{imageId:r}),t.set(r,e)})}_enqueueDisplaySetImagesRequests(e){let{displaySetInstanceUID:t}=e;this._getImageIdsForDisplaySet(e).forEach(e=>{this.cache.isImageCached(e)?this._moveImageIdToLoadedSet(e):this._pendingRequests.push({displaySetInstanceUID:t,imageId:e,aborted:!1})})}_startPrefetching(){if(!this._isRunning){if(!this.config.enabled)return void console.log("StudyPrefetcher is not enabled");this._isRunning=!0,this._loadDisplaySets(),this._sendNextRequests(),this._broadcastEvent(this.EVENTS.SERVICE_STARTED,{})}}_stopPrefetching(){this._isRunning&&(this._isRunning=!1,this._inflightRequests.forEach(e=>e.aborted=!0),this._pendingRequests=[],this._displaySetLoadingStates.clear(),this._imageIdsToDisplaySetsMap.clear(),this._inflightRequests.clear(),this.imageLoadPoolManager.clearRequestStack(this.requestType),this._broadcastEvent(this.EVENTS.SERVICE_STOPPED,{}))}_restartPrefetching(){this._isRunning&&(this._stopPrefetching(),this._startPrefetching())}}rX.REGISTRATION={name:"studyPrefetcherService",altName:"StudyPrefetcherService",create:({configuration:e,servicesManager:t,extensionManager:r})=>new rX({servicesManager:t,extensionManager:r,configuration:e})};class rK{constructor(e,t){this.numberOfScreens=void 0,this.windowsConfig=void 0,this.screenConfig=void 0,this.launchWindows=[],this.basePath=void 0,this.screenNumber=void 0,this.isMultimonitor=void 0,this.setLaunchWindows=e=>{this.launchWindows=e,window.multimonitor.launchWindows=e};const r=new URLSearchParams(window.location.search),n=r.get("screenNumber"),i=r.get("multimonitor"),a={params:r,screenNumber:n,multimonitor:i};this.screenNumber=n?Number(n):-1,this.commandsManager=t;const o=window;for(const r of(o.multimonitor||={setLaunchWindows:this.setLaunchWindows,launchWindows:this.launchWindows,commandsManager:t},o.multimonitor.commandsManager=t,this.launchWindows=window.multimonitor?.launchWindows||this.launchWindows,-1!==this.screenNumber&&(this.launchWindows[this.screenNumber]=window),o.commandsManager=(...t)=>e.commandsManager,Array.isArray(e)?e:[])){if(r.test(a)){if(this.isMultimonitor=!0,this.numberOfScreens=r.screens.length,this.windowsConfig=r,-1===this.screenNumber||null===this.screenNumber)this.screenConfig=rK.SOURCE_SCREEN;else{if(this.screenConfig=r.screens[this.screenNumber],!this.screenConfig)throw Error(`Screen ${n} not configured in ${this.windowsConfig}`);window.name=this.screenConfig.id}return}this.numberOfScreens=1,this.isMultimonitor=!1}}async run(e=1,t,r){let n=(this.screenNumber+(e??1))%this.numberOfScreens,i=await this.getWindow(n);i?i.multimonitor?.commandsManager?i.multimonitor.commandsManager.runAsync(t,r):console.warn("Didn't find a commands manager to run in the other window",i):console.warn("No multimonitor found for screen",n,t)}async launchWindow(e,t=1,r=""){let n=(this.screenNumber+t)%this.numberOfScreens;return this.getWindow(n,e?`StudyInstanceUIDs=${e}${r}`:"")}async getWindow(e,t){return e===this.screenNumber?window:this.launchWindows[e]&&!this.launchWindows[e].closed?this.launchWindows[e]:await this.createWindow(e,t)}async createWindow(e,t){if(e===this.screenNumber)return window;let r=this.windowsConfig.screens[e],n=await window.getScreenDetails?.(),{width:i=1024,height:a=1024,availLeft:o=0,availTop:s=0}=r.screen>=0&&n.screens[r.screen]||n.currentScreen||window.screen||{},l=this.windowsConfig.screens[e],{width:u=1,height:c=1,top:d=0,left:f=0}=l.location||{},h=Math.round(o+f*i),p=Math.round(s+d*a),g=Math.round(i*u),m=Math.round(a*c),y=`${this.basePath}&screenNumber=${e}`,v=t?`${y}#${t}`:y,S=l.id,b=l.options||"",w=`screenX=${h},screenY=${p},width=${g},height=${m},${b}`,_=window.open("",S,w);return(_?.location.href.startsWith(y)||(_=window.open(v,S,w)),_)?(await new Promise(e=>{"complete"===_.document.readyState?e():_.addEventListener("load",()=>e())}),this.launchWindows[e]=_,_):void console.warn("Unable to launch window",v,"called",S,"at",w)}launchAll(){for(let e=0;e<this.numberOfScreens;e++)this.createWindow(e)}setBasePath(){let e=new URL(window.location.href);e.searchParams.delete("screenNumber"),e.searchParams.delete("protocolId"),e.searchParams.delete("launchAll"),e.searchParams.set("multimonitor",e.searchParams.get("multimonitor")||"split"),e.hash="",this.basePath=e.toString()}async onModeEnter(){this.setBasePath(),(this.isMultimonitor&&-1===this.screenNumber||-1!==window.location.href.toLowerCase().indexOf("launchall"))&&this.launchAll()}}rK.SOURCE_SCREEN={id:"source",launch:"source",screen:null,location:{screen:null,width:1,height:1,left:0,top:0}},rK.REGISTRATION={name:"multiMonitorService",create:({configuration:e,commandsManager:t})=>new rK(e,t)};class rZ extends I{constructor({commandsManager:e,servicesManager:t,serviceProvidersManager:r,hotkeysManager:n,appConfig:i={}}){super(rZ.EVENTS),this._commandsManager=void 0,this._servicesManager=void 0,this._hotkeysManager=void 0,this._serviceProvidersManager=void 0,this.modulesMap=void 0,this.modules=void 0,this.registeredExtensionIds=void 0,this.moduleTypeNames=void 0,this._appConfig=void 0,this._extensionLifeCycleHooks=void 0,this.dataSourceMap=void 0,this.dataSourceDefs=void 0,this._activeDataSourceName=void 0,this.registerExtensions=async(e,t=[])=>{for(let r=0;r<e.length;r++){let n=e[r],i=Array.isArray(n);try{if(i){let e=n[0],r=n[1];await this.registerExtension(e,r,t)}else await this.registerExtension(n,{},t)}catch(e){console.error(e)}}},this.registerExtension=async(e,t={},r=[])=>{if(!e)throw Error("Attempting to register a null/undefined extension.");let n=e.id;if(!n)throw m.warn(e),Error("Extension ID not set");this.registeredExtensionIds.includes(n)?m.warn(`Extension ID ${n} has already been registered. Exiting before duplicating modules.`):(e.preRegistration&&await e.preRegistration({servicesManager:this._servicesManager,serviceProvidersManager:this._serviceProvidersManager,commandsManager:this._commandsManager,hotkeysManager:this._hotkeysManager,extensionManager:this,appConfig:this._appConfig,configuration:t}),e.onModeEnter&&(this._extensionLifeCycleHooks.onModeEnter[n]=e.onModeEnter),e.onModeExit&&(this._extensionLifeCycleHooks.onModeExit[n]=e.onModeExit),this.moduleTypeNames.forEach(i=>{let a=this._getExtensionModule(i,e,n,t);if(a){switch(i){case p.COMMANDS:this._initCommandsModule(a);break;case p.DATA_SOURCE:this._initDataSourcesModule(a,n,r);break;case p.HANGING_PROTOCOL:this._initHangingProtocolsModule(a,n);break;case p.PANEL:this._initPanelModule(a,n);break;case p.TOOLBAR:this._initToolbarModule(a,n);break;case p.VIEWPORT:case p.SOP_CLASS_HANDLER:case p.CONTEXT:case p.LAYOUT_TEMPLATE:case p.CUSTOMIZATION:case p.STATE_SYNC:case p.UTILITY:this.processExtensionModule(a,n,i);break;default:throw Error(`Module type invalid: ${i}`)}this.modules[i].push({extensionId:n,module:a})}}),this.registeredExtensionIds.push(n))},this.getModuleEntry=e=>this.modulesMap[e],this.getModulesByType=e=>this.modules[e],this.getDataSources=e=>(e||(e=this._activeDataSourceName),this.dataSourceMap[e]),this.getDataSourceInstance=e=>this.dataSourceMap[e][0],this.getActiveDataSource=()=>this.dataSourceMap[this._activeDataSourceName],this.getActiveDataSourceOrNull=()=>this.dataSourceMap[this._activeDataSourceName]?.[0]??null,this.getDataSourceDefinition=e=>(void 0===e&&(e=this._activeDataSourceName),this.dataSourceDefs[e]),this.getActiveDataSourceDefinition=()=>this.getDataSourceDefinition(this._activeDataSourceName),this.getDataSourcesForUI=()=>{if(this._appConfig?.allowMultiSelectExport===!1)return[];let e=Object.keys(this.dataSourceMap).filter(e=>{let t=this.dataSourceDefs[e]?.configuration,r=this.dataSourceDefs[e].sourceName!==this._activeDataSourceName;return(t?.supportsStow??t?.wadoRoot)&&r});return[this._activeDataSourceName,...e].map(e=>({value:e,label:e,placeHolder:e}))},this._getExtensionModule=(e,t,r,n)=>{var i;let a="get"+((i=e).charAt(0).toUpperCase()+i.substring(1));if(t[a])try{let e=t[a]({appConfig:this._appConfig,commandsManager:this._commandsManager,servicesManager:this._servicesManager,hotkeysManager:this._hotkeysManager,extensionManager:this,configuration:n});return e||m.warn(`Null or undefined returned when registering the ${a} module for the ${r} extension`),e}catch(e){throw console.error(e),Error(`Exception thrown while trying to call ${a} for the ${r} extension`)}},this._initHangingProtocolsModule=(e,t)=>{let{hangingProtocolService:r}=this._servicesManager.services;e.forEach(({name:e,protocol:t})=>{t&&r.addProtocol(e,t)})},this._initPanelModule=(e,t)=>{this.processExtensionModule(e,t,p.PANEL)},this._initToolbarModule=(e,t)=>{let{toolbarService:r}=this._servicesManager.services;e.forEach(e=>{e.evaluate&&r.registerEvaluateFunction(e.name,e.evaluate)})},this._initCommandsModule=e=>{let{definitions:t,defaultContext:r}=e;t&&0!==Object.keys(t).length?(r=r||"VIEWER",this._commandsManager.getContext(r)||this._commandsManager.createContext(r),Object.keys(t).forEach(e=>{let n=t[e];"function"==typeof n&&(n={commandFn:n}),n.context&&!this._commandsManager.getContext(n.context)&&this._commandsManager.createContext(n.context),this._commandsManager.registerCommand(n.context||r,e,n)})):m.warn("Commands Module contains no command definitions")},this.modules={},this.registeredExtensionIds=[],this.moduleTypeNames=Object.values(p),this._commandsManager=e,this._servicesManager=t,this._serviceProvidersManager=r,this._hotkeysManager=n,this._appConfig=i,this.modulesMap={},this.moduleTypeNames.forEach(e=>{this.modules[e]=[]}),this._extensionLifeCycleHooks={onModeEnter:{},onModeExit:{}},this.dataSourceMap={},this.dataSourceDefs={},this.defaultDataSourceName=i.defaultDataSourceName,this._activeDataSourceName=i.defaultDataSourceName,this.peerImport=i.peerImport}setActiveDataSource(e){this._activeDataSourceName!==e&&(this._activeDataSourceName=e,this._broadcastEvent(rZ.EVENTS.ACTIVE_DATA_SOURCE_CHANGED,this.dataSourceDefs[this._activeDataSourceName]))}getRegisteredExtensionIds(){return[...this.registeredExtensionIds]}getUniqueServicesList(e){return Array.from(new Set(Object.values(e.services)))}onModeEnter(){let{registeredExtensionIds:e,_servicesManager:t,_commandsManager:r,_hotkeysManager:n,_extensionLifeCycleHooks:i}=this;for(let e of this.getUniqueServicesList(t))e?.onModeEnter?.();e.forEach(e=>{let a=i.onModeEnter[e];"function"==typeof a&&a({servicesManager:t,commandsManager:r,hotkeysManager:n,extensionManager:this})})}onModeExit(){let{registeredExtensionIds:e,_servicesManager:t,_commandsManager:r,_extensionLifeCycleHooks:n}=this,i=this.getUniqueServicesList(t);for(let a of(e.forEach(e=>{let i=n.onModeExit[e];"function"==typeof i&&i({servicesManager:t,commandsManager:r})}),i))try{a?.onModeExit?.()}catch(e){console.warn("onModeExit caught",e)}}processExtensionModule(e,t,r){e.forEach(e=>{if(!e.name)throw Error(`Extension ID ${t} module ${r} element has no name`);let n=`${t}.${r}.${e.name}`;e.id=n,this.modulesMap[n]=e})}addDataSource(e,t={activate:!1}){let r=this.getDataSources(e.sourceName);!r?.[0]&&(this._createDataSourceInstance(e),t.activate&&this.setActiveDataSource(e.sourceName))}updateDataSourceConfiguration(e,t){let r=this.getDataSources(e);if(!r?.[0])return;let n=this.dataSourceDefs[e];n.configuration=t,this._createDataSourceInstance(n),this._activeDataSourceName===e&&this._broadcastEvent(rZ.EVENTS.ACTIVE_DATA_SOURCE_CHANGED,n)}_createDataSourceInstance(e){let t=this.getModuleEntry(e.namespace);if(!t)return;this.dataSourceDefs[e.sourceName]=e;let r=t.createDataSource(e.configuration,this._servicesManager,this);this.dataSourceMap[e.sourceName]=[r]}_initDataSourcesModule(e,t,r=[]){e.forEach(e=>{this.modulesMap[`${t}.${p.DATA_SOURCE}.${e.name}`]=e}),e.forEach(e=>{let n=`${t}.${p.DATA_SOURCE}.${e.name}`;r.forEach(e=>{e.namespace===n&&this.addDataSource(e)})})}get appConfig(){return this._appConfig}get activeDataSourceName(){return this._activeDataSourceName}}rZ.EVENTS={ACTIVE_DATA_SOURCE_CHANGED:"event::activedatasourcechanged"},rZ.MODULE_TYPES=p;let rJ=class e{constructor(e={}){this.contexts={},this.contextOrder=[],this.getCommand=(e,t=this.contextOrder)=>{let r=[];if(Array.isArray(t))r.push(...t.map(e=>this.getContext(e)).filter(e=>!!e));else if(t){let e=this.getContext(t);e&&r.push(e)}return r.find(t=>!!t[e])?.[e]}}createContext(e,t){if(e){if(this.contexts[e])return this.clearContext(e);this.contexts[e]={},this.contextOrder.splice(0,0,e)}}getContext(e){let t=this.contexts[e];if(t)return t}clearContext(e){e&&(this.contexts[e]={})}registerCommand(e,t,r){if("object"!=typeof r&&"function"!=typeof r)return;let n=e=>"__proto__"!==e&&"constructor"!==e&&"prototype"!==e;if(!n(e)||!n(t))throw Error("Invalid key name to prevent prototype pollution");let i=this.getContext(e);i&&("function"==typeof r?i[t]={commandFn:r,options:{}}:i[t]=r)}runCommand(e,t={},r){if("function"==typeof e)return e(t);let n=this.getCommand(e,r);if(!n)return void m.warn(`Command "${e}" not found in current context`);let{commandFn:i}=n,a=Object.assign({},n.options||{},t);return"function"!=typeof i?void m.warn(`No commandFn was defined for command "${e}"`):i(a)}static convertCommands(t){if("string"==typeof t)return[{commandName:t}];if("commandName"in t)return[t];if("function"==typeof t)return[{commandName:t}];if("commands"in t){let e=t.commands;return this.convertCommands(e)}return Array.isArray(t)?t.map(t=>e.convertCommands(t)[0]):[]}validate(t,r={}){if(!t)return console.debug("No command to run"),[];let n=e.convertCommands(t);return n.length?n.map(e=>({commandName:e.commandName,commandOptions:{...r,...e.commandOptions},context:e.context})):(console.debug("Command is not runnable",t),[])}run(e,t={}){let r=this.validate(e,t),n=[];for(let e=0;e<r.length;e++){let{commandName:t,commandOptions:i,context:a}=r[e];n.push(this.runCommand(t,i,a))}return 1===n.length?n[0]:n}async runAsync(e,t={}){let r=this.validate(e,t),n=[];for(let e=0;e<r.length;e++){let{commandName:t,commandOptions:i,context:a}=r[e];n.push(await this.runCommand(t,i,a))}return 1===n.length?n[0]:n}};var rQ=a(862),r0=a.n(rQ);let r1={hotkeyBindings:[{commandName:"setToolActive",commandOptions:{toolName:"Zoom"},label:"Zoom",keys:["z"],isEditable:!0},{commandName:"scaleUpViewport",label:"Zoom In",keys:["+"],isEditable:!0},{commandName:"scaleDownViewport",label:"Zoom Out",keys:["-"],isEditable:!0},{commandName:"fitViewportToWindow",label:"Zoom to Fit",keys:["="],isEditable:!0},{commandName:"rotateViewportCW",label:"Rotate Right",keys:["r"],isEditable:!0},{commandName:"rotateViewportCCW",label:"Rotate Left",keys:["l"],isEditable:!0},{commandName:"flipViewportHorizontal",label:"Flip Horizontally",keys:["h"],isEditable:!0},{commandName:"flipViewportVertical",label:"Flip Vertically",keys:["v"],isEditable:!0},{commandName:"toggleCine",label:"Cine",keys:["c"]},{commandName:"invertViewport",label:"Invert",keys:["i"],isEditable:!0},{commandName:"incrementActiveViewport",label:"Next Image Viewport",keys:["right"],isEditable:!0},{commandName:"decrementActiveViewport",label:"Previous Image Viewport",keys:["left"],isEditable:!0},{commandName:"updateViewportDisplaySet",commandOptions:{direction:-1},label:"Previous Series",keys:["pageup"],isEditable:!0},{commandName:"updateViewportDisplaySet",commandOptions:{direction:1},label:"Next Series",keys:["pagedown"],isEditable:!0},{commandName:"nextStage",context:"DEFAULT",label:"Next Stage",keys:["."],isEditable:!0},{commandName:"previousStage",context:"DEFAULT",label:"Previous Stage",keys:[","],isEditable:!0},{commandName:"nextImage",label:"Next Image",keys:["down"],isEditable:!0},{commandName:"previousImage",label:"Previous Image",keys:["up"],isEditable:!0},{commandName:"firstImage",label:"First Image",keys:["home"],isEditable:!0},{commandName:"lastImage",label:"Last Image",keys:["end"],isEditable:!0},{commandName:"resetViewport",label:"Reset",keys:["space"],isEditable:!0},{commandName:"cancelMeasurement",label:"Cancel Measurement",keys:["esc"]},{commandName:"setWindowLevelPreset",commandOptions:{presetName:"ct-soft-tissue",presetIndex:0},label:"W/L Preset 1",keys:["1"]},{commandName:"setWindowLevelPreset",commandOptions:{presetName:"ct-lung",presetIndex:1},label:"W/L Preset 2",keys:["2"]},{commandName:"setWindowLevelPreset",commandOptions:{presetName:"ct-bone",presetIndex:2},label:"W/L Preset 3",keys:["3"]},{commandName:"setWindowLevelPreset",commandOptions:{presetName:"ct-brain",presetIndex:3},label:"W/L Preset 4",keys:["4"]},{commandName:"deleteActiveAnnotation",label:"Delete Annotation",keys:["backspace"]},{commandName:"acceptPreview",label:"Accept Preview",keys:["enter"]},{commandName:"rejectPreview",label:"Reject Preview",keys:["esc"]},{commandName:"undo",label:"Undo",keys:["ctrl+z"],isEditable:!0},{commandName:"redo",label:"Redo",keys:["ctrl+y"],isEditable:!0},{commandName:"interpolateScrollForMarkerLabelmap",label:"Interpolate Scroll",keys:["n"],isEditable:!0},{commandName:"increaseBrushSize",label:"Increase Brush Size",keys:["]"],isEditable:!0},{commandName:"decreaseBrushSize",label:"Decrease Brush Size",keys:["["],isEditable:!0},{commandName:"setToolActive",commandOptions:{toolName:"CircularEraser"},label:"Eraser",keys:["e"],isEditable:!0},{commandName:"setToolActive",commandOptions:{toolName:"CircularBrush"},label:"Brush",keys:["b"],isEditable:!0},{commandName:"addNewSegment",label:"Add New Segment",keys:["a"],isEditable:!0}],windowLevelPresets:{1:{description:"Soft tissue",window:"400",level:"40"},2:{description:"Lung",window:"1500",level:"-600"},3:{description:"Liver",window:"150",level:"90"},4:{description:"Bone",window:"2500",level:"480"},5:{description:"Brain",window:"80",level:"40"},6:{description:"Trest",window:"1",level:"1"},7:{description:"Empty1",window:"Empty1",level:"Empty1"},8:{description:"Empty2",window:"Empty2",level:"Empty2"},9:{description:"Empty3",window:"Empty3",level:"Empty3"},10:{description:"Empty4",window:"Empty4",level:"Empty4"}}},r2=r1.hotkeyBindings,r8=function({generateHash:e}){try{let t=localStorage.getItem("hotkey-definitions"),r=localStorage.getItem("hotkeys-migrated");if(!t||"true"===r)return;let n=JSON.parse(t);if(!Array.isArray(n)||0===n.length)return;let i=r2||[],a=JSON.parse(localStorage.getItem("user-preferred-keys")||"{}");n.forEach(t=>{if(!t.commandName||!t.keys)return;let r=i.find(e=>{let r=e.commandName===t.commandName,n=t.commandOptions||{},i=e.commandOptions||{},a=JSON.stringify(n)===JSON.stringify(i);return r&&a});r&&JSON.stringify(r.keys)===JSON.stringify(t.keys)||(a[e({commandName:t.commandName,commandOptions:t.commandOptions||{}})]=t.keys,console.debug(`HotkeysManager: Migrated custom hotkey for ${t.commandName}`))}),localStorage.setItem("user-preferred-keys",JSON.stringify(a)),localStorage.setItem("hotkeys-migrated","true"),localStorage.removeItem("hotkey-definitions"),console.debug("HotkeysManager: Successfully migrated hotkey definitions to new format")}catch(e){console.error("HotkeysManager: Error migrating hotkey definitions",e),localStorage.setItem("hotkeys-migrated","false")}};class r4{constructor(e,t){this._servicesManager=void 0,this._commandsManager=void 0,this.isEnabled=!0,this.hotkeyDefinitions={},this.hotkeyDefaults=[],this.EVENTS=void 0,this.listeners={},this.subscribe=void 0,this._broadcastEvent=void 0,this._unsubscribe=void 0,this._isValidEvent=void 0,this._servicesManager=t,this._commandsManager=e,this.EVENTS=r4.EVENTS,this.subscribe=S.subscribe.bind(this),this._broadcastEvent=S._broadcastEvent.bind(this),this._unsubscribe=S._unsubscribe.bind(this),this._isValidEvent=S._isValidEvent.bind(this),r8({generateHash:this.generateHash})}record(e){return eF.record(e)}cancel(){eF.stopRecord(),eF.unpause()}disable(){this.isEnabled=!1,eF.pause()}enable(){this.isEnabled=!0,eF.unpause()}restoreDefaultBindings(){this.setHotkeys(this.hotkeyDefaults)}destroy(){this.hotkeyDefaults=[],this.hotkeyDefinitions={},eF.reset()}setHotkeys(e=[]){try{this.getValidDefinitions(e).forEach(e=>this.registerHotkeys(e))}catch(t){let{uiNotificationService:e}=this._servicesManager.services;e.show({title:"Hotkeys Manager",message:"Error while setting hotkeys",type:"error"})}}generateHash(e){return r0()({commandName:e.commandName,commandOptions:e.commandOptions||{}})}setDefaultHotKeys(e=[]){let t=this.getValidDefinitions(e);this.hotkeyDefaults=t;let r=JSON.parse(localStorage.getItem("user-preferred-keys")||"{}"),n=t.map(e=>{let t=this.generateHash(e);return r[t]?{...e,keys:r[t]}:e});this.setHotkeys(n)}getValidDefinitions(e){let t=Array.isArray(e)?[...e]:this._parseToArrayLike(e);return t.forEach(e=>{void 0===e.isEditable&&(e.isEditable=!0)}),t}getValidHotkeyDefinitions(e){let t=this.getValidDefinitions(e),r={};return t.forEach(e=>{let{commandName:t,commandOptions:n}=e;r[r0()({commandName:t,commandOptions:n})]=e}),r}_parseToArrayLike(e={}){return Object.entries({...e}).map(e=>this._parseToHotKeyObj(e[0],e[1]))}_parseToHotKeyObj(e,t){return{commandName:e,...t}}registerHotkeys({commandName:e,commandOptions:t={},context:r,keys:n,label:i,isEditable:a}){if(!e)throw Error(`No command was defined for hotkey "${n}"`);let o=this.generateHash({commandName:e,commandOptions:t}),s=this.hotkeyDefinitions[o];if(s&&s.keys===n)return void console.debug("HotkeysManager: Identical hotkey registration skipped.");let l=JSON.parse(localStorage.getItem("user-preferred-keys")||"{}");s&&(l[o]=n,localStorage.setItem("user-preferred-keys",JSON.stringify(l)),this._unbindHotkeys(e,s.keys)),this.hotkeyDefinitions[o]={commandName:e,commandOptions:t,keys:n,label:i,isEditable:a},this._bindHotkeys(e,t,r,n)}_bindHotkeys(e,t={},r,n){if(""===n||void 0===n)return;let i=n instanceof Array?n.join("+"):n;eF.bind(i,n=>{n.preventDefault(),n.stopPropagation(),this._commandsManager.runCommand(e,{evt:n,...t},r),this._broadcastEvent(r4.EVENTS.HOTKEY_PRESSED,{commandName:e,commandOptions:t,keys:i,context:r,evt:n})})}_unbindHotkeys(e,t){if(""!==t&&void 0!==t){if(t instanceof Array){let r=t.join("+");this._unbindHotkeys(e,r);return}eF.unbind(t)}}}r4.EVENTS={HOTKEY_PRESSED:"event::hotkeysManager:hotkeyPressed"};let r3=r4,r5=class{constructor(e){if(this.images=void 0,this.uid=void 0,this.instances=void 0,this.instance=void 0,this.StudyInstanceUID=void 0,this.load=void 0,this.getNumImages=()=>this.images.length,!Array.isArray(e))throw Error("ImageSet expects an array of images");Object.defineProperty(this,"images",{enumerable:!1,configurable:!1,writable:!1,value:e}),Object.defineProperty(this,"uid",{enumerable:!1,configurable:!1,writable:!1,value:y()}),this.instances=e,this.instance=e[0],this.StudyInstanceUID=this.instance?.StudyInstanceUID}getUID(){return this.uid}setAttribute(e,t){this[e]=t}getAttribute(e){return this[e]}setAttributes(e){if("object"==typeof e&&null!==e)for(let[t,r]of Object.entries(e))this[t]=r}getImage(e){return this.images[e]}sort(e){let t=e.getCustomization("instanceSortingCriteria"),r=Object.assign({},t9,t.sortFunctions),n=t.defaultSortFunctionName;return"function"==typeof r[n]?this.images.sort(r[n]):this.isReconstructable&&function(e){if(e.length<=1)return!1;let t=e[0].ImagePositionPatient,r=e[0].ImageOrientationPatient;return!!t&&!!r&&!!t0(e)}(this.images)?(e=>{let t=e[0].ImagePositionPatient,r=tQ(e[0].ImageOrientationPatient),n=e.map(e=>{let n=e.ImagePositionPatient,i=tH.vec3.create();return{distance:tH.vec3.dot(r,tH.vec3.subtract(i,n,t)),image:e}});for(let[t,r]of(n.sort((e,t)=>t.distance-e.distance),n.entries()))e[t]=r.image;return e})(this.images):this.images.sort(t9.sortByInstanceNumber)}sortBy(e){return this.images.sort(e)}};var r6=a(313),r7=a.n(r6),r9=a(557);function ne(e,t,r){let{PaletteColorLookupTableUID:n}=e;if(void 0!==e[t]||void 0!==n)return function(e,t){let r=t[0]||65536,n=t[2];if(!e)return;let i=e=>{let t=e.buffer||e,i=t.byteLength===2*r||n>8?new Uint16Array(t):new Uint8Array(t),a=[];for(let e=0;e<r;e++)a[e]=i[e];return a};if(e.palette)return e.palette;if(e.InlineBinary)try{let t=Uint8Array.from(atob(e.InlineBinary),e=>e.charCodeAt(0));return e.palette=i(t)}catch(t){console.log("Couldn't decode",e.InlineBinary,t);return}let a=Array.isArray(e)?e[0]:e;return a instanceof ArrayBuffer?e.palette=i(a):e.retrieveBulkData?e.retrieveBulkData().then(t=>e.palette=i(t)):void console.error(`No data found for ${e} palette`)}(e[t],e[r])}function nt(e,t,r){if(e[r])return e[r];let n=Object.create(e);return Object.defineProperty(e,r,{value:n,writable:!1,enumerable:!1}),t&&[...t?Object.values(t).filter(Boolean).map(e=>e[0]).filter(e=>"object"==typeof e):[]].forEach(e=>{e.SOPInstanceUID||Object.entries(e).forEach(([e,t])=>{n[e]=t})}),n}let{calibratedPixelSpacingMetadataProvider:nr,getPixelSpacingInformation:nn}=r9.utilities,ni=new class{constructor(){this.imageURIToUIDs=new Map,this.customMetadata=new Map}addImageIdToUIDs(e,t){if(!e)throw Error("MetadataProvider::Empty imageId");let r=tX(e);this.imageURIToUIDs.set(r,t)}addCustomMetadata(e,t,r){let n=tX(e);this.customMetadata.has(t)||this.customMetadata.set(t,{}),this.customMetadata.get(t)[n]=r}_getInstance(e){if(!e)throw Error("MetadataProvider::Empty imageId");let t=this.getUIDsFromImageID(e);if(!t)return;let{StudyInstanceUID:r,SeriesInstanceUID:n,SOPInstanceUID:i,frameNumber:a}=t,o=eo.getInstance(r,n,i);if(o)return a&&((e,t)=>{let{PerFrameFunctionalGroupsSequence:r,SharedFunctionalGroupsSequence:n,NumberOfFrames:i,ImageType:a}=t;if(i<2)return t;t.ImageType=Array.isArray(a)&&a||"string"==typeof a&&a.split("\\")||a;let o=Number.parseInt(e||1),s=t.DetectorInformationSequence&&(!t.ImagePositionPatient||!t.ImageOrientationPatient);if(r&&n||s||i>1){!t.ImageOrientationPatient&&t.DetectorInformationSequence&&(t.ImageOrientationPatient=t.DetectorInformationSequence[0].ImageOrientationPatient);let e=t.ImagePositionPatient;if(!t.ImagePositionPatient&&t.DetectorInformationSequence){let r=t.DetectorInformationSequence[0].ImagePositionPatient,n=t.ImageOrientationPatient;r=r?.map(e=>Number(e)),n=n?.map(e=>Number(e));let i=Number(t.SpacingBetweenSlices);if(n&&i){let t=tH.vec3.fromValues(n[0],n[1],n[2]),a=tH.vec3.fromValues(n[3],n[4],n[5]),s=tH.vec3.cross(tH.vec3.create(),t,a),l=tH.vec3.scaleAndAdd(tH.vec3.create(),r,s,i*(o-1));e=[l[0],l[1],l[2]]}}t._parentInstance||Object.defineProperty(t,"_parentInstance",{value:{...t}});let i=nt(t._parentInstance,n?.[0],"_shared"),a=nt(i,r?.[o-1],o);return a.ImagePositionPatient=e??a.ImagePositionPatient??[0,0,o],Object.defineProperty(a,"frameNumber",{value:o,writable:!0,enumerable:!0,configurable:!0}),a}if(t.GridFrameOffsetVector){t._parentInstance||Object.defineProperty(t,"_parentInstance",{value:{...t}});let e=nt(t._parentInstance,n?.[0],"_shared"),i=nt(e,r?.[o-1],o),a=i.ImagePositionPatient?.map(Number),s=i.ImageOrientationPatient?.map(Number),l=Number(t.GridFrameOffsetVector[o-1]);if(a&&s&&!Number.isNaN(l)){let e=tH.vec3.fromValues(s[0],s[1],s[2]),t=tH.vec3.fromValues(s[3],s[4],s[5]),r=tH.vec3.cross(tH.vec3.create(),e,t),n=tH.vec3.scaleAndAdd(tH.vec3.create(),tH.vec3.fromValues(...a),r,l);i.ImagePositionPatient=[n[0],n[1],n[2]]}return Object.defineProperty(i,"frameNumber",{value:o,writable:!0,enumerable:!0,configurable:!0}),i}return t})(a,o)||o}get(e,t,r={fallback:!1}){if(Array.isArray(t))return;let n=this._getInstance(t);if(e===ns)return n;if(this.customMetadata.has(e)){let r=this.customMetadata.get(e),n=tX(t);if(r[n])return r[n]}return this.getTagFromInstance(e,n,r)}getTag(e,t,r){return this.get(e,t,r)}getInstance(e){return this.get(ns,e)}getTagFromInstance(e,t,r={fallback:!1}){if(t)return t[e]?t[e]:this._getCornerstoneDICOMImageLoaderTag(e,t)}addHandler(e,t){no[e]=t}_getCornerstoneDICOMImageLoaderTag(e,t){let r=no[e]?.(t);if(r)return r;switch(e){case na.GENERAL_SERIES_MODULE:r={modality:t.Modality,seriesInstanceUID:t.SeriesInstanceUID,seriesNumber:t$(t.SeriesNumber),studyInstanceUID:t.StudyInstanceUID,seriesDescription:t.SeriesDescription,seriesDate:t.SeriesDate,seriesTime:t.SeriesTime};break;case na.PATIENT_STUDY_MODULE:r={patientAge:t.PatientAge,patientSize:t.PatientSize,patientWeight:t.PatientWeight};break;case na.PATIENT_DEMOGRAPHIC_MODULE:r={patientSex:t.PatientSex};break;case na.IMAGE_PIXEL_MODULE:r={samplesPerPixel:t$(t.SamplesPerPixel),photometricInterpretation:t.PhotometricInterpretation,rows:t$(t.Rows),columns:t$(t.Columns),bitsAllocated:t$(t.BitsAllocated),bitsStored:t$(t.BitsStored),highBit:t$(t.HighBit),pixelRepresentation:t$(t.PixelRepresentation),planarConfiguration:t$(t.PlanarConfiguration),pixelAspectRatio:t$(t.PixelAspectRatio),smallestPixelValue:t$(t.SmallestPixelValue),largestPixelValue:t$(t.LargestPixelValue),redPaletteColorLookupTableDescriptor:t$(t.RedPaletteColorLookupTableDescriptor),greenPaletteColorLookupTableDescriptor:t$(t.GreenPaletteColorLookupTableDescriptor),bluePaletteColorLookupTableDescriptor:t$(t.BluePaletteColorLookupTableDescriptor),redPaletteColorLookupTableData:ne(t,"RedPaletteColorLookupTableData","RedPaletteColorLookupTableDescriptor"),greenPaletteColorLookupTableData:ne(t,"GreenPaletteColorLookupTableData","GreenPaletteColorLookupTableDescriptor"),bluePaletteColorLookupTableData:ne(t,"BluePaletteColorLookupTableData","BluePaletteColorLookupTableDescriptor")};break;case na.VOI_LUT_MODULE:let{WindowCenter:n,WindowWidth:i,VOILUTFunction:a}=t;if(null==n||null==i)return;let o=Array.isArray(n)?n:[n],s=Array.isArray(i)?i:[i];r={windowCenter:t$(o),windowWidth:t$(s),voiLUTFunction:a};break;case na.MODALITY_LUT_MODULE:let{RescaleIntercept:l,RescaleSlope:u}=t;if(null==l||null==u)return;r={rescaleIntercept:t$(t.RescaleIntercept),rescaleSlope:t$(t.RescaleSlope),rescaleType:t.RescaleType};break;case na.SOP_COMMON_MODULE:r={sopClassUID:t.SOPClassUID,sopInstanceUID:t.SOPInstanceUID};break;case na.PET_IMAGE_MODULE:r={frameReferenceTime:t.FrameReferenceTime,actualFrameDuration:t.ActualFrameDuration};break;case na.PET_ISOTOPE_MODULE:let{RadiopharmaceuticalInformationSequence:c}=t;if(c){let{RadiopharmaceuticalStartTime:e,RadionuclideTotalDose:t,RadionuclideHalfLife:n}=Array.isArray(c)?c[0]:c;r={radiopharmaceuticalInfo:{radiopharmaceuticalStartTime:r7().parseTM(e),radionuclideTotalDose:t,radionuclideHalfLife:n}}}break;case na.OVERLAY_PLANE_MODULE:let d=[];for(let e=0;e<=30;e+=2){let r=`60${e.toString(16)}`;3===r.length&&(r=`600${e.toString(16)}`);let n=t[`${r}3000`];if(!n)continue;let i=`${r}0010`,a=`${r}0011`,o=`${r}0040`,s=`${r}0050`,l=`${r}0022`,u=`${r}1500`,c=`${r}1301`,f=`${r}1302`,h=`${r}1303`,p=t[s],g=0;g=t[i]instanceof Array?new Uint16Array(t[i][0])[0]:t[i];let m=0;m=t[a]instanceof Array?new Uint16Array(t[a][0])[0]:t[a];let y=0,v=0;if(1===p.length){let e=new Int16Array(p[0]);y=e[0],v=e[1]}else y=p[0],v=p[1];let S={rows:g,columns:m,type:t[o],x:y,y:v,pixelData:n,description:t[l],label:t[u],roiArea:t[c],roiMean:t[f],roiStandardDeviation:t[h]};d.push(S)}r={overlays:d};break;case na.PATIENT_MODULE:r={patientName:t.PatientName,patientId:t.PatientID,patientSex:t.PatientSex,patientBirthDate:t.PatientBirthDate,issuerOfPatientId:t.IssuerOfPatientID,otherPatientIDsSequence:t.OtherPatientIDsSequence};break;case na.GENERAL_IMAGE_MODULE:r={sopInstanceUID:t.SOPInstanceUID,instanceNumber:t$(t.InstanceNumber),lossyImageCompression:t.LossyImageCompression,lossyImageCompressionRatio:t.LossyImageCompressionRatio,lossyImageCompressionMethod:t.LossyImageCompressionMethod};break;case na.GENERAL_STUDY_MODULE:r={studyDescription:t.StudyDescription,studyInstanceUID:t.StudyInstanceUID,studyDate:t.StudyDate,studyTime:t.StudyTime,accessionNumber:t.AccessionNumber,studyId:t.StudyID};break;case na.CINE_MODULE:r={frameTime:t.FrameTime,numberOfFrames:t.NumberOfFrames?Number(t.NumberOfFrames):1};break;case na.PET_SERIES_MODULE:r={correctedImage:t.CorrectedImage,units:t.Units,decayCorrection:t.DecayCorrection};break;case na.CALIBRATION_MODULE:r={sequenceOfUltrasoundRegions:t.SequenceOfUltrasoundRegions?.map(e=>({regionSpatialFormat:e.RegionSpatialFormat,regionDataType:e.RegionDataType,regionFlags:e.RegionFlags,regionLocationMinX0:e.RegionLocationMinX0,regionLocationMinY0:e.RegionLocationMinY0,regionLocationMaxX1:e.RegionLocationMaxX1,regionLocationMaxY1:e.RegionLocationMaxY1,referencePixelX0:e.ReferencePixelX0,referencePixelY0:e.ReferencePixelY0,referencePixelPhysicalValueX:e.ReferencePixelPhysicalValueX,referencePixelPhysicalValueY:e.ReferencePixelPhysicalValueY,physicalUnitsXDirection:e.PhysicalUnitsXDirection,physicalUnitsYDirection:e.PhysicalUnitsYDirection,physicalDeltaX:e.PhysicalDeltaX,physicalDeltaY:e.PhysicalDeltaY}))};break;case"temporalPositionIdentifier":r={temporalPositionIdentifier:t.TemporalPositionIdentifier};break;default:return}return r}getFrameInformationFromURL(e){function t(t,r){let n=e.split(t)[1];return n.includes(r)?n.split(r)[0]:n}return e.includes("/frames")?t("/frames","/"):e.includes("&frame=")?t("&frame=","&"):void 0}getUIDsFromImageID(e){let t;if(e.startsWith("wadors:")){let t=e.split("/studies/")[1].split("/");return{StudyInstanceUID:t[0],SeriesInstanceUID:t[2],SOPInstanceUID:t[4],frameNumber:t[6]}}if(e.includes("?requestType=WADO")){let t=eU.parse(e);return{StudyInstanceUID:t.studyUID,SeriesInstanceUID:t.seriesUID,SOPInstanceUID:t.objectUID,frameNumber:t.frameNumber}}t=(t=/^(http|https|dicomfile):\/\//.test(e)?e:tX(e)).split("&frame=")[0];let r=this.imageURIToUIDs.get(t),n=this.getFrameInformationFromURL(e)||"1";return r&&void 0!==n?{...r,frameNumber:n}:r}};eo.setMetaDataProvider(ni);let na={GENERAL_SERIES_MODULE:"generalSeriesModule",PATIENT_STUDY_MODULE:"patientStudyModule",IMAGE_PIXEL_MODULE:"imagePixelModule",VOI_LUT_MODULE:"voiLutModule",MODALITY_LUT_MODULE:"modalityLutModule",SOP_COMMON_MODULE:"sopCommonModule",PET_IMAGE_MODULE:"petImageModule",PET_ISOTOPE_MODULE:"petIsotopeModule",PET_SERIES_MODULE:"petSeriesModule",OVERLAY_PLANE_MODULE:"overlayPlaneModule",PATIENT_DEMOGRAPHIC_MODULE:"patientDemographicModule",PATIENT_MODULE:"patientModule",GENERAL_IMAGE_MODULE:"generalImageModule",GENERAL_STUDY_MODULE:"generalStudyModule",CINE_MODULE:"cineModule",CALIBRATION_MODULE:"calibrationModule"},no={frameModule:e=>{let{frameNumber:t=1,numberOfFrames:r=1,SOPClassUID:n,SOPInstanceUID:i,SeriesInstanceUID:a,StudyInstanceUID:o}=e;return{frameNumber:t,numberOfFrames:r,sopClassUID:n,sopInstanceUID:i,seriesInstanceUID:a,studyInstanceUID:o}},imagePlaneModule:e=>{let t,r,n,i,a,{ImageOrientationPatient:o,ImagePositionPatient:s}=e,{PixelSpacing:l,type:u}=nn(e)||{},c=!1,d=!1,f=!1;l?([t,r]=l,r9.utilities.calibratedPixelSpacingMetadataProvider.get("calibratedPixelSpacing",e.imageId)||nr.add(e.imageId,{rowPixelSpacing:parseFloat(l[0]),columnPixelSpacing:parseFloat(l[1]),type:u})):(t=r=1,c=!0),o?(n=t$(o.slice(0,3)),i=t$(o.slice(3,6)),a=t$(o)):(n=[1,0,0],i=[0,1,0],a=[1,0,0,0,1,0],c=!0,d=!0,f=!0);let h=t$(s)||[0,0,0];return s||(c=!0),{frameOfReferenceUID:e.FrameOfReferenceUID,rows:t$(e.Rows),columns:t$(e.Columns),spacingBetweenSlices:t$(e.SpacingBetweenSlices),imageOrientationPatient:a,rowCosines:n,isDefaultValueSetForRowCosine:d,columnCosines:i,isDefaultValueSetForColumnCosine:f,imagePositionPatient:h,sliceThickness:t$(e.SliceThickness),sliceLocation:t$(e.SliceLocation),pixelSpacing:t$(l||1),rowPixelSpacing:t?t$(t):null,columnPixelSpacing:r?t$(r):null,usingDefaultValues:c}}},ns="instance",nl={MetadataProvider:ni,CommandsManager:rJ,HotkeysManager:r3,ImageSet:r5},nu=(0,ri.createContext)(void 0),nc=({children:e})=>{let t=(0,ri.useRef)(new Map),r={registerViewport:(e,r)=>{t.current.set(e,r)},unregisterViewport:e=>{t.current.delete(e)},getViewportElement:e=>t.current.get(e)||null,viewportRefs:t.current};return ri.createElement(nu.Provider,{value:r},e)},nd=()=>{let e=(0,ri.useContext)(nu);if(void 0===e)throw Error("useViewportRefs must be used within a ViewportRefsProvider");return e},nf=e=>{let{registerViewport:t,unregisterViewport:r,getViewportElement:n}=nd();return{current:n(e),register:r=>t(e,r),unregister:()=>r(e)}};a(642);let nh={getAttribute:function(e,t){return e&&e.Value&&e.Value.length?function(e){let t="";for(let r=0;r<e.length;r++)for(let n=0;n<e[r].length;n++)t+=function(e){let t=e.length;return 0===t?"0000":1===t?"000"+e:2===t?"00"+e:3===t?"0"+e:e}(e[r].charCodeAt(n).toString(16));return parseInt(t,16)}(e.Value):t},getAuthorizationHeader:function({requestOptions:e}={},t={}){let r={},n=t&&t.getAccessToken&&t.getAccessToken();return e?.auth?"function"==typeof e.auth?r.Authorization=e.auth(e):r.Authorization=`Basic ${btoa(e.auth)}`:n&&(r.Authorization=`Bearer ${n}`),r},getModalities:function(e,t){if(!e&&!t)return{};let r=e||{vr:"CS",Value:[]};if(r.Value=r.Value||[],t)if(!r.vr||r.vr!==t.vr)return t;else for(let e=0;e<t.Value.length;e++){let n=t.Value[e];-1===r.Value.indexOf(n)&&r.Value.push(n)}return r},getName:function(e,t){return e&&e.Value&&e.Value.length?e.Value[0].Alphabetic?e.Value[0].Alphabetic:e.Value[0]:t},getNumber:function(e,t){return e&&e.Value&&e.Value.length?parseFloat(e.Value[0]):t},getString:function(e,t){return e&&e.Value&&e.Value.length?e.Value.join("\\"):t}},np={getHTTPErrorHandler:()=>null},ng={getNestedObject:function(e){let t={};for(let r in e){if(!e.hasOwnProperty(r))continue;let n=e[r],i=r.split("."),a=t;for(;i.length;){let e=i.shift();i.length?(a[e]||(a[e]={}),a=a[e]):a[e]=n}}return t},getShallowObject:function(e){let t={},r=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))continue;let a=e?`${e}.${i}`:i,o=t[i];"object"==typeof o?(o instanceof Array&&(a+="[]"),r(a,o,n)):n[a]=o}};return r("",e,t),t}};function nm(e){return"string"==typeof e}let ny={search:function e(t,r,n=null,i=[]){let a=RegExp(r.trim(),"i");return Object.keys(t).forEach(o=>{let s=t[o];if(!s)return;let l=nm(n)?s[n]:s;nm(l)&&a.test(l)&&i.push(s),(s instanceof Object||"object"==typeof s&&null!==s)&&e(s,r,n,i)}),i},encodeId:function(e){let t=e&&e.toString?e.toString():e;return""===t||"string"!=typeof t?"_":t.replace(/[^a-zA-Z0-9-]/g,e=>"_"+e[0].charCodeAt(0).toString(16)+"_")}},nv={userLoggedIn:()=>!1,getUserId:()=>null,getName:()=>null,getAccessToken:()=>null,login:()=>new Promise((e,t)=>t()),logout:()=>new Promise((e,t)=>t()),getData:e=>null,setData:(e,t)=>null},nS=((d={}).STUDY_TO_DISPLAY_SETS="studyToDisplaySetsLoaded",d.STUDY_TO_FIRST_IMAGE="studyToFirstImage",d.DISPLAY_SETS_TO_FIRST_IMAGE="displaySetsToFirstImage",d.DISPLAY_SETS_TO_ALL_IMAGES="displaySetsToAllImages",d.SEARCH_TO_LIST="searchToList",d.SCRIPT_TO_VIEW="scriptToView",d),nb={create:function({query:e,retrieve:t,store:r,reject:n,initialize:i,deleteStudyMetadataPromise:a,getImageIdsForDisplaySet:o,getImageIdsForInstance:s,getConfig:l,getStudyInstanceUIDs:u}){return{query:e||{studies:{mapParams:e=>e,requestResults:()=>{},processResults:e=>e},series:{},instances:{}},retrieve:t||{series:{}},reject:n||{},store:r||{dicom:async e=>{throw Error("store.dicom(naturalizedDicom, StudyInstanceUID) not implemented for dataSource.")}},initialize:i,deleteStudyMetadataPromise:a,getImageIdsForDisplaySet:o,getImageIdsForInstance:s,getConfig:l||(()=>({dicomUploadEnabled:!1})),getStudyInstanceUIDs:u}}},nw=()=>{let{servicesManager:e}=rs(),{displaySetService:t,viewportGridService:r}=e.services,n=(0,ri.useCallback)(e=>(r.getDisplaySetsUIDsForViewport(e)||[]).map(e=>t.getDisplaySetByUID(e)).filter(Boolean),[t,r]),i=n(r.getActiveViewportId())||[],[a,o]=(0,ri.useState)(i);return(0,ri.useEffect)(()=>{let e=[r.subscribe(r.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED,({viewportId:e})=>{o(n(e))}),r.subscribe(r.EVENTS.GRID_STATE_CHANGED,({state:e})=>{let t=e.activeViewportId;t&&o(n(t))})];return()=>{e.forEach(e=>e.unsubscribe())}},[r,n]),a};function n_({buttonSection:e="primary"}){let{commandsManager:t,servicesManager:r}=rs(),{toolbarService:n,viewportGridService:i}=r.services,{EVENTS:a}=n,[o,s]=(0,ri.useState)(n.getButtonSection(e).filter(Boolean)),[l,u]=(0,ri.useState)({}),c=(0,ri.useCallback)(e=>{e.event?.stopPropagation?.();let a=e.viewportId||i.getActiveViewportId(),o=n.getButtonProps(e.itemId),s=((e,t,{servicesManager:r,commandsManager:n})=>{let i=[];for(let r of rw(e.commands))i.push(()=>n.run(r,t));for(let t of rw(e.options)){if(!t?.commands||t.explicitRunOnly)continue;let a=t.value;for(let o of rw(t.commands)){let s={...t,value:a,options:e.options,servicesManager:r,commandsManager:n};i.push(()=>n.run(o,s))}}return i})(o,e,{servicesManager:r,commandsManager:t}),l={...o,commands:s};n.recordInteraction({...e,...l},{refreshProps:{viewportId:a}})},[n,i]);(0,ri.useEffect)(()=>{let t=()=>{s(n.getButtonSection(e)?.filter(Boolean))},r=[a.TOOL_BAR_MODIFIED,a.TOOL_BAR_STATE_MODIFIED].map(e=>n.subscribe(e,t));return()=>{r.forEach(e=>e.unsubscribe())}},[n]),(0,ri.useEffect)(()=>{let e=[i.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED,i.EVENTS.VIEWPORTS_READY,i.EVENTS.LAYOUT_CHANGED].map(e=>i.subscribe(e,({viewportId:e})=>{e=e||i.getActiveViewportId(),n.refreshToolbarState({viewportId:e})}));return()=>e.forEach(e=>e.unsubscribe())},[i,n]);let d=(0,ri.useMemo)(()=>({lockItem:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isLocked:!0},n.refreshToolbarState({viewportId:r,itemId:e}))},unlockItem:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isLocked:!1},n.refreshToolbarState({viewportId:r,itemId:e}))},toggleLock:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isLocked:!a.props.isLocked},n.refreshToolbarState({viewportId:r,itemId:e}))},isItemLocked:(e,t)=>{let r=n.getButton(e);return r?.props?.isLocked===!0},showItem:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isVisible:!0},n.refreshToolbarState({viewportId:r,itemId:e}))},hideItem:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isVisible:!1},n.refreshToolbarState({viewportId:r,itemId:e}))},toggleVisibility:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isVisible:!1===a.props.isVisible},n.refreshToolbarState({viewportId:r,itemId:e}))},isItemVisible:(e,t)=>{let r=n.getButton(e);return r?.props?.isVisible!==!1},openItem:(e,t)=>{u(t=>{let r={};return r[e]=!0,r})},closeItem:(e,t)=>{u(t=>({...t,[e]:!1}))},closeAllItems:e=>{u({})},isItemOpen:(e,t)=>!0===l[e]}),[i,n,l]);return o?.length?{toolbarButtons:o.filter(e=>!1!==e.componentProps.visible),onInteraction:c,...d}:{toolbarButtons:[],onInteraction:c,...d}}function nE(e){let t=nf(e),[r,n]=(0,ri.useState)({width:0,height:0,offsetLeft:0,offsetTop:0,clientRect:null,isVisible:!1}),i=(0,ri.useCallback)(()=>{if(!t?.current)return;let e=t.current,r=e.getBoundingClientRect(),i=r.width,a=r.height,o=e.offsetLeft,s=e.offsetTop,l=i>0&&a>0;n(e=>e.width===i&&e.height===a&&e.offsetLeft===o&&e.offsetTop===s&&e.isVisible===l?e:{width:i,height:a,offsetLeft:o,offsetTop:s,clientRect:r,isVisible:l})},[t]);return(0,ri.useEffect)(()=>{if(!e||!t?.current)return;i();let r=new ResizeObserver(()=>{i()});return r.observe(t.current),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i),t.current&&r.unobserve(t.current),r.disconnect()}},[e,t,i]),(0,ri.useMemo)(()=>r,[r])}function nI(e){let t=nf(e),{width:r,height:n,clientRect:i}=nE(e),[a,o]=(0,ri.useState)({x:0,y:0,isInViewport:!1,relativeY:0,relativeX:0,isWithinNormalizedBox:e=>!1});return(0,ri.useEffect)(()=>{if(!t.current)return;let e=e=>{if(!i)return;let t=e.clientX-i.left,a=e.clientY-i.top,s=t>=0&&t<=i.width&&a>=0&&a<=i.height,l=Math.max(0,Math.min(1,t/r)),u=Math.max(0,Math.min(1,a/n));o({x:t,y:a,isInViewport:s,relativeX:l,relativeY:u,isWithinNormalizedBox:e=>l>=e.minX&&l<=e.maxX&&u>=e.minY&&u<=e.maxY})};return document.addEventListener("mousemove",e),()=>{document.removeEventListener("mousemove",e)}},[t,n,i,r]),a}function nD({buttonSectionId:e}){let{servicesManager:t}=rs(),{toolbarService:r}=t.services,{toolbarButtons:n}=n_({buttonSection:e});return n.reduce((e,t)=>{if(e)return e;let n=t.componentProps.buttonSection;for(let e of n?r.getButtonSection(n):[t]){if(e.componentProps.isActive)return{activeToolOptions:e.componentProps.options,activeToolButtonId:e.componentProps.id};if(e.componentProps.buttonSection){let t=r.getButtonPropsInButtonSection(e.componentProps.buttonSection).find(e=>e.isActive);if(t)return{activeToolOptions:t.options,activeToolButtonId:t.id}}}return null},null)??{}}function nM(){let{commandsManager:e}=rs();return(0,ri.useCallback)((t,r={})=>e.runCommand(t,r),[e])}let nA={...r_.hotkeys,defaults:{hotkeyBindings:r1.hotkeyBindings}},nx={MODULE_TYPES:p,CommandsManager:rJ,ExtensionManager:rZ,HotkeysManager:r3,ServicesManager:W,ServiceProvidersManager:G,defaults:r1,utils:r_,hotkeys:nA,classes:nl,string:ny,user:nv,errorHandler:np,object:ng,log:m,DICOMWeb:nh,viewer:{},CineService:e_,CustomizationService:rL,UIDialogService:K,UIModalService:ee,UINotificationService:en,UIViewportDialogService:ea,DisplaySetService:eh,MeasurementService:H,ToolbarService:ev,ViewportGridService:eb,HangingProtocolService:rP,UserAuthenticationService:rT,MultiMonitorService:rK,IWebApiDataSource:nb,DicomMetadataStore:eo,pubSubServiceInterface:S,PubSubService:I,PanelService:rY,useActiveViewportDisplaySets:nw,WorkflowStepsService:rW,StudyPrefetcherService:rX},nP=nx})(),o})());
|
|
4
|
+
`)}),{viewportOptions:o,displaySetsInfo:s}}_validateViewportSpecificMatch(e,t,r){let{displaySetService:n}=this._servicesManager.services,i=t.displaySets,a=e.displaySetInstanceUIDs.length;if(i.length>0&&a!==i.length)throw Error(`The number of displaySets to set ${a} does not match the number of displaySets in the protocol ${i} - not currently implemented`);e.displaySetInstanceUIDs.forEach(e=>{let i=n.getDisplaySetByUID(e),{displaySets:a}=t;for(let e of a){let t=r[e.id];t&&this._validateRequiredSelectors(t,i)}})}areRequiredSelectorsValid(e,t){let r=!0;for(let n of e)try{this._validateRequiredSelectors(n,t)}catch(e){r=!1;break}return r}_validateRequiredSelectors(e,t){let{seriesMatchingRules:r}=e,n=r.filter(e=>e.required);if(n.length){let e=this.protocolEngine.findMatch(t,n);if(!e||0===e.score)throw Error(`The displaySetInstanceUID ${t.displaySetInstanceUID} does not satisfy the required seriesMatching criteria for the protocol`)}}_validateOptions(e){let{displaySetService:t}=this._servicesManager.services,{displaySetSelectorMap:r}=e;r&&Object.entries(r).forEach(([e,r])=>{r.forEach(e=>{if(!t.getDisplaySetByUID(e))throw Error(`The displaySetInstanceUID ${e} is not found in the displaySetService`)})})}_matchImages(e){let{id:t,studyMatchingRules:r=[],seriesMatchingRules:n}=e,i=[],a=0;console.log("ProtocolEngine::matchImages",r,n);let o=-1===this.protocol.numberOfPriorsReferenced;this.studies.forEach((e,t)=>{if(o&&this.activeStudy!==e)return;let s=this.displaySets.filter(t=>t.StudyInstanceUID===e.StudyInstanceUID&&!t?.unsupported),u=this.protocolEngine.findMatch(e,r,{studies:this.studies,displaySets:s,allDisplaySets:this.displaySets,displaySetMatchDetails:this.displaySetMatchDetails,studyInstanceUIDsIndex:t});!0!==u.requiredFailed&&(this.debug("study",e.StudyInstanceUID,"display sets #",s.length),s.forEach(t=>{let{StudyInstanceUID:r,SeriesInstanceUID:o,displaySetInstanceUID:l}=t,c=this.protocolEngine.findMatch(t,n,{studies:this.studies,instance:t.images?.[0],displaySetMatchDetails:this.displaySetMatchDetails,displaySets:s});if(!0===c.requiredFailed)return void this.debug("Display set required failed",t,n);this.debug("Found displaySet for rules",t),a=Math.max(c.score,a);let d={passed:[],failed:[]};d.passed=d.passed.concat(c.details.passed),d.passed=d.passed.concat(u.details.passed),d.failed=d.failed.concat(c.details.failed),d.failed=d.failed.concat(u.details.failed);let f=c.score+u.score,h={StudyInstanceUID:r,SeriesInstanceUID:o,displaySetInstanceUID:l,matchingScore:f,matchDetails:d,sortingInfo:{score:f,study:e.StudyInstanceUID,...this._getSeriesSortInfoForDisplaySetSort(t)}};this.debug("Adding display set",t,h),i.push(h)}))}),0===i.length&&console.log("No match found",t);let s=eR({name:"score",reverse:!0},{name:"study",reverse:!0},this._getSeriesFieldForDisplaySetSort());i.sort((e,t)=>s(e.sortingInfo,t.sortingInfo));let u=i[0];return console.log("ProtocolEngine::matchImages bestMatch",u,i),{bestMatch:u,matchingScores:i}}_getSeriesSortInfoForDisplaySetSort(e){return{[this._getSeriesFieldForDisplaySetSort().name]:null!=e.SeriesNumber?parseInt(e.SeriesNumber):parseInt(e.seriesNumber)}}_getSeriesFieldForDisplaySetSort(){return{name:"series"}}_isNextStageAvailable(){let e=this._getNumProtocolStages();return this.stageIndex+1<e}_isPreviousStageAvailable(){return this.stageIndex-1>=0}_setCurrentProtocolStage(e,t){let r;for(r=this.stageIndex+e;r>=0&&r<this.protocol.stages.length&&"disabled"===this.protocol.stages[r].status;r+=e);return!(r<0)&&!(r>=this.protocol.stages.length)&&(this.stageIndex=r,this.debug(`ProtocolEngine::setCurrentProtocolStage stage = ${this.stageIndex}`),this._updateViewports(t),this._broadcastEvent(this.EVENTS.PROTOCOL_CHANGED,{viewportMatchDetails:this.viewportMatchDetails,displaySetMatchDetails:this.displaySetMatchDetails,protocol:this.protocol,stageIdx:this.stageIndex,stage:this.protocol.stages[this.stageIndex]}),!0)}debug(...e){this.debugLogging&&console.log(...e)}_copyProtocol(e){return eL()(e)}}rX.EVENTS={PROTOCOL_CHANGED:"event::hanging_protocol_changed",PROTOCOL_RESTORED:"event::hanging_protocol_restore",NEW_LAYOUT:"event::hanging_protocol_new_layout",STAGE_ACTIVATION:"event::hanging_protocol_stage_activation",CUSTOM_IMAGE_LOAD_PERFORMED:"event::hanging_protocol_custom_image_load_performed"},rX.REGISTRATION={name:"hangingProtocolService",altName:"HangingProtocolService",create:({configuration:e={},commandsManager:t,servicesManager:r})=>new rX(t,r)};let rK=rX;class rJ extends L{constructor(){super(rJ.EVENTS),this.serviceImplementation={_getState:()=>console.warn("getState() NOT IMPLEMENTED"),_setUser:()=>console.warn("_setUser() NOT IMPLEMENTED"),_getUser:()=>console.warn("_getUser() NOT IMPLEMENTED"),_getAuthorizationHeader:()=>{},_handleUnauthenticated:()=>console.warn("_handleUnauthenticated() NOT IMPLEMENTED"),_reset:()=>console.warn("reset() NOT IMPLEMENTED"),_set:()=>console.warn("set() NOT IMPLEMENTED")},this.serviceImplementation={...this.serviceImplementation}}getState(){return this.serviceImplementation._getState()}setUser(e){return this.serviceImplementation._setUser(e)}getUser(){return this.serviceImplementation._getUser()}getAuthorizationHeader(){return this.serviceImplementation._getAuthorizationHeader()}handleUnauthenticated(){return this.serviceImplementation._handleUnauthenticated()}reset(){return this.serviceImplementation._reset()}set(e){return this.serviceImplementation._set(e)}setServiceImplementation({getState:e,setUser:t,getUser:r,getAuthorizationHeader:n,handleUnauthenticated:i,reset:a,set:o}){e&&(this.serviceImplementation._getState=e),t&&(this.serviceImplementation._setUser=t),r&&(this.serviceImplementation._getUser=r),n&&(this.serviceImplementation._getAuthorizationHeader=n),i&&(this.serviceImplementation._handleUnauthenticated=i),a&&(this.serviceImplementation._reset=a),o&&(this.serviceImplementation._set=o)}}rJ.EVENTS={},rJ.REGISTRATION={name:"userAuthenticationService",altName:"UserAuthenticationService",create:({configuration:e={}})=>new rJ};let rZ=rJ;var rQ=o(752),r0=o.n(rQ),r1=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,r2=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,r8=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,r3=e=>"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||r2.test(e)),r4=e=>"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||""===e||""===e||r8.test(e)),r6=e=>"string"==typeof e&&/[0-9]/.test(e),r5=e=>"string"==typeof e&&/[0-9A-Fa-f]/.test(e);function r7(){if(t[i])return String.fromCodePoint(t.codePointAt(i))}function r9(){let e=r7();return"\n"===e?(a++,u=0):e?u+=e.length:u++,e&&(i+=e.length),e}let ne={default(){let e;switch(g){case" ":case"\v":case"\f":case" ":case"\xa0":case"\uFEFF":case"\n":case"\r":case"\u2028":case"\u2029":r9();return;case"/":r9(),f="comment";return;case void 0:return r9(),nt("eof")}return"string"==typeof(e=g)&&r1.test(e)?void r9():ne[r]()},comment(){switch(g){case"*":r9(),f="multiLineComment";return;case"/":r9(),f="singleLineComment";return}throw ns(r9())},multiLineComment(){switch(g){case"*":r9(),f="multiLineCommentAsterisk";return;case void 0:throw ns(r9())}r9()},multiLineCommentAsterisk(){switch(g){case"*":r9();return;case"/":r9(),f="default";return;case void 0:throw ns(r9())}r9(),f="multiLineComment"},singleLineComment(){switch(g){case"\n":case"\r":case"\u2028":case"\u2029":r9(),f="default";return;case void 0:return r9(),nt("eof")}r9()},value(){switch(g){case"{":case"[":return nt("punctuator",r9());case"n":return r9(),nr("ull"),nt("null",null);case"t":return r9(),nr("rue"),nt("boolean",!0);case"f":return r9(),nr("alse"),nt("boolean",!1);case"-":case"+":"-"===r9()&&(m=-1),f="sign";return;case".":h=r9(),f="decimalPointLeading";return;case"0":h=r9(),f="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":h=r9(),f="decimalInteger";return;case"I":return r9(),nr("nfinity"),nt("numeric",1/0);case"N":return r9(),nr("aN"),nt("numeric",NaN);case'"':case"'":p='"'===r9(),h="",f="string";return}throw ns(r9())},identifierNameStartEscape(){if("u"!==g)throw ns(r9());r9();let e=nn();switch(e){case"$":case"_":break;default:if(!r3(e))throw nl()}h+=e,f="identifierName"},identifierName(){switch(g){case"$":case"_":case"":case"":h+=r9();return;case"\\":r9(),f="identifierNameEscape";return}if(r4(g)){h+=r9();return}return nt("identifier",h)},identifierNameEscape(){if("u"!==g)throw ns(r9());r9();let e=nn();switch(e){case"$":case"_":case"":case"":break;default:if(!r4(e))throw nl()}h+=e,f="identifierName"},sign(){switch(g){case".":h=r9(),f="decimalPointLeading";return;case"0":h=r9(),f="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":h=r9(),f="decimalInteger";return;case"I":return r9(),nr("nfinity"),nt("numeric",1/0*m);case"N":return r9(),nr("aN"),nt("numeric",NaN)}throw ns(r9())},zero(){switch(g){case".":h+=r9(),f="decimalPoint";return;case"e":case"E":h+=r9(),f="decimalExponent";return;case"x":case"X":h+=r9(),f="hexadecimal";return}return nt("numeric",0*m)},decimalInteger(){switch(g){case".":h+=r9(),f="decimalPoint";return;case"e":case"E":h+=r9(),f="decimalExponent";return}if(r6(g)){h+=r9();return}return nt("numeric",m*Number(h))},decimalPointLeading(){if(r6(g)){h+=r9(),f="decimalFraction";return}throw ns(r9())},decimalPoint(){switch(g){case"e":case"E":h+=r9(),f="decimalExponent";return}if(r6(g)){h+=r9(),f="decimalFraction";return}return nt("numeric",m*Number(h))},decimalFraction(){switch(g){case"e":case"E":h+=r9(),f="decimalExponent";return}if(r6(g)){h+=r9();return}return nt("numeric",m*Number(h))},decimalExponent(){switch(g){case"+":case"-":h+=r9(),f="decimalExponentSign";return}if(r6(g)){h+=r9(),f="decimalExponentInteger";return}throw ns(r9())},decimalExponentSign(){if(r6(g)){h+=r9(),f="decimalExponentInteger";return}throw ns(r9())},decimalExponentInteger(){if(r6(g)){h+=r9();return}return nt("numeric",m*Number(h))},hexadecimal(){if(r5(g)){h+=r9(),f="hexadecimalInteger";return}throw ns(r9())},hexadecimalInteger(){if(r5(g)){h+=r9();return}return nt("numeric",m*Number(h))},string(){switch(g){case"\\":r9(),h+=function(){switch(r7()){case"b":return r9(),"\b";case"f":return r9(),"\f";case"n":return r9(),"\n";case"r":return r9(),"\r";case"t":return r9()," ";case"v":return r9(),"\v";case"0":if(r9(),r6(r7()))throw ns(r9());return"\0";case"x":return r9(),function(){let e="",t=r7();if(!r5(t)||(e+=r9(),!r5(t=r7())))throw ns(r9());return String.fromCodePoint(parseInt(e+=r9(),16))}();case"u":return r9(),nn();case"\n":case"\u2028":case"\u2029":return r9(),"";case"\r":return r9(),"\n"===r7()&&r9(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw ns(r9())}return r9()}();return;case'"':if(p)return r9(),nt("string",h);h+=r9();return;case"'":if(!p)return r9(),nt("string",h);h+=r9();return;case"\n":case"\r":case void 0:throw ns(r9());case"\u2028":case"\u2029":var e;e=g,console.warn(`JSON5: '${nc(e)}' in strings is not valid ECMAScript; consider escaping`)}h+=r9()},start(){switch(g){case"{":case"[":return nt("punctuator",r9())}f="value"},beforePropertyName(){switch(g){case"$":case"_":h=r9(),f="identifierName";return;case"\\":r9(),f="identifierNameStartEscape";return;case"}":return nt("punctuator",r9());case'"':case"'":p='"'===r9(),f="string";return}if(r3(g)){h+=r9(),f="identifierName";return}throw ns(r9())},afterPropertyName(){if(":"===g)return nt("punctuator",r9());throw ns(r9())},beforePropertyValue(){f="value"},afterPropertyValue(){switch(g){case",":case"}":return nt("punctuator",r9())}throw ns(r9())},beforeArrayValue(){if("]"===g)return nt("punctuator",r9());f="value"},afterArrayValue(){switch(g){case",":case"]":return nt("punctuator",r9())}throw ns(r9())},end(){throw ns(r9())}};function nt(e,t){return{type:e,value:t,line:a,column:u}}function nr(e){for(let t of e){if(r7()!==t)throw ns(r9());r9()}}function nn(){let e="",t=4;for(;t-- >0;){if(!r5(r7()))throw ns(r9());e+=r9()}return String.fromCodePoint(parseInt(e,16))}let ni={start(){if("eof"===l.type)throw nu();na()},beforePropertyName(){switch(l.type){case"identifier":case"string":c=l.value,r="afterPropertyName";return;case"punctuator":no();return;case"eof":throw nu()}},afterPropertyName(){if("eof"===l.type)throw nu();r="beforePropertyValue"},beforePropertyValue(){if("eof"===l.type)throw nu();na()},beforeArrayValue(){if("eof"===l.type)throw nu();"punctuator"===l.type&&"]"===l.value?no():na()},afterPropertyValue(){if("eof"===l.type)throw nu();switch(l.value){case",":r="beforePropertyName";return;case"}":no()}},afterArrayValue(){if("eof"===l.type)throw nu();switch(l.value){case",":r="beforeArrayValue";return;case"]":no()}},end(){}};function na(){let e;switch(l.type){case"punctuator":switch(l.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=l.value}if(void 0===d)d=e;else{let t=n[n.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,c,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(null!==e&&"object"==typeof e)n.push(e),r=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{let e=n[n.length-1];r=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}}function no(){n.pop();let e=n[n.length-1];r=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}function ns(e){return void 0===e?nd(`JSON5: invalid end of input at ${a}:${u}`):nd(`JSON5: invalid character '${nc(e)}' at ${a}:${u}`)}function nu(){return nd(`JSON5: invalid end of input at ${a}:${u}`)}function nl(){return u-=5,nd(`JSON5: invalid identifier character at ${a}:${u}`)}function nc(e){let t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){let t=e.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return e}function nd(e){let t=SyntaxError(e);return t.lineNumber=a,t.columnNumber=u,t}let nf=function(e,o){t=String(e),r="start",n=[],i=0,a=1,u=0,l=void 0,c=void 0,d=void 0;do l=function(){for(f="default",h="",p=!1,m=1;;){g=r7();let e=ne[f]();if(e)return e}}(),ni[r]();while("eof"!==l.type);return"function"==typeof o?function e(t,r,n){let i=t[r];if(null!=i&&"object"==typeof i)if(Array.isArray(i))for(let t=0;t<i.length;t++){let r=String(t),a=e(i,r,n);void 0===a?delete i[r]:Object.defineProperty(i,r,{value:a,writable:!0,enumerable:!0,configurable:!0})}else for(let t in i){let r=e(i,t,n);void 0===r?delete i[t]:Object.defineProperty(i,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}return n.call(t,r,i)}({"":d},"",o):d},nh="default",np={prefixes:{}};function nm(e){if(!e||"object"!=typeof e)return null;let t=ng(e.bootstrap),r=ng(e.global),n=e.mode&&"object"==typeof e.mode&&!Array.isArray(e.mode),i="string"==typeof e.requires||Array.isArray(e.requires)&&e.requires.length>0;return t||r||n||i?{...t?{bootstrap:e.bootstrap}:{},...r?{global:e.global}:{},...n?{mode:e.mode}:{},...i?{requires:e.requires}:{}}:null}function ng(e){return Array.isArray(e)?e.length>0:!!e&&"object"==typeof e}let ny=/^([a-z][a-z0-9+.-]*:|\/\/)/i;function nD(e,t="customization"){let r=[];for(let n of Array.from(new Set(e.keys())))if(n.toLowerCase()===t.toLowerCase()){for(let t of e.getAll(n))if(t)for(let e of t.split(",")){let t=e.trim();t&&r.push(t)}}return r}function nv(e,t){let r={valid:[],rejected:[]},n=t.prefixes||{};for(let t of e){let e=function(e){let t=e;for(let e=0;e<5;e++){let e;if(!t.includes("%"))return t;try{e=decodeURIComponent(t)}catch{break}if(e===t)break;t=e}return null}(t);if(null===e){r.rejected.push({raw:t,reason:"contains malformed or unsupported percent-encoding"});continue}if(e.includes("..")){r.rejected.push({raw:t,reason:'contains ".." traversal segment'});continue}if(ny.test(e)){r.rejected.push({raw:t,reason:"full URLs are not permitted"});continue}let i=function(e){if(!e)return null;if(!e.startsWith("/"))return{prefix:nh,name:e};let t=e.slice(1),r=t.indexOf("/");if(r<=0)return null;let n=t.slice(0,r),i=t.slice(r+1);return n&&i?{prefix:`/${n}/`,name:i}:null}(e.trim());if(!i){r.rejected.push({raw:t,reason:"could not be split into a prefix and name"});continue}let{prefix:a,name:o}=i;if(!Object.prototype.hasOwnProperty.call(n,a)){r.rejected.push({raw:t,reason:`unknown prefix "${a}"`});continue}if(!o.trim()||o.split("/").some(e=>!e||"."===e||".."===e||e.includes(".."))){r.rejected.push({raw:t,reason:"invalid or unsafe customization name"});continue}r.valid.push({raw:t,normalized:a===nh?`/${nh}/${o}`:`${a}${o}`,prefix:a,name:o})}return r}let nb=/^([a-z][a-z0-9+.-]*:|\/\/)/i,nS="https://ohif.invalid";function nE(e,t,r){let n,i;try{n=new URL(e,nS),i=new URL(t,nS)}catch{throw Error(`Customization URL could not be parsed for "${r.raw}"`)}let a=i.pathname.endsWith("/")?i.pathname:`${i.pathname}/`;if(!(n.origin===i.origin&&n.pathname.startsWith(a)))throw Error(`Customization "${r.raw}" escapes its configured prefix directory`)}let nw={MODE_CUSTOMIZATION_MODIFIED:"event::CustomizationService:modeModified",GLOBAL_CUSTOMIZATION_MODIFIED:"event::CustomizationService:globalModified",DEFAULT_CUSTOMIZATION_MODIFIED:"event::CustomizationService:defaultModified"},n_=((S={}).Global="global",S.Mode="mode",S.Default="default",S);class nA extends L{constructor({configuration:e,commandsManager:t}){super(nw),this.Scope=n_,this.commandsManager=void 0,this.extensionManager=void 0,this.globalCustomizations=new Map,this.modeCustomizations=new Map,this.defaultCustomizations=new Map,this.transformedCustomizations=new Map,this.configuration=void 0,this._urlCustomizationLoaded=new Map,this._urlCustomizationPending=new Map,this._resolvedUrlModules=[],this._customizationConfig=null,this._currentModeIds=[],this._extensionCustomizationModuleApplied=new Set,this.configuration=e,this.commandsManager=t}init(e){this.extensionManager=e,this.modeCustomizations.clear(),this.extensionManager.getRegisteredExtensionIds().forEach(e=>{let t=`${e}.customizationModule.default`;if(!this._extensionCustomizationModuleApplied.has(t)){let e=this._findExtensionValue(t);if(e){let{value:r}=e;this._addReference(r,n_.Default),this._extensionCustomizationModuleApplied.add(t)}}let r=`${e}.customizationModule.global`;if(!this._extensionCustomizationModuleApplied.has(r)){let e=this._findExtensionValue(r);if(e){let{value:t}=e;this._addReference(t,n_.Global),this._extensionCustomizationModuleApplied.add(r)}}});let t=this._getCustomizationConfig();void 0===t.legacyReferences||this.configuration?._hasBeenAdded||(this.addReferences(t.legacyReferences),Object.defineProperty(this.configuration,"_hasBeenAdded",{value:!0,writable:!1}))}_getCustomizationConfig(){return this._customizationConfig||(this._customizationConfig=function(e){if(!e)return{};if(Array.isArray(e))return{legacyReferences:e};if("object"==typeof e){if(nI.some(t=>t in e)){let t={};for(let r of nI)r in e&&(t[r]=e[r]);return{phased:t}}return{legacyReferences:e}}return{}}(this.configuration)),this._customizationConfig}async applyWindowUrlCustomizations(e){"u">typeof window&&await this.applyCustomizationUrlSearchParams(new URLSearchParams(window.location.search),e)}async applyCustomizationUrlSearchParams(e,t){let r=nD(e);r.length&&await this.requires(r,t)}requires(e,t){return this.loadCustomizationModules(e,t).then(e=>(this._applyLoadedUrlCustomizationModules(e),e))}loadCustomizationModules(e,t){let r,n=t?.policy??((r=this?.extensionManager?.appConfig?.customizationUrlPrefixes)&&"object"==typeof r?{prefixes:r}:np),i=(Array.isArray(e)?e:[e]).map(e=>String(e).trim()).filter(Boolean);if(!i.length)return Promise.resolve([]);let{valid:a,rejected:o}=nv(i,n),s=t?.logger||console;if(o.length){let e=o.map(e=>`"${e.raw}" (${e.reason})`).join("; ");return Promise.reject(Error(`[customizationUrl] refusing to load customization(s): ${e}. Allowed prefixes are configured in appConfig.customizationUrlPrefixes.`))}if(!a.length)return Promise.resolve([]);let u=t?.importFn??this._urlDefaultImport.bind(this),l=new Set,c=[];return a.reduce((e,t)=>e.then(()=>this._urlCustomizationLoadOne(t,n,u,s,l,c)),Promise.resolve()).then(()=>(this._resolvedUrlModules.push(...c),c))}async loadAndApplyBootstrapCustomizations(e,t){this.extensionManager=e;let r=this._getCustomizationConfig(),n=[],i=r.phased?.requires;"string"==typeof i&&i?n.push(i):Array.isArray(i)&&n.push(...i.filter(e=>"string"==typeof e&&e)),"u">typeof window&&n.push(...nD(new URLSearchParams(window.location.search))),n.length&&await this.loadCustomizationModules(n,t),this.applyBootstrapCustomizations()}applyBootstrapCustomizations(){this._applyPhase("bootstrap")}applyGlobalCustomizations(){this._applyPhase("global")}applyModeCustomizations(e){let t=(Array.isArray(e)?e:[e]).filter(Boolean);this._currentModeIds=t;let r=this._collectPhaseBlocks("mode");for(let e of r){let t=e.mode?.["*"];t&&this.setCustomizations(t,n_.Mode)}for(let e of r)for(let r of t){let t=e.mode?.[r];t&&this.setCustomizations(t,n_.Mode)}}onModeEnter(){this.clearTransformedCustomizations(),this.init(this.extensionManager)}onModeExit(){this.clearTransformedCustomizations()}getCustomization(e){let t=this.transformedCustomizations.get(e);if(t)return t;let r=this.globalCustomizations.get(e)??this.modeCustomizations.get(e)??this.defaultCustomizations.get(e),n=this._resolveReferences(this.transform(r),new Set([e]));return void 0!==n&&this.transformedCustomizations.set(e,n),n}_resolveReferences(e,t){if(!e||"object"!=typeof e||e.$$typeof)return e;if("string"==typeof e.$reference)return this._resolveReferenceName(e.$reference,t);if(Array.isArray(e)){let r=!1,n=[];for(let i of e)if(i&&"object"==typeof i&&!i.$$typeof&&"string"==typeof i.$reference){r=!0;let e=this._resolveReferenceName(i.$reference,t);Array.isArray(e)?n.push(...e):void 0!==e&&n.push(e)}else{let e=this._resolveReferences(i,t);r||=e!==i,n.push(e)}return r?n:e}if(!function(e){if(null===e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e))return e;let r=!1,n={};for(let[i,a]of Object.entries(e)){let e=this._resolveReferences(a,t);r||=e!==a,n[i]=e}return r?n:e}_resolveReferenceName(e,t){if(t.has(e))return void console.warn(`CustomizationService: $reference cycle detected at "${e}"`);let r=this.globalCustomizations.get(e)??this.modeCustomizations.get(e)??this.defaultCustomizations.get(e);if(void 0===r)return void console.warn(`CustomizationService: no customization registered for $reference "${e}"`);let n=new Set(t).add(e);return this._resolveReferences(this.transform(r),n)}getValue(e,t){let r=this.getCustomization(e);return void 0===r?t:r}setCustomizations(e,t=n_.Mode){Array.isArray(e)?e.forEach(e=>{this._addReference(e,t)}):Object.entries(e).forEach(([e,r])=>{this._setCustomization(e,r,t)})}setCustomization(e,t,r=n_.Mode){console.warn("setCustomization is deprecated. Please use setCustomizations with an object instead."),this._setCustomization(e,t,r)}getCustomizations(e){return e===n_.Global?this.globalCustomizations:e===n_.Mode?this.modeCustomizations:this.defaultCustomizations}hasCustomization(e){return this.globalCustomizations.has(e)||this.modeCustomizations.has(e)}transform(e){if(!e)return e;let{inheritsFrom:t}=e;if(!t)return e;let r=this.getCustomization(t),n=r?Object.assign({},r,e):e;return n.$transform?.(this)||n}registerCustomUpdateCommand(e,t){e.startsWith("$")||(e="$"+e),(0,rQ.extend)(e,t)}_addReference(e,t=n_.Global){e&&("string"==typeof e&&(e=this._findExtensionValue(e).value),Object.entries(e).forEach(([e,r])=>{this[t===n_.Global&&"setGlobalCustomization"||t===n_.Default&&"setDefaultCustomization"||"setModeCustomization"](e,r)}))}addReferences(e,t=n_.Global){e&&(Array.isArray(e)?e.forEach(e=>{this._addReference(e,t)}):this._addReference(e,t))}clearTransformedCustomizations(){for(let e of(super.reset(),Array.from(this.modeCustomizations.keys())))this.transformedCustomizations.delete(e);this.modeCustomizations.clear()}async _urlDefaultImport(e){if("function"!=typeof fetch)throw Error(`No fetch implementation available to load customization ${e}`);let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch customization ${e}: ${t.status} ${t.statusText}`);return nf(await t.text())}_normalizeImportedCustomizationModule(e){return e&&"object"==typeof e&&"customizations"in e?e:e&&"object"==typeof e.default?e.default:e}_collectUrlDependencyRefs(e){let t=new Set,r=nm(e);if(!r||"object"!=typeof r)return Array.from(t);let n=r.requires;if("string"==typeof n&&n)t.add(n);else if(Array.isArray(n))for(let e of n)"string"==typeof e&&e&&t.add(e);return Array.from(t)}_urlDependencyToRequest(e,t){let r=nv([e],t);return r.valid.length?r.valid[0]:null}_urlCustomizationLoadOne(e,t,r,n,i,a){let o=e.normalized;if(this._urlCustomizationLoaded.has(o))return Promise.resolve(this._urlCustomizationLoaded.get(o)||null);if(this._urlCustomizationPending.has(o))return this._urlCustomizationPending.get(o);i.add(o);let s=this._urlCustomizationLoadOneBody(e,t,r,n,i,a);return this._urlCustomizationPending.set(o,s),s.then(()=>this._urlCustomizationPending.delete(o),()=>this._urlCustomizationPending.delete(o)),s}_urlCustomizationLoadOneBody(e,t,r,n,i,a){let o,s=e.normalized,u=Symbol("importFailed");try{o=function(e,t){let r=(t.prefixes||{})[e.prefix];if(!r)throw Error(`Unknown customization prefix: ${e.prefix}`);if(e.name.includes(".."))throw Error(`Customization name contains traversal: ${e.name}`);let n=e.name.endsWith(".jsonc")?e.name:`${e.name}.jsonc`,i=r.endsWith("/")?r:`${r}/`,a=`${i}${n}`;if(nb.test(r))return nE(a,i,e),a;let o="u">typeof window&&window.location?.origin?window.location.origin:"",s="u"<typeof window?"/":window.PUBLIC_URL||"/",u=s?.startsWith("/")?s:`/${s||""}`,l=e=>e.startsWith("./")?e.slice(2):e.startsWith("/")?e.slice(1):e,c=l(a),d=l(i),f=u.endsWith("/")?u:`${u}/`,h=`${f}${c}`,p=`${f}${d}`,m=o?`${o}${h}`:h;return nE(m,o?`${o}${p}`:p,e),m}(e,t)}catch(r){let t=`[customizationUrl] failed to resolve "${e.raw}": ${r.message}`;return n.warn(t),Promise.resolve(null)}return r(o).catch(t=>(n.warn(`[customizationUrl] failed to import customization "${e.raw}" (${o})`,t),u)).then(l=>{if(l===u)return null;let c=this._normalizeImportedCustomizationModule(l);if(!c||"object"!=typeof c){let t=`[customizationUrl] missing customization module "${e.raw}" (${o}): module is not an object`;return n.warn(t),null}if(!nm(c)){let t=`[customizationUrl] missing customization module "${e.raw}" (${o}): no customizations payload`;return n.warn(t),null}let d=this._collectUrlDependencyRefs(c),f=Promise.resolve();for(let e of d)f=f.then(()=>{let o=this._urlDependencyToRequest(e,t);if(!(!o||i.has(o.normalized)))return this._urlCustomizationLoadOne(o,t,r,n,i,a)});return f.then(()=>{let t={request:e,module:c,url:o};return this._urlCustomizationLoaded.set(s,t),a.push(t),t})})}_applyLoadedUrlCustomizationModules(e){if(e?.length)for(let t of e){let e=nm(t.module);e?.global&&this.setCustomizations(e.global,n_.Global)}}_collectPhaseBlocks(e){let t=[],r=this._getCustomizationConfig().phased;for(let n of(r&&void 0!==r[e]&&t.push(r),this._resolvedUrlModules)){let r=nm(n.module);r&&void 0!==r[e]&&t.push(r)}return t}_applyPhase(e){for(let t of this._collectPhaseBlocks(e)){let r=t[e];r&&this.setCustomizations(r,n_.Global)}}_setCustomization(e,t,r=n_.Mode){switch(r){case n_.Global:this.setGlobalCustomization(e,t);break;case n_.Mode:this.setModeCustomization(e,t);break;case n_.Default:this.setDefaultCustomization(e,t);break;default:throw Error(`Invalid customization scope: ${r}`)}}setModeCustomization(e,t){let r=this.defaultCustomizations.get(e),n=this.modeCustomizations.get(e),i=this.globalCustomizations.get(e),a=n||this._cloneIfNeeded(i)||r,o=this._update(a,t);this.modeCustomizations.set(e,o),this.transformedCustomizations.clear(),this._broadcastEvent(this.EVENTS.MODE_CUSTOMIZATION_MODIFIED,{buttons:this.modeCustomizations,button:this.modeCustomizations.get(e)})}setGlobalCustomization(e,t){let r=this.defaultCustomizations.get(e),n=this.globalCustomizations.get(e),i=this._cloneIfNeeded(n)||r;this.globalCustomizations.set(e,this._update(i,t)),this.transformedCustomizations.clear(),this._broadcastEvent(this.EVENTS.GLOBAL_CUSTOMIZATION_MODIFIED,{buttons:this.globalCustomizations,button:this.globalCustomizations.get(e)})}setDefaultCustomization(e,t){this.transformedCustomizations.clear();let r=this.defaultCustomizations.get(e);this.defaultCustomizations.set(e,this._update(r,t)),this._broadcastEvent(this.EVENTS.DEFAULT_CUSTOMIZATION_MODIFIED,{buttons:this.defaultCustomizations,button:this.defaultCustomizations.get(e)})}_findExtensionValue(e){return this.extensionManager.getModuleEntry(e)}_update(e,t){return(e||(e=void 0),!function e(t){if(Array.isArray(t)){for(let r of t)if(e(r))return!0}else if(t&&"object"==typeof t){if(t.$$typeof)return!1;for(let r of Object.keys(t))if(r.startsWith("$")&&"$transform"!==r&&"$reference"!==r||e(t[r]))return!0}return!1}(t))?t:r0()(e,t)}_cloneIfNeeded(e){return e&&"object"==typeof e?Array.isArray(e)?[...e]:{...e}:e}}nA.EVENTS=nw,nA.REGISTRATION={name:"customizationService",create:({configuration:e,commandsManager:t})=>new nA({configuration:e,commandsManager:t})},(0,rQ.extend)("$filter",(e,t)=>(function e(t,r){if(Array.isArray(t))return"function"==typeof r?t.filter(r):"string"==typeof r?t.filter(e=>e.id!==r):"object"==typeof r&&r.match&&r.$merge?t.map(t=>e(t,r)).map(e=>{var t;return(t=r.match,e&&"object"==typeof e&&Object.entries(t).every(([t,r])=>e[t]===r))?{...e,...r.$merge}:e}):"object"==typeof r&&r.id&&r.$merge?t.map(t=>e(t,r)).map(e=>e.id===r.id?{...e,...r.$merge}:e):t.map(t=>e(t,r));if(t&&"object"==typeof t){let n={...t};for(let[t,i]of Object.entries(n))n[t]=e(i,r);return n}return t})(t,e));let nI=["requires","bootstrap","global","mode"],nC=nA;function nM(){return(nM=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}let nx={PANELS_CHANGED:"event::panelService:panelsChanged",ACTIVATE_PANEL:"event::panelService:activatePanel"},nF=((E={}).Left="left",E.Right="right",E.Bottom="bottom",E);class nP extends L{constructor(e){super(nx),this._extensionManager=void 0,this._panelsGroups=new Map,this._extensionManager=e}get PanelPosition(){return nF}_getPanelComponent(e){let t=this._extensionManager.getModuleEntry(e);if(!t){let t=this._getSimilarPanels(e);if(t.length>0){let r=`Did you mean: ${t.join(", ")}?`;throw Error(`${e} is not a valid entry for an extension module. ${r} Please check your configuration or make sure the extension is registered.`)}throw Error(`${e} is not a valid entry for an extension module, please check your configuration or make sure the extension is registered.`)}if(!t?.component)throw Error(`No component found from extension ${e}. Check the reference string to the extension in your Mode configuration`);let r=t.component;return{entry:t,content:r}}_getSimilarPanels(e,t=.8){return Object.keys(this._extensionManager.modulesMap).filter(e=>e.includes("panelModule")).filter(r=>this._calculateSimilarity(e,r)>=t)}_calculateSimilarity(e,t){let r=new Set(e.toLowerCase().split("")),n=new Set(t.toLowerCase().split("")),i=new Set([...r].filter(e=>n.has(e))),a=new Set([...r,...n]);return i.size/a.size}getPanelData(e){let t,r;if(Array.isArray(e)){let n=e.map(e=>this._getPanelComponent(e));r=n[0].entry,t=e=>rv.createElement(rv.Fragment,null,n.map(({content:t},r)=>rv.createElement(t,nM({key:r},e))))}else({content:t,entry:r}=this._getPanelComponent(e));return{id:r.id,iconName:r.iconName,iconLabel:r.iconLabel,label:r.label,name:r.name,content:t}}addPanel(e,t,r){let n=this._panelsGroups.get(e);n||(n=[],this._panelsGroups.set(e,n));let i=this.getPanelData(t);n.push(i),this._broadcastEvent(nx.PANELS_CHANGED,{position:e,options:r})}addPanels(e,t,r){if(!Array.isArray(t))throw Error('Invalid "panelsIds" array');t.forEach(t=>this.addPanel(e,t,r))}setPanels(e,t){this.reset(),Object.keys(e).forEach(r=>{this.addPanels(r,e[r],t)})}getPanels(e){return[...this._panelsGroups.get(e)??[]]}reset(){let e=Array.from(this._panelsGroups.keys());this._panelsGroups.clear(),e.forEach(e=>this._broadcastEvent(nx.PANELS_CHANGED,{position:e}))}onModeExit(){this.reset()}activatePanel(e,t=!1){this._broadcastEvent(nx.ACTIVATE_PANEL,{panelId:e,forceActive:t})}addActivatePanelTriggers(e,t,r=!1){return t.map(t=>t.sourceEvents.map(n=>t.sourcePubSubService.subscribe(n,()=>this.activatePanel(e,r)))).flat()}}nP.REGISTRATION={name:"panelService",create:({extensionManager:e})=>new nP(e)};let nO=nP,nT={ACTIVE_STEP_CHANGED:"event::workflowStepsService:activateStepChanged",STEPS_CHANGED:"event::workflowStepsService:stepsChanged"};class nk extends L{constructor(e,t,r){super(nT),this._extensionManager=void 0,this._servicesManager=void 0,this._commandsManager=void 0,this._workflowSteps=void 0,this._activeWorkflowStep=void 0,this._workflowSteps=[],this._activeWorkflowStep=null,this._extensionManager=e,this._commandsManager=t,this._servicesManager=r}get workflowSteps(){return[...this._workflowSteps]}get activeWorkflowStep(){return this._activeWorkflowStep}addWorkflowSteps(e){let t=!1;e.forEach(e=>{if(this._workflowSteps.some(t=>t.id===e.id))throw Error(`Duplicated workflow step id (${e.id})`);this._workflowSteps.push(e),t=!0}),t&&this._broadcastEvent(nT.STEPS_CHANGED,{})}_updateToolBar(e){let{toolbarService:t}=this._servicesManager.services,{toolbarButtons:r}=e;(Array.isArray(r)?r:[r]).forEach(({buttonSection:e,buttons:r})=>{t.clearButtonSection(e),t.updateSection(e,r)})}_updatePanels(e){let{panelService:t}=this._servicesManager.services,r=e?.layout?.panels;r&&t.setPanels(r,e?.layout?.options)}_updateHangingProtocol(e){let{hangingProtocol:t}=e;t&&this._commandsManager.runCommand("setHangingProtocol",{protocolId:t.protocolId,stageId:t.stageId,stageIndex:t.stageIndex})}_invokeCallbacks(e){if(!e)return;let t=this._commandsManager;Array.isArray(e)||(e=[e]),e.forEach(e=>{let r=e;if(e?.commandName){let{commandName:n,options:i}=e;r=()=>t.runCommand(n,i)}r()})}setActiveWorkflowStep(e){let t=this._activeWorkflowStep;if(e===t?.id)return;let r=this._workflowSteps.find(t=>t.id===e);if(!r)throw Error(`Invalid workflowStepId (${e})`);this._activeWorkflowStep&&this._invokeCallbacks(t.onExit),this._invokeCallbacks(r.onEnter),this._activeWorkflowStep=r,this._updateToolBar(r),this._updatePanels(r),this._updateHangingProtocol(r),this._broadcastEvent(nT.ACTIVE_STEP_CHANGED,{activeWorkflowStep:r})}reset(){this._activeWorkflowStep=null,this._workflowSteps=[]}onModeEnter(){this.reset()}}nk.REGISTRATION={name:"workflowStepsService",create:({extensionManager:e,commandsManager:t,servicesManager:r})=>new nk(e,t,r)};let nN=nk;var nB=((w=nB||{}).Interaction="interaction",w.Thumbnail="thumbnail",w.Prefetch="prefetch",w.Compute="compute",w);let nU={SERVICE_STARTED:"event::studyPrefetcherService:started",SERVICE_STOPPED:"event::studyPrefetcherService:stopped",DISPLAYSET_LOAD_PROGRESS:"event::studyPrefetcherService:displaySetLoadProgress",DISPLAYSET_LOAD_COMPLETE:"event::studyPrefetcherService:displaySetLoadComplete"};var nL=((_=nL||{}).closest="closest",_.downward="downward",_.upward="upward",_);class nR extends L{constructor({servicesManager:e,extensionManager:t,configuration:r}){super(nU),this._extensionManager=void 0,this._servicesManager=void 0,this._subscriptions=void 0,this._activeDisplaySetsInstanceUIDs=[],this._pendingRequests=[],this._inflightRequests=new Map,this._isRunning=!1,this._displaySetLoadingStates=new Map,this._imageIdsToDisplaySetsMap=new Map,this.config={enabled:!1,displaySetsCount:1,maxNumPrefetchRequests:10,order:nL.downward},this.requestType=nB.Prefetch,this.cache=void 0,this.imageLoadPoolManager=void 0,this.imageLoader=void 0,this.imageLoadEventsManager=void 0,this._servicesManager=e,this._extensionManager=t,this._subscriptions=[],Object.assign(this.config,r)}onModeEnter(){this._addEventListeners()}onModeExit(){this._removeEventListeners(),this._stopPrefetching()}_addImageLoadingEventsListeners(){let e=e=>{this._inflightRequests.get(e)||this._sendNextRequests()},t=t=>{let{image:r}=t.detail,{imageId:n}=r;this._moveImageIdToLoadedSet(n),e(n)},r=t=>{let{imageId:r}=t.detail;this._moveImageIdToFailedSet(r),e(r)};return this.imageLoadEventsManager.addEventListeners(t,r)}_addServicesListeners(){let{displaySetService:e,viewportGridService:t}=this._servicesManager.services;return[e.subscribe(e.EVENTS.DISPLAY_SETS_CHANGED,()=>this._syncWithActiveViewport({forceRestart:!0})),t.subscribe(ek.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED,({viewportId:e})=>this._syncWithActiveViewport({activeViewportId:e})),t.subscribe(ek.EVENTS.LAYOUT_CHANGED,()=>this._syncWithActiveViewport()),t.subscribe(ek.EVENTS.GRID_STATE_CHANGED,()=>this._syncWithActiveViewport()),t.subscribe(ek.EVENTS.VIEWPORTS_READY,()=>{this._syncWithActiveViewport(),this._startPrefetching()})]}_addEventListeners(){let e=this._addImageLoadingEventsListeners(),t=this._addServicesListeners();this._subscriptions.push(...e),this._subscriptions.push(...t)}_removeEventListeners(){this._subscriptions.forEach(e=>e.unsubscribe()),this._subscriptions=[]}_syncWithActiveViewport({activeViewportId:e,forceRestart:t}={}){let{viewportGridService:r}=this._servicesManager.services,n=r.getState(),{viewports:i}=n;if(!(e=e??n.activeViewportId))return;let a=i.get(e);if(!a)return;let o=this._setActiveDisplaySetsUIDs(a.displaySetInstanceUIDs);(t||o)&&this._restartPrefetching()}_setActiveDisplaySetsUIDs(e){return!(e.length===this._activeDisplaySetsInstanceUIDs.length&&e.every(e=>this._activeDisplaySetsInstanceUIDs.includes(e)))&&(this._activeDisplaySetsInstanceUIDs=[...e],this._restartPrefetching(),!0)}_areActiveDisplaySetsLoaded(){let{_activeDisplaySetsInstanceUIDs:e}=this;return e.length&&e.every(e=>this._displaySetLoadingStates.get(e).loadingProgress>=1)}_getClosestDisplaySets(e,t){let r=[],n=t-1,i=t+1;for(;n>=0||i<e.length;)n>=0&&(r.push(e[n]),n--),i<e.length&&(r.push(e[i]),i++);return r}_getDownwardDisplaySets(e,t){let r=[];for(let n=t+1;n<e.length;n++)r.push(e[n]);return r}_getUpwardDisplaySets(e,t){let r=[];for(let n=t-1;n>=0&&n!==t;n--)r.push(e[n]);return r}_getSortedDisplaySetsToPrefetch(e){if(!this._activeDisplaySetsInstanceUIDs?.length)return[];let{displaySetsCount:t}=this.config,r=this._activeDisplaySetsInstanceUIDs,[n]=r,i=e.findIndex(e=>e.displaySetInstanceUID===n),a={[nL.closest]:this._getClosestDisplaySets,[nL.downward]:this._getDownwardDisplaySets,[nL.upward]:this._getUpwardDisplaySets},{order:o}=this.config,s=a[o];if(!s)throw Error(`Invalid order (${o})`);let u=new Set(r);return s.call(this,e,i).filter(e=>!u.has(e.displaySetInstanceUID)).slice(0,t)}_getDisplaySets(){let{displaySetService:e}=this._servicesManager.services,t=[...e.getActiveDisplaySets()],r=this._getSortedDisplaySetsToPrefetch(t);return{displaySets:t,displaySetsToPrefetch:r}}_updateImageIdsDisplaySetMap(e,t){for(let r of t){let t=this._imageIdsToDisplaySetsMap.get(r);t||(t=new Set,this._imageIdsToDisplaySetsMap.set(r,t)),t.add(e)}}_getImageIdsForDisplaySet(e){return this._extensionManager.getActiveDataSource()[0].getImageIdsForDisplaySet(e)}_updateDisplaySetLoadingProgress(e){let{numInstances:t,loadedImageIds:r,failedImageIds:n}=e;e.loadingProgress=(r.size+n.size)/t}_addDisplaySetLoadingState(e){let{displaySetInstanceUID:t}=e,r=this._getImageIdsForDisplaySet(e),n=this._displaySetLoadingStates.get(t);if(n)return;let i=new Set(r),a=new Set;for(let e of r)this.cache.isImageCached(e)?a.add(e):i.add(e);n={displaySetInstanceUID:t,numInstances:r.length,pendingImageIds:i,loadedImageIds:a,failedImageIds:new Set,loadingProgress:0},this._updateDisplaySetLoadingProgress(n),this._displaySetLoadingStates.set(t,n),this._updateImageIdsDisplaySetMap(t,r),a.size&&this._triggerDisplaySetEvents(t)}_loadDisplaySets(){let{displaySets:e,displaySetsToPrefetch:t}=this._getDisplaySets();e.forEach(e=>this._addDisplaySetLoadingState(e)),t.forEach(e=>this._enqueueDisplaySetImagesRequests(e))}_moveImageIdToLoadedSet(e){let t=this._imageIdsToDisplaySetsMap.get(e);if(t){for(let r of Array.from(t.values())){let t=this._displaySetLoadingStates.get(r),{pendingImageIds:n,loadedImageIds:i}=t;n.delete(e),i.add(e),this._updateDisplaySetLoadingProgress(t),this._triggerDisplaySetEvents(r)}return!0}}_moveImageIdToFailedSet(e){let t=this._imageIdsToDisplaySetsMap.get(e);if(t){for(let r of Array.from(t.values())){let t=this._displaySetLoadingStates.get(r),{pendingImageIds:n,failedImageIds:i}=t;n.delete(e),i.add(e),this._updateDisplaySetLoadingProgress(t),this._triggerDisplaySetEvents(r)}return!0}}_triggerDisplaySetEvents(e){let{loadingProgress:t,numInstances:r}=this._displaySetLoadingStates.get(e);this._broadcastEvent(this.EVENTS.DISPLAYSET_LOAD_PROGRESS,{displaySetInstanceUID:e,numInstances:r,loadingProgress:t}),t>=1&&this._broadcastEvent(this.EVENTS.DISPLAYSET_LOAD_COMPLETE,{displaySetInstanceUID:e})}_onImagePrefetchSuccess(e){if(e.aborted)return;let{imageId:t}=e;this._inflightRequests.delete(t),this._moveImageIdToLoadedSet(t),this._sendNextRequests()}_onImagePrefetchFailed(e,t){if(e.aborted)return;console.warn(`An error ocurred when trying to load "${e.imageId}"`,t);let{imageId:r}=e;this._inflightRequests.delete(r),this._moveImageIdToFailedSet(r),this._sendNextRequests()}async _sendNextRequests(){if(!this._isRunning||!this._areActiveDisplaySetsLoaded())return;let{_pendingRequests:e,_inflightRequests:t}=this,{maxNumPrefetchRequests:r}=this.config;if(!e.length||t.size>=r)return;let n=Math.min(e.length,r-t.size);this._pendingRequests.splice(0,n).forEach(e=>{let{imageId:r}=e,n={priority:-5,requestType:this.requestType,additionalDetails:{imageId:r},preScale:{enabled:!0}};this.imageLoadPoolManager.addRequest(async()=>this.imageLoader.loadAndCacheImage(r,n).then(t=>this._onImagePrefetchSuccess(e),t=>this._onImagePrefetchFailed(e,t)),this.requestType,{imageId:r}),t.set(r,e)})}_enqueueDisplaySetImagesRequests(e){let{displaySetInstanceUID:t}=e;this._getImageIdsForDisplaySet(e).forEach(e=>{this.cache.isImageCached(e)?this._moveImageIdToLoadedSet(e):this._pendingRequests.push({displaySetInstanceUID:t,imageId:e,aborted:!1})})}_startPrefetching(){if(!this._isRunning){if(!this.config.enabled)return void console.log("StudyPrefetcher is not enabled");this._isRunning=!0,this._loadDisplaySets(),this._sendNextRequests(),this._broadcastEvent(this.EVENTS.SERVICE_STARTED,{})}}_stopPrefetching(){this._isRunning&&(this._isRunning=!1,this._inflightRequests.forEach(e=>e.aborted=!0),this._pendingRequests=[],this._displaySetLoadingStates.clear(),this._imageIdsToDisplaySetsMap.clear(),this._inflightRequests.clear(),this.imageLoadPoolManager.clearRequestStack(this.requestType),this._broadcastEvent(this.EVENTS.SERVICE_STOPPED,{}))}_restartPrefetching(){this._isRunning&&(this._stopPrefetching(),this._startPrefetching())}}nR.REGISTRATION={name:"studyPrefetcherService",altName:"StudyPrefetcherService",create:({configuration:e,servicesManager:t,extensionManager:r})=>new nR({servicesManager:t,extensionManager:r,configuration:e})};class nj{constructor(e,t){this.numberOfScreens=void 0,this.windowsConfig=void 0,this.screenConfig=void 0,this.launchWindows=[],this.basePath=void 0,this.screenNumber=void 0,this.isMultimonitor=void 0,this.setLaunchWindows=e=>{this.launchWindows=e,window.multimonitor.launchWindows=e};const r=new URLSearchParams(window.location.search),n=r.get("screenNumber"),i=r.get("multimonitor"),a={params:r,screenNumber:n,multimonitor:i};this.screenNumber=n?Number(n):-1,this.commandsManager=t;const o=window;for(const r of(o.multimonitor||={setLaunchWindows:this.setLaunchWindows,launchWindows:this.launchWindows,commandsManager:t},o.multimonitor.commandsManager=t,this.launchWindows=window.multimonitor?.launchWindows||this.launchWindows,-1!==this.screenNumber&&(this.launchWindows[this.screenNumber]=window),o.commandsManager=(...t)=>e.commandsManager,Array.isArray(e)?e:[])){if(r.test(a)){if(this.isMultimonitor=!0,this.numberOfScreens=r.screens.length,this.windowsConfig=r,-1===this.screenNumber||null===this.screenNumber)this.screenConfig=nj.SOURCE_SCREEN;else{if(this.screenConfig=r.screens[this.screenNumber],!this.screenConfig)throw Error(`Screen ${n} not configured in ${this.windowsConfig}`);window.name=this.screenConfig.id}return}this.numberOfScreens=1,this.isMultimonitor=!1}}async run(e=1,t,r){let n=(this.screenNumber+(e??1))%this.numberOfScreens,i=await this.getWindow(n);i?i.multimonitor?.commandsManager?i.multimonitor.commandsManager.runAsync(t,r):console.warn("Didn't find a commands manager to run in the other window",i):console.warn("No multimonitor found for screen",n,t)}async launchWindow(e,t=1,r=""){let n=(this.screenNumber+t)%this.numberOfScreens;return this.getWindow(n,e?`StudyInstanceUIDs=${e}${r}`:"")}async getWindow(e,t){return e===this.screenNumber?window:this.launchWindows[e]&&!this.launchWindows[e].closed?this.launchWindows[e]:await this.createWindow(e,t)}async createWindow(e,t){if(e===this.screenNumber)return window;let r=this.windowsConfig.screens[e],n=await window.getScreenDetails?.(),{width:i=1024,height:a=1024,availLeft:o=0,availTop:s=0}=r.screen>=0&&n.screens[r.screen]||n.currentScreen||window.screen||{},u=this.windowsConfig.screens[e],{width:l=1,height:c=1,top:d=0,left:f=0}=u.location||{},h=Math.round(o+f*i),p=Math.round(s+d*a),m=Math.round(i*l),g=Math.round(a*c),y=`${this.basePath}&screenNumber=${e}`,D=t?`${y}#${t}`:y,v=u.id,b=u.options||"",S=`screenX=${h},screenY=${p},width=${m},height=${g},${b}`,E=window.open("",v,S);return(E?.location.href.startsWith(y)||(E=window.open(D,v,S)),E)?(await new Promise(e=>{"complete"===E.document.readyState?e():E.addEventListener("load",()=>e())}),this.launchWindows[e]=E,E):void console.warn("Unable to launch window",D,"called",v,"at",S)}launchAll(){for(let e=0;e<this.numberOfScreens;e++)this.createWindow(e)}setBasePath(){let e=new URL(window.location.href);e.searchParams.delete("screenNumber"),e.searchParams.delete("protocolId"),e.searchParams.delete("launchAll"),e.searchParams.set("multimonitor",e.searchParams.get("multimonitor")||"split"),e.hash="",this.basePath=e.toString()}onModeEnter(){this.setBasePath(),(this.isMultimonitor&&-1===this.screenNumber||-1!==window.location.href.toLowerCase().indexOf("launchall"))&&this.launchAll()}}nj.SOURCE_SCREEN={id:"source",launch:"source",screen:null,location:{screen:null,width:1,height:1,left:0,top:0}},nj.REGISTRATION={name:"multiMonitorService",create:({configuration:e,commandsManager:t})=>new nj(e,t)};class nV extends L{constructor({commandsManager:e,servicesManager:t,serviceProvidersManager:r,hotkeysManager:n,appConfig:i={}}){super(nV.EVENTS),this._commandsManager=void 0,this._servicesManager=void 0,this._hotkeysManager=void 0,this._serviceProvidersManager=void 0,this.modulesMap=void 0,this.modules=void 0,this.registeredExtensionIds=void 0,this.moduleTypeNames=void 0,this._appConfig=void 0,this._extensionLifeCycleHooks=void 0,this.dataSourceMap=void 0,this.dataSourceDefs=void 0,this._activeDataSourceName=void 0,this.registerExtensions=async(e,t=[])=>{for(let r=0;r<e.length;r++){let n=e[r],i=Array.isArray(n);try{if(i){let e=n[0],r=n[1];await this.registerExtension(e,r,t)}else await this.registerExtension(n,{},t)}catch(e){console.error(e)}}},this.registerExtension=async(e,t={},r=[])=>{if(!e)throw Error("Attempting to register a null/undefined extension.");let n=e.id;if(!n)throw F.warn(e),Error("Extension ID not set");this.registeredExtensionIds.includes(n)?F.warn(`Extension ID ${n} has already been registered. Exiting before duplicating modules.`):(e.preRegistration&&await e.preRegistration({servicesManager:this._servicesManager,serviceProvidersManager:this._serviceProvidersManager,commandsManager:this._commandsManager,hotkeysManager:this._hotkeysManager,extensionManager:this,appConfig:this._appConfig,configuration:t}),e.onModeEnter&&(this._extensionLifeCycleHooks.onModeEnter[n]=e.onModeEnter),e.onModeExit&&(this._extensionLifeCycleHooks.onModeExit[n]=e.onModeExit),this.moduleTypeNames.forEach(i=>{let a=this._getExtensionModule(i,e,n,t);if(a){switch(i){case M.COMMANDS:this._initCommandsModule(a);break;case M.DATA_SOURCE:this._initDataSourcesModule(a,n,r);break;case M.HANGING_PROTOCOL:this._initHangingProtocolsModule(a,n);break;case M.PANEL:this._initPanelModule(a,n);break;case M.TOOLBAR:this._initToolbarModule(a,n);break;case M.VIEWPORT:case M.SOP_CLASS_HANDLER:case M.CONTEXT:case M.LAYOUT_TEMPLATE:case M.CUSTOMIZATION:case M.STATE_SYNC:case M.UTILITY:this.processExtensionModule(a,n,i);break;default:throw Error(`Module type invalid: ${i}`)}this.modules[i].push({extensionId:n,module:a})}}),this.registeredExtensionIds.push(n))},this.getModuleEntry=e=>this.modulesMap[e],this.getModulesByType=e=>this.modules[e],this.getDataSources=e=>(e||(e=this._activeDataSourceName),this.dataSourceMap[e]),this.getDataSourceInstance=e=>this.dataSourceMap[e][0],this.getActiveDataSource=()=>this.dataSourceMap[this._activeDataSourceName],this.getActiveDataSourceOrNull=()=>this.dataSourceMap[this._activeDataSourceName]?.[0]??null,this.getDataSourceDefinition=e=>(void 0===e&&(e=this._activeDataSourceName),this.dataSourceDefs[e]),this.getActiveDataSourceDefinition=()=>this.getDataSourceDefinition(this._activeDataSourceName),this.getDataSourcesForUI=()=>{if(this._appConfig?.allowMultiSelectExport===!1)return[];let e=Object.keys(this.dataSourceMap).filter(e=>{let t=this.dataSourceDefs[e]?.configuration,r=this.dataSourceDefs[e].sourceName!==this._activeDataSourceName;return(t?.supportsStow??t?.wadoRoot)&&r});return[this._activeDataSourceName,...e].map(e=>({value:e,label:e,placeHolder:e}))},this._getExtensionModule=(e,t,r,n)=>{var i;let a="get"+((i=e).charAt(0).toUpperCase()+i.substring(1));if(t[a])try{let e=t[a]({appConfig:this._appConfig,commandsManager:this._commandsManager,servicesManager:this._servicesManager,hotkeysManager:this._hotkeysManager,extensionManager:this,configuration:n});return e||F.warn(`Null or undefined returned when registering the ${a} module for the ${r} extension`),e}catch(e){throw console.error(e),Error(`Exception thrown while trying to call ${a} for the ${r} extension`)}},this._initHangingProtocolsModule=(e,t)=>{let{hangingProtocolService:r}=this._servicesManager.services;e.forEach(({name:e,protocol:t})=>{t&&r.addProtocol(e,t)})},this._initPanelModule=(e,t)=>{this.processExtensionModule(e,t,M.PANEL)},this._initToolbarModule=(e,t)=>{let{toolbarService:r}=this._servicesManager.services;e.forEach(e=>{e.evaluate&&r.registerEvaluateFunction(e.name,e.evaluate)})},this._initCommandsModule=e=>{let{definitions:t,defaultContext:r}=e;t&&0!==Object.keys(t).length?(r=r||"VIEWER",this._commandsManager.getContext(r)||this._commandsManager.createContext(r),Object.keys(t).forEach(e=>{let n=t[e];"function"==typeof n&&(n={commandFn:n}),n.context&&!this._commandsManager.getContext(n.context)&&this._commandsManager.createContext(n.context),this._commandsManager.registerCommand(n.context||r,e,n)})):F.warn("Commands Module contains no command definitions")},this.modules={},this.registeredExtensionIds=[],this.moduleTypeNames=Object.values(M),this._commandsManager=e,this._servicesManager=t,this._serviceProvidersManager=r,this._hotkeysManager=n,this._appConfig=i,this.modulesMap={},this.moduleTypeNames.forEach(e=>{this.modules[e]=[]}),this._extensionLifeCycleHooks={onModeEnter:{},onModeExit:{}},this.dataSourceMap={},this.dataSourceDefs={},this.defaultDataSourceName=i.defaultDataSourceName,this._activeDataSourceName=i.defaultDataSourceName,this.peerImport=i.peerImport}setActiveDataSource(e){this._activeDataSourceName!==e&&(this._activeDataSourceName=e,this._broadcastEvent(nV.EVENTS.ACTIVE_DATA_SOURCE_CHANGED,this.dataSourceDefs[this._activeDataSourceName]))}getRegisteredExtensionIds(){return[...this.registeredExtensionIds]}getUniqueServicesList(e){return Array.from(new Set(Object.values(e.services)))}onModeEnter(){let{registeredExtensionIds:e,_servicesManager:t,_commandsManager:r,_hotkeysManager:n,_extensionLifeCycleHooks:i}=this;for(let e of this.getUniqueServicesList(t))e?.onModeEnter?.();e.forEach(e=>{let a=i.onModeEnter[e];"function"==typeof a&&a({servicesManager:t,commandsManager:r,hotkeysManager:n,extensionManager:this})})}onModeExit(){let{registeredExtensionIds:e,_servicesManager:t,_commandsManager:r,_extensionLifeCycleHooks:n}=this,i=this.getUniqueServicesList(t);for(let a of(e.forEach(e=>{let i=n.onModeExit[e];"function"==typeof i&&i({servicesManager:t,commandsManager:r})}),i))try{a?.onModeExit?.()}catch(e){console.warn("onModeExit caught",e)}}processExtensionModule(e,t,r){e.forEach(e=>{if(!e.name)throw Error(`Extension ID ${t} module ${r} element has no name`);let n=`${t}.${r}.${e.name}`;e.id=n,this.modulesMap[n]=e})}addDataSource(e,t={activate:!1}){let r=this.getDataSources(e.sourceName);!r?.[0]&&(this._createDataSourceInstance(e),t.activate&&this.setActiveDataSource(e.sourceName))}updateDataSourceConfiguration(e,t){let r=this.getDataSources(e);if(!r?.[0])return;let n=this.dataSourceDefs[e];n.configuration=t,this._createDataSourceInstance(n),this._activeDataSourceName===e&&this._broadcastEvent(nV.EVENTS.ACTIVE_DATA_SOURCE_CHANGED,n)}_createDataSourceInstance(e){let t=this.getModuleEntry(e.namespace);if(!t)return;this.dataSourceDefs[e.sourceName]=e;let r=t.createDataSource(e.configuration,this._servicesManager,this);this.dataSourceMap[e.sourceName]=[r]}_initDataSourcesModule(e,t,r=[]){e.forEach(e=>{this.modulesMap[`${t}.${M.DATA_SOURCE}.${e.name}`]=e}),e.forEach(e=>{let n=`${t}.${M.DATA_SOURCE}.${e.name}`;r.forEach(e=>{e.namespace===n&&this.addDataSource(e)})})}registerCommandsModule(e,t="VIEWER"){this._initCommandsModule({...e,defaultContext:e.defaultContext||t})}get appConfig(){return this._appConfig}get activeDataSourceName(){return this._activeDataSourceName}}nV.EVENTS={ACTIVE_DATA_SOURCE_CHANGED:"event::activedatasourcechanged"},nV.MODULE_TYPES=M;let nY=class e{constructor(e={}){this.contexts={},this.contextOrder=[],this.getCommand=(e,t=this.contextOrder)=>{let r=[];if(Array.isArray(t))r.push(...t.map(e=>this.getContext(e)).filter(e=>!!e));else if(t){let e=this.getContext(t);e&&r.push(e)}return r.find(t=>!!t[e])?.[e]}}createContext(e,t){if(e){if(this.contexts[e])return this.clearContext(e);this.contexts[e]={},this.contextOrder.splice(0,0,e)}}getContext(e){let t=this.contexts[e];if(t)return t}clearContext(e){e&&(this.contexts[e]={})}registerCommand(e,t,r){if("object"!=typeof r&&"function"!=typeof r)return;let n=e=>"__proto__"!==e&&"constructor"!==e&&"prototype"!==e;if(!n(e)||!n(t))throw Error("Invalid key name to prevent prototype pollution");let i=this.getContext(e);i&&("function"==typeof r?i[t]={commandFn:r,options:{}}:i[t]=r)}runCommand(e,t={},r){if("function"==typeof e)return e(t);let n=this.getCommand(e,r);if(!n)return void F.warn(`Command "${e}" not found in current context`);let{commandFn:i}=n,a=Object.assign({},n.options||{},t);return"function"!=typeof i?void F.warn(`No commandFn was defined for command "${e}"`):i(a)}static convertCommands(t){if("string"==typeof t)return[{commandName:t}];if("commandName"in t)return[t];if("function"==typeof t)return[{commandName:t}];if("commands"in t){let e=t.commands;return this.convertCommands(e)}return Array.isArray(t)?t.map(t=>e.convertCommands(t)[0]):[]}validate(t,r={}){if(!t)return console.debug("No command to run"),[];let n=e.convertCommands(t);return n.length?n.map(e=>({commandName:e.commandName,commandOptions:{...r,...e.commandOptions},context:e.context})):(console.debug("Command is not runnable",t),[])}run(e,t={}){let r=this.validate(e,t),n=[];for(let e=0;e<r.length;e++){let{commandName:t,commandOptions:i,context:a}=r[e];n.push(this.runCommand(t,i,a))}return 1===n.length?n[0]:n}async runAsync(e,t={}){let r=this.validate(e,t),n=[];for(let e=0;e<r.length;e++){let{commandName:t,commandOptions:i,context:a}=r[e];n.push(await this.runCommand(t,i,a))}return 1===n.length?n[0]:n}};var n$=o(862),nz=o.n(n$);let nW={hotkeyBindings:[{commandName:"setToolActive",commandOptions:{toolName:"Zoom"},label:"Zoom",keys:["z"],isEditable:!0},{commandName:"scaleUpViewport",label:"Zoom In",keys:["+"],isEditable:!0},{commandName:"scaleDownViewport",label:"Zoom Out",keys:["-"],isEditable:!0},{commandName:"fitViewportToWindow",label:"Zoom to Fit",keys:["="],isEditable:!0},{commandName:"rotateViewportCW",label:"Rotate Right",keys:["r"],isEditable:!0},{commandName:"rotateViewportCCW",label:"Rotate Left",keys:["l"],isEditable:!0},{commandName:"flipViewportHorizontal",label:"Flip Horizontally",keys:["h"],isEditable:!0},{commandName:"flipViewportVertical",label:"Flip Vertically",keys:["v"],isEditable:!0},{commandName:"toggleCine",label:"Cine",keys:["c"]},{commandName:"invertViewport",label:"Invert",keys:["i"],isEditable:!0},{commandName:"incrementActiveViewport",label:"Next Image Viewport",keys:["right"],isEditable:!0},{commandName:"decrementActiveViewport",label:"Previous Image Viewport",keys:["left"],isEditable:!0},{commandName:"updateViewportDisplaySet",commandOptions:{direction:-1},label:"Previous Series",keys:["pageup"],isEditable:!0},{commandName:"updateViewportDisplaySet",commandOptions:{direction:1},label:"Next Series",keys:["pagedown"],isEditable:!0},{commandName:"nextStage",context:"DEFAULT",label:"Next Stage",keys:["."],isEditable:!0},{commandName:"previousStage",context:"DEFAULT",label:"Previous Stage",keys:[","],isEditable:!0},{commandName:"nextImage",label:"Next Image",keys:["down"],isEditable:!0},{commandName:"previousImage",label:"Previous Image",keys:["up"],isEditable:!0},{commandName:"firstImage",label:"First Image",keys:["home"],isEditable:!0},{commandName:"lastImage",label:"Last Image",keys:["end"],isEditable:!0},{commandName:"resetViewport",label:"Reset",keys:["space"],isEditable:!0},{commandName:"cancelActiveOperation",label:"Cancel",keys:["esc"]},{commandName:"setWindowLevelPreset",commandOptions:{presetName:"ct-soft-tissue",presetIndex:0},label:"W/L Preset 1",keys:["1"]},{commandName:"setWindowLevelPreset",commandOptions:{presetName:"ct-lung",presetIndex:1},label:"W/L Preset 2",keys:["2"]},{commandName:"setWindowLevelPreset",commandOptions:{presetName:"ct-bone",presetIndex:2},label:"W/L Preset 3",keys:["3"]},{commandName:"setWindowLevelPreset",commandOptions:{presetName:"ct-brain",presetIndex:3},label:"W/L Preset 4",keys:["4"]},{commandName:"deleteActiveAnnotation",label:"Delete Annotation",keys:["backspace"]},{commandName:"acceptPreview",label:"Accept Preview",keys:["enter"]},{commandName:"undo",label:"Undo",keys:["ctrl+z"],isEditable:!0},{commandName:"redo",label:"Redo",keys:["ctrl+y"],isEditable:!0},{commandName:"interpolateScrollForMarkerLabelmap",label:"Interpolate Scroll",keys:["n"],isEditable:!0},{commandName:"increaseBrushSize",label:"Increase Brush Size",keys:["]"],isEditable:!0},{commandName:"decreaseBrushSize",label:"Decrease Brush Size",keys:["["],isEditable:!0},{commandName:"setToolActive",commandOptions:{toolName:"CircularEraser"},label:"Eraser",keys:["e"],isEditable:!0},{commandName:"setToolActive",commandOptions:{toolName:"CircularBrush"},label:"Brush",keys:["b"],isEditable:!0},{commandName:"addNewSegment",label:"Add New Segment",keys:["a"],isEditable:!0}],windowLevelPresets:{1:{description:"Soft tissue",window:"400",level:"40"},2:{description:"Lung",window:"1500",level:"-600"},3:{description:"Liver",window:"150",level:"90"},4:{description:"Bone",window:"2500",level:"480"},5:{description:"Brain",window:"80",level:"40"},6:{description:"Trest",window:"1",level:"1"},7:{description:"Empty1",window:"Empty1",level:"Empty1"},8:{description:"Empty2",window:"Empty2",level:"Empty2"},9:{description:"Empty3",window:"Empty3",level:"Empty3"},10:{description:"Empty4",window:"Empty4",level:"Empty4"}}},nH=nW.hotkeyBindings,nG=function({generateHash:e}){try{let t=localStorage.getItem("hotkey-definitions"),r=localStorage.getItem("hotkeys-migrated");if(!t||"true"===r)return;let n=JSON.parse(t);if(!Array.isArray(n)||0===n.length)return;let i=nH||[],a=JSON.parse(localStorage.getItem("user-preferred-keys")||"{}");n.forEach(t=>{if(!t.commandName||!t.keys)return;let r=i.find(e=>{let r=e.commandName===t.commandName,n=t.commandOptions||{},i=e.commandOptions||{},a=JSON.stringify(n)===JSON.stringify(i);return r&&a});r&&JSON.stringify(r.keys)===JSON.stringify(t.keys)||(a[e({commandName:t.commandName,commandOptions:t.commandOptions||{}})]=t.keys,console.debug(`HotkeysManager: Migrated custom hotkey for ${t.commandName}`))}),localStorage.setItem("user-preferred-keys",JSON.stringify(a)),localStorage.setItem("hotkeys-migrated","true"),localStorage.removeItem("hotkey-definitions"),console.debug("HotkeysManager: Successfully migrated hotkey definitions to new format")}catch(e){console.error("HotkeysManager: Error migrating hotkey definitions",e),localStorage.setItem("hotkeys-migrated","false")}};class nq{constructor(e,t){this._servicesManager=void 0,this._commandsManager=void 0,this.isEnabled=!0,this.hotkeyDefinitions={},this.hotkeyDefaults=[],this.EVENTS=void 0,this.listeners={},this.subscribe=void 0,this._broadcastEvent=void 0,this._unsubscribe=void 0,this._isValidEvent=void 0,this._servicesManager=t,this._commandsManager=e,this.EVENTS=nq.EVENTS,this.subscribe=T.subscribe.bind(this),this._broadcastEvent=T._broadcastEvent.bind(this),this._unsubscribe=T._unsubscribe.bind(this),this._isValidEvent=T._isValidEvent.bind(this),nG({generateHash:this.generateHash})}record(e){return e0.record(e)}cancel(){e0.stopRecord(),e0.unpause()}disable(){this.isEnabled=!1,e0.pause()}enable(){this.isEnabled=!0,e0.unpause()}restoreDefaultBindings(){this.setHotkeys(this.hotkeyDefaults)}destroy(){this.hotkeyDefaults=[],this.hotkeyDefinitions={},e0.reset()}setHotkeys(e=[]){try{this.getValidDefinitions(e).forEach(e=>this.registerHotkeys(e))}catch(t){let{uiNotificationService:e}=this._servicesManager.services;e.show({title:"Hotkeys Manager",message:"Error while setting hotkeys",type:"error"})}}generateHash(e){return nz()({commandName:e.commandName,commandOptions:e.commandOptions||{}})}setDefaultHotKeys(e=[]){let t=this.getValidDefinitions(e);this.hotkeyDefaults=t;let r=JSON.parse(localStorage.getItem("user-preferred-keys")||"{}"),n=t.map(e=>{let t=this.generateHash(e);return r[t]?{...e,keys:r[t]}:e});this.setHotkeys(n)}getValidDefinitions(e){let t=Array.isArray(e)?[...e]:this._parseToArrayLike(e);return t.forEach(e=>{void 0===e.isEditable&&(e.isEditable=!0)}),t}getValidHotkeyDefinitions(e){let t=this.getValidDefinitions(e),r={};return t.forEach(e=>{let{commandName:t,commandOptions:n}=e;r[nz()({commandName:t,commandOptions:n})]=e}),r}_parseToArrayLike(e={}){return Object.entries({...e}).map(e=>this._parseToHotKeyObj(e[0],e[1]))}_parseToHotKeyObj(e,t){return{commandName:e,...t}}registerHotkeys({commandName:e,commandOptions:t={},context:r,keys:n,label:i,isEditable:a}){if(!e)throw Error(`No command was defined for hotkey "${n}"`);let o=this.generateHash({commandName:e,commandOptions:t}),s=this.hotkeyDefinitions[o];if(s&&s.keys===n)return void console.debug("HotkeysManager: Identical hotkey registration skipped.");let u=JSON.parse(localStorage.getItem("user-preferred-keys")||"{}");s&&(u[o]=n,localStorage.setItem("user-preferred-keys",JSON.stringify(u)),this._unbindHotkeys(e,s.keys)),this.hotkeyDefinitions[o]={commandName:e,commandOptions:t,keys:n,label:i,isEditable:a},this._bindHotkeys(e,t,r,n)}_bindHotkeys(e,t={},r,n){if(""===n||void 0===n)return;let i=n instanceof Array?n.join("+"):n;e0.bind(i,n=>{n.preventDefault(),n.stopPropagation(),this._commandsManager.runCommand(e,{evt:n,...t},r),this._broadcastEvent(nq.EVENTS.HOTKEY_PRESSED,{commandName:e,commandOptions:t,keys:i,context:r,evt:n})})}_unbindHotkeys(e,t){if(""!==t&&void 0!==t){if(t instanceof Array){let r=t.join("+");this._unbindHotkeys(e,r);return}e0.unbind(t)}}}nq.EVENTS={HOTKEY_PRESSED:"event::hotkeysManager:hotkeyPressed"};let nX=nq,nK=class{constructor(e){if(this.images=void 0,this.uid=void 0,this.instances=void 0,this.instance=void 0,this.StudyInstanceUID=void 0,this.load=void 0,this.getNumImages=()=>this.images.length,!Array.isArray(e))throw Error("ImageSet expects an array of images");Object.defineProperty(this,"images",{enumerable:!1,configurable:!1,writable:!1,value:e}),Object.defineProperty(this,"uid",{enumerable:!1,configurable:!1,writable:!1,value:P()}),this.instances=e,this.instance=e[0],this.StudyInstanceUID=this.instance?.StudyInstanceUID}getUID(){return this.uid}setAttribute(e,t){this[e]=t}getAttribute(e){return this[e]}setAttributes(e){if("object"==typeof e&&null!==e)for(let[t,r]of Object.entries(e))this[t]=r}getImage(e){return this.images[e]}sort(e){let t=e.getCustomization("instanceSortingCriteria"),r=Object.assign({},rp,t.sortFunctions),n=t.defaultSortFunctionName;return"function"==typeof r[n]?this.images.sort(r[n]):this.isReconstructable&&function(e){if(e.length<=1)return!1;let t=e[0].ImagePositionPatient,r=e[0].ImageOrientationPatient;return!!t&&!!r&&!!ra(e)}(this.images)?(e=>{let t=e[0].ImagePositionPatient,r=ri(e[0].ImageOrientationPatient),n=e.map(e=>{let n=e.ImagePositionPatient,i=t3.vec3.create();return{distance:t3.vec3.dot(r,t3.vec3.subtract(i,n,t)),image:e}});for(let[t,r]of(n.sort((e,t)=>t.distance-e.distance),n.entries()))e[t]=r.image;return e})(this.images):this.images.sort(rp.sortByInstanceNumber)}sortBy(e){return this.images.sort(e)}};var nJ=o(313),nZ=o.n(nJ),nQ=o(557),n0=o(223);function n1(e,t,r){let{PaletteColorLookupTableUID:n}=e;if(void 0!==e[t]||void 0!==n)return function(e,t){let r=t[0]||65536,n=t[2];if(!e)return;let i=e=>{let t=e.buffer||e,i=t.byteLength===2*r||n>8?new Uint16Array(t):new Uint8Array(t),a=[];for(let e=0;e<r;e++)a[e]=i[e];return a};if(e.palette)return e.palette;if(e.InlineBinary)try{let t=Uint8Array.from(atob(e.InlineBinary),e=>e.charCodeAt(0));return e.palette=i(t)}catch(t){console.log("Couldn't decode",e.InlineBinary,t);return}let a=Array.isArray(e)?e[0]:e;return a instanceof ArrayBuffer?e.palette=i(a):e.retrieveBulkData?e.retrieveBulkData().then(t=>e.palette=i(t)):void console.error(`No data found for ${e} palette`)}(e[t],e[r])}function n2(e,t,r){if(e[r])return e[r];let n=Object.create(e);return Object.defineProperty(e,r,{value:n,writable:!1,enumerable:!1}),t&&[...t?Object.values(t).filter(Boolean).map(e=>e[0]).filter(e=>"object"==typeof e):[]].forEach(e=>{e.SOPInstanceUID||Object.entries(e).forEach(([e,t])=>{n[e]=t})}),n}let{calibratedPixelSpacingMetadataProvider:n8,getPixelSpacingInformation:n3}=nQ.utilities,{getUriModule:n4}=n0.utilities,n6=new class{constructor(){this.imageURIToUIDs=new Map,this.customMetadata=new Map}addImageIdToUIDs(e,t){if(!e)throw Error("MetadataProvider::Empty imageId");let r=re(e);this.imageURIToUIDs.set(r,t)}addCustomMetadata(e,t,r){let n=re(e);this.customMetadata.has(t)||this.customMetadata.set(t,{}),this.customMetadata.get(t)[n]=r}_getInstance(e){if(!e)throw Error("MetadataProvider::Empty imageId");let t=this.getUIDsFromImageID(e);if(!t)return;let{StudyInstanceUID:r,SeriesInstanceUID:n,SOPInstanceUID:i,frameNumber:a}=t,o=eb.getInstance(r,n,i);if(!o)return;let s=a&&((e,t)=>{let{PerFrameFunctionalGroupsSequence:r,SharedFunctionalGroupsSequence:n,NumberOfFrames:i,ImageType:a}=t;if(i<2)return t;t.ImageType=Array.isArray(a)&&a||"string"==typeof a&&a.split("\\")||a;let o=Number.parseInt(e||1),s=t.DetectorInformationSequence&&(!t.ImagePositionPatient||!t.ImageOrientationPatient);if(r&&n||s||i>1){!t.ImageOrientationPatient&&t.DetectorInformationSequence&&(t.ImageOrientationPatient=t.DetectorInformationSequence[0].ImageOrientationPatient);let e=t.ImagePositionPatient;if(!t.ImagePositionPatient&&t.DetectorInformationSequence){let r=t.DetectorInformationSequence[0].ImagePositionPatient,n=t.ImageOrientationPatient;r=r?.map(e=>Number(e)),n=n?.map(e=>Number(e));let i=Number(t.SpacingBetweenSlices);if(n&&i){let t=t3.vec3.fromValues(n[0],n[1],n[2]),a=t3.vec3.fromValues(n[3],n[4],n[5]),s=t3.vec3.cross(t3.vec3.create(),t,a),u=t3.vec3.scaleAndAdd(t3.vec3.create(),r,s,i*(o-1));e=[u[0],u[1],u[2]]}}t._parentInstance||Object.defineProperty(t,"_parentInstance",{value:{...t},enumerable:!1,writable:!1,configurable:!1});let i=n2(t._parentInstance,n?.[0],"_shared"),a=n2(i,r?.[o-1],o);return a.ImagePositionPatient=e??a.ImagePositionPatient??[0,0,o],Object.defineProperty(a,"frameNumber",{value:o,writable:!0,enumerable:!1,configurable:!0}),a}if(t.GridFrameOffsetVector){t._parentInstance||Object.defineProperty(t,"_parentInstance",{value:{...t},enumerable:!1,writable:!1,configurable:!1});let e=n2(t._parentInstance,n?.[0],"_shared"),i=n2(e,r?.[o-1],o),a=i.ImagePositionPatient?.map(Number),s=i.ImageOrientationPatient?.map(Number),u=Number(t.GridFrameOffsetVector[o-1]);if(a&&s&&!Number.isNaN(u)){let e=t3.vec3.fromValues(s[0],s[1],s[2]),t=t3.vec3.fromValues(s[3],s[4],s[5]),r=t3.vec3.cross(t3.vec3.create(),e,t),n=t3.vec3.scaleAndAdd(t3.vec3.create(),t3.vec3.fromValues(...a),r,u);i.ImagePositionPatient=[n[0],n[1],n[2]]}return Object.defineProperty(i,"frameNumber",{value:o,writable:!0,enumerable:!1,configurable:!0}),i}return t})(a,o)||o;return s&&Object.defineProperty(s,"imageId",{value:e,writable:!0,enumerable:!1,configurable:!0}),s}get(e,t,r={fallback:!1}){if(Array.isArray(t))return;let n=this._getInstance(t);if(e===n9)return n;if(this.customMetadata.has(e)){let r=this.customMetadata.get(e),n=re(t);if(r[n])return r[n]}return this.getTagFromInstance(e,n,r)}getTag(e,t,r){return this.get(e,t,r)}getInstance(e){return this.get(n9,e)}getTagFromInstance(e,t,r={fallback:!1}){if(t)return t[e]?t[e]:this._getCornerstoneDICOMImageLoaderTag(e,t)}addHandler(e,t){n7[e]=t}_getCornerstoneDICOMImageLoaderTag(e,t){let r=n7[e]?.(t);if(r)return r;switch(e){case n5.GENERAL_SERIES_MODULE:r={modality:t.Modality,seriesInstanceUID:t.SeriesInstanceUID,seriesNumber:t8(t.SeriesNumber),studyInstanceUID:t.StudyInstanceUID,seriesDescription:t.SeriesDescription,seriesDate:t.SeriesDate,seriesTime:t.SeriesTime};break;case n5.PATIENT_STUDY_MODULE:r={patientAge:t.PatientAge,patientSize:t.PatientSize,patientWeight:t.PatientWeight};break;case n5.PATIENT_DEMOGRAPHIC_MODULE:r={patientSex:t.PatientSex};break;case n5.IMAGE_PIXEL_MODULE:r={samplesPerPixel:t8(t.SamplesPerPixel),photometricInterpretation:t.PhotometricInterpretation,rows:t8(t.Rows),columns:t8(t.Columns),bitsAllocated:t8(t.BitsAllocated),bitsStored:t8(t.BitsStored),highBit:t8(t.HighBit),pixelRepresentation:t8(t.PixelRepresentation),planarConfiguration:t8(t.PlanarConfiguration),pixelAspectRatio:t8(t.PixelAspectRatio),smallestPixelValue:t8(t.SmallestPixelValue),largestPixelValue:t8(t.LargestPixelValue),redPaletteColorLookupTableDescriptor:t8(t.RedPaletteColorLookupTableDescriptor),greenPaletteColorLookupTableDescriptor:t8(t.GreenPaletteColorLookupTableDescriptor),bluePaletteColorLookupTableDescriptor:t8(t.BluePaletteColorLookupTableDescriptor),redPaletteColorLookupTableData:n1(t,"RedPaletteColorLookupTableData","RedPaletteColorLookupTableDescriptor"),greenPaletteColorLookupTableData:n1(t,"GreenPaletteColorLookupTableData","GreenPaletteColorLookupTableDescriptor"),bluePaletteColorLookupTableData:n1(t,"BluePaletteColorLookupTableData","BluePaletteColorLookupTableDescriptor")};break;case n5.VOI_LUT_MODULE:let{WindowCenter:n,WindowWidth:i,VOILUTFunction:a}=t;if(null==n||null==i)return;let o=Array.isArray(n)?n:[n],s=Array.isArray(i)?i:[i];r={windowCenter:t8(o),windowWidth:t8(s),voiLUTFunction:a};break;case n5.MODALITY_LUT_MODULE:let{RescaleIntercept:u,RescaleSlope:l}=t;if(null==u||null==l)return;r={rescaleIntercept:t8(t.RescaleIntercept),rescaleSlope:t8(t.RescaleSlope),rescaleType:t.RescaleType};break;case n5.SOP_COMMON_MODULE:r={sopClassUID:t.SOPClassUID,sopInstanceUID:t.SOPInstanceUID};break;case n5.PET_IMAGE_MODULE:r={frameReferenceTime:t.FrameReferenceTime,actualFrameDuration:t.ActualFrameDuration};break;case n5.PET_ISOTOPE_MODULE:let{RadiopharmaceuticalInformationSequence:c}=t;if(c){let{RadiopharmaceuticalStartTime:e,RadionuclideTotalDose:t,RadionuclideHalfLife:n}=Array.isArray(c)?c[0]:c;r={radiopharmaceuticalInfo:{radiopharmaceuticalStartTime:nZ().parseTM(e),radionuclideTotalDose:t,radionuclideHalfLife:n}}}break;case n5.OVERLAY_PLANE_MODULE:let d=[];for(let e=0;e<=30;e+=2){let r=`60${e.toString(16)}`;3===r.length&&(r=`600${e.toString(16)}`);let n=t[`${r}3000`];if(!n)continue;let i=`${r}0010`,a=`${r}0011`,o=`${r}0040`,s=`${r}0050`,u=`${r}0022`,l=`${r}1500`,c=`${r}1301`,f=`${r}1302`,h=`${r}1303`,p=t[s],m=0;m=t[i]instanceof Array?new Uint16Array(t[i][0])[0]:t[i];let g=0;g=t[a]instanceof Array?new Uint16Array(t[a][0])[0]:t[a];let y=0,D=0;if(1===p.length){let e=new Int16Array(p[0]);y=e[0],D=e[1]}else y=p[0],D=p[1];let v={rows:m,columns:g,type:t[o],x:y,y:D,pixelData:n,description:t[u],label:t[l],roiArea:t[c],roiMean:t[f],roiStandardDeviation:t[h]};d.push(v)}r={overlays:d};break;case n5.PATIENT_MODULE:r={patientName:t.PatientName,patientId:t.PatientID,patientSex:t.PatientSex,patientBirthDate:t.PatientBirthDate,issuerOfPatientId:t.IssuerOfPatientID,otherPatientIDsSequence:t.OtherPatientIDsSequence};break;case n5.GENERAL_IMAGE_MODULE:r={sopInstanceUID:t.SOPInstanceUID,instanceNumber:t8(t.InstanceNumber),lossyImageCompression:t.LossyImageCompression,lossyImageCompressionRatio:t.LossyImageCompressionRatio,lossyImageCompressionMethod:t.LossyImageCompressionMethod};break;case n5.GENERAL_STUDY_MODULE:r={studyDescription:t.StudyDescription,studyInstanceUID:t.StudyInstanceUID,studyDate:t.StudyDate,studyTime:t.StudyTime,accessionNumber:t.AccessionNumber,studyId:t.StudyID};break;case n5.CINE_MODULE:r={frameTime:t.FrameTime,numberOfFrames:t.NumberOfFrames?Number(t.NumberOfFrames):1};break;case n5.PET_SERIES_MODULE:r={correctedImage:t.CorrectedImage,units:t.Units,decayCorrection:t.DecayCorrection};break;case n5.CALIBRATION_MODULE:r={sequenceOfUltrasoundRegions:t.SequenceOfUltrasoundRegions?.map(e=>({regionSpatialFormat:e.RegionSpatialFormat,regionDataType:e.RegionDataType,regionFlags:e.RegionFlags,regionLocationMinX0:e.RegionLocationMinX0,regionLocationMinY0:e.RegionLocationMinY0,regionLocationMaxX1:e.RegionLocationMaxX1,regionLocationMaxY1:e.RegionLocationMaxY1,referencePixelX0:e.ReferencePixelX0,referencePixelY0:e.ReferencePixelY0,referencePixelPhysicalValueX:e.ReferencePixelPhysicalValueX,referencePixelPhysicalValueY:e.ReferencePixelPhysicalValueY,physicalUnitsXDirection:e.PhysicalUnitsXDirection,physicalUnitsYDirection:e.PhysicalUnitsYDirection,physicalDeltaX:e.PhysicalDeltaX,physicalDeltaY:e.PhysicalDeltaY}))};break;case"temporalPositionIdentifier":r={temporalPositionIdentifier:t.TemporalPositionIdentifier};break;default:return}return r}getUIDsFromImageID(e){if(e.startsWith("wadors:")){let t=e.split("/studies/")[1].split("/");return{StudyInstanceUID:t[0],SeriesInstanceUID:t[2],SOPInstanceUID:t[4],frameNumber:t[6]}}if(e.includes("?requestType=WADO")){let t=eX.parse(e),r=t.frameNumber||t.frame;return{StudyInstanceUID:t.studyUID,SeriesInstanceUID:t.seriesUID,SOPInstanceUID:t.objectUID,frameNumber:r}}let t=re(e),r=this.imageURIToUIDs.get(t);if(!r)return;let n=n4(e)?.framesString||r.frameNumber||"1";return{...r,frameNumber:n}}};eb.setMetaDataProvider(n6);let n5={GENERAL_SERIES_MODULE:"generalSeriesModule",PATIENT_STUDY_MODULE:"patientStudyModule",IMAGE_PIXEL_MODULE:"imagePixelModule",VOI_LUT_MODULE:"voiLutModule",MODALITY_LUT_MODULE:"modalityLutModule",SOP_COMMON_MODULE:"sopCommonModule",PET_IMAGE_MODULE:"petImageModule",PET_ISOTOPE_MODULE:"petIsotopeModule",PET_SERIES_MODULE:"petSeriesModule",OVERLAY_PLANE_MODULE:"overlayPlaneModule",PATIENT_DEMOGRAPHIC_MODULE:"patientDemographicModule",PATIENT_MODULE:"patientModule",GENERAL_IMAGE_MODULE:"generalImageModule",GENERAL_STUDY_MODULE:"generalStudyModule",CINE_MODULE:"cineModule",CALIBRATION_MODULE:"calibrationModule"},n7={frameModule:e=>{let{frameNumber:t=1,numberOfFrames:r=1,SOPClassUID:n,SOPInstanceUID:i,SeriesInstanceUID:a,StudyInstanceUID:o}=e;return{frameNumber:t,numberOfFrames:r,sopClassUID:n,sopInstanceUID:i,seriesInstanceUID:a,studyInstanceUID:o}},imagePlaneModule:e=>{let t,r,n,i,a,{ImageOrientationPatient:o,ImagePositionPatient:s}=e,{PixelSpacing:u,type:l}=n3(e)||{},c=!1,d=!1,f=!1;u?([t,r]=u,nQ.utilities.calibratedPixelSpacingMetadataProvider.get("calibratedPixelSpacing",e.imageId)||n8.add(e.imageId,{rowPixelSpacing:parseFloat(u[0]),columnPixelSpacing:parseFloat(u[1]),type:l})):(t=r=1,c=!0),o?(n=t8(o.slice(0,3)),i=t8(o.slice(3,6)),a=t8(o)):(n=[1,0,0],i=[0,1,0],a=[1,0,0,0,1,0],c=!0,d=!0,f=!0);let h=t8(s)||[0,0,0];return s||(c=!0),{frameOfReferenceUID:e.FrameOfReferenceUID,rows:t8(e.Rows),columns:t8(e.Columns),spacingBetweenSlices:t8(e.SpacingBetweenSlices),imageOrientationPatient:a,rowCosines:n,isDefaultValueSetForRowCosine:d,columnCosines:i,isDefaultValueSetForColumnCosine:f,imagePositionPatient:h,sliceThickness:t8(e.SliceThickness),sliceLocation:t8(e.SliceLocation),pixelSpacing:t8(u||1),rowPixelSpacing:t?t8(t):null,columnPixelSpacing:r?t8(r):null,usingDefaultValues:c}}},n9="instance",ie={MetadataProvider:n6,CommandsManager:nY,HotkeysManager:nX,ImageSet:nK},it=(0,rv.createContext)(void 0),ir=({children:e})=>{let t=(0,rv.useRef)(new Map),r={registerViewport:(e,r)=>{t.current.set(e,r)},unregisterViewport:e=>{t.current.delete(e)},getViewportElement:e=>t.current.get(e)||null,viewportRefs:t.current};return rv.createElement(it.Provider,{value:r},e)},ii=()=>{let e=(0,rv.useContext)(it);if(void 0===e)throw Error("useViewportRefs must be used within a ViewportRefsProvider");return e},ia=e=>{let{registerViewport:t,unregisterViewport:r,getViewportElement:n}=ii();return{current:n(e),register:r=>t(e,r),unregister:()=>r(e)}};o(642);let io={getAttribute:function(e,t){return e&&e.Value&&e.Value.length?function(e){let t="";for(let r=0;r<e.length;r++)for(let n=0;n<e[r].length;n++)t+=function(e){let t=e.length;return 0===t?"0000":1===t?"000"+e:2===t?"00"+e:3===t?"0"+e:e}(e[r].charCodeAt(n).toString(16));return parseInt(t,16)}(e.Value):t},getAuthorizationHeader:function({requestOptions:e}={},t={}){let r={},n=t&&t.getAccessToken&&t.getAccessToken();return e?.auth?"function"==typeof e.auth?r.Authorization=e.auth(e):r.Authorization=`Basic ${btoa(e.auth)}`:n&&(r.Authorization=`Bearer ${n}`),r},getModalities:function(e,t){if(!e&&!t)return{};let r=e||{vr:"CS",Value:[]};if(r.Value=r.Value||[],t)if(!r.vr||r.vr!==t.vr)return t;else for(let e=0;e<t.Value.length;e++){let n=t.Value[e];-1===r.Value.indexOf(n)&&r.Value.push(n)}return r},getName:function(e,t){return e&&e.Value&&e.Value.length?e.Value[0].Alphabetic?e.Value[0].Alphabetic:e.Value[0]:t},getNumber:function(e,t){return e&&e.Value&&e.Value.length?parseFloat(e.Value[0]):t},getString:function(e,t){return e&&e.Value&&e.Value.length?e.Value.join("\\"):t}},is={getHTTPErrorHandler:()=>null},iu={getNestedObject:function(e){let t={};for(let r in e){if(!e.hasOwnProperty(r))continue;let n=e[r],i=r.split("."),a=t;for(;i.length;){let e=i.shift();i.length?(a[e]||(a[e]={}),a=a[e]):a[e]=n}}return t},getShallowObject:function(e){let t={},r=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))continue;let a=e?`${e}.${i}`:i,o=t[i];"object"==typeof o?(o instanceof Array&&(a+="[]"),r(a,o,n)):n[a]=o}};return r("",e,t),t}};function il(e){return"string"==typeof e}let ic={search:function e(t,r,n=null,i=[]){let a=RegExp(r.trim(),"i");return Object.keys(t).forEach(o=>{let s=t[o];if(!s)return;let u=il(n)?s[n]:s;il(u)&&a.test(u)&&i.push(s),(s instanceof Object||"object"==typeof s&&null!==s)&&e(s,r,n,i)}),i},encodeId:function(e){let t=e&&e.toString?e.toString():e;return""===t||"string"!=typeof t?"_":t.replace(/[^a-zA-Z0-9-]/g,e=>"_"+e[0].charCodeAt(0).toString(16)+"_")}},id={userLoggedIn:()=>!1,getUserId:()=>null,getName:()=>null,getAccessToken:()=>null,login:()=>new Promise((e,t)=>t()),logout:()=>new Promise((e,t)=>t()),getData:e=>null,setData:(e,t)=>null},ih=((A={}).STUDY_TO_DISPLAY_SETS="studyToDisplaySetsLoaded",A.STUDY_TO_FIRST_IMAGE="studyToFirstImage",A.DISPLAY_SETS_TO_FIRST_IMAGE="displaySetsToFirstImage",A.DISPLAY_SETS_TO_ALL_IMAGES="displaySetsToAllImages",A.SEARCH_TO_LIST="searchToList",A.SCRIPT_TO_VIEW="scriptToView",A),ip={create:function({query:e,retrieve:t,store:r,reject:n,initialize:i,deleteStudyMetadataPromise:a,getImageIdsForDisplaySet:o,getImageIdsForInstance:s,getConfig:u,getStudyInstanceUIDs:l}){return{query:e||{studies:{mapParams:e=>e,requestResults:()=>{},processResults:e=>e},series:{},instances:{}},retrieve:t||{series:{}},reject:n||{},store:r||{dicom:async e=>{throw Error("store.dicom(naturalizedDicom, StudyInstanceUID) not implemented for dataSource.")}},initialize:i,deleteStudyMetadataPromise:a,getImageIdsForDisplaySet:o,getImageIdsForInstance:s,getConfig:u||(()=>({dicomUploadEnabled:!1})),getStudyInstanceUIDs:l}}},im=()=>{let{servicesManager:e}=rE(),{displaySetService:t,viewportGridService:r}=e.services,n=(0,rv.useCallback)(e=>(r.getDisplaySetsUIDsForViewport(e)||[]).map(e=>t.getDisplaySetByUID(e)).filter(Boolean),[t,r]),i=n(r.getActiveViewportId())||[],[a,o]=(0,rv.useState)(i);return(0,rv.useEffect)(()=>{let e=[r.subscribe(r.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED,({viewportId:e})=>{o(n(e))}),r.subscribe(r.EVENTS.GRID_STATE_CHANGED,({state:e})=>{let t=e.activeViewportId;t&&o(n(t))})];return()=>{e.forEach(e=>e.unsubscribe())}},[r,n]),a};function ig({buttonSection:e="primary"}){let{commandsManager:t,servicesManager:r}=rE(),{toolbarService:n,viewportGridService:i}=r.services,{EVENTS:a}=n,[o,s]=(0,rv.useState)(n.getButtonSection(e).filter(Boolean)),[u,l]=(0,rv.useState)({}),c=(0,rv.useCallback)(e=>{e.event?.stopPropagation?.();let a=e.viewportId||i.getActiveViewportId(),o=n.getButtonProps(e.itemId),s=((e,t,{servicesManager:r,commandsManager:n})=>{let i=[];for(let r of rB(e.commands))i.push(()=>n.run(r,t));for(let t of rB(e.options)){if(!t?.commands||t.explicitRunOnly)continue;let a=t.value;for(let o of rB(t.commands)){let s={...t,value:a,options:e.options,servicesManager:r,commandsManager:n};i.push(()=>n.run(o,s))}}return i})(o,e,{servicesManager:r,commandsManager:t}),u={...o,commands:s};n.recordInteraction({...e,...u},{refreshProps:{viewportId:a}})},[n,i]);(0,rv.useEffect)(()=>{let t=()=>{s(n.getButtonSection(e)?.filter(Boolean))},r=[a.TOOL_BAR_MODIFIED,a.TOOL_BAR_STATE_MODIFIED].map(e=>n.subscribe(e,t));return()=>{r.forEach(e=>e.unsubscribe())}},[n]),(0,rv.useEffect)(()=>{let e=[i.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED,i.EVENTS.VIEWPORTS_READY,i.EVENTS.LAYOUT_CHANGED].map(e=>i.subscribe(e,({viewportId:e})=>{e=e||i.getActiveViewportId(),n.refreshToolbarState({viewportId:e})}));return()=>e.forEach(e=>e.unsubscribe())},[i,n]);let d=(0,rv.useMemo)(()=>({lockItem:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isLocked:!0},n.refreshToolbarState({viewportId:r,itemId:e}))},unlockItem:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isLocked:!1},n.refreshToolbarState({viewportId:r,itemId:e}))},toggleLock:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isLocked:!a.props.isLocked},n.refreshToolbarState({viewportId:r,itemId:e}))},isItemLocked:(e,t)=>{let r=n.getButton(e);return r?.props?.isLocked===!0},showItem:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isVisible:!0},n.refreshToolbarState({viewportId:r,itemId:e}))},hideItem:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isVisible:!1},n.refreshToolbarState({viewportId:r,itemId:e}))},toggleVisibility:(e,t)=>{let r=t||i.getActiveViewportId(),a=n.getButton(e);a&&(a.props={...a.props,isVisible:!1===a.props.isVisible},n.refreshToolbarState({viewportId:r,itemId:e}))},isItemVisible:(e,t)=>{let r=n.getButton(e);return r?.props?.isVisible!==!1},openItem:(e,t)=>{l(t=>{let r={};return r[e]=!0,r})},closeItem:(e,t)=>{l(t=>({...t,[e]:!1}))},closeAllItems:e=>{l({})},isItemOpen:(e,t)=>!0===u[e]}),[i,n,u]);return o?.length?{toolbarButtons:o.filter(e=>!1!==e.componentProps.visible),onInteraction:c,...d}:{toolbarButtons:[],onInteraction:c,...d}}function iy(e){let t=ia(e),[r,n]=(0,rv.useState)({width:0,height:0,offsetLeft:0,offsetTop:0,clientRect:null,isVisible:!1}),i=(0,rv.useCallback)(()=>{if(!t?.current)return;let e=t.current,r=e.getBoundingClientRect(),i=r.width,a=r.height,o=e.offsetLeft,s=e.offsetTop,u=i>0&&a>0;n(e=>e.width===i&&e.height===a&&e.offsetLeft===o&&e.offsetTop===s&&e.isVisible===u?e:{width:i,height:a,offsetLeft:o,offsetTop:s,clientRect:r,isVisible:u})},[t]);return(0,rv.useEffect)(()=>{if(!e||!t?.current)return;i();let r=new ResizeObserver(()=>{i()});return r.observe(t.current),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i),t.current&&r.unobserve(t.current),r.disconnect()}},[e,t,i]),(0,rv.useMemo)(()=>r,[r])}function iD(e){let t=ia(e),{width:r,height:n,clientRect:i}=iy(e),[a,o]=(0,rv.useState)({x:0,y:0,isInViewport:!1,relativeY:0,relativeX:0,isWithinNormalizedBox:e=>!1});return(0,rv.useEffect)(()=>{if(!t.current)return;let e=e=>{if(!i)return;let t=e.clientX-i.left,a=e.clientY-i.top,s=t>=0&&t<=i.width&&a>=0&&a<=i.height,u=Math.max(0,Math.min(1,t/r)),l=Math.max(0,Math.min(1,a/n));o({x:t,y:a,isInViewport:s,relativeX:u,relativeY:l,isWithinNormalizedBox:e=>u>=e.minX&&u<=e.maxX&&l>=e.minY&&l<=e.maxY})};return document.addEventListener("mousemove",e),()=>{document.removeEventListener("mousemove",e)}},[t,n,i,r]),a}function iv({buttonSectionId:e}){let{servicesManager:t}=rE(),{toolbarService:r}=t.services,{toolbarButtons:n}=ig({buttonSection:e});return n.reduce((e,t)=>{if(e)return e;let n=t.componentProps.buttonSection;for(let e of n?r.getButtonSection(n):[t]){if(e.componentProps.isActive)return{activeToolOptions:e.componentProps.options,activeToolButtonId:e.componentProps.id};if(e.componentProps.buttonSection){let t=r.getButtonPropsInButtonSection(e.componentProps.buttonSection).find(e=>e.isActive);if(t)return{activeToolOptions:t.options,activeToolButtonId:t.id}}}return null},null)??{}}function ib(){let{commandsManager:e}=rE();return(0,rv.useCallback)((t,r={})=>e.runCommand(t,r),[e])}let iS={...r$.hotkeys,defaults:{hotkeyBindings:nW.hotkeyBindings}},iE={MODULE_TYPES:M,CommandsManager:nY,ExtensionManager:nV,HotkeysManager:nX,ServicesManager:ea,ServiceProvidersManager:eo,defaults:nW,utils:r$,hotkeys:iS,classes:ie,string:ic,user:id,errorHandler:is,object:iu,log:F,DICOMWeb:io,viewer:{},CineService:eB,CustomizationService:nC,UIDialogService:ec,UIModalService:ep,UINotificationService:ey,UIViewportDialogService:ev,DisplaySetService:eC,MeasurementService:ei,ToolbarService:eO,ViewportGridService:ek,HangingProtocolService:rK,UserAuthenticationService:rZ,MultiMonitorService:nj,IWebApiDataSource:ip,DicomMetadataStore:eb,pubSubServiceInterface:T,PubSubService:L,PanelService:nO,useActiveViewportDisplaySets:im,WorkflowStepsService:nN,StudyPrefetcherService:nR},iw=iE})(),s})());
|